Handle non-autoconf build correctly with new changes (CVS 4832)

FossilOrigin-Name: e2a9f5f1054f077e4773dd3d2c8f2ce5be118a01
diff --git a/src/build.c b/src/build.c
index c825a28..b5320c6 100644
--- a/src/build.c
+++ b/src/build.c
@@ -22,7 +22,7 @@
 **     COMMIT
 **     ROLLBACK
 **
-** $Id: build.c,v 1.473 2008/03/06 07:35:22 mlcreech Exp $
+** $Id: build.c,v 1.474 2008/03/06 09:58:50 mlcreech Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -2283,7 +2283,7 @@
     regRowid = regIdxKey + pIndex->nColumn;
     j1 = sqlite3VdbeAddOp3(v, OP_IsNull, regIdxKey, 0, pIndex->nColumn);
     j2 = sqlite3VdbeAddOp4(v, OP_IsUnique, iIdx,
-                           0, regRowid, (char*)(intptr_t)regRecord, P4_INT32);
+                           0, regRowid, (char*)(sqlite3_intptr_t)regRecord, P4_INT32);
     sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, OE_Abort, 0,
                     "indexed columns are not unique", P4_STATIC);
     sqlite3VdbeJumpHere(v, j1);
diff --git a/src/common.h b/src/common.h
index 5805a7e..22e4ea3 100644
--- a/src/common.h
+++ b/src/common.h
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Common includes/defines based on output of configure script
 **
-** @(#) $Id: common.h,v 1.1 2008/03/06 07:36:18 mlcreech Exp $
+** @(#) $Id: common.h,v 1.2 2008/03/06 09:58:50 mlcreech Exp $
 */
 #ifndef _COMMON_H_
 #define _COMMON_H_
@@ -47,11 +47,9 @@
 ** practically it's == sizeof(void *)).  We fall back to an int if this type
 ** isn't defined.
 */
-#ifndef HAVE_INTPTR_T
-  typedef int intptr_t;
-#endif
-#ifndef HAVE_UINTPTR_T
-  typedef unsigned int uintptr_t;
+#ifdef HAVE_INTPTR_T
+  typedef intptr_t sqlite3_intptr_t;
+# define __sqlite3_intptr_defined
 #endif
 
 #endif
diff --git a/src/func.c b/src/func.c
index 2c2a1d1..027d8a4 100644
--- a/src/func.c
+++ b/src/func.c
@@ -16,7 +16,7 @@
 ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: func.c,v 1.185 2008/03/06 07:35:22 mlcreech Exp $
+** $Id: func.c,v 1.186 2008/03/06 09:58:50 mlcreech Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -875,7 +875,7 @@
   const unsigned char *zIn;         /* Input string */
   const unsigned char *zCharSet;    /* Set of characters to trim */
   int nIn;                          /* Number of bytes in input */
-  intptr_t flags;                   /* 1: trimleft  2: trimright  3: trim */
+  sqlite3_intptr_t flags;           /* 1: trimleft  2: trimright  3: trim */
   int i;                            /* Loop counter */
   unsigned char *aLen;              /* Length of each character in zCharSet */
   unsigned char **azChar;           /* Individual characters in zCharSet */
@@ -916,7 +916,7 @@
     }
   }
   if( nChar>0 ){
-    flags = (intptr_t)sqlite3_user_data(context);
+    flags = (sqlite3_intptr_t)sqlite3_user_data(context);
     if( flags & 1 ){
       while( nIn>0 ){
         int len;
@@ -1459,7 +1459,7 @@
     if( argType==0xff ){
       pArg = db;
     }else{
-      pArg = (void*)(intptr_t)argType;
+      pArg = (void*)(sqlite3_intptr_t)argType;
     }
     sqlite3CreateFunc(db, aFuncs[i].zName, aFuncs[i].nArg,
         aFuncs[i].eTextRep, pArg, aFuncs[i].xFunc, 0, 0);
@@ -1478,7 +1478,7 @@
   sqlite3AttachFunctions(db);
 #endif
   for(i=0; i<sizeof(aAggs)/sizeof(aAggs[0]); i++){
-    void *pArg = (void*)(intptr_t)aAggs[i].argType;
+    void *pArg = (void*)(sqlite3_intptr_t)aAggs[i].argType;
     sqlite3CreateFunc(db, aAggs[i].zName, aAggs[i].nArg, SQLITE_UTF8, 
         pArg, 0, aAggs[i].xStep, aAggs[i].xFinalize);
     if( aAggs[i].needCollSeq ){
diff --git a/src/insert.c b/src/insert.c
index f3807c5..52e5b3a 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.230 2008/03/06 07:35:22 mlcreech Exp $
+** $Id: insert.c,v 1.231 2008/03/06 09:58:50 mlcreech Exp $
 */
 #include "sqliteInt.h"
 
@@ -1193,7 +1193,8 @@
     regR = sqlite3GetTempReg(pParse);
     sqlite3VdbeAddOp2(v, OP_SCopy, regRowid-hasTwoRowids, regR);
     j3 = sqlite3VdbeAddOp4(v, OP_IsUnique, baseCur+iCur+1, 0,
-                           regR, (char*)(intptr_t)aRegIdx[iCur], P4_INT32);
+                           regR, (char*)(sqlite3_intptr_t)aRegIdx[iCur],
+                           P4_INT32);
 
     /* Generate code that executes if the new index entry is not unique */
     assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index aac130a..5876f99 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.668 2008/03/06 09:19:00 mlcreech Exp $
+** @(#) $Id: sqliteInt.h,v 1.669 2008/03/06 09:58:50 mlcreech Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -21,7 +21,12 @@
 ** the SQLite source tree.
 */
 #ifdef SQLITE_STANDARD_BUILD
-#include "common.h"
+# include "common.h"
+#endif
+
+#ifndef __sqlite3_intptr_defined
+  /* Fallbacks if doing a standalone build... */
+  typedef int sqlite3_intptr_t;
 #endif
 
 /*
diff --git a/src/table.c b/src/table.c
index 42fb66f..eac9168 100644
--- a/src/table.c
+++ b/src/table.c
@@ -145,7 +145,7 @@
   res.azResult[0] = 0;
   rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg);
   assert( sizeof(res.azResult[0])>= sizeof(res.nData) );
-  res.azResult[0] = (char*)(intptr_t)res.nData;
+  res.azResult[0] = (char*)(sqlite3_intptr_t)res.nData;
   if( (rc&0xff)==SQLITE_ABORT ){
     sqlite3_free_table(&res.azResult[1]);
     if( res.zErrMsg ){
@@ -187,10 +187,10 @@
   char **azResult            /* Result returned from from sqlite3_get_table() */
 ){
   if( azResult ){
-    intptr_t i, n;
+    sqlite3_intptr_t i, n;
     azResult--;
     assert( azResult!=0 );
-    n = (intptr_t)azResult[0];
+    n = (sqlite3_intptr_t)azResult[0];
     for(i=1; i<n; i++){ if( azResult[i] ) sqlite3_free(azResult[i]); }
     sqlite3_free(azResult);
   }
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index cd6f793..551c071 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -531,7 +531,7 @@
   if( n==P4_INT32 ){
     /* Note: this cast is safe, because the origin data point was an int
     ** that was cast to a (const char *). */
-    pOp->p4.i = (int)(intptr_t)zP4;
+    pOp->p4.i = (int)(sqlite3_intptr_t)zP4;
     pOp->p4type = n;
   }else if( zP4==0 ){
     pOp->p4.p = 0;
diff --git a/src/vdbemem.c b/src/vdbemem.c
index 3bbb04c..1bf3766 100644
--- a/src/vdbemem.c
+++ b/src/vdbemem.c
@@ -922,7 +922,7 @@
   expandBlob(pVal);
   if( pVal->flags&MEM_Str ){
     sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);
-    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&(intptr_t)pVal->z) ){
+    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&(sqlite3_intptr_t)pVal->z) ){
       assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 );
       if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){
         return 0;
diff --git a/src/vtab.c b/src/vtab.c
index c86e85a..eec604b 100644
--- a/src/vtab.c
+++ b/src/vtab.c
@@ -11,7 +11,7 @@
 *************************************************************************
 ** This file contains code used to help implement virtual tables.
 **
-** $Id: vtab.c,v 1.64 2008/03/06 07:35:22 mlcreech Exp $
+** $Id: vtab.c,v 1.65 2008/03/06 09:58:50 mlcreech Exp $
 */
 #ifndef SQLITE_OMIT_VIRTUALTABLE
 #include "sqliteInt.h"
@@ -611,7 +611,7 @@
 **
 ** The array is cleared after invoking the callbacks. 
 */
-static void callFinaliser(sqlite3 *db, intptr_t offset){
+static void callFinaliser(sqlite3 *db, sqlite3_intptr_t offset){
   int i;
   if( db->aVTrans ){
     for(i=0; i<db->nVTrans && db->aVTrans[i]; i++){
@@ -664,7 +664,7 @@
 ** sqlite3.aVTrans array. Then clear the array itself.
 */
 int sqlite3VtabRollback(sqlite3 *db){
-  callFinaliser(db, (intptr_t)(&((sqlite3_module *)0)->xRollback));
+  callFinaliser(db, (sqlite3_intptr_t)(&((sqlite3_module *)0)->xRollback));
   return SQLITE_OK;
 }
 
@@ -673,7 +673,7 @@
 ** sqlite3.aVTrans array. Then clear the array itself.
 */
 int sqlite3VtabCommit(sqlite3 *db){
-  callFinaliser(db, (intptr_t)(&((sqlite3_module *)0)->xCommit));
+  callFinaliser(db, (sqlite3_intptr_t)(&((sqlite3_module *)0)->xCommit));
   return SQLITE_OK;
 }