Fix compiler warnings.

FossilOrigin-Name: e9955c0e14d13ba1411f013acb4979958dae2516
This commit is contained in:
drh 2014-12-05 00:32:09 +00:00
parent 5de7d966bd
commit 2c3abeb8c3
4 changed files with 20 additions and 17 deletions

View File

@ -21,11 +21,11 @@ SQLITE_EXTENSION_INIT1
** Structure used to accumulate the output
*/
struct EvalResult {
char *z; /* Accumulated output */
const char *zSep; /* Separator */
int szSep; /* Size of the separator string */
int nAlloc; /* Number of bytes allocated for z[] */
int nUsed; /* Number of bytes of z[] actually used */
char *z; /* Accumulated output */
const char *zSep; /* Separator */
int szSep; /* Size of the separator string */
sqlite3_int64 nAlloc; /* Number of bytes allocated for z[] */
sqlite3_int64 nUsed; /* Number of bytes of z[] actually used */
};
/*
@ -37,10 +37,13 @@ static int callback(void *pCtx, int argc, char **argv, char **colnames){
for(i=0; i<argc; i++){
const char *z = argv[i] ? argv[i] : "";
size_t sz = strlen(z);
if( sz+p->nUsed+p->szSep+1 > p->nAlloc ){
if( (sqlite3_int64)sz+p->nUsed+p->szSep+1 > p->nAlloc ){
char *zNew;
p->nAlloc = p->nAlloc*2 + sz + p->szSep + 1;
zNew = sqlite3_realloc(p->z, p->nAlloc);
/* Using sqlite3_realloc64() would be better, but it is a recent
** addition and will cause a segfault if loaded by an older version
** of SQLite. */
zNew = p->nAlloc<=0x7fffffff ? sqlite3_realloc(p->z, (int)p->nAlloc) : 0;
if( zNew==0 ){
sqlite3_free(p->z);
memset(p, 0, sizeof(*p));
@ -93,7 +96,7 @@ static void sqlEvalFunc(
sqlite3_result_error_nomem(context);
sqlite3_free(x.z);
}else{
sqlite3_result_text(context, x.z, x.nUsed, sqlite3_free);
sqlite3_result_text(context, x.z, (int)x.nUsed, sqlite3_free);
}
}

View File

@ -1,5 +1,5 @@
C Fix\sthe\sautoconf\sand\sMSVC\smakefiles,\swhich\shave\sbeen\sbroken\sfor\snearly\sa\nmonth.\s\s:-(
D 2014-12-05T00:17:39.977
C Fix\scompiler\swarnings.
D 2014-12-05T00:32:09.905
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -109,7 +109,7 @@ F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
F ext/misc/amatch.c 678056a4bfcd83c4e82dea81d37543cd1d6dbee1
F ext/misc/closure.c 636024302cde41b2bf0c542f81c40c624cfb7012
F ext/misc/compress.c 76e45655f4046e756064ab10c62e18f2eb846b9f
F ext/misc/eval.c 04e630bde869aa1fec6b993d40591f963be2f868
F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
F ext/misc/fuzzer.c 136533c53cfce0957f0b48fa11dba27e21c5c01d
F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e
@ -238,7 +238,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 81712116e826b0089bb221b018929536b2b5406f
F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc
F src/tclsqlite.c 0a874655dd39a9875e39c5d3c464db662171d228
F src/test1.c f5d7ecd3dd663b11f35269fd91f7090db0570903
F src/test1.c c24d7f67252348d756773a6dbe23a61b4552f709
F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712
F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c
F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df
@ -1223,7 +1223,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 0d3aef97ebddf422b8bdcbc5878970c6129e3f54
R cd249245e23c4920ae8ada9787d27cef
P 520c2b838da8b230487c8c66f3ba8e5daa1ca886
R 2f1363efb358b758f4fe53b98d762c1d
U drh
Z 911d29bfeef3460d645482250c6ca2bc
Z 8ac94f0b609313b69c75d4df8f71997e

View File

@ -1 +1 @@
520c2b838da8b230487c8c66f3ba8e5daa1ca886
e9955c0e14d13ba1411f013acb4979958dae2516

View File

@ -3661,7 +3661,7 @@ static int test_prepare_v2(
zCopy = malloc(bytes);
memcpy(zCopy, zSql, bytes);
}else{
int n = strlen(zSql) + 1;
int n = (int)strlen(zSql) + 1;
zCopy = malloc(n);
memcpy(zCopy, zSql, n);
}