Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix harmless compiler warnings in lsmtest. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
bd8a1fb9b33418717c786a7275f636cd |
User & Date: | mistachkin 2017-07-10 21:32:11.229 |
Context
2017-07-11
| ||
00:09 | Incomplete implementation of the COMPLETION table-valued function. So far it only works for SQL keywords. (check-in: caefbc723b user: drh tags: trunk) | |
2017-07-10
| ||
21:32 | Fix harmless compiler warnings in lsmtest. (check-in: bd8a1fb9b3 user: mistachkin tags: trunk) | |
20:39 | Fix errors in comments in the STMT virtual table. No code changes. (check-in: 9a8f045d62 user: drh tags: trunk) | |
Changes
Changes to ext/lsm1/Makefile.msc.
︙ | ︙ | |||
37 38 39 40 41 42 43 | $(LSMDIR)\lsm-test\lsmtest_func.c $(LSMDIR)\lsm-test\lsmtest_io.c \ $(LSMDIR)\lsm-test\lsmtest_main.c $(LSMDIR)\lsm-test\lsmtest_mem.c \ $(LSMDIR)\lsm-test\lsmtest_tdb.c $(LSMDIR)\lsm-test\lsmtest_tdb3.c \ $(LSMDIR)\lsm-test\lsmtest_util.c $(LSMDIR)\lsm-test\lsmtest_win32.c # all: lsm.dll | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | $(LSMDIR)\lsm-test\lsmtest_func.c $(LSMDIR)\lsm-test\lsmtest_io.c \ $(LSMDIR)\lsm-test\lsmtest_main.c $(LSMDIR)\lsm-test\lsmtest_mem.c \ $(LSMDIR)\lsm-test\lsmtest_tdb.c $(LSMDIR)\lsm-test\lsmtest_tdb3.c \ $(LSMDIR)\lsm-test\lsmtest_util.c $(LSMDIR)\lsm-test\lsmtest_win32.c # all: lsm.dll LSMOPTS = $(NO_WARN) -DLSM_MUTEX_WIN32=1 -I$(LSMDIR) !IF $(DEBUG)>2 LSMOPTS = $(LSMOPTS) -DLSM_DEBUG=1 !ENDIF !IF $(MEMDEBUG)!=0 LSMOPTS = $(LSMOPTS) -DLSM_DEBUG_MEM=1 |
︙ | ︙ |
Changes to ext/lsm1/lsm-test/lsmtest6.c.
︙ | ︙ | |||
196 197 198 199 200 201 202 | int nScan, int *pRc ){ if( *pRc==0 ){ int rc; int iScan = 0; lsm_cursor *pCsr; | | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | int nScan, int *pRc ){ if( *pRc==0 ){ int rc; int iScan = 0; lsm_cursor *pCsr; int (*xAdvance)(lsm_cursor *) = 0; rc = lsm_csr_open(pDb, &pCsr); testOomAssertRc(pOom, rc); if( rc==LSM_OK ){ if( bReverse ){ |
︙ | ︙ | |||
349 350 351 352 353 354 355 | static int lsmWriteStr(lsm_db *pDb, const char *zKey, const char *zVal){ int nKey = strlen(zKey); int nVal = strlen(zVal); return lsm_insert(pDb, (void *)zKey, nKey, (void *)zVal, nVal); } | | | | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | static int lsmWriteStr(lsm_db *pDb, const char *zKey, const char *zVal){ int nKey = strlen(zKey); int nVal = strlen(zVal); return lsm_insert(pDb, (void *)zKey, nKey, (void *)zVal, nVal); } static void setup_delete_db(void){ testDeleteLsmdb(LSMTEST6_TESTDB); } /* ** Create a small database. With the following content: ** ** "one" -> "one" ** "two" -> "four" ** "three" -> "nine" ** "four" -> "sixteen" ** "five" -> "twentyfive" ** "six" -> "thirtysix" ** "seven" -> "fourtynine" ** "eight" -> "sixtyfour" */ static void setup_populate_db(void){ const char *azStr[] = { "one", "one", "two", "four", "three", "nine", "four", "sixteen", "five", "twentyfive", "six", "thirtysix", |
︙ | ︙ | |||
407 408 409 410 411 412 413 | ** Set up a database file with the following properties: ** ** * Page size is 1024 bytes. ** * Block size is 64 KB. ** * Contains 5000 key-value pairs starting at 0 from the ** datasource returned getDatasource(). */ | | | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | ** Set up a database file with the following properties: ** ** * Page size is 1024 bytes. ** * Block size is 64 KB. ** * Contains 5000 key-value pairs starting at 0 from the ** datasource returned getDatasource(). */ static void setup_populate_db2(void){ Datasource *pData; int ii; int rc; int nBlocksize = 64*1024; int nPagesize = 1024; int nWritebuffer = 4*1024; lsm_db *pDb; |
︙ | ︙ |
Changes to ext/lsm1/lsm-test/lsmtest8.c.
︙ | ︙ | |||
88 89 90 91 92 93 94 | fd = fopen(zFile, "r"); if( fd==0 ){ *pRc = 1; }else{ if( 0!=fseek(fd, iOff, SEEK_SET) ){ *pRc = 1; }else{ | > | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | fd = fopen(zFile, "r"); if( fd==0 ){ *pRc = 1; }else{ if( 0!=fseek(fd, iOff, SEEK_SET) ){ *pRc = 1; }else{ assert( nByte>=0 ); if( (size_t)nByte!=fread(pOut, 1, nByte, fd) ){ *pRc = 1; } } fclose(fd); } } } |
︙ | ︙ | |||
113 114 115 116 117 118 119 | fd = fopen(zFile, "r+"); if( fd==0 ){ *pRc = 1; }else{ if( 0!=fseek(fd, iOff, SEEK_SET) ){ *pRc = 1; }else{ | > | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | fd = fopen(zFile, "r+"); if( fd==0 ){ *pRc = 1; }else{ if( 0!=fseek(fd, iOff, SEEK_SET) ){ *pRc = 1; }else{ assert( nByte>=0 ); if( (size_t)nByte!=fwrite(pOut, 1, nByte, fd) ){ *pRc = 1; } } fclose(fd); } } } |
︙ | ︙ |
Changes to ext/lsm1/lsm-test/lsmtest_io.c.
︙ | ︙ | |||
143 144 145 146 147 148 149 | if( safe_isdigit(c) ){ i64 iOff = 0; int nByte = 0; int rc = 0; int nPg; int iPg; | | | | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | if( safe_isdigit(c) ){ i64 iOff = 0; int nByte = 0; int rc = 0; int nPg; int iPg; nByte = (int)getNextSize(z, &z, &rc); if( rc || *z!='@' ) goto bad_command; z++; iOff = getNextSize(z, &z, &rc); if( rc || (safe_isspace(*z)==0 && *z!='\0') ) goto bad_command; if( pzOut ) *pzOut = z; nPg = (nByte+pgsz-1) / pgsz; lseek(pCtx->fd, (off_t)iOff, SEEK_SET); for(iPg=0; iPg<nPg; iPg++){ write(pCtx->fd, aData, pgsz); } pCtx->nWrite += nByte/1024; return 0; } |
︙ | ︙ | |||
207 208 209 210 211 212 213 | if( nArg<2 ){ testPrintUsage("FILE PGSZ ?CMD-1 ...?"); return -1; } zFile = azArg[0]; zPgsz = azArg[1]; | | | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | if( nArg<2 ){ testPrintUsage("FILE PGSZ ?CMD-1 ...?"); return -1; } zFile = azArg[0]; zPgsz = azArg[1]; pgsz = (int)getNextSize(zPgsz, 0, &rc); if( pgsz<=0 ){ testPrintError("Ridiculous page size: %d", pgsz); return -1; } aData = malloc(pgsz); memset(aData, 0x77, pgsz); |
︙ | ︙ |
Changes to ext/lsm1/lsm-test/lsmtest_main.c.
︙ | ︙ | |||
898 899 900 901 902 903 904 | pLog = fopen("/tmp/speed.log", "w"); tdb_lsm_write_hook(pDb, do_speed_write_hook2, (void *)pLog); #endif testTimeInit(); for(i=0; i<nRow; i+=nStep){ int iStep; | | | 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | pLog = fopen("/tmp/speed.log", "w"); tdb_lsm_write_hook(pDb, do_speed_write_hook2, (void *)pLog); #endif testTimeInit(); for(i=0; i<nRow; i+=nStep){ int iStep; int nWrite1 = 0, nWrite2 = 0; testCaseProgress(i, nRow, testCaseNDot(), &iDot); if( pLsm ) lsm_info(pLsm, LSM_INFO_NWRITE, &nWrite1); for(iStep=0; iStep<nStep; iStep++){ u32 aKey[4]; /* 16-byte key */ u32 aVal[25]; /* 100 byte value */ testPrngArray(i+iStep, aKey, ArraySize(aKey)); testPrngArray(i+iStep, aVal, ArraySize(aVal)); |
︙ | ︙ |
Changes to ext/lsm1/lsm-test/lsmtest_mem.c.
︙ | ︙ | |||
41 42 43 44 45 46 47 | /* Mutex to protect pFirst and aHash */ void (*xEnterMutex)(TmGlobal*); /* Call this to enter the mutex */ void (*xLeaveMutex)(TmGlobal*); /* Call this to leave mutex */ void (*xDelMutex)(TmGlobal*); /* Call this to delete mutex */ void *pMutex; /* Mutex handle */ | | | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | /* Mutex to protect pFirst and aHash */ void (*xEnterMutex)(TmGlobal*); /* Call this to enter the mutex */ void (*xLeaveMutex)(TmGlobal*); /* Call this to leave mutex */ void (*xDelMutex)(TmGlobal*); /* Call this to delete mutex */ void *pMutex; /* Mutex handle */ void *(*xSaveMalloc)(void *, size_t); void *(*xSaveRealloc)(void *, void *, size_t); void (*xSaveFree)(void *, void *); /* OOM injection scheduling. If nCountdown is greater than zero when a ** malloc attempt is made, it is decremented. If this means nCountdown ** transitions from 1 to 0, then the allocation fails. If bPersist is true ** when this happens, nCountdown is then incremented back to 1 (so that the ** next attempt fails too). */ |
︙ | ︙ | |||
179 180 181 182 183 184 185 | static void tmFree(TmGlobal *pTm, void *p){ if( p ){ TmBlockHdr *pHdr; u8 *pUser = (u8 *)p; tmEnterMutex(pTm); | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | static void tmFree(TmGlobal *pTm, void *p){ if( p ){ TmBlockHdr *pHdr; u8 *pUser = (u8 *)p; tmEnterMutex(pTm); pHdr = (TmBlockHdr *)(pUser - BLOCK_HDR_SIZE); assert( pHdr->iForeGuard==FOREGUARD ); assert( 0==memcmp(&pUser[pHdr->nByte], &rearguard, 4) ); if( pHdr->pPrev ){ assert( pHdr->pPrev->pNext==pHdr ); pHdr->pPrev->pNext = pHdr->pNext; }else{ |
︙ | ︙ | |||
214 215 216 217 218 219 220 | static void *tmRealloc(TmGlobal *pTm, void *p, int nByte){ void *pNew; pNew = tmMalloc(pTm, nByte); if( pNew && p ){ TmBlockHdr *pHdr; u8 *pUser = (u8 *)p; | | | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | static void *tmRealloc(TmGlobal *pTm, void *p, int nByte){ void *pNew; pNew = tmMalloc(pTm, nByte); if( pNew && p ){ TmBlockHdr *pHdr; u8 *pUser = (u8 *)p; pHdr = (TmBlockHdr *)(pUser - BLOCK_HDR_SIZE); memcpy(pNew, p, MIN(nByte, pHdr->nByte)); tmFree(pTm, p); } return pNew; } static void tmMallocOom( |
︙ | ︙ | |||
351 352 353 354 355 356 357 | pMutex->pEnv = pEnv; pEnv->xMutexStatic(pEnv, LSM_MUTEX_HEAP, &pMutex->pMutex); pGlobal->xEnterMutex = tmLsmMutexEnter; pGlobal->xLeaveMutex = tmLsmMutexLeave; pGlobal->xDelMutex = tmLsmMutexDel; pGlobal->pMutex = (void *)pMutex; | | | | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | pMutex->pEnv = pEnv; pEnv->xMutexStatic(pEnv, LSM_MUTEX_HEAP, &pMutex->pMutex); pGlobal->xEnterMutex = tmLsmMutexEnter; pGlobal->xLeaveMutex = tmLsmMutexLeave; pGlobal->xDelMutex = tmLsmMutexDel; pGlobal->pMutex = (void *)pMutex; pGlobal->xSaveMalloc = pEnv->xMalloc; pGlobal->xSaveRealloc = pEnv->xRealloc; pGlobal->xSaveFree = pEnv->xFree; /* Set up pEnv to the use the new TmGlobal */ pEnv->pMemCtx = (void *)pGlobal; pEnv->xMalloc = tmLsmEnvMalloc; pEnv->xRealloc = tmLsmEnvRealloc; pEnv->xFree = tmLsmEnvFree; } |
︙ | ︙ |
Changes to ext/lsm1/lsm-test/lsmtest_tdb.c.
︙ | ︙ | |||
763 764 765 766 767 768 769 | nLib++; } zSpec = &zLib[nLib]; while( *zSpec==' ' ) zSpec++; if( *zSpec=='\0' ) zSpec = 0; for(i=0; i<ArraySize(aLib); i++){ | > | | 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | nLib++; } zSpec = &zLib[nLib]; while( *zSpec==' ' ) zSpec++; if( *zSpec=='\0' ) zSpec = 0; for(i=0; i<ArraySize(aLib); i++){ if( (int)strlen(aLib[i].zName)==nLib && 0==memcmp(zLib, aLib[i].zName, nLib) ){ rc = aLib[i].xOpen(zSpec, (zDb ? zDb : aLib[i].zDefaultDb), bClear, ppDb); if( rc==0 ){ (*ppDb)->zLibrary = aLib[i].zName; } break; } } |
︙ | ︙ |
Changes to ext/lsm1/lsm-test/lsmtest_tdb3.c.
︙ | ︙ | |||
195 196 197 198 199 200 201 | lsm_env *pRealEnv = tdb_lsm_env(); LsmFile *p = (LsmFile *)pFile; LsmDb *pDb = p->pDb; if( pDb->bCrashed ) return LSM_IOERR; if( pDb->bPrepareCrash ){ | | | | | | | | | | | | | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | lsm_env *pRealEnv = tdb_lsm_env(); LsmFile *p = (LsmFile *)pFile; LsmDb *pDb = p->pDb; if( pDb->bCrashed ) return LSM_IOERR; if( pDb->bPrepareCrash ){ FileData *pData2 = &pDb->aFile[p->bLog]; int iFirst; int iLast; int iSector; iFirst = (int)(iOff / pDb->szSector); iLast = (int)((iOff + nData - 1) / pDb->szSector); if( pData2->nSector<(iLast+1) ){ int nNew = ( ((iLast + 1) + 63) / 64 ) * 64; assert( nNew>iLast ); pData2->aSector = (FileSector *)testRealloc( pData2->aSector, nNew*sizeof(FileSector) ); memset(&pData2->aSector[pData2->nSector], 0, (nNew - pData2->nSector) * sizeof(FileSector) ); pData2->nSector = nNew; } for(iSector=iFirst; iSector<=iLast; iSector++){ if( pData2->aSector[iSector].aOld==0 ){ u8 *aOld = (u8 *)testMalloc(pDb->szSector); pRealEnv->xRead( p->pReal, (lsm_i64)iSector*pDb->szSector, aOld, pDb->szSector ); pData2->aSector[iSector].aOld = aOld; } } } if( pDb->xWriteHook ){ int rc; int nUs; |
︙ | ︙ | |||
543 544 545 546 547 548 549 | static int waitOnWorker(LsmDb *pDb){ int rc; int nLimit = -1; int nSleep = 0; rc = lsm_config(pDb->db, LSM_CONFIG_AUTOFLUSH, &nLimit); do { | | | | | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | static int waitOnWorker(LsmDb *pDb){ int rc; int nLimit = -1; int nSleep = 0; rc = lsm_config(pDb->db, LSM_CONFIG_AUTOFLUSH, &nLimit); do { int nOld, nNew, rc2; rc2 = lsm_info(pDb->db, LSM_INFO_TREE_SIZE, &nOld, &nNew); if( rc2!=LSM_OK ) return rc2; if( nOld==0 || nNew<(nLimit/2) ) break; #ifdef LSM_MUTEX_PTHREADS mt_signal_worker(pDb, 0); #endif usleep(5000); nSleep += 5; }while( 1 ); |
︙ | ︙ | |||
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | testPrintError("syntax error at: \"%s\"\n", z); return 1; } int tdb_lsm_config_str(TestDb *pDb, const char *zStr){ int rc = 0; if( tdb_lsm(pDb) ){ int i; LsmDb *pLsm = (LsmDb *)pDb; rc = test_lsm_config_str(pLsm, pLsm->db, 0, zStr, 0); #ifdef LSM_MUTEX_PTHREADS for(i=0; rc==0 && i<pLsm->nWorker; i++){ rc = test_lsm_config_str(0, pLsm->aWorker[i].pWorker, 1, zStr, 0); } | > > | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | testPrintError("syntax error at: \"%s\"\n", z); return 1; } int tdb_lsm_config_str(TestDb *pDb, const char *zStr){ int rc = 0; if( tdb_lsm(pDb) ){ #ifdef LSM_MUTEX_PTHREADS int i; #endif LsmDb *pLsm = (LsmDb *)pDb; rc = test_lsm_config_str(pLsm, pLsm->db, 0, zStr, 0); #ifdef LSM_MUTEX_PTHREADS for(i=0; rc==0 && i<pLsm->nWorker; i++){ rc = test_lsm_config_str(0, pLsm->aWorker[i].pWorker, 1, zStr, 0); } |
︙ | ︙ |