/ Check-in [64d13339]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Compiler-warning fixes in the sqldiff.exe utility.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 64d13339d44d1b7ec6768a33421f2138cb7872d8
User & Date: drh 2015-08-20 23:33:09
Context
2015-08-21
12:37
Fix typo in comment. No changes to code. check-in: 7b8d17dd user: drh tags: trunk
2015-08-20
23:54
Merge recent trunk enhancements, include table-valued functions. check-in: e9196d56 user: drh tags: sessions
23:45
Merge recent enhancements from trunk, including table-valued expressions. check-in: b9927c87 user: drh tags: cursor-hints
23:39
Merge the latest changes from trunk, including the table-valued function implementation. check-in: 10c44432 user: drh tags: json
23:33
Compiler-warning fixes in the sqldiff.exe utility. check-in: 64d13339 user: drh tags: trunk
23:28
Fix a couple C99-isms that cause compile errors on MSVC. check-in: bc577fe6 user: drh tags: trunk
21:09
Fix compiler warnings in the sqldiff tool seen with MSVC. Closed-Leaf check-in: 072279d4 user: mistachkin tags: msvcWarn
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/sqldiff.c.

   806    806   }
   807    807   
   808    808   /*
   809    809   ** Advance the rolling hash by a single character "c"
   810    810   */
   811    811   static void hash_next(hash *pHash, int c){
   812    812     u16 old = pHash->z[pHash->i];
   813         -  pHash->z[pHash->i] = c;
          813  +  pHash->z[pHash->i] = (char)c;
   814    814     pHash->i = (pHash->i+1)&(NHASH-1);
   815         -  pHash->a = pHash->a - old + c;
          815  +  pHash->a = pHash->a - old + (char)c;
   816    816     pHash->b = pHash->b - NHASH*old + pHash->a;
   817    817   }
   818    818   
   819    819   /*
   820    820   ** Return a 32-bit hash value
   821    821   */
   822    822   static u32 hash_32bit(hash *pHash){
................................................................................
   845    845   }
   846    846   
   847    847   /*
   848    848   ** Return the number digits in the base-64 representation of a positive integer
   849    849   */
   850    850   static int digit_count(int v){
   851    851     unsigned int i, x;
   852         -  for(i=1, x=64; v>=x; i++, x <<= 6){}
          852  +  for(i=1, x=64; (unsigned int)v>=x; i++, x <<= 6){}
   853    853     return i;
   854    854   }
   855    855   
   856    856   /*
   857    857   ** Compute a 32-bit checksum on the N-byte buffer.  Return the result.
   858    858   */
   859    859   static unsigned int checksum(const char *zIn, size_t N){
................................................................................
   952    952   static int rbuDeltaCreate(
   953    953     const char *zSrc,      /* The source or pattern file */
   954    954     unsigned int lenSrc,   /* Length of the source file */
   955    955     const char *zOut,      /* The target file */
   956    956     unsigned int lenOut,   /* Length of the target file */
   957    957     char *zDelta           /* Write the delta into this buffer */
   958    958   ){
   959         -  int i, base;
          959  +  unsigned int i, base;
   960    960     char *zOrigDelta = zDelta;
   961    961     hash h;
   962    962     int nHash;                 /* Number of hash table entries */
   963    963     int *landmark;             /* Primary hash table */
   964    964     int *collide;              /* Collision chain */
   965    965     int lastRead = -1;         /* Last byte of zSrc read by a COPY command */
   966    966   
................................................................................
  1001   1001   
  1002   1002     /* Begin scanning the target file and generating copy commands and
  1003   1003     ** literal sections of the delta.
  1004   1004     */
  1005   1005     base = 0;    /* We have already generated everything before zOut[base] */
  1006   1006     while( base+NHASH<lenOut ){
  1007   1007       int iSrc, iBlock;
  1008         -    unsigned int bestCnt, bestOfst=0, bestLitsz=0;
         1008  +    int bestCnt, bestOfst=0, bestLitsz=0;
  1009   1009       hash_init(&h, &zOut[base]);
  1010   1010       i = 0;     /* Trying to match a landmark against zOut[base+i] */
  1011   1011       bestCnt = 0;
  1012   1012       while( 1 ){
  1013   1013         int hv;
  1014   1014         int limit = 250;
  1015   1015   
................................................................................
  1034   1034           int cnt, ofst, litsz;
  1035   1035           int j, k, x, y;
  1036   1036           int sz;
  1037   1037   
  1038   1038           /* Beginning at iSrc, match forwards as far as we can.  j counts
  1039   1039           ** the number of characters that match */
  1040   1040           iSrc = iBlock*NHASH;
  1041         -        for(j=0, x=iSrc, y=base+i; x<lenSrc && y<lenOut; j++, x++, y++){
         1041  +        for(
         1042  +          j=0, x=iSrc, y=base+i;
         1043  +          (unsigned int)x<lenSrc && (unsigned int)y<lenOut;
         1044  +          j++, x++, y++
         1045  +        ){
  1042   1046             if( zSrc[x]!=zOut[y] ) break;
  1043   1047           }
  1044   1048           j--;
  1045   1049   
  1046   1050           /* Beginning at iSrc-1, match backwards as far as we can.  k counts
  1047   1051           ** the number of characters that match */
  1048         -        for(k=1; k<iSrc && k<=i; k++){
         1052  +        for(k=1; k<iSrc && (unsigned int)k<=i; k++){
  1049   1053             if( zSrc[iSrc-k]!=zOut[base+i-k] ) break;
  1050   1054           }
  1051   1055           k--;
  1052   1056   
  1053   1057           /* Compute the offset and size of the matching region */
  1054   1058           ofst = iSrc-k;
  1055   1059           cnt = j+k+1;