aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/btree_rb.c25
-rw-r--r--src/os.c2
-rw-r--r--src/printf.c6
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)
diff --git a/src/os.c b/src/os.c
index fb987f3ca..b4ae7a107 100644
--- a/src/os.c
+++ b/src/os.c
@@ -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: