Index: ext/lsm1/Makefile.msc ================================================================== --- ext/lsm1/Makefile.msc +++ ext/lsm1/Makefile.msc @@ -39,11 +39,11 @@ $(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 = -DLSM_MUTEX_WIN32=1 -I$(LSMDIR) +LSMOPTS = $(NO_WARN) -DLSM_MUTEX_WIN32=1 -I$(LSMDIR) !IF $(DEBUG)>2 LSMOPTS = $(LSMOPTS) -DLSM_DEBUG=1 !ENDIF Index: ext/lsm1/lsm-test/lsmtest6.c ================================================================== --- ext/lsm1/lsm-test/lsmtest6.c +++ ext/lsm1/lsm-test/lsmtest6.c @@ -198,11 +198,11 @@ ){ if( *pRc==0 ){ int rc; int iScan = 0; lsm_cursor *pCsr; - int (*xAdvance)(lsm_cursor *); + int (*xAdvance)(lsm_cursor *) = 0; rc = lsm_csr_open(pDb, &pCsr); testOomAssertRc(pOom, rc); @@ -351,11 +351,11 @@ int nKey = strlen(zKey); int nVal = strlen(zVal); return lsm_insert(pDb, (void *)zKey, nKey, (void *)zVal, nVal); } -static void setup_delete_db(){ +static void setup_delete_db(void){ testDeleteLsmdb(LSMTEST6_TESTDB); } /* ** Create a small database. With the following content: @@ -367,11 +367,11 @@ ** "five" -> "twentyfive" ** "six" -> "thirtysix" ** "seven" -> "fourtynine" ** "eight" -> "sixtyfour" */ -static void setup_populate_db(){ +static void setup_populate_db(void){ const char *azStr[] = { "one", "one", "two", "four", "three", "nine", "four", "sixteen", @@ -409,11 +409,11 @@ ** * 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(){ +static void setup_populate_db2(void){ Datasource *pData; int ii; int rc; int nBlocksize = 64*1024; int nPagesize = 1024; Index: ext/lsm1/lsm-test/lsmtest8.c ================================================================== --- ext/lsm1/lsm-test/lsmtest8.c +++ ext/lsm1/lsm-test/lsmtest8.c @@ -90,11 +90,12 @@ *pRc = 1; }else{ if( 0!=fseek(fd, iOff, SEEK_SET) ){ *pRc = 1; }else{ - if( nByte!=fread(pOut, 1, nByte, fd) ){ + assert( nByte>=0 ); + if( (size_t)nByte!=fread(pOut, 1, nByte, fd) ){ *pRc = 1; } } fclose(fd); } @@ -115,11 +116,12 @@ *pRc = 1; }else{ if( 0!=fseek(fd, iOff, SEEK_SET) ){ *pRc = 1; }else{ - if( nByte!=fwrite(pOut, 1, nByte, fd) ){ + assert( nByte>=0 ); + if( (size_t)nByte!=fwrite(pOut, 1, nByte, fd) ){ *pRc = 1; } } fclose(fd); } Index: ext/lsm1/lsm-test/lsmtest_io.c ================================================================== --- ext/lsm1/lsm-test/lsmtest_io.c +++ ext/lsm1/lsm-test/lsmtest_io.c @@ -145,19 +145,19 @@ int nByte = 0; int rc = 0; int nPg; int iPg; - nByte = getNextSize(z, &z, &rc); + 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, iOff, SEEK_SET); + lseek(pCtx->fd, (off_t)iOff, SEEK_SET); for(iPg=0; iPgfd, aData, pgsz); } pCtx->nWrite += nByte/1024; @@ -209,11 +209,11 @@ return -1; } zFile = azArg[0]; zPgsz = azArg[1]; - pgsz = getNextSize(zPgsz, 0, &rc); + pgsz = (int)getNextSize(zPgsz, 0, &rc); if( pgsz<=0 ){ testPrintError("Ridiculous page size: %d", pgsz); return -1; } aData = malloc(pgsz); Index: ext/lsm1/lsm-test/lsmtest_main.c ================================================================== --- ext/lsm1/lsm-test/lsmtest_main.c +++ ext/lsm1/lsm-test/lsmtest_main.c @@ -900,11 +900,11 @@ #endif testTimeInit(); for(i=0; iiForeGuard==FOREGUARD ); assert( 0==memcmp(&pUser[pHdr->nByte], &rearguard, 4) ); if( pHdr->pPrev ){ assert( pHdr->pPrev->pNext==pHdr ); @@ -216,11 +216,11 @@ pNew = tmMalloc(pTm, nByte); if( pNew && p ){ TmBlockHdr *pHdr; u8 *pUser = (u8 *)p; - pHdr = (TmBlockHdr *)&pUser[BLOCK_HDR_SIZE * -1]; + pHdr = (TmBlockHdr *)(pUser - BLOCK_HDR_SIZE); memcpy(pNew, p, MIN(nByte, pHdr->nByte)); tmFree(pTm, p); } return pNew; } @@ -353,13 +353,13 @@ pGlobal->xEnterMutex = tmLsmMutexEnter; pGlobal->xLeaveMutex = tmLsmMutexLeave; pGlobal->xDelMutex = tmLsmMutexDel; pGlobal->pMutex = (void *)pMutex; - pGlobal->xSaveMalloc = (void *)pEnv->xMalloc; - pGlobal->xSaveRealloc = (void *)pEnv->xRealloc; - pGlobal->xSaveFree = (void *)pEnv->xFree; + 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; Index: ext/lsm1/lsm-test/lsmtest_tdb.c ================================================================== --- ext/lsm1/lsm-test/lsmtest_tdb.c +++ ext/lsm1/lsm-test/lsmtest_tdb.c @@ -765,11 +765,12 @@ zSpec = &zLib[nLib]; while( *zSpec==' ' ) zSpec++; if( *zSpec=='\0' ) zSpec = 0; for(i=0; izLibrary = aLib[i].zName; } break; Index: ext/lsm1/lsm-test/lsmtest_tdb3.c ================================================================== --- ext/lsm1/lsm-test/lsmtest_tdb3.c +++ ext/lsm1/lsm-test/lsmtest_tdb3.c @@ -197,37 +197,37 @@ LsmDb *pDb = p->pDb; if( pDb->bCrashed ) return LSM_IOERR; if( pDb->bPrepareCrash ){ - FileData *pData = &pDb->aFile[p->bLog]; + FileData *pData2 = &pDb->aFile[p->bLog]; int iFirst; int iLast; int iSector; - iFirst = (iOff / pDb->szSector); - iLast = ((iOff + nData - 1) / pDb->szSector); + iFirst = (int)(iOff / pDb->szSector); + iLast = (int)((iOff + nData - 1) / pDb->szSector); - if( pData->nSector<(iLast+1) ){ + if( pData2->nSector<(iLast+1) ){ int nNew = ( ((iLast + 1) + 63) / 64 ) * 64; assert( nNew>iLast ); - pData->aSector = (FileSector *)testRealloc( - pData->aSector, nNew*sizeof(FileSector) + pData2->aSector = (FileSector *)testRealloc( + pData2->aSector, nNew*sizeof(FileSector) ); - memset(&pData->aSector[pData->nSector], - 0, (nNew - pData->nSector) * sizeof(FileSector) + memset(&pData2->aSector[pData2->nSector], + 0, (nNew - pData2->nSector) * sizeof(FileSector) ); - pData->nSector = nNew; + pData2->nSector = nNew; } for(iSector=iFirst; iSector<=iLast; iSector++){ - if( pData->aSector[iSector].aOld==0 ){ + if( pData2->aSector[iSector].aOld==0 ){ u8 *aOld = (u8 *)testMalloc(pDb->szSector); pRealEnv->xRead( p->pReal, (lsm_i64)iSector*pDb->szSector, aOld, pDb->szSector ); - pData->aSector[iSector].aOld = aOld; + pData2->aSector[iSector].aOld = aOld; } } } if( pDb->xWriteHook ){ @@ -545,13 +545,13 @@ int nLimit = -1; int nSleep = 0; rc = lsm_config(pDb->db, LSM_CONFIG_AUTOFLUSH, &nLimit); do { - int nOld, nNew, rc; - rc = lsm_info(pDb->db, LSM_INFO_TREE_SIZE, &nOld, &nNew); - if( rc!=LSM_OK ) return rc; + 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); @@ -886,11 +886,13 @@ } 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 && inWorker; i++){