diff options
author | drh <drh@noemail.net> | 2004-02-29 00:11:30 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2004-02-29 00:11:30 +0000 |
commit | 3039c0a89639d3dcd4bb8d2a9839a6df089dbae7 (patch) | |
tree | 2349b8d62640deae061c5b12bc5f3ded56e65986 /src | |
parent | 1d78a38f51ded28a88b97929079ad19258608ac1 (diff) | |
download | sqlite-3039c0a89639d3dcd4bb8d2a9839a6df089dbae7.tar.gz sqlite-3039c0a89639d3dcd4bb8d2a9839a6df089dbae7.zip |
Fix some compiler warnings in LCC. The warnings did not indicate real
problems. Ticket #634. Not all warnings in ticket #634 were fixed. (CVS 1276)
FossilOrigin-Name: e97089b7df3e2fbfcf36062099d02ecb75e9a870
Diffstat (limited to 'src')
-rw-r--r-- | src/btree_rb.c | 25 | ||||
-rw-r--r-- | src/os.c | 2 | ||||
-rw-r--r-- | src/printf.c | 6 |
3 files changed, 15 insertions, 18 deletions
diff --git a/src/btree_rb.c b/src/btree_rb.c index d57ddca72..ea4b3dda7 100644 --- a/src/btree_rb.c +++ b/src/btree_rb.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree_rb.c,v 1.23 2004/02/12 15:31:21 drh Exp $ +** $Id: btree_rb.c,v 1.24 2004/02/29 00:11:31 drh Exp $ ** ** This file implements an in-core database using Red-Black balanced ** binary trees. @@ -259,17 +259,16 @@ static void rightRotate(BtRbTree *pTree, BtRbNode *pX) * concatenation of orig and val is returned. The original orig is deleted * (using sqliteFree()). */ -static char *append_val(char * orig, char const * val) -{ +static char *append_val(char * orig, char const * val){ + char *z; if( !orig ){ - return sqliteStrDup( val ); + z = sqliteStrDup( val ); } else{ - char * ret = 0; - sqliteSetString(&ret, orig, val, (char*)0); + z = 0; + sqliteSetString(&z, orig, val, (char*)0); sqliteFree( orig ); - return ret; } - assert(0); + return z; } /* @@ -1178,12 +1177,11 @@ static int memRbtreeKey(RbtCursor* pCur, int offset, int amt, char *zBuf) if( !pCur->pNode ) return 0; if( !pCur->pNode->pKey || ((amt + offset) <= pCur->pNode->nKey) ){ memcpy(zBuf, ((char*)pCur->pNode->pKey)+offset, amt); - return amt; }else{ memcpy(zBuf, ((char*)pCur->pNode->pKey)+offset, pCur->pNode->nKey-offset); - return pCur->pNode->nKey-offset; + amt = pCur->pNode->nKey-offset; } - assert(0); + return amt; } static int memRbtreeDataSize(RbtCursor* pCur, int *pSize) @@ -1201,12 +1199,11 @@ static int memRbtreeData(RbtCursor *pCur, int offset, int amt, char *zBuf) if( !pCur->pNode ) return 0; if( (amt + offset) <= pCur->pNode->nData ){ memcpy(zBuf, ((char*)pCur->pNode->pData)+offset, amt); - return amt; }else{ memcpy(zBuf, ((char*)pCur->pNode->pData)+offset ,pCur->pNode->nData-offset); - return pCur->pNode->nData-offset; + amt = pCur->pNode->nData-offset; } - assert(0); + return amt; } static int memRbtreeCloseCursor(RbtCursor* pCur) @@ -1214,7 +1214,7 @@ int sqliteOsFileSize(OsFile *id, off_t *pSize){ ** the LockFileEx() API. */ int isNT(void){ - static osType = 0; /* 0=unknown 1=win95 2=winNT */ + static int osType = 0; /* 0=unknown 1=win95 2=winNT */ if( osType==0 ){ OSVERSIONINFO sInfo; sInfo.dwOSVersionInfoSize = sizeof(sInfo); diff --git a/src/printf.c b/src/printf.c index 3cd794280..620578d76 100644 --- a/src/printf.c +++ b/src/printf.c @@ -358,7 +358,7 @@ static int vxprintf( if( flag_zeropad && precision<width-(prefix!=0) ){ precision = width-(prefix!=0); } - bufpt = &buf[etBUFSIZE]; + bufpt = &buf[etBUFSIZE-1]; { register char *cset; /* Use registers for speed */ register int base; @@ -369,7 +369,7 @@ static int vxprintf( longvalue = longvalue/base; }while( longvalue>0 ); } - length = &buf[etBUFSIZE]-bufpt; + length = &buf[etBUFSIZE-1]-bufpt; for(idx=precision-length; idx>0; idx--){ *(--bufpt) = '0'; /* Zero pad */ } @@ -381,7 +381,7 @@ static int vxprintf( for(pre=infop->prefix; (x=(*pre))!=0; pre++) *(--bufpt) = x; } } - length = &buf[etBUFSIZE]-bufpt; + length = &buf[etBUFSIZE-1]-bufpt; break; case etFLOAT: case etEXP: |