aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/delete.c4
-rw-r--r--src/main.c2
-rw-r--r--src/msvc.h35
-rw-r--r--src/pragma.c2
-rw-r--r--src/shell.c7
-rw-r--r--src/sqliteInt.h8
-rw-r--r--src/tclsqlite.c14
-rw-r--r--src/test1.c8
-rw-r--r--src/test2.c2
-rw-r--r--src/test8.c6
-rw-r--r--src/test_journal.c7
-rw-r--r--src/test_malloc.c4
-rw-r--r--src/test_multiplex.c4
-rw-r--r--src/test_quota.c2
-rw-r--r--src/test_vfs.c4
-rw-r--r--src/vdbe.c4
16 files changed, 87 insertions, 26 deletions
diff --git a/src/delete.c b/src/delete.c
index d81dd3f6b..011fb80de 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -226,8 +226,8 @@ void sqlite3DeleteFrom(
WhereInfo *pWInfo; /* Information about the WHERE clause */
Index *pIdx; /* For looping over indices of the table */
int iTabCur; /* Cursor number for the table */
- int iDataCur; /* VDBE cursor for the canonical data source */
- int iIdxCur; /* Cursor number of the first index */
+ int iDataCur = 0; /* VDBE cursor for the canonical data source */
+ int iIdxCur = 0; /* Cursor number of the first index */
int nIdx; /* Number of indices */
sqlite3 *db; /* Main database structure */
AuthContext sContext; /* Authorization context */
diff --git a/src/main.c b/src/main.c
index 191d624b7..8cf16b001 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3140,7 +3140,7 @@ int sqlite3_table_column_metadata(
char *zErrMsg = 0;
Table *pTab = 0;
Column *pCol = 0;
- int iCol;
+ int iCol = 0;
char const *zDataType = 0;
char const *zCollSeq = 0;
diff --git a/src/msvc.h b/src/msvc.h
new file mode 100644
index 000000000..4508e6941
--- /dev/null
+++ b/src/msvc.h
@@ -0,0 +1,35 @@
+/*
+** 2015 January 12
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains code that is specific to MSVC.
+*/
+#ifndef _MSVC_H_
+#define _MSVC_H_
+
+#if defined(_MSC_VER)
+#pragma warning(disable : 4054)
+#pragma warning(disable : 4055)
+#pragma warning(disable : 4100)
+#pragma warning(disable : 4127)
+#pragma warning(disable : 4152)
+#pragma warning(disable : 4189)
+#pragma warning(disable : 4206)
+#pragma warning(disable : 4210)
+#pragma warning(disable : 4232)
+#pragma warning(disable : 4244)
+#pragma warning(disable : 4305)
+#pragma warning(disable : 4306)
+#pragma warning(disable : 4702)
+#pragma warning(disable : 4706)
+#endif /* defined(_MSC_VER) */
+
+#endif /* _MSVC_H_ */
diff --git a/src/pragma.c b/src/pragma.c
index 1312beef0..34830e33a 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -727,7 +727,7 @@ void sqlite3Pragma(
Token *pId; /* Pointer to <id> token */
char *aFcntl[4]; /* Argument to SQLITE_FCNTL_PRAGMA */
int iDb; /* Database index for <database> */
- int lwr, upr, mid; /* Binary search bounds */
+ int lwr, upr, mid = 0; /* Binary search bounds */
int rc; /* return value form SQLITE_FCNTL_PRAGMA */
sqlite3 *db = pParse->db; /* The database connection */
Db *pDb; /* The specific database being pragmaed */
diff --git a/src/shell.c b/src/shell.c
index 18313fabd..9c0481c0d 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -18,6 +18,13 @@
#endif
/*
+** If requested, include the SQLite compiler options file for MSVC.
+*/
+#if defined(INCLUDE_MSVC_H)
+#include "msvc.h"
+#endif
+
+/*
** Enable large-file support for fopen() and friends on unix.
*/
#ifndef SQLITE_DISABLE_LFS
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index e1642a08c..379456d5f 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -16,6 +16,14 @@
#define _SQLITEINT_H_
/*
+** Include the header file used to customize the compiler options for MSVC.
+** This should be done first so that it can successfully prevent spurious
+** compiler warnings due to subsequent content in this file and other files
+** that are included by this file.
+*/
+#include "msvc.h"
+
+/*
** These #defines should enable >2GB file support on POSIX if the
** underlying operating system supports it. If the OS lacks
** large file support, or if the OS is windows, these should be no-ops.
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 852f966a8..a912e8aba 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -25,6 +25,14 @@
** hundreds of new commands used for testing
** SQLite. This option implies -DSQLITE_TCLMD5.
*/
+
+/*
+** If requested, include the SQLite compiler options file for MSVC.
+*/
+#if defined(INCLUDE_MSVC_H)
+#include "msvc.h"
+#endif
+
#include "tcl.h"
#include <errno.h>
@@ -1085,10 +1093,10 @@ static int dbPrepareAndBind(
SqlPreparedStmt **ppPreStmt /* OUT: Object used to cache statement */
){
const char *zSql = zIn; /* Pointer to first SQL statement in zIn */
- sqlite3_stmt *pStmt; /* Prepared statement object */
+ sqlite3_stmt *pStmt = 0; /* Prepared statement object */
SqlPreparedStmt *pPreStmt; /* Pointer to cached statement */
int nSql; /* Length of zSql in bytes */
- int nVar; /* Number of variables in statement */
+ int nVar = 0; /* Number of variables in statement */
int iParm = 0; /* Next free entry in apParm */
char c;
int i;
@@ -3102,7 +3110,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
** The EXTERN macros are required by TCL in order to work on windows.
*/
EXTERN int Sqlite3_Init(Tcl_Interp *interp){
- int rc = Tcl_InitStubs(interp, "8.4", 0)==0 ? TCL_ERROR : TCL_OK;
+ int rc = Tcl_InitStubs(interp, "8.4", 0) ? TCL_OK : TCL_ERROR;
if( rc==TCL_OK ){
Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0);
#ifndef SQLITE_3_SUFFIX_ONLY
diff --git a/src/test1.c b/src/test1.c
index 475473d77..8f21660c2 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -567,7 +567,7 @@ static int test_get_table_printf(
Tcl_DString str;
int rc;
char *zErr = 0;
- int nRow, nCol;
+ int nRow = 0, nCol = 0;
char **aResult;
int i;
char zBuf[30];
@@ -2120,7 +2120,7 @@ static int test_stmt_status(
Tcl_Obj *CONST objv[]
){
int iValue;
- int i, op, resetFlag;
+ int i, op = 0, resetFlag;
const char *zOpName;
sqlite3_stmt *pStmt;
@@ -3098,7 +3098,7 @@ static int test_bind_double(
){
sqlite3_stmt *pStmt;
int idx;
- double value;
+ double value = 0;
int rc;
const char *zVal;
int i;
@@ -5458,7 +5458,7 @@ static int test_limit(
{ "SQLITE_LIMIT_TOOSMALL", -1, },
{ "SQLITE_LIMIT_TOOBIG", SQLITE_LIMIT_WORKER_THREADS+1 },
};
- int i, id;
+ int i, id = 0;
int val;
const char *zId;
diff --git a/src/test2.c b/src/test2.c
index 58f271ff2..7192ddfff 100644
--- a/src/test2.c
+++ b/src/test2.c
@@ -310,7 +310,7 @@ static int page_get(
){
Pager *pPager;
char zBuf[100];
- DbPage *pPage;
+ DbPage *pPage = 0;
int pgno;
int rc;
if( argc!=3 ){
diff --git a/src/test8.c b/src/test8.c
index 407dd54c7..f37a28ced 100644
--- a/src/test8.c
+++ b/src/test8.c
@@ -777,11 +777,11 @@ static int echoBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
sqlite3_stmt *pStmt = 0;
Tcl_Interp *interp = pVtab->interp;
- int nRow;
+ int nRow = 0;
int useIdx = 0;
int rc = SQLITE_OK;
int useCost = 0;
- double cost;
+ double cost = 0;
int isIgnoreUsable = 0;
if( Tcl_GetVar(interp, "echo_module_ignore_usable", TCL_GLOBAL_ONLY) ){
isIgnoreUsable = 1;
@@ -927,7 +927,7 @@ int echoUpdate(
sqlite3 *db = pVtab->db;
int rc = SQLITE_OK;
- sqlite3_stmt *pStmt;
+ sqlite3_stmt *pStmt = 0;
char *z = 0; /* SQL statement to execute */
int bindArgZero = 0; /* True to bind apData[0] to sql var no. nData */
int bindArgOne = 0; /* True to bind apData[1] to sql var no. 1 */
diff --git a/src/test_journal.c b/src/test_journal.c
index e8701a4ee..6e320b7ab 100644
--- a/src/test_journal.c
+++ b/src/test_journal.c
@@ -409,7 +409,9 @@ static int openTransaction(jt_file *pMain, jt_file *pJournal){
if( iOff==PENDING_BYTE ) continue;
rc = sqlite3OsRead(pMain->pReal, aData, pMain->nPagesize, iOff);
pMain->aCksum[ii] = genCksum(aData, pMain->nPagesize);
- if( ii+1==pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ) rc = SQLITE_OK;
+ if( ii+1==(int)pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ){
+ rc = SQLITE_OK;
+ }
}
}
@@ -550,7 +552,8 @@ static int jtWrite(
*/
}else{
u32 pgno = (u32)(iOfst/p->nPagesize + 1);
- assert( (iAmt==1||iAmt==p->nPagesize) && ((iOfst+iAmt)%p->nPagesize)==0 );
+ assert( (iAmt==1||iAmt==(int)p->nPagesize) &&
+ ((iOfst+iAmt)%p->nPagesize)==0 );
assert( pgno<=p->nPage || p->nSync>0 );
assert( pgno>p->nPage || sqlite3BitvecTest(p->pWritable, pgno) );
}
diff --git a/src/test_malloc.c b/src/test_malloc.c
index 54a89472d..1ea4de506 100644
--- a/src/test_malloc.c
+++ b/src/test_malloc.c
@@ -1338,7 +1338,7 @@ static int test_status(
Tcl_Obj *CONST objv[]
){
int rc, iValue, mxValue;
- int i, op, resetFlag;
+ int i, op = 0, resetFlag;
const char *zOpName;
static const struct {
const char *zName;
@@ -1395,7 +1395,7 @@ static int test_db_status(
Tcl_Obj *CONST objv[]
){
int rc, iValue, mxValue;
- int i, op, resetFlag;
+ int i, op = 0, resetFlag;
const char *zOpName;
sqlite3 *db;
extern int getDbPointer(Tcl_Interp*, const char*, sqlite3**);
diff --git a/src/test_multiplex.c b/src/test_multiplex.c
index 99819371c..8f204c669 100644
--- a/src/test_multiplex.c
+++ b/src/test_multiplex.c
@@ -406,7 +406,7 @@ static void multiplexControlFunc(
){
int rc = SQLITE_OK;
sqlite3 *db = sqlite3_context_db_handle(context);
- int op;
+ int op = 0;
int iVal;
if( !db || argc!=2 ){
@@ -535,7 +535,7 @@ static int multiplexOpen(
/* assign pointers to extra space allocated */
memset(pGroup, 0, sz);
pMultiplexOpen->pGroup = pGroup;
- pGroup->bEnabled = -1;
+ pGroup->bEnabled = (unsigned char)-1;
pGroup->bTruncate = sqlite3_uri_boolean(zUri, "truncate",
(flags & SQLITE_OPEN_MAIN_DB)==0);
pGroup->szChunk = (int)sqlite3_uri_int64(zUri, "chunksize",
diff --git a/src/test_quota.c b/src/test_quota.c
index 80ebd0589..e8e0b3407 100644
--- a/src/test_quota.c
+++ b/src/test_quota.c
@@ -889,7 +889,7 @@ int sqlite3_quota_set(
** management, update its size.
*/
int sqlite3_quota_file(const char *zFilename){
- char *zFull;
+ char *zFull = 0;
sqlite3_file *fd;
int rc;
int outFlags = 0;
diff --git a/src/test_vfs.c b/src/test_vfs.c
index 7ee2a9345..37081af78 100644
--- a/src/test_vfs.c
+++ b/src/test_vfs.c
@@ -421,7 +421,7 @@ static int tvfsSync(sqlite3_file *pFile, int flags){
Testvfs *p = (Testvfs *)pFd->pVfs->pAppData;
if( p->pScript && p->mask&TESTVFS_SYNC_MASK ){
- char *zFlags;
+ char *zFlags = 0;
switch( flags ){
case SQLITE_SYNC_NORMAL:
@@ -1225,7 +1225,7 @@ static int testvfs_obj_cmd(
case CMD_CANTOPENERR:
case CMD_IOERR:
case CMD_FULLERR: {
- TestFaultInject *pTest;
+ TestFaultInject *pTest = 0;
int iRet;
switch( aSubcmd[i].eCmd ){
diff --git a/src/vdbe.c b/src/vdbe.c
index 3dac74dfd..1e0ff96af 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -3823,8 +3823,8 @@ case OP_Found: { /* jump, in3 */
/* For the OP_NoConflict opcode, take the jump if any of the
** input fields are NULL, since any key with a NULL will not
** conflict */
- for(ii=0; ii<r.nField; ii++){
- if( r.aMem[ii].flags & MEM_Null ){
+ for(ii=0; ii<pIdxKey->nField; ii++){
+ if( pIdxKey->aMem[ii].flags & MEM_Null ){
pc = pOp->p2 - 1; VdbeBranchTaken(1,2);
break;
}