/ Check-in [4258e42d]
Login

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

Overview
Comment:Changes to the --hexdb decoder option in the shell (and also in the TCL test code) so that it works on systems where sscanf() does not recognize "%hhx" as wanting to delivery results into a character-size variable.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4258e42d92b0113ba59f407197fc24f21734900e5b02952deed07818be3e3e5d
User & Date: drh 2019-04-23 15:30:58
Context
2019-04-23
22:00
Make no atttempt to generate VDBE code for VACUUM after a syntax error. check-in: 93084247 user: drh tags: trunk
15:30
Changes to the --hexdb decoder option in the shell (and also in the TCL test code) so that it works on systems where sscanf() does not recognize "%hhx" as wanting to delivery results into a character-size variable. check-in: 4258e42d user: drh tags: trunk
15:08
Minor simplification of NULL value handling for STAT4. check-in: 69bad925 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.in.

  3854   3854     int nLine;
  3855   3855     int n = 0;
  3856   3856     int pgsz = 0;
  3857   3857     int iOffset = 0;
  3858   3858     int j, k;
  3859   3859     int rc;
  3860   3860     FILE *in;
  3861         -  unsigned char x[16];
         3861  +  unsigned int x[16];
  3862   3862     char zLine[1000];
  3863   3863     if( p->zDbFilename ){
  3864   3864       in = fopen(p->zDbFilename, "r");
  3865   3865       if( in==0 ){
  3866   3866         utf8_printf(stderr, "cannot open \"%s\" for reading\n", p->zDbFilename);
  3867   3867         return 0;
  3868   3868       }
................................................................................
  3892   3892       if( rc==2 ){
  3893   3893         iOffset = k;
  3894   3894         continue;
  3895   3895       }
  3896   3896       if( strncmp(zLine, "| end ", 6)==0 ){
  3897   3897         break;
  3898   3898       }
  3899         -    rc = sscanf(zLine,"| %d: %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx"
  3900         -                      "  %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx",
         3899  +    rc = sscanf(zLine,"| %d: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x",
  3901   3900                   &j, &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &x[6], &x[7],
  3902   3901                   &x[8], &x[9], &x[10], &x[11], &x[12], &x[13], &x[14], &x[15]);
  3903   3902       if( rc==17 ){
  3904   3903         k = iOffset+j;
  3905   3904         if( k+16<=n ){
  3906         -        memcpy(a+k, x, 16);
         3905  +        int ii;
         3906  +        for(ii=0; ii<16; ii++) a[k+ii] = x[ii]&0xff;
  3907   3907         }
  3908   3908       }
  3909   3909     }
  3910   3910     *pnData = n;
  3911   3911     if( in!=p->in ){
  3912   3912       fclose(in);
  3913   3913     }else{

Changes to src/test1.c.

  7695   7695     unsigned char *a = 0;
  7696   7696     int n = 0;
  7697   7697     int lineno = 0;
  7698   7698     int i, iNext;
  7699   7699     int iOffset = 0;
  7700   7700     int j, k;
  7701   7701     int rc;
  7702         -  unsigned char x[16];
         7702  +  unsigned int x[16];
  7703   7703     if( objc!=2 ){
  7704   7704       Tcl_WrongNumArgs(interp, 1, objv, "HEXDB");
  7705   7705       return TCL_ERROR;
  7706   7706     }
  7707   7707     zIn = Tcl_GetString(objv[1]);
  7708   7708     for(i=0; zIn[i]; i=iNext){
  7709   7709       lineno++;
................................................................................
  7727   7727         continue;
  7728   7728       }
  7729   7729       rc = sscanf(zIn+i, "| page %d offset %d", &j, &k);
  7730   7730       if( rc==2 ){
  7731   7731         iOffset = k;
  7732   7732         continue;
  7733   7733       }
  7734         -    rc = sscanf(zIn+i,"| %d: %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx"
  7735         -                      "  %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx",
         7734  +    rc = sscanf(zIn+i,"| %d: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x",
  7736   7735                   &j, &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &x[6], &x[7],
  7737   7736                   &x[8], &x[9], &x[10], &x[11], &x[12], &x[13], &x[14], &x[15]);
  7738   7737       if( rc==17 ){
  7739   7738         k = iOffset+j;
  7740   7739         if( k+16<=n ){
  7741         -        memcpy(a+k, x, 16);
         7740  +        int ii;
         7741  +        for(ii=0; ii<16; ii++) a[k+ii] = x[ii]&0xff;
  7742   7742         }
  7743   7743         continue;
  7744   7744       }
  7745   7745     }
  7746   7746     Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(a, n));
  7747   7747     free(a);
  7748   7748     return TCL_OK;