Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix MSVC compiler warnings in test code. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cb7a850439c9a4a7887650d6b81d95ab |
User & Date: | drh 2012-03-30 14:59:43.262 |
Context
2012-03-30
| ||
15:48 | When a named CHECK constraint fails, include the name of the constraint in the error message. (check-in: 1b75f301af user: drh tags: trunk) | |
14:59 | Fix MSVC compiler warnings in test code. (check-in: cb7a850439 user: drh tags: trunk) | |
13:34 | Fix an FTS4 test script problem for windows. (check-in: 36aa6665e7 user: drh tags: trunk) | |
Changes
Changes to ext/fts3/fts3_term.c.
︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 78 79 80 81 82 | int nDb; /* Result of strlen(zDb) */ int nFts3; /* Result of strlen(zFts3) */ int nByte; /* Bytes of space to allocate here */ int rc; /* value returned by declare_vtab() */ Fts3termTable *p; /* Virtual table object to return */ int iIndex = 0; if( argc==5 ){ iIndex = atoi(argv[4]); argc--; } /* The user should specify a single argument - the name of an fts3 table. */ if( argc!=4 ){ | > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | int nDb; /* Result of strlen(zDb) */ int nFts3; /* Result of strlen(zFts3) */ int nByte; /* Bytes of space to allocate here */ int rc; /* value returned by declare_vtab() */ Fts3termTable *p; /* Virtual table object to return */ int iIndex = 0; UNUSED_PARAMETER(pCtx); if( argc==5 ){ iIndex = atoi(argv[4]); argc--; } /* The user should specify a single argument - the name of an fts3 table. */ if( argc!=4 ){ |
︙ | ︙ | |||
227 228 229 230 231 232 233 | pCsr->pNext += sqlite3Fts3GetVarint(pCsr->pNext, &v); pCsr->iCol = 0; pCsr->iPos = 0; } if( v==1 ){ pCsr->pNext += sqlite3Fts3GetVarint(pCsr->pNext, &v); | | | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | pCsr->pNext += sqlite3Fts3GetVarint(pCsr->pNext, &v); pCsr->iCol = 0; pCsr->iPos = 0; } if( v==1 ){ pCsr->pNext += sqlite3Fts3GetVarint(pCsr->pNext, &v); pCsr->iCol += (int)v; pCsr->iPos = 0; pCsr->pNext += sqlite3Fts3GetVarint(pCsr->pNext, &v); } pCsr->iPos += (int)(v - 2); return SQLITE_OK; } /* ** xFilter - Initialize a cursor to point at the start of its data. */ |
︙ | ︙ | |||
353 354 355 356 357 358 359 | fts3termRowidMethod, /* xRowid */ 0, /* xUpdate */ 0, /* xBegin */ 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindFunction */ | | > > > | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | fts3termRowidMethod, /* xRowid */ 0, /* xUpdate */ 0, /* xBegin */ 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindFunction */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0 /* xRollbackTo */ }; int rc; /* Return code */ rc = sqlite3_create_module(db, "fts4term", &fts3term_module, 0); return rc; } #endif #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ |
Changes to ext/fts3/fts3_test.c.
︙ | ︙ | |||
156 157 158 159 160 161 162 163 164 165 166 167 168 169 | NearDocument doc = {0, 0}; Tcl_Obj **apDocToken; Tcl_Obj *pRet; Tcl_Obj *pPhrasecount = 0; Tcl_Obj **apExprToken; int nExprToken; /* Must have 3 or more arguments. */ if( objc<3 || (objc%2)==0 ){ Tcl_WrongNumArgs(interp, 1, objv, "DOCUMENT EXPR ?OPTION VALUE?..."); rc = TCL_ERROR; goto near_match_out; } | > > | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | NearDocument doc = {0, 0}; Tcl_Obj **apDocToken; Tcl_Obj *pRet; Tcl_Obj *pPhrasecount = 0; Tcl_Obj **apExprToken; int nExprToken; UNUSED_PARAMETER(clientData); /* Must have 3 or more arguments. */ if( objc<3 || (objc%2)==0 ){ Tcl_WrongNumArgs(interp, 1, objv, "DOCUMENT EXPR ?OPTION VALUE?..."); rc = TCL_ERROR; goto near_match_out; } |
︙ | ︙ | |||
310 311 312 313 314 315 316 317 318 319 320 321 322 323 | test_fts3_node_chunksize = iArg1; test_fts3_node_chunk_threshold = iArg2; } Tcl_SetObjResult(interp, pRet); Tcl_DecrRefCount(pRet); #endif return TCL_OK; } #ifdef SQLITE_ENABLE_FTS3 /************************************************************************** ** Beginning of test tokenizer code. ** | > | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | test_fts3_node_chunksize = iArg1; test_fts3_node_chunk_threshold = iArg2; } Tcl_SetObjResult(interp, pRet); Tcl_DecrRefCount(pRet); #endif UNUSED_PARAMETER(clientData); return TCL_OK; } #ifdef SQLITE_ENABLE_FTS3 /************************************************************************** ** Beginning of test tokenizer code. ** |
︙ | ︙ | |||
348 349 350 351 352 353 354 355 356 357 358 359 360 361 | } test_tokenizer_cursor; static int testTokenizerCreate( int argc, const char * const *argv, sqlite3_tokenizer **ppTokenizer ){ test_tokenizer *pNew; pNew = sqlite3_malloc(sizeof(test_tokenizer)); if( !pNew ) return SQLITE_NOMEM; memset(pNew, 0, sizeof(test_tokenizer)); *ppTokenizer = (sqlite3_tokenizer *)pNew; return SQLITE_OK; | > > | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | } test_tokenizer_cursor; static int testTokenizerCreate( int argc, const char * const *argv, sqlite3_tokenizer **ppTokenizer ){ test_tokenizer *pNew; UNUSED_PARAMETER(argc); UNUSED_PARAMETER(argv); pNew = sqlite3_malloc(sizeof(test_tokenizer)); if( !pNew ) return SQLITE_NOMEM; memset(pNew, 0, sizeof(test_tokenizer)); *ppTokenizer = (sqlite3_tokenizer *)pNew; return SQLITE_OK; |
︙ | ︙ | |||
503 504 505 506 507 508 509 510 511 512 513 514 515 516 | Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewByteArrayObj( (const unsigned char *)&pPtr, sizeof(sqlite3_tokenizer_module *) )); #endif return TCL_OK; } /* ** End of tokenizer code. **************************************************************************/ | > | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewByteArrayObj( (const unsigned char *)&pPtr, sizeof(sqlite3_tokenizer_module *) )); #endif UNUSED_PARAMETER(clientData); return TCL_OK; } /* ** End of tokenizer code. **************************************************************************/ |
︙ | ︙ |
Changes to src/test1.c.
︙ | ︙ | |||
3259 3260 3261 3262 3263 3264 3265 | #ifndef SQLITE_OMIT_UTF16 sqlite3_stmt *pStmt; int idx; int bytes; char *value; int rc; | | | 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 | #ifndef SQLITE_OMIT_UTF16 sqlite3_stmt *pStmt; int idx; int bytes; char *value; int rc; void (*xDel)(void*) = (objc==6?SQLITE_STATIC:SQLITE_TRANSIENT); Tcl_Obj *oStmt = objv[objc-4]; Tcl_Obj *oN = objv[objc-3]; Tcl_Obj *oString = objv[objc-2]; Tcl_Obj *oBytes = objv[objc-1]; if( objc!=5 && objc!=6){ Tcl_AppendResult(interp, "wrong # args: should be \"", |
︙ | ︙ | |||
3607 3608 3609 3610 3611 3612 3613 | rc = sqlite3_prepare(db, zSql, bytes, &pStmt, objc>=5 ? &zTail : 0); Tcl_ResetResult(interp); if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR; if( zTail && objc>=5 ){ if( bytes>=0 ){ bytes = bytes - (zTail-zSql); } | | | 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 | rc = sqlite3_prepare(db, zSql, bytes, &pStmt, objc>=5 ? &zTail : 0); Tcl_ResetResult(interp); if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR; if( zTail && objc>=5 ){ if( bytes>=0 ){ bytes = bytes - (zTail-zSql); } if( (int)strlen(zTail)<bytes ){ bytes = strlen(zTail); } Tcl_ObjSetVar2(interp, objv[4], 0, Tcl_NewStringObj(zTail, bytes), 0); } if( rc!=SQLITE_OK ){ assert( pStmt==0 ); sprintf(zBuf, "(%d) ", rc); |
︙ | ︙ | |||
5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 | int ok; /* Finished ok */ int err; /* True if an error occurs */ }; #endif #if SQLITE_OS_WIN /* ** The background thread that does file locking. */ static void win32_file_locker(void *pAppData){ struct win32FileLocker *p = (struct win32FileLocker*)pAppData; if( p->evName ){ HANDLE ev = OpenEvent(EVENT_MODIFY_STATE, FALSE, p->evName); | > | 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 | int ok; /* Finished ok */ int err; /* True if an error occurs */ }; #endif #if SQLITE_OS_WIN #include <process.h> /* ** The background thread that does file locking. */ static void win32_file_locker(void *pAppData){ struct win32FileLocker *p = (struct win32FileLocker*)pAppData; if( p->evName ){ HANDLE ev = OpenEvent(EVENT_MODIFY_STATE, FALSE, p->evName); |
︙ | ︙ | |||
6124 6125 6126 6127 6128 6129 6130 | { "sqlite3_column_name16", test_stmt_utf16, (void*)sqlite3_column_name16}, { "add_alignment_test_collations", add_alignment_test_collations, 0 }, #ifndef SQLITE_OMIT_DECLTYPE { "sqlite3_column_decltype16",test_stmt_utf16,(void*)sqlite3_column_decltype16}, #endif #ifdef SQLITE_ENABLE_COLUMN_METADATA {"sqlite3_column_database_name16", | | | 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 | { "sqlite3_column_name16", test_stmt_utf16, (void*)sqlite3_column_name16}, { "add_alignment_test_collations", add_alignment_test_collations, 0 }, #ifndef SQLITE_OMIT_DECLTYPE { "sqlite3_column_decltype16",test_stmt_utf16,(void*)sqlite3_column_decltype16}, #endif #ifdef SQLITE_ENABLE_COLUMN_METADATA {"sqlite3_column_database_name16", test_stmt_utf16, (void*)sqlite3_column_database_name16}, {"sqlite3_column_table_name16", test_stmt_utf16, (void*)sqlite3_column_table_name16}, {"sqlite3_column_origin_name16", test_stmt_utf16, (void*)sqlite3_column_origin_name16}, #endif #endif { "sqlite3_create_collation_v2", test_create_collation_v2, 0 }, { "sqlite3_global_recover", test_global_recover, 0 }, { "working_64bit_int", working_64bit_int, 0 }, |
︙ | ︙ |
Changes to src/test3.c.
︙ | ︙ | |||
461 462 463 464 465 466 467 | } if( Tcl_GetInt(interp, argv[1], (int*)&start) ) return TCL_ERROR; if( Tcl_GetInt(interp, argv[2], (int*)&mult) ) return TCL_ERROR; if( Tcl_GetInt(interp, argv[3], (int*)&count) ) return TCL_ERROR; if( Tcl_GetInt(interp, argv[4], (int*)&incr) ) return TCL_ERROR; in = start; in *= mult; | | | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | } if( Tcl_GetInt(interp, argv[1], (int*)&start) ) return TCL_ERROR; if( Tcl_GetInt(interp, argv[2], (int*)&mult) ) return TCL_ERROR; if( Tcl_GetInt(interp, argv[3], (int*)&count) ) return TCL_ERROR; if( Tcl_GetInt(interp, argv[4], (int*)&incr) ) return TCL_ERROR; in = start; in *= mult; for(i=0; i<(int)count; i++){ char zErr[200]; n1 = putVarint(zBuf, in); if( n1>9 || n1<1 ){ sprintf(zErr, "putVarint returned %d - should be between 1 and 9", n1); Tcl_AppendResult(interp, zErr, 0); return TCL_ERROR; } |
︙ | ︙ |
Changes to src/test6.c.
︙ | ︙ | |||
173 174 175 176 177 178 179 | static int writeDbFile(CrashFile *p, u8 *z, i64 iAmt, i64 iOff){ int rc = SQLITE_OK; int iSkip = 0; if( iOff==PENDING_BYTE && (p->flags&SQLITE_OPEN_MAIN_DB) ){ iSkip = 512; } if( (iAmt-iSkip)>0 ){ | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | static int writeDbFile(CrashFile *p, u8 *z, i64 iAmt, i64 iOff){ int rc = SQLITE_OK; int iSkip = 0; if( iOff==PENDING_BYTE && (p->flags&SQLITE_OPEN_MAIN_DB) ){ iSkip = 512; } if( (iAmt-iSkip)>0 ){ rc = sqlite3OsWrite(p->pRealFile, &z[iSkip], (int)(iAmt-iSkip), iOff+iSkip); } return rc; } /* ** Flush the write-list as if xSync() had been called on file handle ** pFile. If isCrash is true, simulate a crash. |
︙ | ︙ | |||
302 303 304 305 306 307 308 | ); } #endif break; } case 3: { /* Trash sectors */ u8 *zGarbage; | | | | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | ); } #endif break; } case 3: { /* Trash sectors */ u8 *zGarbage; int iFirst = (int)(pWrite->iOffset/g.iSectorSize); int iLast = (int)((pWrite->iOffset+pWrite->nBuf-1)/g.iSectorSize); assert(pWrite->zBuf); #ifdef TRACE_CRASHTEST printf("Trashing %d sectors @ sector %d (%s)\n", 1+iLast-iFirst, iFirst, pWrite->pFile->zName ); |
︙ | ︙ | |||
426 427 428 429 430 431 432 | sqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_int64 iOfst ){ CrashFile *pCrash = (CrashFile *)pFile; if( iAmt+iOfst>pCrash->iSize ){ | | | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | sqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_int64 iOfst ){ CrashFile *pCrash = (CrashFile *)pFile; if( iAmt+iOfst>pCrash->iSize ){ pCrash->iSize = (int)(iAmt+iOfst); } while( pCrash->iSize>pCrash->nData ){ u8 *zNew; int nNew = (pCrash->nData*2) + 4096; zNew = crash_realloc(pCrash->zData, nNew); if( !zNew ){ return SQLITE_NOMEM; |
︙ | ︙ | |||
450 451 452 453 454 455 456 | /* ** Truncate a crash-file. */ static int cfTruncate(sqlite3_file *pFile, sqlite_int64 size){ CrashFile *pCrash = (CrashFile *)pFile; assert(size>=0); if( pCrash->iSize>size ){ | | | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | /* ** Truncate a crash-file. */ static int cfTruncate(sqlite3_file *pFile, sqlite_int64 size){ CrashFile *pCrash = (CrashFile *)pFile; assert(size>=0); if( pCrash->iSize>size ){ pCrash->iSize = (int)size; } return writeListAppend(pFile, size, 0, 0); } /* ** Sync a crash-file. */ |
︙ | ︙ | |||
514 515 516 517 518 519 520 | } static int cfFileControl(sqlite3_file *pFile, int op, void *pArg){ if( op==SQLITE_FCNTL_SIZE_HINT ){ CrashFile *pCrash = (CrashFile *)pFile; i64 nByte = *(i64 *)pArg; if( nByte>pCrash->iSize ){ if( SQLITE_OK==writeListAppend(pFile, nByte, 0, 0) ){ | | | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | } static int cfFileControl(sqlite3_file *pFile, int op, void *pArg){ if( op==SQLITE_FCNTL_SIZE_HINT ){ CrashFile *pCrash = (CrashFile *)pFile; i64 nByte = *(i64 *)pArg; if( nByte>pCrash->iSize ){ if( SQLITE_OK==writeListAppend(pFile, nByte, 0, 0) ){ pCrash->iSize = (int)nByte; } } return SQLITE_OK; } return sqlite3OsFileControl(((CrashFile *)pFile)->pRealFile, op, pArg); } |
︙ | ︙ | |||
631 632 633 634 635 636 637 | */ const int isDb = (flags&SQLITE_OPEN_MAIN_DB); i64 iChunk = pWrapper->iSize; if( iChunk>PENDING_BYTE && isDb ){ iChunk = PENDING_BYTE; } memset(pWrapper->zData, 0, pWrapper->nData); | | | | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | */ const int isDb = (flags&SQLITE_OPEN_MAIN_DB); i64 iChunk = pWrapper->iSize; if( iChunk>PENDING_BYTE && isDb ){ iChunk = PENDING_BYTE; } memset(pWrapper->zData, 0, pWrapper->nData); rc = sqlite3OsRead(pReal, pWrapper->zData, (int)iChunk, 0); if( SQLITE_OK==rc && pWrapper->iSize>(PENDING_BYTE+512) && isDb ){ i64 iOff = PENDING_BYTE+512; iChunk = pWrapper->iSize - iOff; rc = sqlite3OsRead(pReal, &pWrapper->zData[iOff], (int)iChunk, iOff); } }else{ rc = SQLITE_NOMEM; } } if( rc!=SQLITE_OK && pWrapper->pMethod ){ sqlite3OsClose(pFile); |
︙ | ︙ |
Changes to src/test_journal.c.
︙ | ︙ | |||
400 401 402 403 404 405 406 | } iTrunk = decodeUint32(aData); } /* Calculate and store a checksum for each page in the database file. */ if( rc==SQLITE_OK ){ int ii; | | | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | } iTrunk = decodeUint32(aData); } /* Calculate and store a checksum for each page in the database file. */ if( rc==SQLITE_OK ){ int ii; for(ii=0; rc==SQLITE_OK && ii<(int)pMain->nPage; ii++){ i64 iOff = (i64)(pMain->nPagesize) * (i64)ii; if( iOff==PENDING_BYTE ) continue; rc = sqlite3OsRead(pMain->pReal, aData, pMain->nPagesize, iOff); pMain->aCksum[ii] = genCksum(aData, pMain->nPagesize); if( ii+1==pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ) rc = SQLITE_OK; } } |
︙ | ︙ | |||
462 463 464 465 466 467 468 | */ if( iSize>=(iOff+nSector) ){ rc = sqlite3OsRead(pReal, zBuf, 28, iOff); if( rc!=SQLITE_OK || 0==decodeJournalHdr(zBuf, 0, 0, 0, 0) ){ continue; } } | | | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | */ if( iSize>=(iOff+nSector) ){ rc = sqlite3OsRead(pReal, zBuf, 28, iOff); if( rc!=SQLITE_OK || 0==decodeJournalHdr(zBuf, 0, 0, 0, 0) ){ continue; } } nRec = (u32)((iSize-iOff) / (pMain->nPagesize+8)); } /* Read all the records that follow the journal-header just read. */ for(ii=0; rc==SQLITE_OK && ii<nRec && iOff<iSize; ii++){ u32 pgno; rc = sqlite3OsRead(pReal, zBuf, 4, iOff); if( rc==SQLITE_OK ){ |
︙ | ︙ | |||
534 535 536 537 538 539 540 | } if( p->iMaxOff<(iOfst + iAmt) ){ p->iMaxOff = iOfst + iAmt; } } if( p->flags&SQLITE_OPEN_MAIN_DB && p->pWritable ){ | | | | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | } if( p->iMaxOff<(iOfst + iAmt) ){ p->iMaxOff = iOfst + iAmt; } } if( p->flags&SQLITE_OPEN_MAIN_DB && p->pWritable ){ if( iAmt<(int)p->nPagesize && p->nPagesize%iAmt==0 && iOfst>=(PENDING_BYTE+512) && iOfst+iAmt<=PENDING_BYTE+p->nPagesize ){ /* No-op. This special case is hit when the backup code is copying a ** to a database with a larger page-size than the source database and ** it needs to fill in the non-locking-region part of the original ** pending-byte page. */ }else{ u32 pgno = (u32)(iOfst/p->nPagesize + 1); assert( (iAmt==1||iAmt==p->nPagesize) && ((iOfst+iAmt)%p->nPagesize)==0 ); assert( pgno<=p->nPage || p->nSync>0 ); assert( pgno>p->nPage || sqlite3BitvecTest(p->pWritable, pgno) ); } } rc = sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst); |
︙ | ︙ | |||
574 575 576 577 578 579 580 | /* Truncating a journal file. This is the end of a transaction. */ jt_file *pMain = locateDatabaseHandle(p->zName); closeTransaction(pMain); } if( p->flags&SQLITE_OPEN_MAIN_DB && p->pWritable ){ u32 pgno; u32 locking_page = (u32)(PENDING_BYTE/p->nPagesize+1); | | | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | /* Truncating a journal file. This is the end of a transaction. */ jt_file *pMain = locateDatabaseHandle(p->zName); closeTransaction(pMain); } if( p->flags&SQLITE_OPEN_MAIN_DB && p->pWritable ){ u32 pgno; u32 locking_page = (u32)(PENDING_BYTE/p->nPagesize+1); for(pgno=(u32)(size/p->nPagesize+1); pgno<=p->nPage; pgno++){ assert( pgno==locking_page || sqlite3BitvecTest(p->pWritable, pgno) ); } } return sqlite3OsTruncate(p->pReal, size); } /* |
︙ | ︙ |
Changes to src/test_multiplex.c.
︙ | ︙ | |||
525 526 527 528 529 530 531 | const char *zUri = (flags & SQLITE_OPEN_URI) ? zName : 0; /* assign pointers to extra space allocated */ memset(pGroup, 0, sz); pMultiplexOpen->pGroup = pGroup; pGroup->bEnabled = -1; pGroup->bTruncate = sqlite3_uri_boolean(zUri, "truncate", (flags & SQLITE_OPEN_MAIN_DB)==0); | | | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | const char *zUri = (flags & SQLITE_OPEN_URI) ? zName : 0; /* assign pointers to extra space allocated */ memset(pGroup, 0, sz); pMultiplexOpen->pGroup = pGroup; pGroup->bEnabled = -1; pGroup->bTruncate = sqlite3_uri_boolean(zUri, "truncate", (flags & SQLITE_OPEN_MAIN_DB)==0); pGroup->szChunk = (int)sqlite3_uri_int64(zUri, "chunksize", SQLITE_MULTIPLEX_CHUNK_SIZE); pGroup->szChunk = (pGroup->szChunk+0xffff)&~0xffff; if( zName ){ char *p = (char *)&pGroup[1]; pGroup->zName = p; memcpy(pGroup->zName, zName, nName+1); pGroup->nName = nName; |
︙ | ︙ | |||
593 594 595 596 597 598 599 | ** just disable the multiplexor all togethre. */ rc = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[1].z, SQLITE_ACCESS_EXISTS, &bExists); bExists = multiplexSubSize(pGroup, 1, &rc)>0; if( rc==SQLITE_OK && bExists && sz==(sz&0xffff0000) && sz>0 && sz!=pGroup->szChunk ){ | | | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | ** just disable the multiplexor all togethre. */ rc = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[1].z, SQLITE_ACCESS_EXISTS, &bExists); bExists = multiplexSubSize(pGroup, 1, &rc)>0; if( rc==SQLITE_OK && bExists && sz==(sz&0xffff0000) && sz>0 && sz!=pGroup->szChunk ){ pGroup->szChunk = (int)sz; }else if( rc==SQLITE_OK && !bExists && sz>pGroup->szChunk ){ pGroup->bEnabled = 0; } } } } |
︙ | ︙ |
Changes to src/test_onefile.c.
︙ | ︙ | |||
284 285 286 287 288 289 290 | sqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_int64 iOfst ){ tmp_file *pTmp = (tmp_file *)pFile; if( (iAmt+iOfst)>pTmp->nAlloc ){ | | | | | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | sqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_int64 iOfst ){ tmp_file *pTmp = (tmp_file *)pFile; if( (iAmt+iOfst)>pTmp->nAlloc ){ int nNew = (int)(2*(iAmt+iOfst+pTmp->nAlloc)); char *zNew = sqlite3_realloc(pTmp->zAlloc, nNew); if( !zNew ){ return SQLITE_NOMEM; } pTmp->zAlloc = zNew; pTmp->nAlloc = nNew; } memcpy(&pTmp->zAlloc[iOfst], zBuf, iAmt); pTmp->nSize = (int)MAX(pTmp->nSize, iOfst+iAmt); return SQLITE_OK; } /* ** Truncate a tmp-file. */ static int tmpTruncate(sqlite3_file *pFile, sqlite_int64 size){ tmp_file *pTmp = (tmp_file *)pFile; pTmp->nSize = (int)MIN(pTmp->nSize, size); return SQLITE_OK; } /* ** Sync a tmp-file. */ static int tmpSync(sqlite3_file *pFile, int flags){ |
︙ | ︙ | |||
414 415 416 417 418 419 420 | rc = SQLITE_IOERR_SHORT_READ; }else if( p->eType==DATABASE_FILE ){ rc = pF->pMethods->xRead(pF, zBuf, iAmt, iOfst+BLOCKSIZE); }else{ /* Journal file. */ int iRem = iAmt; int iBuf = 0; | | | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | rc = SQLITE_IOERR_SHORT_READ; }else if( p->eType==DATABASE_FILE ){ rc = pF->pMethods->xRead(pF, zBuf, iAmt, iOfst+BLOCKSIZE); }else{ /* Journal file. */ int iRem = iAmt; int iBuf = 0; int ii = (int)iOfst; while( iRem>0 && rc==SQLITE_OK ){ int iRealOff = pReal->nBlob - BLOCKSIZE*((ii/BLOCKSIZE)+1) + ii%BLOCKSIZE; int iRealAmt = MIN(iRem, BLOCKSIZE - (iRealOff%BLOCKSIZE)); rc = pF->pMethods->xRead(pF, &((char *)zBuf)[iBuf], iRealAmt, iRealOff); ii += iRealAmt; iBuf += iRealAmt; |
︙ | ︙ | |||
449 450 451 452 453 454 455 | if( p->eType==DATABASE_FILE ){ if( (iAmt+iOfst+BLOCKSIZE)>(pReal->nBlob-pReal->nJournal) ){ rc = SQLITE_FULL; }else{ rc = pF->pMethods->xWrite(pF, zBuf, iAmt, iOfst+BLOCKSIZE); if( rc==SQLITE_OK ){ | | | | | | | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | if( p->eType==DATABASE_FILE ){ if( (iAmt+iOfst+BLOCKSIZE)>(pReal->nBlob-pReal->nJournal) ){ rc = SQLITE_FULL; }else{ rc = pF->pMethods->xWrite(pF, zBuf, iAmt, iOfst+BLOCKSIZE); if( rc==SQLITE_OK ){ pReal->nDatabase = (int)MAX(pReal->nDatabase, iAmt+iOfst); } } }else{ /* Journal file. */ int iRem = iAmt; int iBuf = 0; int ii = (int)iOfst; while( iRem>0 && rc==SQLITE_OK ){ int iRealOff = pReal->nBlob - BLOCKSIZE*((ii/BLOCKSIZE)+1) + ii%BLOCKSIZE; int iRealAmt = MIN(iRem, BLOCKSIZE - (iRealOff%BLOCKSIZE)); if( iRealOff<(pReal->nDatabase+BLOCKSIZE) ){ rc = SQLITE_FULL; }else{ rc = pF->pMethods->xWrite(pF, &((char *)zBuf)[iBuf], iRealAmt,iRealOff); ii += iRealAmt; iBuf += iRealAmt; iRem -= iRealAmt; } } if( rc==SQLITE_OK ){ pReal->nJournal = (int)MAX(pReal->nJournal, iAmt+iOfst); } } return rc; } /* ** Truncate an fs-file. */ static int fsTruncate(sqlite3_file *pFile, sqlite_int64 size){ fs_file *p = (fs_file *)pFile; fs_real_file *pReal = p->pReal; if( p->eType==DATABASE_FILE ){ pReal->nDatabase = (int)MIN(pReal->nDatabase, size); }else{ pReal->nJournal = (int)MIN(pReal->nJournal, size); } return SQLITE_OK; } /* ** Sync an fs-file. */ |
︙ | ︙ | |||
637 638 639 640 641 642 643 | goto open_out; } if( size==0 ){ rc = pRealFile->pMethods->xWrite(pRealFile, "\0", 1, BLOBSIZE-1); pReal->nBlob = BLOBSIZE; }else{ unsigned char zS[4]; | | | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | goto open_out; } if( size==0 ){ rc = pRealFile->pMethods->xWrite(pRealFile, "\0", 1, BLOBSIZE-1); pReal->nBlob = BLOBSIZE; }else{ unsigned char zS[4]; pReal->nBlob = (int)size; rc = pRealFile->pMethods->xRead(pRealFile, zS, 4, 0); pReal->nDatabase = (zS[0]<<24)+(zS[1]<<16)+(zS[2]<<8)+zS[3]; if( rc==SQLITE_OK ){ rc = pRealFile->pMethods->xRead(pRealFile, zS, 4, pReal->nBlob-4); if( zS[0] || zS[1] || zS[2] || zS[3] ){ pReal->nJournal = pReal->nBlob; } |
︙ | ︙ |
Changes to src/test_osinst.c.
︙ | ︙ | |||
238 239 240 241 242 243 244 | } #else static sqlite3_uint64 vfslog_time(){ return 0; } #endif | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | } #else static sqlite3_uint64 vfslog_time(){ return 0; } #endif static void vfslog_call(sqlite3_vfs *, int, int, sqlite3_int64, int, int, int); static void vfslog_string(sqlite3_vfs *, const char *); /* ** Close an vfslog-file. */ static int vfslogClose(sqlite3_file *pFile){ sqlite3_uint64 t; |
︙ | ︙ | |||
644 645 646 647 648 649 650 | p[3] = v; } static void vfslog_call( sqlite3_vfs *pVfs, int eEvent, int iFileid, | | | | 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | p[3] = v; } static void vfslog_call( sqlite3_vfs *pVfs, int eEvent, int iFileid, sqlite3_int64 nClick, int return_code, int size, int offset ){ VfslogVfs *p = (VfslogVfs *)pVfs; unsigned char *zRec; if( (24+p->nBuf)>sizeof(p->aBuf) ){ vfslog_flush(p); } zRec = (unsigned char *)&p->aBuf[p->nBuf]; put32bits(&zRec[0], eEvent); put32bits(&zRec[4], iFileid); put32bits(&zRec[8], (unsigned int)(nClick&0xffff)); put32bits(&zRec[12], return_code); put32bits(&zRec[16], size); put32bits(&zRec[20], offset); p->nBuf += 24; } static void vfslog_string(sqlite3_vfs *pVfs, const char *zStr){ |
︙ | ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | switch( i ){ case 0: { sqlite3_result_text(ctx, vfslog_eventname(val), -1, SQLITE_STATIC); break; } case 1: { char *zStr = pCsr->zTransient; | | | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | switch( i ){ case 0: { sqlite3_result_text(ctx, vfslog_eventname(val), -1, SQLITE_STATIC); break; } case 1: { char *zStr = pCsr->zTransient; if( val!=0 && val<(unsigned)pCsr->nFile ){ zStr = pCsr->azFile[val]; } sqlite3_result_text(ctx, zStr, -1, SQLITE_TRANSIENT); break; } default: sqlite3_result_int(ctx, val); |
︙ | ︙ |
Changes to src/test_quota.c.
︙ | ︙ | |||
1056 1057 1058 1059 1060 1061 1062 | if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){ if( pGroup->xCallback ){ pGroup->xCallback(pFile->zFilename, &pGroup->iLimit, szNew, pGroup->pArg); } if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){ iEnd = pGroup->iLimit - pGroup->iSize + pFile->iSize; | | | 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){ if( pGroup->xCallback ){ pGroup->xCallback(pFile->zFilename, &pGroup->iLimit, szNew, pGroup->pArg); } if( szNew>pGroup->iLimit && pGroup->iLimit>0 ){ iEnd = pGroup->iLimit - pGroup->iSize + pFile->iSize; nmemb = (size_t)((iEnd - iOfst)/size); iEnd = iOfst + size*nmemb; szNew = pGroup->iSize - pFile->iSize + iEnd; } } pGroup->iSize = szNew; pFile->iSize = iEnd; quotaLeave(); |
︙ | ︙ |
Changes to src/test_stat.c.
︙ | ︙ | |||
320 321 322 323 324 325 326 | u32 nPayload; /* Bytes of payload total (local+overflow) */ int nLocal; /* Bytes of payload stored locally */ iOff += getVarint32(&aData[iOff], nPayload); if( p->flags==0x0D ){ u64 dummy; iOff += sqlite3GetVarint(&aData[iOff], &dummy); } | | > | | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | u32 nPayload; /* Bytes of payload total (local+overflow) */ int nLocal; /* Bytes of payload stored locally */ iOff += getVarint32(&aData[iOff], nPayload); if( p->flags==0x0D ){ u64 dummy; iOff += sqlite3GetVarint(&aData[iOff], &dummy); } if( nPayload>(u32)p->nMxPayload ) p->nMxPayload = nPayload; getLocalPayload(nUsable, p->flags, nPayload, &nLocal); pCell->nLocal = nLocal; assert( nLocal>=0 ); assert( nPayload>=nLocal ); assert( nLocal<=(nUsable-35) ); if( nPayload>(u32)nLocal ){ int j; int nOvfl = ((nPayload - nLocal) + nUsable-4 - 1) / (nUsable - 4); pCell->nLastOvfl = (nPayload-nLocal) - (nOvfl-1) * (nUsable-4); pCell->nOvfl = nOvfl; pCell->aOvfl = sqlite3_malloc(sizeof(u32)*nOvfl); pCell->aOvfl[0] = sqlite3Get4byte(&aData[iOff+nLocal]); for(j=1; j<nOvfl; j++){ |
︙ | ︙ | |||
374 375 376 377 378 379 380 | /* If connected to a ZIPVFS backend, override the page size and ** offset with actual values obtained from ZIPVFS. */ fd = sqlite3PagerFile(pPager); x[0] = pCsr->iPageno; if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){ pCsr->iOffset = x[0]; | | | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | /* If connected to a ZIPVFS backend, override the page size and ** offset with actual values obtained from ZIPVFS. */ fd = sqlite3PagerFile(pPager); x[0] = pCsr->iPageno; if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){ pCsr->iOffset = x[0]; pCsr->szPage = (int)x[1]; } } /* ** Move a statvfs cursor to the next entry in the file. */ static int statNext(sqlite3_vtab_cursor *pCursor){ |
︙ | ︙ | |||
396 397 398 399 400 401 402 | sqlite3_free(pCsr->zPath); pCsr->zPath = 0; if( pCsr->aPage[0].pPg==0 ){ rc = sqlite3_step(pCsr->pStmt); if( rc==SQLITE_ROW ){ int nPage; | | | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | sqlite3_free(pCsr->zPath); pCsr->zPath = 0; if( pCsr->aPage[0].pPg==0 ){ rc = sqlite3_step(pCsr->pStmt); if( rc==SQLITE_ROW ){ int nPage; u32 iRoot = (u32)sqlite3_column_int64(pCsr->pStmt, 1); sqlite3PagerPagecount(pPager, &nPage); if( nPage==0 ){ pCsr->isEof = 1; return sqlite3_reset(pCsr->pStmt); } rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg); pCsr->aPage[0].iPgno = iRoot; |
︙ | ︙ |
Changes to src/test_wholenumber.c.
︙ | ︙ | |||
29 30 31 32 33 34 35 | #ifndef SQLITE_OMIT_VIRTUALTABLE /* A wholenumber cursor object */ typedef struct wholenumber_cursor wholenumber_cursor; struct wholenumber_cursor { sqlite3_vtab_cursor base; /* Base class - must be first */ | | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #ifndef SQLITE_OMIT_VIRTUALTABLE /* A wholenumber cursor object */ typedef struct wholenumber_cursor wholenumber_cursor; struct wholenumber_cursor { sqlite3_vtab_cursor base; /* Base class - must be first */ sqlite3_int64 iValue; /* Current value */ sqlite3_int64 mxValue; /* Maximum value */ }; /* Methods for the wholenumber module */ static int wholenumberConnect( sqlite3 *db, void *pAux, int argc, const char *const*argv, |
︙ | ︙ |