/ Check-in [4060efb6]
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:Fix tool/showwal.c so that it handles WAL files that contain 64KiB pages.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4060efb646c873c4abde7ab9ddf330489a44f274
User & Date: dan 2014-09-15 16:53:23
Context
2014-09-16
03:24
Performance improvement to the sqlite3MemCompare() routine by factoring out sqlite3BlobCompare(). check-in: 20ed2321 user: drh tags: trunk
2014-09-15
16:57
Merge latest trunk fixes into this branch. check-in: 5efafef5 user: dan tags: ota-update
16:53
Fix tool/showwal.c so that it handles WAL files that contain 64KiB pages. check-in: 4060efb6 user: dan tags: trunk
16:50
Avoid attempting to call the xFetch() method of an sqlite3_io_methods object with a version number less than 3. check-in: dedaa6fb user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to tool/showwal.c.

   506    506       }
   507    507       free(zMap);
   508    508     }  
   509    509   }
   510    510   
   511    511   int main(int argc, char **argv){
   512    512     struct stat sbuf;
   513         -  unsigned char zPgSz[2];
          513  +  unsigned char zPgSz[4];
   514    514     if( argc<2 ){
   515    515       fprintf(stderr,"Usage: %s FILENAME ?PAGE? ...\n", argv[0]);
   516    516       exit(1);
   517    517     }
   518    518     fd = open(argv[1], O_RDONLY);
   519    519     if( fd<0 ){
   520    520       fprintf(stderr,"%s: can't open %s\n", argv[0], argv[1]);
   521    521       exit(1);
   522    522     }
   523    523     zPgSz[0] = 0;
   524    524     zPgSz[1] = 0;
   525         -  lseek(fd, 10, SEEK_SET);
   526         -  read(fd, zPgSz, 2);
   527         -  pagesize = zPgSz[0]*256 + zPgSz[1];
          525  +  lseek(fd, 8, SEEK_SET);
          526  +  read(fd, zPgSz, 4);
          527  +  pagesize = zPgSz[1]*65536 + zPgSz[2]*256 + zPgSz[3];
   528    528     if( pagesize==0 ) pagesize = 1024;
   529    529     printf("Pagesize: %d\n", pagesize);
   530    530     fstat(fd, &sbuf);
   531    531     if( sbuf.st_size<32 ){
   532    532       printf("file too small to be a WAL\n");
   533    533       return 0;
   534    534     }