aboutsummaryrefslogtreecommitdiff
path: root/ext/rbu/sqlite3rbu.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/rbu/sqlite3rbu.c')
-rw-r--r--ext/rbu/sqlite3rbu.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/ext/rbu/sqlite3rbu.c b/ext/rbu/sqlite3rbu.c
index 4c38e14c9..145b446d3 100644
--- a/ext/rbu/sqlite3rbu.c
+++ b/ext/rbu/sqlite3rbu.c
@@ -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{