SQLite

Check-in [7b3f866e61]
Login

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

Overview
Comment:Fix minor problems with the "showwal" utility program. Add a missing header to the zipfile.c extension.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7b3f866e619c2b781b613493727cd111335ceec690d984408725c756feff26e6
User & Date: drh 2023-10-25 18:35:48.042
Context
2023-10-25
18:53
Provide dummy parameter names in the prototype for the new xIntegrity method of the sqlite3_module object. (check-in: 131374d720 user: drh tags: trunk)
18:35
Fix minor problems with the "showwal" utility program. Add a missing header to the zipfile.c extension. (check-in: 7b3f866e61 user: drh tags: trunk)
17:26
Test module altermalloc3.test requires DQS_DDL to be turned on. (check-in: c4d02f4b07 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/misc/zipfile.c.
25
26
27
28
29
30
31

32
33
34
35
36
37
38
**    *  Only the "inflate/deflate" (zlib) compression method is supported
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <stdio.h>
#include <string.h>
#include <assert.h>


#include <zlib.h>

#ifndef SQLITE_OMIT_VIRTUALTABLE

#ifndef SQLITE_AMALGAMATION








>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
**    *  Only the "inflate/deflate" (zlib) compression method is supported
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdint.h>

#include <zlib.h>

#ifndef SQLITE_OMIT_VIRTUALTABLE

#ifndef SQLITE_AMALGAMATION

Changes to tool/showwal.c.
539
540
541
542
543
544
545






546



547



548
549
550
551
552
553
554
555
556
557
558
559
560
561
  fd = open(argv[1], O_RDONLY);
  if( fd<0 ){
    fprintf(stderr,"%s: can't open %s\n", argv[0], argv[1]);
    exit(1);
  }
  zPgSz[0] = 0;
  zPgSz[1] = 0;






  lseek(fd, 8, SEEK_SET);



  read(fd, zPgSz, 4);



  pagesize = zPgSz[1]*65536 + zPgSz[2]*256 + zPgSz[3];
  if( pagesize==0 ) pagesize = 1024;
  printf("Pagesize: %d\n", pagesize);
  fstat(fd, &sbuf);
  if( sbuf.st_size<32 ){
    printf("file too small to be a WAL\n");
    return 0;
  }
  mxFrame = (sbuf.st_size - 32)/(pagesize + 24);
  printf("Available pages: 1..%d\n", mxFrame);
  if( argc==2 ){
    int i;
    Cksum x;
    print_wal_header(&x);







>
>
>
>
>
>
|
>
>
>
|
>
>
>



<
|
|
|







539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562

563
564
565
566
567
568
569
570
571
572
  fd = open(argv[1], O_RDONLY);
  if( fd<0 ){
    fprintf(stderr,"%s: can't open %s\n", argv[0], argv[1]);
    exit(1);
  }
  zPgSz[0] = 0;
  zPgSz[1] = 0;
  fstat(fd, &sbuf);
  if( sbuf.st_size<32 ){
    printf("%s: file too small to be a WAL - only %d bytes\n",
           argv[1], (int)sbuf.st_size);
    return 0;
  }
  if( lseek(fd, 8, SEEK_SET)!=8 ){
    printf("\"%s\" seems to not be a valid WAL file\n", argv[1]);
    return 1;
  }
  if( read(fd, zPgSz, 4)!=4 ){
    printf("\"%s\": cannot read the page size\n", argv[1]);
    return 1;
  }
  pagesize = zPgSz[1]*65536 + zPgSz[2]*256 + zPgSz[3];
  if( pagesize==0 ) pagesize = 1024;
  printf("Pagesize: %d\n", pagesize);

  if( (pagesize & (pagesize-1))!=0 || pagesize<512 || pagesize>65536 ){
    printf("\"%s\": invalid page size.\n", argv[1]);
    return 1;
  }
  mxFrame = (sbuf.st_size - 32)/(pagesize + 24);
  printf("Available pages: 1..%d\n", mxFrame);
  if( argc==2 ){
    int i;
    Cksum x;
    print_wal_header(&x);