]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Added macros to convert between 32-bit ints and 64-bit ptrs to avoid compiler warning...
authorshane <shane@noemail.net>
Tue, 8 Jul 2008 22:28:48 +0000 (22:28 +0000)
committershane <shane@noemail.net>
Tue, 8 Jul 2008 22:28:48 +0000 (22:28 +0000)
FossilOrigin-Name: 6cdb6841ff4683e424ef394733da9c24f5602570

manifest
manifest.uuid
src/build.c
src/func.c
src/insert.c
src/sqliteInt.h
src/table.c
src/vdbeaux.c
src/vdbemem.c
src/where.c

index 3f5ac4825b9c80385b6b24e392e7333374c45432..29b78e36d422d0be116c4ad4592de2f0189640e6 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Added\stest_mutex.c\s(for\stestfixture)\sto\sinput\sfile\sfor\sconfigure\sscript.\s(CVS\s5377)
-D 2008-07-08T22:15:50
+C Added\smacros\sto\sconvert\sbetween\s32-bit\sints\sand\s64-bit\sptrs\sto\savoid\scompiler\swarnings.\s(CVS\s5378)
+D 2008-07-08T22:28:49
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -98,19 +98,19 @@ F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2
 F src/btree.c a52b0a1d0459e3a028a90df84a84ec1c58148574
 F src/btree.h b1bd7e0b8c2e33658aaf447cb0d1d94f74664b6b
 F src/btreeInt.h 8f6e0817365ac822da0afffedc664ba03047718b
-F src/build.c f6a74df6d888a00ac91cec332d41f2292a002767
+F src/build.c c5985afa7f2519ffd2b93d575caa6d75d610156b
 F src/callback.c aa492a0ad8c2d454edff9fb8a57fae13743cf71d
 F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
 F src/date.c e841168e5520bbbb2a1cbcdce7531d8b23017b4d
 F src/delete.c d3fc5987f2eb88f7b9549d58a5dfea079a83fe8b
 F src/expr.c 8f2caa888af148ebf9cdb2cf7ffaae2a09767c48
 F src/fault.c 3638519d1e0b82bccfafcb9f5ff491918b28f8e1
-F src/func.c 1e7d9569570134ac0771a00382d9d4b41c4aa052
+F src/func.c 08422a7bd06c25c5e6823d525f7c63563e3fcf61
 F src/global.c f12dc84d23f52d2ed42d1bdb5460fa3caf63e890
 F src/hash.c eb64e48f3781100e5934f759fbe72a63a8fe78cb
 F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
 F src/hwtime.h 745961687a65ef8918cd551c02e5ccb4b8e772de
-F src/insert.c 6203674c043a25ef2064743ca2c5553f5b58ccd9
+F src/insert.c d20fb21ef632ec4b5ba196edbdd7a1cb15b1f1e7
 F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
 F src/legacy.c 3626c71fb70912abec9a4312beba753a9ce800df
 F src/loadext.c ae0eed9fa96d74172d2a90ee63b5bc36d284295c
@@ -144,10 +144,10 @@ F src/select.c 5ff8bc0ec204d02fb9d61ce59d5efc80680b8897
 F src/shell.c 484e7297e066f22830f9c15d7abbcdd2acb097b0
 F src/sqlite.h.in 22c32cedf7e435d5b3bb8564ce0a640c40dbbfb1
 F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
-F src/sqliteInt.h 5add05d6e2369503673c8795d684e366e8e14402
+F src/sqliteInt.h 97c17728266bef590721276ef19c68c2fe577c4e
 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
 F src/status.c 6cb10377992505bd69f1ca1d75c1240a65f25a58
-F src/table.c 1fa8f8113ac9cbc09ae4801c6d2a7f0af82c5822
+F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
 F src/tclsqlite.c 4dd9ee4cb44846ad9bcc4d0da8088c1e7d4b33d9
 F src/test1.c 30bdb22f911efd492c4f49565eae014330231ece
 F src/test2.c c46d146019ab6e37474e66b3c789e5237d9ea7b7
@@ -185,12 +185,12 @@ F src/vdbe.c 4b3c7d0c7f68ec241bebe075c26a46a1618a32cb
 F src/vdbe.h c46155c221418bea29ee3a749d5950fcf85a70e2
 F src/vdbeInt.h 30535c1d30ba1b5fb58d8f0e1d1261af976558aa
 F src/vdbeapi.c a7c6b8db324cf7eccff32de871dea36aa305c994
-F src/vdbeaux.c c037e3279ccef6c960ff1c529c7ab2a7431dc451
+F src/vdbeaux.c 734d27d1e18bb4fb3c7f94d499039a8d3bbf8407
 F src/vdbeblob.c 9345f6dcd675fdcfdb537d2d2f487542d9ea136a
 F src/vdbefifo.c c46dae1194e4277bf007144d7e5b0c0b1c24f136
-F src/vdbemem.c ee1a032b44ab59bd83a064544a0895003eecaec1
+F src/vdbemem.c 3a27b04a25e933a46e9609356426f802fd1ef945
 F src/vtab.c 2096c03ec5540a43c8c73a8f43407dfd3549a982
-F src/where.c 013a14f8e64686c2cea13eda5f2dbfcfdbb4d33a
+F src/where.c e8a241aab7dc7b43be697de30f2469046d1eca69
 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/all.test ed6849e7a425620d5d4388409f3b15901b5bc2e7
@@ -600,7 +600,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P b40d9496d03b16a25c164bbb694860539f77cbc3
-R cd1100607ecda4285f414b5cc8debe5d
+P bfca089dbfa742c5ba3a530f61b5e979935d127f
+R 2fd5b0b488f6cefac45207b2dc106528
 U shane
-Z 13f1570fbf6a7563b5523ff34acfea48
+Z 21361f9c1827dc63347e00a7ff2f8aa2
index 03ae43255e6ba77433617671fa4a771f65390435..e68cf9c580e2a3468c16447d2951ae64651469b1 100644 (file)
@@ -1 +1 @@
-bfca089dbfa742c5ba3a530f61b5e979935d127f
\ No newline at end of file
+6cdb6841ff4683e424ef394733da9c24f5602570
\ No newline at end of file
index 1cff08b1fe9e42a16c5e502f2a963b89ee0941d9..926015fe9b05c3e20a71d80595dbd2205a0dc1fc 100644 (file)
@@ -22,7 +22,7 @@
 **     COMMIT
 **     ROLLBACK
 **
-** $Id: build.c,v 1.488 2008/07/08 19:34:07 drh Exp $
+** $Id: build.c,v 1.489 2008/07/08 22:28:49 shane Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -2302,7 +2302,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
     regRowid = regIdxKey + pIndex->nColumn;
     j1 = sqlite3VdbeAddOp3(v, OP_IsNull, regIdxKey, 0, pIndex->nColumn);
     j2 = sqlite3VdbeAddOp4(v, OP_IsUnique, iIdx,
-                           0, regRowid, (char*)regRecord, P4_INT32);
+                           0, regRowid, SQLITE_INT_TO_PTR(regRecord), P4_INT32);
     sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, OE_Abort, 0,
                     "indexed columns are not unique", P4_STATIC);
     sqlite3VdbeJumpHere(v, j1);
index 014d0af7f48255de20fdc9adbb0d142a58bdf213..47709caab7b0a0722c4a7555a5384fed0db2bf25 100644 (file)
@@ -16,7 +16,7 @@
 ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: func.c,v 1.194 2008/06/18 15:34:10 drh Exp $
+** $Id: func.c,v 1.195 2008/07/08 22:28:49 shane Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -908,7 +908,7 @@ static void trimFunc(
     }
   }
   if( nChar>0 ){
-    flags = (int)sqlite3_user_data(context);
+    flags = SQLITE_PTR_TO_INT(sqlite3_user_data(context));
     if( flags & 1 ){
       while( nIn>0 ){
         int len;
@@ -1286,7 +1286,7 @@ void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
   for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
     void *pArg;
     u8 argType = aFuncs[i].argType;
-    pArg = (void*)(int)argType;
+    pArg = SQLITE_INT_TO_PTR(argType);
     sqlite3CreateFunc(db, aFuncs[i].zName, aFuncs[i].nArg,
         aFuncs[i].eTextRep, pArg, aFuncs[i].xFunc, 0, 0);
     if( aFuncs[i].needCollSeq ){
@@ -1304,7 +1304,7 @@ void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
   sqlite3AttachFunctions(db);
 #endif
   for(i=0; i<sizeof(aAggs)/sizeof(aAggs[0]); i++){
-    void *pArg = (void*)(int)aAggs[i].argType;
+    void *pArg = SQLITE_INT_TO_PTR(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 ){
index bada466542b14cd72b6721bb9e0dafe1445a02ed..586775e5c6e63464f2cb03dbfa1d4da78d1c098b 100644 (file)
@@ -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.245 2008/07/08 19:34:07 drh Exp $
+** $Id: insert.c,v 1.246 2008/07/08 22:28:49 shane Exp $
 */
 #include "sqliteInt.h"
 
@@ -1258,7 +1258,7 @@ void sqlite3GenerateConstraintChecks(
     regR = sqlite3GetTempReg(pParse);
     sqlite3VdbeAddOp2(v, OP_SCopy, regRowid-hasTwoRowids, regR);
     j3 = sqlite3VdbeAddOp4(v, OP_IsUnique, baseCur+iCur+1, 0,
-                           regR, (char*)aRegIdx[iCur],
+                           regR, SQLITE_INT_TO_PTR(aRegIdx[iCur]),
                            P4_INT32);
 
     /* Generate code that executes if the new index entry is not unique */
index e56f6f51439580cd33c9ff0086954fcb6dcc97f6..103fd04fe6b690cf2aec9e4ffb8e93f5dffcafd6 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.736 2008/07/08 19:34:07 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.737 2008/07/08 22:28:49 shane Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
 # define unlikely(X)  !!(X)
 #endif
 
+/*
+ * This macro is used to "hide" some ugliness in casting an int
+ * value to a ptr value under the MSVC 64-bit compiler.   Casting
+ * non 64-bit values to ptr types results in a "hard" error with 
+ * the MSVC 64-bit compiler which this attempts to avoid.  
+ *
+ * A simple compiler pragma or casting sequence could not be found
+ * to correct this in all situations, so this macro was introduced.
+ *
+ * It could be argued that the intptr_t type could be used in this
+ * case, but that type is not available on all compilers, or 
+ * requires the #include of specific headers which differs between
+ * platforms.
+ */
+#define SQLITE_INT_TO_PTR(X)   ((void*)&((char*)0)[X])
+#define SQLITE_PTR_TO_INT(X)   ((int)(((char*)X)-(char*)0))
 
 /*
 ** These #defines should enable >2GB file support on Posix if the
index 563bf637f11be86db9163d0b6029a7dc9716bc7f..1bd1bd19e6c2f47a66098a3651e913dc84614baa 100644 (file)
@@ -16,7 +16,7 @@
 ** These routines are in a separate files so that they will not be linked
 ** if they are not used.
 **
-** $Id: table.c,v 1.35 2008/05/16 04:51:55 danielk1977 Exp $
+** $Id: table.c,v 1.36 2008/07/08 22:28:49 shane Exp $
 */
 #include "sqliteInt.h"
 #include <stdlib.h>
@@ -147,7 +147,7 @@ int sqlite3_get_table(
   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*)res.nData;
+  res.azResult[0] = SQLITE_INT_TO_PTR(res.nData);
   if( (rc&0xff)==SQLITE_ABORT ){
     sqlite3_free_table(&res.azResult[1]);
     if( res.zErrMsg ){
@@ -192,7 +192,7 @@ void sqlite3_free_table(
     int i, n;
     azResult--;
     assert( azResult!=0 );
-    n = (int)azResult[0];
+    n = SQLITE_PTR_TO_INT(azResult[0]);
     for(i=1; i<n; i++){ if( azResult[i] ) sqlite3_free(azResult[i]); }
     sqlite3_free(azResult);
   }
index 0a7dc6e6f887c14d6ec83cc79792fbd99cc64506..b774d994e52b2789ad8d12fe0103c3ff0cbb07c7 100644 (file)
@@ -14,7 +14,7 @@
 ** to version 2.8.7, all this code was combined into the vdbe.c source file.
 ** But that file was getting too big so this subroutines were split out.
 **
-** $Id: vdbeaux.c,v 1.394 2008/07/08 19:34:07 drh Exp $
+** $Id: vdbeaux.c,v 1.395 2008/07/08 22:28:49 shane Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -535,7 +535,7 @@ void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){
   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)zP4;
+    pOp->p4.i = SQLITE_PTR_TO_INT(zP4);
     pOp->p4type = n;
   }else if( zP4==0 ){
     pOp->p4.p = 0;
index 7abf08dc7d61e660b779ee470161fe09d50836b2..22ca21d9a3983d379a06d3f4d1b86c834622f9fd 100644 (file)
@@ -15,7 +15,7 @@
 ** only within the VDBE.  Interface routines refer to a Mem using the
 ** name sqlite_value
 **
-** $Id: vdbemem.c,v 1.116 2008/07/08 14:52:10 drh Exp $
+** $Id: vdbemem.c,v 1.117 2008/07/08 22:28:49 shane Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -904,7 +904,7 @@ const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){
   expandBlob(pVal);
   if( pVal->flags&MEM_Str ){
     sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);
-    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&(int)pVal->z) ){
+    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){
       assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 );
       if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){
         return 0;
index 069b70778f407fb780eddf1798c506d7a9aa947a..b59450a0c77e235e870ddaf0c72a07622d3736e2 100644 (file)
@@ -16,7 +16,7 @@
 ** so is applicable.  Because this module is responsible for selecting
 ** indices, you might also think of this module as the "query optimizer".
 **
-** $Id: where.c,v 1.313 2008/07/08 19:45:02 drh Exp $
+** $Id: where.c,v 1.314 2008/07/08 22:28:49 shane Exp $
 */
 #include "sqliteInt.h"
 
@@ -2605,7 +2605,7 @@ WhereInfo *sqlite3WhereBegin(
       testcase( op==OP_MoveLe );
       testcase( op==OP_MoveLt );
       sqlite3VdbeAddOp4(v, op, iIdxCur, nxt, regBase, 
-                        (char*)nConstraint, P4_INT32);
+                        SQLITE_INT_TO_PTR(nConstraint), P4_INT32);
 
       /* Load the value for the inequality constraint at the end of the
       ** range (if any).
@@ -2627,7 +2627,7 @@ WhereInfo *sqlite3WhereBegin(
       testcase( op==OP_IdxGE );
       testcase( op==OP_IdxLT );
       sqlite3VdbeAddOp4(v, op, iIdxCur, nxt, regBase,
-                        (char*)nConstraint, P4_INT32);
+                        SQLITE_INT_TO_PTR(nConstraint), P4_INT32);
       sqlite3VdbeChangeP5(v, endEq!=bRev);
 
       /* If there are inequality constraints, check that the value