/ Check-in [3f8c068a]
Login

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

Overview
Comment:Suppress harmless compiler warning.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3f8c068a41b01f59d7f5d56f3bced78587f4d26c
User & Date: drh 2010-08-17 19:40:08
Context
2010-08-17
19:49
Remove a NEVER() that is actually reachable. check-in: acb171d4 user: drh tags: trunk
19:40
Suppress harmless compiler warning. check-in: 3f8c068a user: drh tags: trunk
19:34
Return an error when parsing "?NNN" if NNN is so large it cannot be stored as a 32-bit int. check-in: fc9014be user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/analyze.c.

   499    499         if( p->eType==SQLITE_TEXT || p->eType==SQLITE_BLOB ){
   500    500           sqlite3DbFree(db, p->u.z);
   501    501         }
   502    502       }
   503    503       sqlite3DbFree(db, pIdx->aSample);
   504    504     }
   505    505   #else
          506  +  UNUSED_PARAMETER(db);
   506    507     UNUSED_PARAMETER(pIdx);
   507    508   #endif
   508    509   }
   509    510   
   510    511   /*
   511    512   ** Load the content of the sqlite_stat1 and sqlite_stat2 tables. The
   512    513   ** contents of sqlite_stat1 are used to populate the Index.aiRowEst[]

Changes to src/btree.c.

  2261   2261     */
  2262   2262     nPage = nPageHeader = get4byte(28+(u8*)pPage1->aData);
  2263   2263     sqlite3PagerPagecount(pBt->pPager, &nPageFile);
  2264   2264     if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){
  2265   2265       nPage = nPageFile;
  2266   2266     }
  2267   2267     if( nPage>0 ){
  2268         -    int pageSize;
  2269         -    int usableSize;
         2268  +    u32 pageSize;
         2269  +    u32 usableSize;
  2270   2270       u8 *page1 = pPage1->aData;
  2271   2271       rc = SQLITE_NOTADB;
  2272   2272       if( memcmp(page1, zMagicHeader, 16)!=0 ){
  2273   2273         goto page1_init_failed;
  2274   2274       }
  2275   2275   
  2276   2276   #ifdef SQLITE_OMIT_WAL
................................................................................
  2330   2330         /* After reading the first page of the database assuming a page size
  2331   2331         ** of BtShared.pageSize, we have discovered that the page-size is
  2332   2332         ** actually pageSize. Unlock the database, leave pBt->pPage1 at
  2333   2333         ** zero and return SQLITE_OK. The caller will call this function
  2334   2334         ** again with the correct page-size.
  2335   2335         */
  2336   2336         releasePage(pPage1);
  2337         -      pBt->usableSize = (u32)usableSize;
  2338         -      pBt->pageSize = (u32)pageSize;
         2337  +      pBt->usableSize = usableSize;
         2338  +      pBt->pageSize = pageSize;
  2339   2339         freeTempSpace(pBt);
  2340   2340         rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize,
  2341   2341                                      pageSize-usableSize);
  2342   2342         return rc;
  2343   2343       }
  2344   2344       if( nPageHeader>nPageFile ){
  2345   2345         rc = SQLITE_CORRUPT_BKPT;
  2346   2346         goto page1_init_failed;
  2347   2347       }
  2348   2348       if( usableSize<480 ){
  2349   2349         goto page1_init_failed;
  2350   2350       }
  2351         -    pBt->pageSize = (u32)pageSize;
  2352         -    pBt->usableSize = (u32)usableSize;
         2351  +    pBt->pageSize = pageSize;
         2352  +    pBt->usableSize = usableSize;
  2353   2353   #ifndef SQLITE_OMIT_AUTOVACUUM
  2354   2354       pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0);
  2355   2355       pBt->incrVacuum = (get4byte(&page1[36 + 7*4])?1:0);
  2356   2356   #endif
  2357   2357     }
  2358   2358   
  2359   2359     /* maxLocal is the maximum amount of payload to store locally for
................................................................................
  5329   5329   ** the cell content has been copied someplace else.  This routine just
  5330   5330   ** removes the reference to the cell from pPage.
  5331   5331   **
  5332   5332   ** "sz" must be the number of bytes in the cell.
  5333   5333   */
  5334   5334   static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
  5335   5335     int i;          /* Loop counter */
  5336         -  int pc;         /* Offset to cell content of cell being deleted */
         5336  +  u32 pc;         /* Offset to cell content of cell being deleted */
  5337   5337     u8 *data;       /* pPage->aData */
  5338   5338     u8 *ptr;        /* Used to move bytes around within data[] */
  5339   5339     int rc;         /* The return code */
  5340   5340     int hdr;        /* Beginning of the header.  0 most pages.  100 page 1 */
  5341   5341   
  5342   5342     if( *pRC ) return;
  5343   5343   
................................................................................
  5347   5347     assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  5348   5348     data = pPage->aData;
  5349   5349     ptr = &data[pPage->cellOffset + 2*idx];
  5350   5350     pc = get2byte(ptr);
  5351   5351     hdr = pPage->hdrOffset;
  5352   5352     testcase( pc==get2byte(&data[hdr+5]) );
  5353   5353     testcase( pc+sz==pPage->pBt->usableSize );
  5354         -  if( pc < get2byte(&data[hdr+5]) || pc+sz > pPage->pBt->usableSize ){
         5354  +  if( pc < (u32)get2byte(&data[hdr+5]) || pc+sz > pPage->pBt->usableSize ){
  5355   5355       *pRC = SQLITE_CORRUPT_BKPT;
  5356   5356       return;
  5357   5357     }
  5358   5358     rc = freeSpace(pPage, pc, sz);
  5359   5359     if( rc ){
  5360   5360       *pRC = rc;
  5361   5361       return;
................................................................................
  5885   5885         ** Unless SQLite is compiled in secure-delete mode. In this case,
  5886   5886         ** the dropCell() routine will overwrite the entire cell with zeroes.
  5887   5887         ** In this case, temporarily copy the cell into the aOvflSpace[]
  5888   5888         ** buffer. It will be copied out again as soon as the aSpace[] buffer
  5889   5889         ** is allocated.  */
  5890   5890         if( pBt->secureDelete ){
  5891   5891           int iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
  5892         -        if( (iOff+szNew[i])>pBt->usableSize ){
         5892  +        if( (iOff+szNew[i])>(int)pBt->usableSize ){
  5893   5893             rc = SQLITE_CORRUPT_BKPT;
  5894   5894             memset(apOld, 0, (i+1)*sizeof(MemPage*));
  5895   5895             goto balance_cleanup;
  5896   5896           }else{
  5897   5897             memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);
  5898   5898             apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
  5899   5899           }
................................................................................
  7454   7454       if( isFreeList ){
  7455   7455         int n = get4byte(&pOvflData[4]);
  7456   7456   #ifndef SQLITE_OMIT_AUTOVACUUM
  7457   7457         if( pCheck->pBt->autoVacuum ){
  7458   7458           checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0, zContext);
  7459   7459         }
  7460   7460   #endif
  7461         -      if( n>pCheck->pBt->usableSize/4-2 ){
         7461  +      if( n>(int)pCheck->pBt->usableSize/4-2 ){
  7462   7462           checkAppendMsg(pCheck, zContext,
  7463   7463              "freelist leaf count too big on page %d", iPage);
  7464   7464           N--;
  7465   7465         }else{
  7466   7466           for(i=0; i<n; i++){
  7467   7467             Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
  7468   7468   #ifndef SQLITE_OMIT_AUTOVACUUM
................................................................................
  7678   7678       for(i=0; i<nCell; i++){
  7679   7679         int pc = get2byte(&data[cellStart+i*2]);
  7680   7680         u32 size = 65536;
  7681   7681         int j;
  7682   7682         if( pc<=usableSize-4 ){
  7683   7683           size = cellSizePtr(pPage, &data[pc]);
  7684   7684         }
  7685         -      if( (pc+size-1)>=usableSize ){
         7685  +      if( (int)(pc+size-1)>=usableSize ){
  7686   7686           checkAppendMsg(pCheck, 0, 
  7687   7687               "Corruption detected in cell %d on page %d",i,iPage);
  7688   7688         }else{
  7689   7689           for(j=pc+size-1; j>=pc; j--) hit[j]++;
  7690   7690         }
  7691   7691       }
  7692   7692       i = get2byte(&data[hdr+1]);

Changes to src/pager.c.

  1330   1330   ** - 4 bytes: Database page size.
  1331   1331   ** 
  1332   1332   ** Followed by (JOURNAL_HDR_SZ - 28) bytes of unused space.
  1333   1333   */
  1334   1334   static int writeJournalHdr(Pager *pPager){
  1335   1335     int rc = SQLITE_OK;                 /* Return code */
  1336   1336     char *zHeader = pPager->pTmpSpace;  /* Temporary space used to build header */
  1337         -  u32 nHeader = pPager->pageSize;     /* Size of buffer pointed to by zHeader */
         1337  +  u32 nHeader = (u32)pPager->pageSize;/* Size of buffer pointed to by zHeader */
  1338   1338     u32 nWrite;                         /* Bytes of header sector written */
  1339   1339     int ii;                             /* Loop counter */
  1340   1340   
  1341   1341     assert( isOpen(pPager->jfd) );      /* Journal file must be open. */
  1342   1342   
  1343   1343     if( nHeader>JOURNAL_HDR_SZ(pPager) ){
  1344   1344       nHeader = JOURNAL_HDR_SZ(pPager);
................................................................................
  3360   3360     ** is a no-op for that case anyhow.
  3361   3361     */
  3362   3362   
  3363   3363     u32 pageSize = *pPageSize;
  3364   3364     assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) );
  3365   3365     if( (pPager->memDb==0 || pPager->dbSize==0)
  3366   3366      && sqlite3PcacheRefCount(pPager->pPCache)==0 
  3367         -   && pageSize && pageSize!=pPager->pageSize 
         3367  +   && pageSize && pageSize!=(u32)pPager->pageSize 
  3368   3368     ){
  3369   3369       char *pNew;                 /* New temp space */
  3370   3370       i64 nByte = 0;
  3371   3371   
  3372   3372       if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){
  3373   3373         rc = sqlite3OsFileSize(pPager->fd, &nByte);
  3374   3374       }
................................................................................
  4895   4895       /* The maximum page number is 2^31. Return SQLITE_CORRUPT if a page
  4896   4896       ** number greater than this, or the unused locking-page, is requested. */
  4897   4897       if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
  4898   4898         rc = SQLITE_CORRUPT_BKPT;
  4899   4899         goto pager_acquire_err;
  4900   4900       }
  4901   4901   
  4902         -    if( MEMDB || pPager->dbSize<(int)pgno || noContent || !isOpen(pPager->fd) ){
         4902  +    if( MEMDB || pPager->dbSize<pgno || noContent || !isOpen(pPager->fd) ){
  4903   4903         if( pgno>pPager->mxPgno ){
  4904   4904           rc = SQLITE_FULL;
  4905   4905           goto pager_acquire_err;
  4906   4906         }
  4907   4907         if( noContent ){
  4908   4908           /* Failure to set the bits in the InJournal bit-vectors is benign.
  4909   4909           ** It merely means that we might do some extra work to journal a