Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix harmless compiler warnings in the showdb utility program. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
27c27daa3324b7c9323acfb972330367 |
User & Date: | drh 2014-01-28 20:36:22.236 |
Context
2014-01-29
| ||
01:46 | Make sure that sqlite3SelectDup() initializes the nSelectRow of the duplicate Select object. (check-in: 5bb29b8210 user: drh tags: trunk) | |
2014-01-28
| ||
20:36 | Fix harmless compiler warnings in the showdb utility program. (check-in: 27c27daa33 user: drh tags: trunk) | |
18:53 | Fix a potential over-size and hence undefined shift operation. (check-in: 6379b07295 user: drh tags: trunk) | |
Changes
Changes to tool/showdb.c.
︙ | ︙ | |||
115 116 117 118 119 120 121 | } return aData; } /* ** Print an entire page of content as hex */ | | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | } return aData; } /* ** Print an entire page of content as hex */ static void print_page(int iPg){ int iStart; unsigned char *aData; iStart = (iPg-1)*pagesize; fprintf(stdout, "Page %d: (offsets 0x%x..0x%x)\n", iPg, iStart, iStart+pagesize-1); aData = print_byte_range(iStart, pagesize, 0); free(aData); } /* Print a line of decode output showing a 4-byte integer. */ static void print_decode_line( unsigned char *aData, /* Content being decoded */ int ofst, int nByte, /* Start and size of decode */ const char *zMsg /* Message to append */ ){ int i, j; int val = aData[ofst]; char zBuf[100]; |
︙ | ︙ | |||
424 425 426 427 428 429 430 | */ static void decode_trunk_page( int pgno, /* The page number */ int pagesize, /* Size of each page */ int detail, /* Show leaf pages if true */ int recursive /* Follow the trunk change if true */ ){ | | | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | */ static void decode_trunk_page( int pgno, /* The page number */ int pagesize, /* Size of each page */ int detail, /* Show leaf pages if true */ int recursive /* Follow the trunk change if true */ ){ int n, i; unsigned char *a; while( pgno>0 ){ a = getContent((pgno-1)*pagesize, pagesize); printf("Decode of freelist trunk page %d:\n", pgno); print_decode_line(a, 0, 4, "Next freelist trunk page"); print_decode_line(a, 4, 4, "Number of entries on this page"); if( detail ){ |
︙ | ︙ | |||
491 492 493 494 495 496 497 | static void page_usage_cell( unsigned char cType, /* Page type */ unsigned char *a, /* Cell content */ int pgno, /* page containing the cell */ int cellno /* Index of the cell on the page */ ){ int i; | < | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | static void page_usage_cell( unsigned char cType, /* Page type */ unsigned char *a, /* Cell content */ int pgno, /* page containing the cell */ int cellno /* Index of the cell on the page */ ){ int i; int n = 0; i64 nPayload; i64 rowid; int nLocal; i = 0; if( cType<=5 ){ a += 4; |
︙ | ︙ | |||
673 674 675 676 677 678 679 | sqlite3_snprintf(sizeof(zQuery), zQuery, "SELECT type, name, rootpage FROM SQLITE_MASTER WHERE rootpage" " ORDER BY rowid %s", j?"DESC":""); rc = sqlite3_prepare_v2(db, zQuery, -1, &pStmt, 0); if( rc==SQLITE_OK ){ while( sqlite3_step(pStmt)==SQLITE_ROW ){ int pgno = sqlite3_column_int(pStmt, 2); | | | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | sqlite3_snprintf(sizeof(zQuery), zQuery, "SELECT type, name, rootpage FROM SQLITE_MASTER WHERE rootpage" " ORDER BY rowid %s", j?"DESC":""); rc = sqlite3_prepare_v2(db, zQuery, -1, &pStmt, 0); if( rc==SQLITE_OK ){ while( sqlite3_step(pStmt)==SQLITE_ROW ){ int pgno = sqlite3_column_int(pStmt, 2); page_usage_btree(pgno, 0, 0, (const char*)sqlite3_column_text(pStmt,1)); } }else{ printf("ERROR: cannot query database: %s\n", sqlite3_errmsg(db)); } rc = sqlite3_finalize(pStmt); if( rc==SQLITE_OK ) break; } |
︙ | ︙ | |||
831 832 833 834 835 836 837 | nByte = pagesize; } a = getContent(ofst, nByte); decode_btree_page(a, iStart, hdrSize, &zLeft[1]); free(a); continue; }else if( zLeft && zLeft[0]=='t' ){ | < | 830 831 832 833 834 835 836 837 838 839 840 841 842 843 | nByte = pagesize; } a = getContent(ofst, nByte); decode_btree_page(a, iStart, hdrSize, &zLeft[1]); free(a); continue; }else if( zLeft && zLeft[0]=='t' ){ int detail = 0; int recursive = 0; int i; for(i=1; zLeft[i]; i++){ if( zLeft[i]=='r' ) recursive = 1; if( zLeft[i]=='d' ) detail = 1; } |
︙ | ︙ | |||
857 858 859 860 861 862 863 864 | while( iStart<=iEnd ){ print_page(iStart); iStart++; } } } close(db); } | > | 855 856 857 858 859 860 861 862 863 | while( iStart<=iEnd ){ print_page(iStart); iStart++; } } } close(db); return 0; } |