/ Check-in [27c27daa]
Login

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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 27c27daa3324b7c9323acfb972330367630bb64e
User & Date: drh 2014-01-28 20:36:22
Context
2014-01-29
01:46
Make sure that sqlite3SelectDup() initializes the nSelectRow of the duplicate Select object. check-in: 5bb29b82 user: drh tags: trunk
2014-01-28
20:36
Fix harmless compiler warnings in the showdb utility program. check-in: 27c27daa user: drh tags: trunk
18:53
Fix a potential over-size and hence undefined shift operation. check-in: 6379b072 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/showdb.c.

   115    115     }
   116    116     return aData;
   117    117   }
   118    118   
   119    119   /*
   120    120   ** Print an entire page of content as hex
   121    121   */
   122         -static print_page(int iPg){
          122  +static void print_page(int iPg){
   123    123     int iStart;
   124    124     unsigned char *aData;
   125    125     iStart = (iPg-1)*pagesize;
   126    126     fprintf(stdout, "Page %d:   (offsets 0x%x..0x%x)\n",
   127    127             iPg, iStart, iStart+pagesize-1);
   128    128     aData = print_byte_range(iStart, pagesize, 0);
   129    129     free(aData);
   130    130   }
   131    131   
   132    132   /* Print a line of decode output showing a 4-byte integer.
   133    133   */
   134         -static print_decode_line(
          134  +static void print_decode_line(
   135    135     unsigned char *aData,      /* Content being decoded */
   136    136     int ofst, int nByte,       /* Start and size of decode */
   137    137     const char *zMsg           /* Message to append */
   138    138   ){
   139    139     int i, j;
   140    140     int val = aData[ofst];
   141    141     char zBuf[100];
................................................................................
   424    424   */
   425    425   static void decode_trunk_page(
   426    426     int pgno,             /* The page number */
   427    427     int pagesize,         /* Size of each page */
   428    428     int detail,           /* Show leaf pages if true */
   429    429     int recursive         /* Follow the trunk change if true */
   430    430   ){
   431         -  int n, i, k;
          431  +  int n, i;
   432    432     unsigned char *a;
   433    433     while( pgno>0 ){
   434    434       a = getContent((pgno-1)*pagesize, pagesize);
   435    435       printf("Decode of freelist trunk page %d:\n", pgno);
   436    436       print_decode_line(a, 0, 4, "Next freelist trunk page");
   437    437       print_decode_line(a, 4, 4, "Number of entries on this page");
   438    438       if( detail ){
................................................................................
   491    491   static void page_usage_cell(
   492    492     unsigned char cType,    /* Page type */
   493    493     unsigned char *a,       /* Cell content */
   494    494     int pgno,               /* page containing the cell */
   495    495     int cellno              /* Index of the cell on the page */
   496    496   ){
   497    497     int i;
   498         -  int nDesc = 0;
   499    498     int n = 0;
   500    499     i64 nPayload;
   501    500     i64 rowid;
   502    501     int nLocal;
   503    502     i = 0;
   504    503     if( cType<=5 ){
   505    504       a += 4;
................................................................................
   673    672       sqlite3_snprintf(sizeof(zQuery), zQuery,
   674    673                "SELECT type, name, rootpage FROM SQLITE_MASTER WHERE rootpage"
   675    674                " ORDER BY rowid %s", j?"DESC":"");
   676    675       rc = sqlite3_prepare_v2(db, zQuery, -1, &pStmt, 0);
   677    676       if( rc==SQLITE_OK ){
   678    677         while( sqlite3_step(pStmt)==SQLITE_ROW ){
   679    678           int pgno = sqlite3_column_int(pStmt, 2);
   680         -        page_usage_btree(pgno, 0, 0, sqlite3_column_text(pStmt, 1));
          679  +        page_usage_btree(pgno, 0, 0, (const char*)sqlite3_column_text(pStmt,1));
   681    680         }
   682    681       }else{
   683    682         printf("ERROR: cannot query database: %s\n", sqlite3_errmsg(db));
   684    683       }
   685    684       rc = sqlite3_finalize(pStmt);
   686    685       if( rc==SQLITE_OK ) break;
   687    686     }
................................................................................
   831    830             nByte = pagesize;
   832    831           }
   833    832           a = getContent(ofst, nByte);
   834    833           decode_btree_page(a, iStart, hdrSize, &zLeft[1]);
   835    834           free(a);
   836    835           continue;
   837    836         }else if( zLeft && zLeft[0]=='t' ){
   838         -        unsigned char *a;
   839    837           int detail = 0;
   840    838           int recursive = 0;
   841    839           int i;
   842    840           for(i=1; zLeft[i]; i++){
   843    841             if( zLeft[i]=='r' ) recursive = 1;
   844    842             if( zLeft[i]=='d' ) detail = 1;
   845    843           }
................................................................................
   857    855         while( iStart<=iEnd ){
   858    856           print_page(iStart);
   859    857           iStart++;
   860    858         }
   861    859       }
   862    860     }
   863    861     close(db);
          862  +  return 0;
   864    863   }