Fossil

Changes On Branch th-int-min-errors
Login

Changes On Branch th-int-min-errors

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch th-int-min-errors Excluding Merge-Ins

This is equivalent to a diff from a8b6fdc8 to 4a98d2aa

2024-01-04
09:32
Use an unsigned int in Th_SetResultInt() to address issues with GCC for INT_MIN. ... (check-in: 301edfc0 user: preben tags: trunk)
2023-12-07
19:57
Improvements to the diff algorithm. See forum thread 515e0d43425d7164 for discussion. ... (check-in: a45c7f0a user: drh tags: trunk)
2023-12-05
16:02
Provide a dark mode for the TCL/TK-based diff GUI. ... (check-in: b59a42f1 user: danield tags: tk-diff-darkmode)
2023-12-03
21:36
The th1-expr-3 test revealed that Th_SetResultInt() could produce incorrect result for INT_MIN. Ensure that -1*iVal is positive for all values and remove unsiged casts. Seems a common optimisation problem with gcc on various verisons from 10 through 13 on Linux, NetBSD and OmniOS on various architectures. ... (Closed-Leaf check-in: 4a98d2aa user: preben tags: th-int-min-errors)
20:28
Include termio.h to determine terminal width on OmniOS. Uses __EXTENSIONS__ in line with detection of solaris like systems in auto.def. ... (Closed-Leaf check-in: 32428f12 user: preben tags: omnios-terminal-width)
2023-12-01
22:37
Typo corrections in comments only. No change in functionality. ... (check-in: a8b6fdc8 user: andybradford tags: trunk)
2023-11-28
22:05
Tiny documentation fix: an extra space before argument to the '--base-rcvid' hook test option made the argument appear on the line describing the option. ... (check-in: cb283ca5 user: km tags: trunk)

Changes to src/th.c.

2868
2869
2870
2871
2872
2873
2874

2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892

/*
** Set the result of the interpreter to the th1 representation of
** the integer iVal and return TH_OK.
*/
int Th_SetResultInt(Th_Interp *interp, int iVal){
  int isNegative = 0;

  char zBuf[32];
  char *z = &zBuf[32];

  if( iVal<0 ){
    isNegative = 1;
    iVal = iVal * -1;
  }
  *(--z) = '\0';
  *(--z) = (char)(48+((unsigned)iVal%10));
  while( (iVal = ((unsigned)iVal/10))>0 ){
    *(--z) = (char)(48+((unsigned)iVal%10));
    assert(z>zBuf);
  }
  if( isNegative ){
    *(--z) = '-';
  }

  return Th_SetResult(interp, z, -1);







>





|


|
|
|







2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893

/*
** Set the result of the interpreter to the th1 representation of
** the integer iVal and return TH_OK.
*/
int Th_SetResultInt(Th_Interp *interp, int iVal){
  int isNegative = 0;
  unsigned int uVal = iVal;
  char zBuf[32];
  char *z = &zBuf[32];

  if( iVal<0 ){
    isNegative = 1;
    uVal = iVal * -1;
  }
  *(--z) = '\0';
  *(--z) = (char)(48+(uVal%10));
  while( (uVal = (uVal/10))>0 ){
    *(--z) = (char)(48+(uVal%10));
    assert(z>zBuf);
  }
  if( isNegative ){
    *(--z) = '-';
  }

  return Th_SetResult(interp, z, -1);