Fix compiler warnings with MSVC build. (CVS 6699)

FossilOrigin-Name: 0791588520603d106aa0b8ce24d68b740b7b80c8
diff --git a/src/build.c b/src/build.c
index 93548af..d231338 100644
--- a/src/build.c
+++ b/src/build.c
@@ -22,7 +22,7 @@
 **     COMMIT
 **     ROLLBACK
 **
-** $Id: build.c,v 1.547 2009/05/28 21:04:38 drh Exp $
+** $Id: build.c,v 1.548 2009/06/01 16:53:10 shane Exp $
 */
 #include "sqliteInt.h"
 
@@ -1089,7 +1089,7 @@
       pCol->pDflt = sqlite3ExprDup(db, pSpan->pExpr, EXPRDUP_REDUCE);
       sqlite3DbFree(db, pCol->zDflt);
       pCol->zDflt = sqlite3DbStrNDup(db, (char*)pSpan->zStart,
-                                     pSpan->zEnd - pSpan->zStart);
+                                     (int)(pSpan->zEnd - pSpan->zStart));
     }
   }
   sqlite3ExprDelete(db, pSpan->pExpr);
diff --git a/src/expr.c b/src/expr.c
index f6cb658..24fcb4a 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.444 2009/05/30 23:35:43 drh Exp $
+** $Id: expr.c,v 1.445 2009/06/01 16:53:10 shane Exp $
 */
 #include "sqliteInt.h"
 
@@ -404,7 +404,7 @@
 ){
   Expr *pNew;
   int nExtra = 0;
-  int iValue;
+  int iValue = 0;
 
   if( pToken ){
     if( op!=TK_INTEGER || pToken->z==0
@@ -1084,7 +1084,7 @@
     assert( db->mallocFailed || pItem->pExpr==pSpan->pExpr );
     sqlite3DbFree(db, pItem->zSpan);
     pItem->zSpan = sqlite3DbStrNDup(db, (char*)pSpan->zStart,
-                                    pSpan->zEnd - pSpan->zStart);
+                                    (int)(pSpan->zEnd - pSpan->zStart));
   }
 }
 
@@ -1641,9 +1641,6 @@
     case TK_EXISTS:
     case TK_SELECT:
     default: {
-      testcase( pExpr->op==TK_EXISTS );
-      testcase( pExpr->op==TK_SELECT );
-      assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT );
       /* If this has to be a scalar SELECT.  Generate code to put the
       ** value of this select in a memory cell and record the number
       ** of the memory cell in iColumn.  If this is an EXISTS, write
@@ -1654,6 +1651,10 @@
       Select *pSel;                         /* SELECT statement to encode */
       SelectDest dest;                      /* How to deal with SELECt result */
 
+      testcase( pExpr->op==TK_EXISTS );
+      testcase( pExpr->op==TK_SELECT );
+      assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT );
+
       assert( ExprHasProperty(pExpr, EP_xIsSelect) );
       pSel = pExpr->x.pSelect;
       sqlite3SelectDestInit(&dest, 0, ++pParse->nMem);
@@ -1671,7 +1672,7 @@
       if( sqlite3Select(pParse, pSel, &dest) ){
         return;
       }
-      pExpr->iColumn = dest.iParm;
+      pExpr->iColumn = (i16)dest.iParm;
       ExprSetIrreducible(pExpr);
       break;
     }
@@ -3338,7 +3339,7 @@
             ExprSetIrreducible(pExpr);
             pExpr->pAggInfo = pAggInfo;
             pExpr->op = TK_AGG_COLUMN;
-            pExpr->iAgg = k;
+            pExpr->iAgg = (i16)k;
             break;
           } /* endif pExpr->iTable==pItem->iCursor */
         } /* end loop over pSrcList */
@@ -3383,7 +3384,7 @@
         */
         assert( !ExprHasAnyProperty(pExpr, EP_TokenOnly|EP_Reduced) );
         ExprSetIrreducible(pExpr);
-        pExpr->iAgg = i;
+        pExpr->iAgg = (i16)i;
         pExpr->pAggInfo = pAggInfo;
         return WRC_Prune;
       }
diff --git a/src/main.c b/src/main.c
index 83000c1..941322a 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.554 2009/05/22 10:53:29 drh Exp $
+** $Id: main.c,v 1.555 2009/06/01 16:53:10 shane Exp $
 */
 #include "sqliteInt.h"
 
@@ -1192,7 +1192,8 @@
 #endif
 #if SQLITE_TEMP_STORE==3
   return 1;
-#else
+#endif
+#if SQLITE_TEMP_STORE<1 || SQLITE_TEMP_STORE>3
   return 0;
 #endif
 }
diff --git a/src/resolve.c b/src/resolve.c
index 55a47ca..e7458cc 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -14,7 +14,7 @@
 ** resolve all identifiers by associating them with a particular
 ** table and column.
 **
-** $Id: resolve.c,v 1.27 2009/05/29 14:39:08 drh Exp $
+** $Id: resolve.c,v 1.28 2009/06/01 16:53:10 shane Exp $
 */
 #include "sqliteInt.h"
 #include <stdlib.h>
@@ -190,7 +190,7 @@
             pMatch = pItem;
             pSchema = pTab->pSchema;
             /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
-            pExpr->iColumn = j==pTab->iPKey ? -1 : j;
+            pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;
             if( i<pSrcList->nSrc-1 ){
               if( pItem[1].jointype & JT_NATURAL ){
                 /* If this match occurred in the left table of a natural join,
@@ -246,7 +246,7 @@
         for(iCol=0; iCol < pTab->nCol; iCol++, pCol++) {
           if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
             cnt++;
-            pExpr->iColumn = iCol==pTab->iPKey ? -1 : iCol;
+            pExpr->iColumn = iCol==pTab->iPKey ? -1 : (i16)iCol;
             pExpr->pTab = pTab;
             if( iCol>=0 ){
               testcase( iCol==31 );
@@ -591,6 +591,8 @@
 ){
   int i;             /* Loop counter */
 
+  UNUSED_PARAMETER(pParse);
+
   if( pE->op==TK_ID || (pE->op==TK_STRING && pE->u.zToken[0]!='\'') ){
     char *zCol = pE->u.zToken;
     for(i=0; i<pEList->nExpr; i++){
diff --git a/src/select.c b/src/select.c
index b40d3d2..e3acd2f 100644
--- a/src/select.c
+++ b/src/select.c
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle SELECT statements in SQLite.
 **
-** $Id: select.c,v 1.522 2009/05/31 21:21:41 drh Exp $
+** $Id: select.c,v 1.523 2009/06/01 16:53:10 shane Exp $
 */
 #include "sqliteInt.h"
 
@@ -234,7 +234,7 @@
     ExprSetProperty(pE, EP_FromJoin);
     assert( !ExprHasAnyProperty(pE, EP_TokenOnly|EP_Reduced) );
     ExprSetIrreducible(pE);
-    pE->iRightJoinTable = iRightJoinTable;
+    pE->iRightJoinTable = (i16)iRightJoinTable;
   }
   *ppExpr = sqlite3ExprAnd(pParse->db,*ppExpr, pE);
 }
@@ -270,7 +270,7 @@
     ExprSetProperty(p, EP_FromJoin);
     assert( !ExprHasAnyProperty(p, EP_TokenOnly|EP_Reduced) );
     ExprSetIrreducible(p);
-    p->iRightJoinTable = iTable;
+    p->iRightJoinTable = (i16)iTable;
     setJoinExpr(p->pLeft, iTable);
     p = p->pRight;
   }