1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix harmless compiler warnings in RBU and add RBU to the autoconf and windows

makefiles.

FossilOrigin-Name: fabe78c5d8ab353988f6fe0decacd651edc17ec2
This commit is contained in:
drh
2016-01-14 13:22:24 +00:00
parent 62e63bb9a9
commit 7647377f52
6 changed files with 50 additions and 34 deletions

View File

@ -75,7 +75,7 @@ int main(int argc, char **argv){
/* Process command line arguments. Following this block local variables
** zTarget, zRbu and nStep are all set. */
if( argc==5 ){
int nArg1 = strlen(argv[1]);
size_t nArg1 = strlen(argv[1]);
if( nArg1>5 || nArg1<2 || memcmp("-step", argv[1], nArg1) ) usage(argv[0]);
nStep = atoi(argv[2]);
}else if( argc!=3 ){
@ -103,7 +103,7 @@ int main(int argc, char **argv){
"SQLITE_OK: rbu update incomplete (%lld operations so far)\n",
nProgress
);
fprintf(stdout, zBuf);
fprintf(stdout, "%s", zBuf);
break;
case SQLITE_DONE:
@ -111,7 +111,7 @@ int main(int argc, char **argv){
"SQLITE_DONE: rbu update completed (%lld operations)\n",
nProgress
);
fprintf(stdout, zBuf);
fprintf(stdout, "%s", zBuf);
break;
default:
@ -122,4 +122,3 @@ int main(int argc, char **argv){
sqlite3_free(zErrmsg);
return (rc==SQLITE_OK || rc==SQLITE_DONE) ? 0 : 1;
}

View File

@ -935,7 +935,7 @@ static void *rbuMalloc(sqlite3rbu *p, int nByte){
void *pRet = 0;
if( p->rc==SQLITE_OK ){
assert( nByte>0 );
pRet = sqlite3_malloc(nByte);
pRet = sqlite3_malloc64(nByte);
if( pRet==0 ){
p->rc = SQLITE_NOMEM;
}else{
@ -981,8 +981,8 @@ static char *rbuStrndup(const char *zStr, int *pRc){
assert( *pRc==SQLITE_OK );
if( zStr ){
int nCopy = strlen(zStr) + 1;
zRet = (char*)sqlite3_malloc(nCopy);
size_t nCopy = strlen(zStr) + 1;
zRet = (char*)sqlite3_malloc64(nCopy);
if( zRet ){
memcpy(zRet, zStr, nCopy);
}else{
@ -2330,7 +2330,7 @@ static int rbuCaptureWalRead(sqlite3rbu *pRbu, i64 iOff, int iAmt){
if( pRbu->nFrame==pRbu->nFrameAlloc ){
int nNew = (pRbu->nFrameAlloc ? pRbu->nFrameAlloc : 64) * 2;
RbuFrame *aNew;
aNew = (RbuFrame*)sqlite3_realloc(pRbu->aFrame, nNew * sizeof(RbuFrame));
aNew = (RbuFrame*)sqlite3_realloc64(pRbu->aFrame, nNew * sizeof(RbuFrame));
if( aNew==0 ) return SQLITE_NOMEM;
pRbu->aFrame = aNew;
pRbu->nFrameAlloc = nNew;
@ -2395,7 +2395,7 @@ static LPWSTR rbuWinUtf8ToUnicode(const char *zFilename){
if( nChar==0 ){
return 0;
}
zWideFilename = sqlite3_malloc( nChar*sizeof(zWideFilename[0]) );
zWideFilename = sqlite3_malloc64( nChar*sizeof(zWideFilename[0]) );
if( zWideFilename==0 ){
return 0;
}
@ -3029,11 +3029,12 @@ sqlite3rbu *sqlite3rbu_open(
const char *zState
){
sqlite3rbu *p;
int nTarget = strlen(zTarget);
int nRbu = strlen(zRbu);
int nState = zState ? strlen(zState) : 0;
size_t nTarget = strlen(zTarget);
size_t nRbu = strlen(zRbu);
size_t nState = zState ? strlen(zState) : 0;
size_t nByte = sizeof(sqlite3rbu) + nTarget+1 + nRbu+1+ nState+1;
p = (sqlite3rbu*)sqlite3_malloc(sizeof(sqlite3rbu)+nTarget+1+nRbu+1+nState+1);
p = (sqlite3rbu*)sqlite3_malloc64(nByte);
if( p ){
RbuState *pState = 0;
@ -3170,7 +3171,7 @@ sqlite3 *sqlite3rbu_db(sqlite3rbu *pRbu, int bRbu){
static void rbuEditErrmsg(sqlite3rbu *p){
if( p->rc==SQLITE_CONSTRAINT && p->zErrmsg ){
int i;
int nErrmsg = strlen(p->zErrmsg);
size_t nErrmsg = strlen(p->zErrmsg);
for(i=0; i<(nErrmsg-8); i++){
if( memcmp(&p->zErrmsg[i], "rbu_imp_", 8)==0 ){
int nDel = 8;
@ -3634,7 +3635,7 @@ static int rbuVfsShmMap(
if( eStage==RBU_STAGE_OAL || eStage==RBU_STAGE_MOVE ){
if( iRegion<=p->nShm ){
int nByte = (iRegion+1) * sizeof(char*);
char **apNew = (char**)sqlite3_realloc(p->apShm, nByte);
char **apNew = (char**)sqlite3_realloc64(p->apShm, nByte);
if( apNew==0 ){
rc = SQLITE_NOMEM;
}else{
@ -3645,7 +3646,7 @@ static int rbuVfsShmMap(
}
if( rc==SQLITE_OK && p->apShm[iRegion]==0 ){
char *pNew = (char*)sqlite3_malloc(szRegion);
char *pNew = (char*)sqlite3_malloc64(szRegion);
if( pNew==0 ){
rc = SQLITE_NOMEM;
}else{
@ -3755,7 +3756,7 @@ static int rbuVfsOpen(
** the name of the *-wal file this db connection will use. SQLite
** happens to pass a pointer to this buffer when using xAccess()
** or xOpen() to operate on the *-wal file. */
int n = strlen(zName);
int n = (int)strlen(zName);
const char *z = &zName[n];
if( flags & SQLITE_OPEN_URI ){
int odd = 0;
@ -3781,8 +3782,8 @@ static int rbuVfsOpen(
** code ensures that the string passed to xOpen() is terminated by a
** pair of '\0' bytes in case the VFS attempts to extract a URI
** parameter from it. */
int nCopy = strlen(zName);
char *zCopy = sqlite3_malloc(nCopy+2);
size_t nCopy = strlen(zName);
char *zCopy = sqlite3_malloc64(nCopy+2);
if( zCopy ){
memcpy(zCopy, zName, nCopy);
zCopy[nCopy-3] = 'o';
@ -4011,13 +4012,13 @@ int sqlite3rbu_create_vfs(const char *zName, const char *zParent){
};
rbu_vfs *pNew = 0; /* Newly allocated VFS */
int nName;
int rc = SQLITE_OK;
size_t nName;
size_t nByte;
int nByte;
nName = strlen(zName);
nByte = sizeof(rbu_vfs) + nName + 1;
pNew = (rbu_vfs*)sqlite3_malloc(nByte);
pNew = (rbu_vfs*)sqlite3_malloc64(nByte);
if( pNew==0 ){
rc = SQLITE_NOMEM;
}else{