aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/btree.c47
-rw-r--r--src/delete.c4
-rw-r--r--src/expr.c4
-rw-r--r--src/insert.c18
-rw-r--r--src/main.c4
-rw-r--r--src/pager.c5
6 files changed, 42 insertions, 40 deletions
diff --git a/src/btree.c b/src/btree.c
index b0f43f555..dca50cd06 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.170 2004/06/15 11:40:04 danielk1977 Exp $
+** $Id: btree.c,v 1.171 2004/06/16 12:00:29 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@@ -1346,7 +1346,7 @@ void sqlite3BtreeCursorList(Btree *pBt){
** are no active cursors, it also releases the read lock.
*/
int sqlite3BtreeRollback(Btree *pBt){
- int rc;
+ int rc = SQLITE_OK;
MemPage *pPage1;
if( pBt->inTrans==TRANS_WRITE ){
rc = sqlite3pager_rollback(pBt->pPager);
@@ -1732,30 +1732,31 @@ static int getPayload(
}else{
offset -= pCur->info.nLocal;
}
+ ovflSize = pBt->usableSize - 4;
if( amt>0 ){
nextPage = get4byte(&aPayload[pCur->info.nLocal]);
- }
- ovflSize = pBt->usableSize - 4;
- while( amt>0 && nextPage ){
- rc = sqlite3pager_get(pBt->pPager, nextPage, (void**)&aPayload);
- if( rc!=0 ){
- return rc;
- }
- nextPage = get4byte(aPayload);
- if( offset<ovflSize ){
- int a = amt;
- if( a + offset > ovflSize ){
- a = ovflSize - offset;
+ while( amt>0 && nextPage ){
+ rc = sqlite3pager_get(pBt->pPager, nextPage, (void**)&aPayload);
+ if( rc!=0 ){
+ return rc;
}
- memcpy(pBuf, &aPayload[offset+4], a);
- offset = 0;
- amt -= a;
- pBuf += a;
- }else{
- offset -= ovflSize;
+ nextPage = get4byte(aPayload);
+ if( offset<ovflSize ){
+ int a = amt;
+ if( a + offset > ovflSize ){
+ a = ovflSize - offset;
+ }
+ memcpy(pBuf, &aPayload[offset+4], a);
+ offset = 0;
+ amt -= a;
+ pBuf += a;
+ }else{
+ offset -= ovflSize;
+ }
+ sqlite3pager_unref(aPayload);
}
- sqlite3pager_unref(aPayload);
}
+
if( amt>0 ){
return SQLITE_CORRUPT;
}
@@ -2836,7 +2837,7 @@ static int balance(MemPage*);
static int balance_nonroot(MemPage *pPage){
MemPage *pParent; /* The parent of pPage */
Btree *pBt; /* The whole database */
- int nCell; /* Number of cells in aCell[] */
+ int nCell = 0; /* Number of cells in aCell[] */
int nOld; /* Number of pages in apOld[] */
int nNew; /* Number of pages in apNew[] */
int nDiv; /* Number of cells in apDiv[] */
@@ -3494,7 +3495,7 @@ int sqlite3BtreeDelete(BtCursor *pCur){
MemPage *pPage = pCur->pPage;
unsigned char *pCell;
int rc;
- Pgno pgnoChild;
+ Pgno pgnoChild = 0;
Btree *pBt = pCur->pBt;
assert( pPage->isInit );
diff --git a/src/delete.c b/src/delete.c
index b9cc3f05c..5f326908b 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle DELETE FROM statements.
**
-** $Id: delete.c,v 1.73 2004/06/10 10:50:15 danielk1977 Exp $
+** $Id: delete.c,v 1.74 2004/06/16 12:00:49 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -61,7 +61,7 @@ void sqlite3DeleteFrom(
Vdbe *v; /* The virtual database engine */
Table *pTab; /* The table from which records will be deleted */
const char *zDb; /* Name of database holding pTab */
- int end, addr; /* A couple addresses of generated code */
+ int end, addr = 0; /* A couple addresses of generated code */
int i; /* Loop counter */
WhereInfo *pWInfo; /* Information about the WHERE clause */
Index *pIdx; /* For looping over indices of the table */
diff --git a/src/expr.c b/src/expr.c
index d43eb0dbf..568447bf4 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.142 2004/06/15 16:51:01 danielk1977 Exp $
+** $Id: expr.c,v 1.143 2004/06/16 12:00:50 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -1160,7 +1160,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
case TK_FLOAT: op = OP_Real; break;
case TK_STRING: op = OP_String8; break;
case TK_BLOB: op = OP_HexBlob; break;
- default: break;
+ default: op = 0; break;
}
switch( pExpr->op ){
case TK_COLUMN: {
diff --git a/src/insert.c b/src/insert.c
index 969f768ce..8dedbbbee 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
-** $Id: insert.c,v 1.110 2004/06/10 10:50:21 danielk1977 Exp $
+** $Id: insert.c,v 1.111 2004/06/16 12:00:54 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -177,17 +177,17 @@ void sqlite3Insert(
Vdbe *v; /* Generate code into this virtual machine */
Index *pIdx; /* For looping over indices of the table */
int nColumn; /* Number of columns in the data */
- int base; /* VDBE Cursor number for pTab */
- int iCont, iBreak; /* Beginning and end of the loop over srcTab */
+ int base = 0; /* VDBE Cursor number for pTab */
+ int iCont=0,iBreak=0; /* Beginning and end of the loop over srcTab */
sqlite *db; /* The main database structure */
int keyColumn = -1; /* Column that is the INTEGER PRIMARY KEY */
int endOfLoop; /* Label for the end of the insertion loop */
int useTempTable; /* Store SELECT results in intermediate table */
- int srcTab; /* Data comes from this temporary cursor if >=0 */
- int iSelectLoop; /* Address of code that implements the SELECT */
- int iCleanup; /* Address of the cleanup code */
- int iInsertBlock; /* Address of the subroutine used to insert data */
- int iCntMem; /* Memory cell used for the row counter */
+ int srcTab = 0; /* Data comes from this temporary cursor if >=0 */
+ int iSelectLoop = 0; /* Address of code that implements the SELECT */
+ int iCleanup = 0; /* Address of the cleanup code */
+ int iInsertBlock = 0; /* Address of the subroutine used to insert data */
+ int iCntMem = 0; /* Memory cell used for the row counter */
int isView; /* True if attempting to insert into a view */
int row_triggers_exist = 0; /* True if there are FOR EACH ROW triggers */
@@ -735,7 +735,7 @@ void sqlite3GenerateConstraintChecks(
int iCur;
Index *pIdx;
int seenReplace = 0;
- int jumpInst1, jumpInst2;
+ int jumpInst1=0, jumpInst2;
int contAddr;
int hasTwoRecnos = (isUpdate && recnoChng);
diff --git a/src/main.c b/src/main.c
index fc44eae38..fa4bcc211 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.223 2004/06/16 10:39:32 danielk1977 Exp $
+** $Id: main.c,v 1.224 2004/06/16 12:00:56 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -1021,7 +1021,7 @@ prepare_out:
if( rc==SQLITE_OK ){
*ppStmt = (sqlite3_stmt*)sParse.pVdbe;
}else if( sParse.pVdbe ){
- sqlite3_finalize(sParse.pVdbe);
+ sqlite3_finalize((sqlite3_stmt*)sParse.pVdbe);
}
if( zErrMsg ){
diff --git a/src/pager.c b/src/pager.c
index 9540fab39..bf8843aae 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.130 2004/06/16 10:39:39 danielk1977 Exp $
+** @(#) $Id: pager.c,v 1.131 2004/06/16 12:01:01 danielk1977 Exp $
*/
#include "os.h" /* Must be first to enable large file support */
#include "sqliteInt.h"
@@ -1087,7 +1087,8 @@ int sqlite3pager_open(
char *zFullPathname = 0;
int nameLen;
OsFile fd;
- int rc, i;
+ int rc = SQLITE_OK;
+ int i;
int tempFile = 0;
int memDb = 0;
int readOnly = 0;