Fix compiler warnings in LSM1, especially in the test logic.

FossilOrigin-Name: 9bd3be92b8add7bd0d7bc4b0742b2dd227ebb8d67a839b78f26f2b06b47490f2
This commit is contained in:
drh 2017-07-03 21:09:28 +00:00
parent 45408a108f
commit 518ee8f06f
7 changed files with 40 additions and 22 deletions

View File

@ -232,6 +232,12 @@ void testDatasourceFree(Datasource *);
void testDatasourceEntry(Datasource *, int, void **, int *, void **, int *);
/* End of test_datasource.c interface.
*************************************************************************/
void testDatasourceFetch(
TestDb *pDb, /* Database handle */
Datasource *pData,
int iKey,
int *pRc /* IN/OUT: Error code */
);
void testWriteDatasource(TestDb *, Datasource *, int, int *);
void testWriteDatasourceRange(TestDb *, Datasource *, int, int, int *);

View File

@ -242,6 +242,7 @@ static void testCompareCksumLsmdb(
}
}
#if 0 /* not used */
static void testCompareCksumBtdb(
const char *zFile, /* Path to LSM database */
const char *zExpect1, /* Expected checksum 1 */
@ -278,6 +279,7 @@ static void testCompareCksumBtdb(
}
}
}
#endif /* not used */
/* Above this point are reusable test routines. Not clear that they
** should really be in this file.
@ -484,4 +486,3 @@ void do_crash_test(const char *zPattern, int *pRc){
}
}
}

View File

@ -115,6 +115,7 @@ void testCommit(TestDb *pDb, int iTrans, int *pRc){
testSetError(rc);
}
}
#if 0 /* unused */
static void testRollback(TestDb *pDb, int iTrans, int *pRc){
if( *pRc==0 ){
int rc;
@ -122,6 +123,7 @@ static void testRollback(TestDb *pDb, int iTrans, int *pRc){
testSetError(rc);
}
}
#endif
void testWriteStr(
TestDb *pDb, /* Database handle */
@ -133,10 +135,11 @@ void testWriteStr(
testWrite(pDb, (void *)zKey, strlen(zKey), (void *)zVal, nVal, pRc);
}
#if 0 /* unused */
static void testDeleteStr(TestDb *pDb, const char *zKey, int *pRc){
testDelete(pDb, (void *)zKey, strlen(zKey), pRc);
}
#endif
void testFetchStr(
TestDb *pDb, /* Database handle */
const char *zKey, /* Key to query database for */
@ -343,6 +346,7 @@ void testReopen(TestDb **ppDb, int *pRc){
}
#if 0 /* unused */
static void testSystemSelect(const char *zSys, int *piSel, int *pRc){
if( *pRc==0 ){
struct SysName { const char *zName; } *aName;
@ -359,6 +363,7 @@ static void testSystemSelect(const char *zSys, int *piSel, int *pRc){
free(aName);
}
}
#endif
char *testMallocVPrintf(const char *zFormat, va_list ap){
int nByte;
@ -541,6 +546,7 @@ static void flushPrev(FILE *pOut){
}
}
#if 0 /* unused */
static void do_speed_write_hook2(
void *pCtx,
int bLog,
@ -565,6 +571,7 @@ static void do_speed_write_hook2(
}
}
}
#endif
#define ST_REPEAT 0
#define ST_WRITE 1
@ -662,7 +669,6 @@ int do_speed_test2(int nArg, char **azArg){
if( aOpt[iSel].eVal>=0 ){
aParam[aOpt[iSel].eVal] = atoi(azArg[i+1]);
}else{
int j;
zSystem = azArg[i+1];
bLsm = 0;
#if 0

View File

@ -326,13 +326,13 @@ static void *tmLsmMalloc(int n){ return malloc(n); }
static void tmLsmFree(void *ptr){ free(ptr); }
static void *tmLsmRealloc(void *ptr, int n){ return realloc(ptr, n); }
static void *tmLsmEnvMalloc(lsm_env *p, int n){
static void *tmLsmEnvMalloc(lsm_env *p, size_t n){
return tmMalloc((TmGlobal *)(p->pMemCtx), n);
}
static void tmLsmEnvFree(lsm_env *p, void *ptr){
tmFree((TmGlobal *)(p->pMemCtx), ptr);
}
static void *tmLsmEnvRealloc(lsm_env *p, void *ptr, int n){
static void *tmLsmEnvRealloc(lsm_env *p, void *ptr, size_t n){
return tmRealloc((TmGlobal *)(p->pMemCtx), ptr, n);
}
@ -370,9 +370,9 @@ void testMallocUninstall(lsm_env *pEnv){
TmGlobal *p = (TmGlobal *)pEnv->pMemCtx;
pEnv->pMemCtx = 0;
if( p ){
pEnv->xMalloc = (void *(*)(lsm_env*, int))(p->xSaveMalloc);
pEnv->xRealloc = (void *(*)(lsm_env*, void*, int))(p->xSaveRealloc);
pEnv->xFree = (void (*)(lsm_env*, void*))(p->xSaveFree);
pEnv->xMalloc = p->xSaveMalloc;
pEnv->xRealloc = p->xSaveRealloc;
pEnv->xFree = p->xSaveFree;
p->xDelMutex(p);
tmLsmFree(p);
}

View File

@ -459,7 +459,10 @@ static int lsm1Column(
if( aVal[0]==SQLITE_INTEGER ){
sqlite3_result_int64(ctx, *(sqlite3_int64*)&x);
}else{
sqlite3_result_double(ctx, *(double*)&x);
double r;
assert( sizeof(r)==sizeof(x) );
memcpy(&r, &x, sizeof(r));
sqlite3_result_double(ctx, r);
}
break;
}
@ -666,7 +669,9 @@ int lsm1Update(
if( eType==SQLITE_INTEGER ){
*(sqlite3_int64*)&x = sqlite3_value_int64(pValue);
}else{
*(double*)&x = sqlite3_value_double(pValue);
double r = sqlite3_value_double(pValue);
assert( sizeof(r)==sizeof(x) );
memcpy(&x, &r, sizeof(r));
}
for(i=8; x>0 && i>=1; i--){
aVal[i] = x & 0xff;

View File

@ -1,5 +1,5 @@
C Fix\sa\sbug\sin\slsm\squeries\son\slevels\sundergoing\sincremental\san\smerge\sthat\ncontain\srange-delete\smarkers.
D 2017-07-03T20:19:28.955
C Fix\scompiler\swarnings\sin\sLSM1,\sespecially\sin\sthe\stest\slogic.
D 2017-07-03T21:09:28.601
F Makefile.in 081e48dfe7f995d57ce1a88ddf4d2917b4349158648a6cd45b42beae30de3a12
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 4ebb1d257cac7fb1bcb4ba59278416d410ff1c4bf59447a9c37a415f3516056a
@ -212,9 +212,9 @@ F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
F ext/lsm1/Makefile a2ea4975162be8932b5efa727080f4982715d34c32035d9eb7a015ae78404981
F ext/lsm1/Makefile.msc c8140509750fb207f0e984991bc426e91a11adb2f6434f218c52103b9d33a8e1
F ext/lsm1/lsm-test/README 87ea529d2abe615e856d4714bfe8bb185e6c2771b8612aa6298588b7b43e6f86
F ext/lsm1/lsm-test/lsmtest.h ba9c3cdd4dee660f14de8fe0a5b8c36d72bb5524730f0ce7641aa08f0ef56da5
F ext/lsm1/lsm-test/lsmtest.h 346295688c4b304689950f10e4dcd4640321f3c860112b72cb0691ca075b6a71
F ext/lsm1/lsm-test/lsmtest1.c 2570b0e21e854d3d079dc04a535ce58abe50ed512da23117ab95b01fecdb90a0
F ext/lsm1/lsm-test/lsmtest2.c 385efd49f3411bb2c8e0f9ffbd4f87450d5ac368aeee62d509d2c0ce10e4215b
F ext/lsm1/lsm-test/lsmtest2.c 188b09aec776516aeedcfd13b9c6faf85ba16b3671a0897a2c740ee00a5dc4f8
F ext/lsm1/lsm-test/lsmtest3.c 9ab87528a36dbf4a61d7c8ad954f5ee368c0878c127b84b942b2e2abe522de26
F ext/lsm1/lsm-test/lsmtest4.c d258d6a245db5d8eaede096e2368d23f859c5e92c80ab9122463f708514fe10c
F ext/lsm1/lsm-test/lsmtest5.c 8d5242a0f870d65eeada191c8945781fed9cb8ece3886573790ebd373b62dac5
@ -226,8 +226,8 @@ F ext/lsm1/lsm-test/lsmtest_bt.c d70d9a9be5eef9360af1251dd083948d74fd30137a08f61
F ext/lsm1/lsm-test/lsmtest_datasource.c 5d770be191d0ca51315926723009b2c25c0b4b8136840494ef710ac324aa916c
F ext/lsm1/lsm-test/lsmtest_func.c 159aa401bc8032bfa3d8cf2977bd687abebab880255895a5eb45770d626fa38d
F ext/lsm1/lsm-test/lsmtest_io.c ba678e052f497b4c2ff41d47672a1f2a02f495d14083845ee66e0bda678f5b80
F ext/lsm1/lsm-test/lsmtest_main.c ea24e68f0295753f42723ce0fa1606993b2109f2b21feb24a0696b42160708f5
F ext/lsm1/lsm-test/lsmtest_mem.c 996b1e76cc876e8d765182a2f14159b1acbf56cbf86d286173e13e970b79a945
F ext/lsm1/lsm-test/lsmtest_main.c f1d18e3a3e9315ec4198901a11c9d2ec6cb96d1a40089fd60b6a64e0b6b8db35
F ext/lsm1/lsm-test/lsmtest_mem.c c2980abdbc5024628d10910acb703354f2606b4a6f9624679da4e9a56bcee3e9
F ext/lsm1/lsm-test/lsmtest_tdb.c e46c3f44880d45fd444daf2b2a53bca7a64f9df3f6480cbb1b47a039cc95626a
F ext/lsm1/lsm-test/lsmtest_tdb.h 85d6a5f30f6264e1d0b2062f23d03adcf2d04460ddbfe40d35e7270be9b50a30
F ext/lsm1/lsm-test/lsmtest_tdb2.cc 99ea7f2dd9c7536c8fb9bdd329e4cfeb76899f3ddf6f48bdd3926e016922b715
@ -249,7 +249,7 @@ F ext/lsm1/lsm_str.c 77ebdd5040ddf267a6f724d4c83132d2dce8a226
F ext/lsm1/lsm_tree.c 5d9fb2bc58a1a70c75126bd8d7198f7b627e165b
F ext/lsm1/lsm_unix.c 57361bcf5b1a1a028f5d66571ee490e9064d2cfb145a2cc9e5ddade467bb551b
F ext/lsm1/lsm_varint.c b19ae9bd26b5a1e8402fb8a564b25d9542338a41
F ext/lsm1/lsm_vtab.c fff303ce03168eca9e333add3c1429b3471674b0
F ext/lsm1/lsm_vtab.c 812b74a9a7539e8cab49761591ffddc1b3580735fac5d638826c8d2be95ff38b
F ext/lsm1/lsm_win32.c 69eb9fd25197432b084037efd69b365d8182ab1e4372a9c45a9c47e542105c5c
F ext/misc/README.md 8e008c8d2b02e09096b31dfba033253ac27c6c06a18aa5826e299fa7601d90b2
F ext/misc/amatch.c 6db4607cb17c54b853a2d7c7c36046d004853f65b9b733e6f019d543d5dfae87
@ -1628,7 +1628,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 9111ac69bf307997e590bc9459222661fc79f549b3c493168a654a5046e6e4ad
R 17216989ed0c1efa9e59126318b86d4a
U dan
Z d89f155c1b113ffdce094dbb498ae299
P b2c2487928becbea5a932895d153709c98a057a3c71c2600e165478562e9f7c5
R bcb7ebe8efca15287f517b1401472d17
U drh
Z 118d9f2944646b21169b67bb250f000b

View File

@ -1 +1 @@
b2c2487928becbea5a932895d153709c98a057a3c71c2600e165478562e9f7c5
9bd3be92b8add7bd0d7bc4b0742b2dd227ebb8d67a839b78f26f2b06b47490f2