Skip to content

Commit

Permalink
Fixes for harmless compiler warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
D. Richard Hipp committed Apr 13, 2019
1 parent 1db2980 commit e519f24
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 34 deletions.
6 changes: 3 additions & 3 deletions ext/fts3/fts3_snippet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,8 +1000,8 @@ static int fts3MatchinfoCheck(
return SQLITE_ERROR;
}

static int fts3MatchinfoSize(MatchInfo *pInfo, char cArg){
int nVal; /* Number of integers output by cArg */
static size_t fts3MatchinfoSize(MatchInfo *pInfo, char cArg){
size_t nVal; /* Number of integers output by cArg */

switch( cArg ){
case FTS3_MATCHINFO_NDOC:
Expand Down Expand Up @@ -1285,7 +1285,7 @@ static int fts3MatchinfoValues(

case FTS3_MATCHINFO_LHITS_BM:
case FTS3_MATCHINFO_LHITS: {
int nZero = fts3MatchinfoSize(pInfo, zArg[i]) * sizeof(u32);
size_t nZero = fts3MatchinfoSize(pInfo, zArg[i]) * sizeof(u32);
memset(pInfo->aMatchinfo, 0, nZero);
rc = fts3ExprLHitGather(pCsr->pExpr, pInfo);
break;
Expand Down
2 changes: 1 addition & 1 deletion ext/fts5/fts5_index.c
Original file line number Diff line number Diff line change
Expand Up @@ -3691,7 +3691,7 @@ static int fts5WriteDlidxGrow(
if( aDlidx==0 ){
p->rc = SQLITE_NOMEM;
}else{
int nByte = sizeof(Fts5DlidxWriter) * (nLvl - pWriter->nDlidx);
size_t nByte = sizeof(Fts5DlidxWriter) * (nLvl - pWriter->nDlidx);
memset(&aDlidx[pWriter->nDlidx], 0, nByte);
pWriter->aDlidx = aDlidx;
pWriter->nDlidx = nLvl;
Expand Down
20 changes: 10 additions & 10 deletions ext/fts5/fts5_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2468,14 +2468,14 @@ static int fts5CreateAux(
int rc = sqlite3_overload_function(pGlobal->db, zName, -1);
if( rc==SQLITE_OK ){
Fts5Auxiliary *pAux;
int nName; /* Size of zName in bytes, including \0 */
int nByte; /* Bytes of space to allocate */
sqlite3_int64 nName; /* Size of zName in bytes, including \0 */
sqlite3_int64 nByte; /* Bytes of space to allocate */

nName = (int)strlen(zName) + 1;
nName = strlen(zName) + 1;
nByte = sizeof(Fts5Auxiliary) + nName;
pAux = (Fts5Auxiliary*)sqlite3_malloc(nByte);
pAux = (Fts5Auxiliary*)sqlite3_malloc64(nByte);
if( pAux ){
memset(pAux, 0, nByte);
memset(pAux, 0, (size_t)nByte);
pAux->zFunc = (char*)&pAux[1];
memcpy(pAux->zFunc, zName, nName);
pAux->pGlobal = pGlobal;
Expand Down Expand Up @@ -2505,15 +2505,15 @@ static int fts5CreateTokenizer(
){
Fts5Global *pGlobal = (Fts5Global*)pApi;
Fts5TokenizerModule *pNew;
int nName; /* Size of zName and its \0 terminator */
int nByte; /* Bytes of space to allocate */
sqlite3_int64 nName; /* Size of zName and its \0 terminator */
sqlite3_int64 nByte; /* Bytes of space to allocate */
int rc = SQLITE_OK;

nName = (int)strlen(zName) + 1;
nName = strlen(zName) + 1;
nByte = sizeof(Fts5TokenizerModule) + nName;
pNew = (Fts5TokenizerModule*)sqlite3_malloc(nByte);
pNew = (Fts5TokenizerModule*)sqlite3_malloc64(nByte);
if( pNew ){
memset(pNew, 0, nByte);
memset(pNew, 0, (size_t)nByte);
pNew->zName = (char*)&pNew[1];
memcpy(pNew->zName, zName, nName);
pNew->pUserData = pUserData;
Expand Down
8 changes: 4 additions & 4 deletions ext/rbu/sqlite3rbu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ static int rbuMPrintfExec(sqlite3rbu *p, sqlite3 *db, const char *zFmt, ...){
** immediately without attempting the allocation or modifying the stored
** error code.
*/
static void *rbuMalloc(sqlite3rbu *p, int nByte){
static void *rbuMalloc(sqlite3rbu *p, sqlite3_int64 nByte){
void *pRet = 0;
if( p->rc==SQLITE_OK ){
assert( nByte>0 );
Expand All @@ -1061,7 +1061,7 @@ static void *rbuMalloc(sqlite3rbu *p, int nByte){
** error code in the RBU handle passed as the first argument.
*/
static void rbuAllocateIterArrays(sqlite3rbu *p, RbuObjIter *pIter, int nCol){
int nByte = (2*sizeof(char*) + sizeof(int) + 3*sizeof(u8)) * nCol;
sqlite3_int64 nByte = (2*sizeof(char*) + sizeof(int) + 3*sizeof(u8)) * nCol;
char **azNew;

azNew = (char**)rbuMalloc(p, nByte);
Expand Down Expand Up @@ -1705,7 +1705,7 @@ static char *rbuObjIterGetSetlist(
*/
static char *rbuObjIterGetBindlist(sqlite3rbu *p, int nBind){
char *zRet = 0;
int nByte = nBind*2 + 1;
sqlite3_int64 nByte = 2*(sqlite3_int64)nBind + 1;

zRet = (char*)rbuMalloc(p, nByte);
if( zRet ){
Expand Down Expand Up @@ -4561,7 +4561,7 @@ static int rbuVfsShmMap(
assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );
if( eStage==RBU_STAGE_OAL || eStage==RBU_STAGE_MOVE ){
if( iRegion<=p->nShm ){
int nByte = (iRegion+1) * sizeof(char*);
sqlite3_int64 nByte = (iRegion+1) * sizeof(char*);
char **apNew = (char**)sqlite3_realloc64(p->apShm, nByte);
if( apNew==0 ){
rc = SQLITE_NOMEM;
Expand Down
8 changes: 4 additions & 4 deletions ext/session/sqlite3session.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ static int sessionGrowHash(int bPatchset, SessionTable *pTab){
if( pTab->nChange==0 || pTab->nEntry>=(pTab->nChange/2) ){
int i;
SessionChange **apNew;
int nNew = (pTab->nChange ? pTab->nChange : 128) * 2;
sqlite3_int64 nNew = 2*(sqlite3_int64)(pTab->nChange ? pTab->nChange : 128);

apNew = (SessionChange **)sqlite3_malloc64(sizeof(SessionChange *) * nNew);
if( apNew==0 ){
Expand Down Expand Up @@ -1829,7 +1829,7 @@ int sqlite3session_attach(
** If successful, return zero. Otherwise, if an OOM condition is encountered,
** set *pRc to SQLITE_NOMEM and return non-zero.
*/
static int sessionBufferGrow(SessionBuffer *p, int nByte, int *pRc){
static int sessionBufferGrow(SessionBuffer *p, size_t nByte, int *pRc){
if( *pRc==SQLITE_OK && p->nAlloc-p->nBuf<nByte ){
u8 *aNew;
i64 nNew = p->nAlloc ? p->nAlloc : 128;
Expand Down Expand Up @@ -2947,7 +2947,7 @@ static int sessionChangesetReadTblhdr(sqlite3_changeset_iter *p){
}

if( rc==SQLITE_OK ){
int iPK = sizeof(sqlite3_value*)*p->nCol*2;
size_t iPK = sizeof(sqlite3_value*)*p->nCol*2;
memset(p->tblhdr.aBuf, 0, iPK);
memcpy(&p->tblhdr.aBuf[iPK], &p->in.aData[p->in.iNext], nCopy);
p->in.iNext += nCopy;
Expand Down Expand Up @@ -4251,7 +4251,7 @@ static int sessionRetryConstraints(

rc = sessionChangesetStart(&pIter2, 0, 0, cons.nBuf, cons.aBuf, 0);
if( rc==SQLITE_OK ){
int nByte = 2*pApply->nCol*sizeof(sqlite3_value*);
size_t nByte = 2*pApply->nCol*sizeof(sqlite3_value*);
int rc2;
pIter2->bPatchset = bPatchset;
pIter2->zTab = (char*)zTab;
Expand Down
3 changes: 1 addition & 2 deletions src/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -3768,7 +3768,7 @@ void *sqlite3ArrayAllocate(
int *pIdx /* Write the index of a new slot here */
){
char *z;
sqlite3_int64 n = *pnEntry;
sqlite3_int64 n = *pIdx = *pnEntry;
if( (n & (n-1))==0 ){
sqlite3_int64 sz = (n==0) ? 1 : 2*n;
void *pNew = sqlite3DbRealloc(db, pArray, sz*szEntry);
Expand All @@ -3780,7 +3780,6 @@ void *sqlite3ArrayAllocate(
}
z = (char*)pArray;
memset(&z[n * szEntry], 0, szEntry);
*pIdx = n;
++*pnEntry;
return pArray;
}
Expand Down
4 changes: 2 additions & 2 deletions src/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static HashElem *findElementWithHash(
unsigned int *pHash /* Write the hash value here */
){
HashElem *elem; /* Used to loop thru the element list */
int count; /* Number of elements left to test */
unsigned int count; /* Number of elements left to test */
unsigned int h; /* The computed hash */
static HashElem nullElement = { 0, 0, 0, 0 };

Expand Down Expand Up @@ -198,8 +198,8 @@ static void removeElementGivenHash(
if( pEntry->chain==elem ){
pEntry->chain = elem->next;
}
assert( pEntry->count>0 );
pEntry->count--;
assert( pEntry->count>=0 );
}
sqlite3_free( elem );
pH->count--;
Expand Down
2 changes: 1 addition & 1 deletion src/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct Hash {
unsigned int count; /* Number of entries in this table */
HashElem *first; /* The first element of the array */
struct _ht { /* the hash table */
int count; /* Number of entries with this hash */
unsigned int count; /* Number of entries with this hash */
HashElem *chain; /* Pointer to first entry with this hash */
} *ht;
};
Expand Down
10 changes: 5 additions & 5 deletions src/vdbeaux.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static int growOpArray(Vdbe *v, int nOp){
: (sqlite3_int64)v->nOpAlloc+nOp);
#else
sqlite3_int64 nNew = (v->nOpAlloc ? 2*(sqlite3_int64)v->nOpAlloc
: (sqlite3_int64)1024/sizeof(Op));
: (sqlite3_int64)(1024/sizeof(Op)));
UNUSED_PARAMETER(nOp);
#endif

Expand Down Expand Up @@ -2068,9 +2068,9 @@ void sqlite3VdbeIOTraceSql(Vdbe *p){
** of a ReusableSpace object by the allocSpace() routine below.
*/
struct ReusableSpace {
u8 *pSpace; /* Available memory */
int nFree; /* Bytes of available memory */
int nNeeded; /* Total bytes that could not be allocated */
u8 *pSpace; /* Available memory */
sqlite3_int64 nFree; /* Bytes of available memory */
sqlite3_int64 nNeeded; /* Total bytes that could not be allocated */
};

/* Try to allocate nByte bytes of 8-byte aligned bulk memory for pBuf
Expand All @@ -2090,7 +2090,7 @@ struct ReusableSpace {
static void *allocSpace(
struct ReusableSpace *p, /* Bulk memory available for allocation */
void *pBuf, /* Pointer to a prior allocation */
int nByte /* Bytes of memory needed */
sqlite3_int64 nByte /* Bytes of memory needed */
){
assert( EIGHT_BYTE_ALIGNMENT(p->pSpace) );
if( pBuf==0 ){
Expand Down
5 changes: 3 additions & 2 deletions src/wal.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ static SQLITE_NOINLINE int walIndexPageRealloc(

/* Enlarge the pWal->apWiData[] array if required */
if( pWal->nWiData<=iPage ){
int nByte = sizeof(u32*)*(iPage+1);
sqlite3_int64 nByte = sizeof(u32*)*(iPage+1);
volatile u32 **apNew;
apNew = (volatile u32 **)sqlite3_realloc64((void *)pWal->apWiData, nByte);
if( !apNew ){
Expand Down Expand Up @@ -679,6 +679,7 @@ static void walChecksumBytes(

assert( nByte>=8 );
assert( (nByte&0x00000007)==0 );
assert( nByte<=65536 );

if( nativeCksum ){
do {
Expand Down Expand Up @@ -1616,7 +1617,7 @@ static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){
WalIterator *p; /* Return value */
int nSegment; /* Number of segments to merge */
u32 iLast; /* Last frame in log */
int nByte; /* Number of bytes to allocate */
sqlite3_int64 nByte; /* Number of bytes to allocate */
int i; /* Iterator variable */
ht_slot *aTmp; /* Temp space used by merge-sort */
int rc = SQLITE_OK; /* Return Code */
Expand Down

0 comments on commit e519f24

Please sign in to comment.