/ Check-in [54839a84]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use intptr_t definition to silence warnings about ptr-int casts (CVS 4824)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 54839a84e6ce080ea8a0f6ce32acaa053d20f311
User & Date: mlcreech 2008-03-06 07:35:22
Context
2008-03-06
07:36
Add headers for use with autoconf (missing from previous checkin) (CVS 4825) check-in: 4513a5f4 user: mlcreech tags: trunk
07:35
Use intptr_t definition to silence warnings about ptr-int casts (CVS 4824) check-in: 54839a84 user: mlcreech tags: trunk
07:19
Include inttypes.h when available, add support for intptr_t (CVS 4823) check-in: 88698fbd user: mlcreech tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

    18     18   **     CREATE INDEX
    19     19   **     DROP INDEX
    20     20   **     creating ID lists
    21     21   **     BEGIN TRANSACTION
    22     22   **     COMMIT
    23     23   **     ROLLBACK
    24     24   **
    25         -** $Id: build.c,v 1.472 2008/01/31 13:35:49 drh Exp $
           25  +** $Id: build.c,v 1.473 2008/03/06 07:35:22 mlcreech Exp $
    26     26   */
    27     27   #include "sqliteInt.h"
    28     28   #include <ctype.h>
    29     29   
    30     30   /*
    31     31   ** This routine is called when a new SQL statement is beginning to
    32     32   ** be parsed.  Initialize the pParse structure as needed.
................................................................................
  2279   2279     if( pIndex->onError!=OE_None ){
  2280   2280       int j1, j2;
  2281   2281       int regRowid;
  2282   2282   
  2283   2283       regRowid = regIdxKey + pIndex->nColumn;
  2284   2284       j1 = sqlite3VdbeAddOp3(v, OP_IsNull, regIdxKey, 0, pIndex->nColumn);
  2285   2285       j2 = sqlite3VdbeAddOp4(v, OP_IsUnique, iIdx,
  2286         -                           0, regRowid, (char*)regRecord, P4_INT32);
         2286  +                           0, regRowid, (char*)(intptr_t)regRecord, P4_INT32);
  2287   2287       sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, OE_Abort, 0,
  2288   2288                       "indexed columns are not unique", P4_STATIC);
  2289   2289       sqlite3VdbeJumpHere(v, j1);
  2290   2290       sqlite3VdbeJumpHere(v, j2);
  2291   2291     }
  2292   2292     sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord);
  2293   2293     sqlite3ReleaseTempReg(pParse, regRecord);

Changes to src/func.c.

    12     12   ** This file contains the C functions that implement various SQL
    13     13   ** functions of SQLite.  
    14     14   **
    15     15   ** There is only one exported symbol in this file - the function
    16     16   ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
    17     17   ** All other code has file scope.
    18     18   **
    19         -** $Id: func.c,v 1.184 2008/02/19 18:29:07 drh Exp $
           19  +** $Id: func.c,v 1.185 2008/03/06 07:35:22 mlcreech Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   #include <ctype.h>
    23     23   #include <stdlib.h>
    24     24   #include <assert.h>
    25     25   #include "vdbeInt.h"
    26     26   
................................................................................
   871    871     sqlite3_context *context,
   872    872     int argc,
   873    873     sqlite3_value **argv
   874    874   ){
   875    875     const unsigned char *zIn;         /* Input string */
   876    876     const unsigned char *zCharSet;    /* Set of characters to trim */
   877    877     int nIn;                          /* Number of bytes in input */
   878         -  int flags;                        /* 1: trimleft  2: trimright  3: trim */
          878  +  intptr_t flags;                   /* 1: trimleft  2: trimright  3: trim */
   879    879     int i;                            /* Loop counter */
   880    880     unsigned char *aLen;              /* Length of each character in zCharSet */
   881    881     unsigned char **azChar;           /* Individual characters in zCharSet */
   882    882     int nChar;                        /* Number of characters in zCharSet */
   883    883   
   884    884     if( sqlite3_value_type(argv[0])==SQLITE_NULL ){
   885    885       return;
................................................................................
   912    912           azChar[nChar] = (unsigned char *)z;
   913    913           SQLITE_SKIP_UTF8(z);
   914    914           aLen[nChar] = z - azChar[nChar];
   915    915         }
   916    916       }
   917    917     }
   918    918     if( nChar>0 ){
   919         -    flags = (int)sqlite3_user_data(context);
          919  +    flags = (intptr_t)sqlite3_user_data(context);
   920    920       if( flags & 1 ){
   921    921         while( nIn>0 ){
   922    922           int len;
   923    923           for(i=0; i<nChar; i++){
   924    924             len = aLen[i];
   925    925             if( memcmp(zIn, azChar[i], len)==0 ) break;
   926    926           }
................................................................................
  1455   1455   
  1456   1456     for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
  1457   1457       void *pArg;
  1458   1458       u8 argType = aFuncs[i].argType;
  1459   1459       if( argType==0xff ){
  1460   1460         pArg = db;
  1461   1461       }else{
  1462         -      pArg = (void*)(int)argType;
         1462  +      pArg = (void*)(intptr_t)argType;
  1463   1463       }
  1464   1464       sqlite3CreateFunc(db, aFuncs[i].zName, aFuncs[i].nArg,
  1465   1465           aFuncs[i].eTextRep, pArg, aFuncs[i].xFunc, 0, 0);
  1466   1466       if( aFuncs[i].needCollSeq ){
  1467   1467         FuncDef *pFunc = sqlite3FindFunction(db, aFuncs[i].zName, 
  1468   1468             strlen(aFuncs[i].zName), aFuncs[i].nArg, aFuncs[i].eTextRep, 0);
  1469   1469         if( pFunc && aFuncs[i].needCollSeq ){
................................................................................
  1474   1474   #ifndef SQLITE_OMIT_ALTERTABLE
  1475   1475     sqlite3AlterFunctions(db);
  1476   1476   #endif
  1477   1477   #ifndef SQLITE_OMIT_PARSER
  1478   1478     sqlite3AttachFunctions(db);
  1479   1479   #endif
  1480   1480     for(i=0; i<sizeof(aAggs)/sizeof(aAggs[0]); i++){
  1481         -    void *pArg = (void*)(int)aAggs[i].argType;
         1481  +    void *pArg = (void*)(intptr_t)aAggs[i].argType;
  1482   1482       sqlite3CreateFunc(db, aAggs[i].zName, aAggs[i].nArg, SQLITE_UTF8, 
  1483   1483           pArg, 0, aAggs[i].xStep, aAggs[i].xFinalize);
  1484   1484       if( aAggs[i].needCollSeq ){
  1485   1485         FuncDef *pFunc = sqlite3FindFunction( db, aAggs[i].zName,
  1486   1486             strlen(aAggs[i].zName), aAggs[i].nArg, SQLITE_UTF8, 0);
  1487   1487         if( pFunc && aAggs[i].needCollSeq ){
  1488   1488           pFunc->needCollSeq = 1;

Changes to src/insert.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains C code routines that are called by the parser
    13     13   ** to handle INSERT statements in SQLite.
    14     14   **
    15         -** $Id: insert.c,v 1.229 2008/02/13 18:25:27 danielk1977 Exp $
           15  +** $Id: insert.c,v 1.230 2008/03/06 07:35:22 mlcreech Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** Set P4 of the most recently inserted opcode to a column affinity
    21     21   ** string for index pIdx. A column affinity string has one character
    22     22   ** for each column in the table, according to the affinity of the column:
................................................................................
  1189   1189       
  1190   1190   
  1191   1191       /* Check to see if the new index entry will be unique */
  1192   1192       j2 = sqlite3VdbeAddOp3(v, OP_IsNull, regIdx, 0, pIdx->nColumn);
  1193   1193       regR = sqlite3GetTempReg(pParse);
  1194   1194       sqlite3VdbeAddOp2(v, OP_SCopy, regRowid-hasTwoRowids, regR);
  1195   1195       j3 = sqlite3VdbeAddOp4(v, OP_IsUnique, baseCur+iCur+1, 0,
  1196         -                           regR, (char*)aRegIdx[iCur], P4_INT32);
         1196  +                           regR, (char*)(intptr_t)aRegIdx[iCur], P4_INT32);
  1197   1197   
  1198   1198       /* Generate code that executes if the new index entry is not unique */
  1199   1199       assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
  1200   1200           || onError==OE_Ignore || onError==OE_Replace );
  1201   1201       switch( onError ){
  1202   1202         case OE_Rollback:
  1203   1203         case OE_Abort:

Changes to src/table.c.

   141    141     if( res.azResult==0 ){
   142    142        db->errCode = SQLITE_NOMEM;
   143    143        return SQLITE_NOMEM;
   144    144     }
   145    145     res.azResult[0] = 0;
   146    146     rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg);
   147    147     assert( sizeof(res.azResult[0])>= sizeof(res.nData) );
   148         -  res.azResult[0] = (char*)res.nData;
          148  +  res.azResult[0] = (char*)(intptr_t)res.nData;
   149    149     if( (rc&0xff)==SQLITE_ABORT ){
   150    150       sqlite3_free_table(&res.azResult[1]);
   151    151       if( res.zErrMsg ){
   152    152         if( pzErrMsg ){
   153    153           sqlite3_free(*pzErrMsg);
   154    154           *pzErrMsg = sqlite3_mprintf("%s",res.zErrMsg);
   155    155         }
................................................................................
   183    183   /*
   184    184   ** This routine frees the space the sqlite3_get_table() malloced.
   185    185   */
   186    186   void sqlite3_free_table(
   187    187     char **azResult            /* Result returned from from sqlite3_get_table() */
   188    188   ){
   189    189     if( azResult ){
   190         -    int i, n;
          190  +    intptr_t i, n;
   191    191       azResult--;
   192    192       assert( azResult!=0 );
   193         -    n = (int)azResult[0];
          193  +    n = (intptr_t)azResult[0];
   194    194       for(i=1; i<n; i++){ if( azResult[i] ) sqlite3_free(azResult[i]); }
   195    195       sqlite3_free(azResult);
   196    196     }
   197    197   }
   198    198   
   199    199   #endif /* SQLITE_OMIT_GET_TABLE */

Changes to src/vdbeaux.c.

   525    525       addr = p->nOp - 1;
   526    526       if( addr<0 ) return;
   527    527     }
   528    528     pOp = &p->aOp[addr];
   529    529     freeP4(pOp->p4type, pOp->p4.p);
   530    530     pOp->p4.p = 0;
   531    531     if( n==P4_INT32 ){
   532         -    pOp->p4.i = (int)zP4;
          532  +    /* Note: this cast is safe, because the origin data point was an int
          533  +    ** that was cast to a (const char *). */
          534  +    pOp->p4.i = (int)(intptr_t)zP4;
   533    535       pOp->p4type = n;
   534    536     }else if( zP4==0 ){
   535    537       pOp->p4.p = 0;
   536    538       pOp->p4type = P4_NOTUSED;
   537    539     }else if( n==P4_KEYINFO ){
   538    540       KeyInfo *pKeyInfo;
   539    541       int nField, nByte;

Changes to src/vdbemem.c.

   918    918       return 0;
   919    919     }
   920    920     assert( (MEM_Blob>>3) == MEM_Str );
   921    921     pVal->flags |= (pVal->flags & MEM_Blob)>>3;
   922    922     expandBlob(pVal);
   923    923     if( pVal->flags&MEM_Str ){
   924    924       sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);
   925         -    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&(int)pVal->z) ){
          925  +    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&(intptr_t)pVal->z) ){
   926    926         assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 );
   927    927         if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){
   928    928           return 0;
   929    929         }
   930    930       }
   931    931       sqlite3VdbeMemNulTerminate(pVal);
   932    932     }else{

Changes to src/vtab.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to help implement virtual tables.
    13     13   **
    14         -** $Id: vtab.c,v 1.63 2008/01/23 03:03:05 drh Exp $
           14  +** $Id: vtab.c,v 1.64 2008/03/06 07:35:22 mlcreech Exp $
    15     15   */
    16     16   #ifndef SQLITE_OMIT_VIRTUALTABLE
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   static int createModule(
    20     20     sqlite3 *db,                    /* Database in which module is registered */
    21     21     const char *zName,              /* Name assigned to this module */
................................................................................
   607    607   ** This function invokes either the xRollback or xCommit method
   608    608   ** of each of the virtual tables in the sqlite3.aVTrans array. The method
   609    609   ** called is identified by the second argument, "offset", which is
   610    610   ** the offset of the method to call in the sqlite3_module structure.
   611    611   **
   612    612   ** The array is cleared after invoking the callbacks. 
   613    613   */
   614         -static void callFinaliser(sqlite3 *db, int offset){
          614  +static void callFinaliser(sqlite3 *db, intptr_t offset){
   615    615     int i;
   616    616     if( db->aVTrans ){
   617    617       for(i=0; i<db->nVTrans && db->aVTrans[i]; i++){
   618    618         sqlite3_vtab *pVtab = db->aVTrans[i];
   619    619         int (*x)(sqlite3_vtab *);
   620    620         x = *(int (**)(sqlite3_vtab *))((char *)pVtab->pModule + offset);
   621    621         if( x ) x(pVtab);
................................................................................
   660    660   }
   661    661   
   662    662   /*
   663    663   ** Invoke the xRollback method of all virtual tables in the 
   664    664   ** sqlite3.aVTrans array. Then clear the array itself.
   665    665   */
   666    666   int sqlite3VtabRollback(sqlite3 *db){
   667         -  callFinaliser(db, (int)(&((sqlite3_module *)0)->xRollback));
          667  +  callFinaliser(db, (intptr_t)(&((sqlite3_module *)0)->xRollback));
   668    668     return SQLITE_OK;
   669    669   }
   670    670   
   671    671   /*
   672    672   ** Invoke the xCommit method of all virtual tables in the 
   673    673   ** sqlite3.aVTrans array. Then clear the array itself.
   674    674   */
   675    675   int sqlite3VtabCommit(sqlite3 *db){
   676         -  callFinaliser(db, (int)(&((sqlite3_module *)0)->xCommit));
          676  +  callFinaliser(db, (intptr_t)(&((sqlite3_module *)0)->xCommit));
   677    677     return SQLITE_OK;
   678    678   }
   679    679   
   680    680   /*
   681    681   ** If the virtual table pVtab supports the transaction interface
   682    682   ** (xBegin/xRollback/xCommit and optionally xSync) and a transaction is
   683    683   ** not currently open, invoke the xBegin method now.