mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Attempt to fix the showwal.c utility program so that it works on WAL files
larger than 4GiB. FossilOrigin-Name: 5c0f9ea98a2b944857fe05d53a0143cb827b7d8215c37f33f1bce47ec1189952
This commit is contained in:
@ -117,7 +117,7 @@ static void out_of_memory(void){
|
||||
** Space to hold the content is obtained from malloc() and needs to be
|
||||
** freed by the caller.
|
||||
*/
|
||||
static unsigned char *getContent(int ofst, int nByte){
|
||||
static unsigned char *getContent(i64 ofst, int nByte){
|
||||
unsigned char *aData;
|
||||
aData = malloc(nByte);
|
||||
if( aData==0 ) out_of_memory();
|
||||
@ -204,10 +204,10 @@ static void print_decode_line(
|
||||
** Print an entire page of content as hex
|
||||
*/
|
||||
static void print_frame(int iFrame){
|
||||
int iStart;
|
||||
i64 iStart;
|
||||
unsigned char *aData;
|
||||
iStart = 32 + (iFrame-1)*(pagesize+24);
|
||||
fprintf(stdout, "Frame %d: (offsets 0x%x..0x%x)\n",
|
||||
iStart = 32 + (i64)(iFrame-1)*(pagesize+24);
|
||||
fprintf(stdout, "Frame %d: (offsets 0x%llx..0x%llx)\n",
|
||||
iFrame, iStart, iStart+pagesize+24);
|
||||
aData = getContent(iStart, pagesize+24);
|
||||
print_decode_line(aData, 0, 4, 0, "Page number");
|
||||
@ -224,10 +224,10 @@ static void print_frame(int iFrame){
|
||||
** Summarize a single frame on a single line.
|
||||
*/
|
||||
static void print_oneline_frame(int iFrame, Cksum *pCksum){
|
||||
int iStart;
|
||||
i64 iStart;
|
||||
unsigned char *aData;
|
||||
unsigned int s0, s1;
|
||||
iStart = 32 + (iFrame-1)*(pagesize+24);
|
||||
iStart = 32 + (i64)(iFrame-1)*(pagesize+24);
|
||||
aData = getContent(iStart, 24);
|
||||
extendCksum(pCksum, aData, 8, 0);
|
||||
extendCksum(pCksum, getContent(iStart+24, pagesize), pagesize, 0);
|
||||
@ -564,7 +564,8 @@ int main(int argc, char **argv){
|
||||
}else if( zLeft && zLeft[0]=='.' && zLeft[1]=='.' ){
|
||||
iEnd = strtol(&zLeft[2], 0, 0);
|
||||
}else if( zLeft && zLeft[0]=='b' ){
|
||||
int ofst, nByte, hdrSize;
|
||||
i64 ofst;
|
||||
int nByte, hdrSize;
|
||||
unsigned char *a;
|
||||
if( iStart==1 ){
|
||||
hdrSize = 100;
|
||||
@ -572,10 +573,10 @@ int main(int argc, char **argv){
|
||||
nByte = pagesize-100;
|
||||
}else{
|
||||
hdrSize = 0;
|
||||
ofst = (iStart-1)*pagesize;
|
||||
ofst = (i64)(iStart-1)*pagesize;
|
||||
nByte = pagesize;
|
||||
}
|
||||
ofst = 32 + hdrSize + (iStart-1)*(pagesize+24) + 24;
|
||||
ofst = 32 + hdrSize + (i64)(iStart-1)*(pagesize+24) + 24;
|
||||
a = getContent(ofst, nByte);
|
||||
decode_btree_page(a, iStart, hdrSize, zLeft+1);
|
||||
free(a);
|
||||
|
Reference in New Issue
Block a user