/ Check-in [fc4f7c11]
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 showwal.c so that it works with 64KiB pages.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ota-update
Files: files | file ages | folders
SHA1: fc4f7c115207b786e3cac8cb6be4db3131b99a46
User & Date: dan 2014-09-04 18:05:42
Context
2014-09-04
19:05
Avoid ever running a checkpoint in ota mode. check-in: 9ae44447 user: dan tags: ota-update
18:05
Fix showwal.c so that it works with 64KiB pages. check-in: fc4f7c11 user: dan tags: ota-update
11:03
Avoid calling sqlite3OsFetch() on a file-handle for which the xFetch method is NULL. check-in: 071f7f2d user: dan tags: ota-update
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     }