/ Check-in [83a59151]
Login

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

Overview
Comment:Clean up annoying (and pointless) compiler warnings about differing signedness. (CVS 2810)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 83a59151559d9496d4f546e03e65087ea974717d
User & Date: drh 2005-12-09 20:02:05
Context
2005-12-09
20:21
More annoying and pointless signedness warnings fixed. (CVS 2811) check-in: 590578be user: drh tags: trunk
20:02
Clean up annoying (and pointless) compiler warnings about differing signedness. (CVS 2810) check-in: 83a59151 user: drh tags: trunk
14:39
Define the sqliteMalloc() macro differently to avoid a compiler warning. (CVS 2809) check-in: 3d177bde user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/alter.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 used to generate VDBE code
    13     13   ** that implements the ALTER TABLE command.
    14     14   **
    15         -** $Id: alter.c,v 1.10 2005/12/06 12:52:59 danielk1977 Exp $
           15  +** $Id: alter.c,v 1.11 2005/12/09 20:02:05 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /*
    21     21   ** The code in this file only exists if we are not omitting the
    22     22   ** ALTER TABLE logic from the build.
................................................................................
    43     43     sqlite3_value **argv
    44     44   ){
    45     45     unsigned char const *zSql = sqlite3_value_text(argv[0]);
    46     46     unsigned char const *zTableName = sqlite3_value_text(argv[1]);
    47     47   
    48     48     int token;
    49     49     Token tname;
    50         -  char const *zCsr = zSql;
           50  +  unsigned char const *zCsr = zSql;
    51     51     int len = 0;
    52     52     char *zRet;
    53     53   
    54     54     /* The principle used to locate the table name in the CREATE TABLE 
    55     55     ** statement is that the table name is the first token that is immediatedly
    56     56     ** followed by a left parenthesis - TK_LP.
    57     57     */
................................................................................
    92     92   ){
    93     93     unsigned char const *zSql = sqlite3_value_text(argv[0]);
    94     94     unsigned char const *zTableName = sqlite3_value_text(argv[1]);
    95     95   
    96     96     int token;
    97     97     Token tname;
    98     98     int dist = 3;
    99         -  char const *zCsr = zSql;
           99  +  unsigned char const *zCsr = zSql;
   100    100     int len = 0;
   101    101     char *zRet;
   102    102   
   103    103     /* The principle used to locate the table name in the CREATE TRIGGER 
   104    104     ** statement is that the table name is the first token that is immediatedly
   105    105     ** preceded by either TK_ON or TK_DOT and immediatedly followed by one
   106    106     ** of TK_WHEN, TK_BEGIN or TK_FOR.
................................................................................
   438    438         sqlite3ErrorMsg(pParse, "Cannot add a column with non-constant default");
   439    439         return;
   440    440       }
   441    441       sqlite3ValueFree(pVal);
   442    442     }
   443    443   
   444    444     /* Modify the CREATE TABLE statement. */
   445         -  zCol = sqliteStrNDup(pColDef->z, pColDef->n);
          445  +  zCol = sqliteStrNDup((char*)pColDef->z, pColDef->n);
   446    446     if( zCol ){
   447    447       char *zEnd = &zCol[pColDef->n-1];
   448    448       while( (zEnd>zCol && *zEnd==';') || isspace(*(unsigned char *)zEnd) ){
   449    449         *zEnd-- = '\0';
   450    450       }
   451    451       sqlite3NestedParse(pParse, 
   452    452           "UPDATE %Q.%s SET "

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     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         -** $Id: btree.c,v 1.272 2005/11/24 14:34:36 drh Exp $
           12  +** $Id: btree.c,v 1.273 2005/12/09 20:02:05 drh Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** For a detailed discussion of BTrees, refer to
    16     16   **
    17     17   **     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
    18     18   **     "Sorting And Searching", pages 473-480. Addison-Wesley
    19     19   **     Publishing Company, Reading, Massachusetts.
................................................................................
  1531   1531   **
  1532   1532   ** If there is a transaction in progress, this routine is a no-op.
  1533   1533   */
  1534   1534   static void unlockBtreeIfUnused(Btree *pBt){
  1535   1535     if( pBt->inTrans==TRANS_NONE && pBt->pCursor==0 && pBt->pPage1!=0 ){
  1536   1536       if( pBt->pPage1->aData==0 ){
  1537   1537         MemPage *pPage = pBt->pPage1;
  1538         -      pPage->aData = &((char*)pPage)[-pBt->pageSize];
         1538  +      pPage->aData = &((u8*)pPage)[-pBt->pageSize];
  1539   1539         pPage->pBt = pBt;
  1540   1540         pPage->pgno = 1;
  1541   1541       }
  1542   1542       releasePage(pBt->pPage1);
  1543   1543       pBt->pPage1 = 0;
  1544   1544       pBt->inStmt = 0;
  1545   1545     }

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.356 2005/12/06 12:52:59 danielk1977 Exp $
           25  +** $Id: build.c,v 1.357 2005/12/09 20:02:05 drh 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.
................................................................................
   505    505   ** Tokens are often just pointers into the original SQL text and so
   506    506   ** are not \000 terminated and are not persistent.  The returned string
   507    507   ** is \000 terminated and is persistent.
   508    508   */
   509    509   char *sqlite3NameFromToken(Token *pName){
   510    510     char *zName;
   511    511     if( pName ){
   512         -    zName = sqliteStrNDup(pName->z, pName->n);
          512  +    zName = sqliteStrNDup((char*)pName->z, pName->n);
   513    513       sqlite3Dequote(zName);
   514    514     }else{
   515    515       zName = 0;
   516    516     }
   517    517     return zName;
   518    518   }
   519    519   
................................................................................
  2220   2220   #endif
  2221   2221   
  2222   2222     /* If pList==0, it means this routine was called to make a primary
  2223   2223     ** key out of the last column added to the table under construction.
  2224   2224     ** So create a fake list to simulate this.
  2225   2225     */
  2226   2226     if( pList==0 ){
  2227         -    nullId.z = pTab->aCol[pTab->nCol-1].zName;
  2228         -    nullId.n = strlen(nullId.z);
         2227  +    nullId.z = (u8*)pTab->aCol[pTab->nCol-1].zName;
         2228  +    nullId.n = strlen((char*)nullId.z);
  2229   2229       pList = sqlite3ExprListAppend(0, 0, &nullId);
  2230   2230       if( pList==0 ) goto exit_create_index;
  2231   2231     }
  2232   2232   
  2233   2233     /* 
  2234   2234     ** Allocate the index structure. 
  2235   2235     */
................................................................................
  2976   2976       return;
  2977   2977     }
  2978   2978   
  2979   2979     if( pName1==0 || pName1->z==0 ){
  2980   2980       reindexDatabases(pParse, 0);
  2981   2981       return;
  2982   2982     }else if( pName2==0 || pName2->z==0 ){
  2983         -    pColl = sqlite3FindCollSeq(db, db->enc, pName1->z, pName1->n, 0);
         2983  +    pColl = sqlite3FindCollSeq(db, db->enc, (char*)pName1->z, pName1->n, 0);
  2984   2984       if( pColl ){
  2985   2985         reindexDatabases(pParse, pColl);
  2986   2986         return;
  2987   2987       }
  2988   2988     }
  2989   2989     iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pObjName);
  2990   2990     if( iDb<0 ) return;

Changes to src/date.c.

    12     12   ** This file contains the C functions that implement date and time
    13     13   ** functions for SQLite.  
    14     14   **
    15     15   ** There is only one exported symbol in this file - the function
    16     16   ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
    17     17   ** All other code has file scope.
    18     18   **
    19         -** $Id: date.c,v 1.46 2005/11/30 03:20:31 drh Exp $
           19  +** $Id: date.c,v 1.47 2005/12/09 20:02:05 drh Exp $
    20     20   **
    21     21   ** NOTES:
    22     22   **
    23     23   ** SQLite processes all times and dates as Julian Day numbers.  The
    24     24   ** dates and times are stored as the number of days since noon
    25     25   ** in Greenwich on November 24, 4714 B.C. according to the Gregorian
    26     26   ** calendar system.
................................................................................
   635    635   ** the resulting time into the DateTime structure p.  Return 0
   636    636   ** on success and 1 if there are any errors.
   637    637   */
   638    638   static int isDate(int argc, sqlite3_value **argv, DateTime *p){
   639    639     int i;
   640    640     if( argc==0 ) return 1;
   641    641     if( SQLITE_NULL==sqlite3_value_type(argv[0]) || 
   642         -      parseDateOrTime(sqlite3_value_text(argv[0]), p) ) return 1;
          642  +      parseDateOrTime((char*)sqlite3_value_text(argv[0]), p) ) return 1;
   643    643     for(i=1; i<argc; i++){
   644    644       if( SQLITE_NULL==sqlite3_value_type(argv[i]) || 
   645         -        parseModifier(sqlite3_value_text(argv[i]), p) ) return 1;
          645  +        parseModifier((char*)sqlite3_value_text(argv[i]), p) ) return 1;
   646    646     }
   647    647     return 0;
   648    648   }
   649    649   
   650    650   
   651    651   /*
   652    652   ** The following routines implement the various date and time functions
................................................................................
   751    751     sqlite3_context *context,
   752    752     int argc,
   753    753     sqlite3_value **argv
   754    754   ){
   755    755     DateTime x;
   756    756     int n, i, j;
   757    757     char *z;
   758         -  const char *zFmt = sqlite3_value_text(argv[0]);
          758  +  const char *zFmt = (const char*)sqlite3_value_text(argv[0]);
   759    759     char zBuf[100];
   760    760     if( zFmt==0 || isDate(argc-1, argv+1, &x) ) return;
   761    761     for(i=0, n=1; zFmt[i]; i++, n++){
   762    762       if( zFmt[i]=='%' ){
   763    763         switch( zFmt[i+1] ){
   764    764           case 'd':
   765    765           case 'H':

Changes to src/expr.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 routines used for analyzing expressions and
    13     13   ** for generating VDBE code that evaluates expressions in SQLite.
    14     14   **
    15         -** $Id: expr.c,v 1.241 2005/12/06 12:52:59 danielk1977 Exp $
           15  +** $Id: expr.c,v 1.242 2005/12/09 20:02:05 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /*
    21     21   ** Return the 'affinity' of the expression pExpr if any.
    22     22   **
................................................................................
   231    231       return 0;
   232    232     }
   233    233     if( v==0 ) return 0;
   234    234     p = sqlite3Expr(TK_REGISTER, 0, 0, pToken);
   235    235     if( p==0 ){
   236    236       return 0;  /* Malloc failed */
   237    237     }
   238         -  depth = atoi(&pToken->z[1]);
          238  +  depth = atoi((char*)&pToken->z[1]);
   239    239     p->iTable = pParse->nMem++;
   240    240     sqlite3VdbeAddOp(v, OP_Dup, depth, 0);
   241    241     sqlite3VdbeAddOp(v, OP_MemStore, p->iTable, 1);
   242    242     return p;
   243    243   }
   244    244   
   245    245   /*
................................................................................
   323    323     if( pToken->n==1 ){
   324    324       /* Wildcard of the form "?".  Assign the next variable number */
   325    325       pExpr->iTable = ++pParse->nVar;
   326    326     }else if( pToken->z[0]=='?' ){
   327    327       /* Wildcard of the form "?nnn".  Convert "nnn" to an integer and
   328    328       ** use it as the variable number */
   329    329       int i;
   330         -    pExpr->iTable = i = atoi(&pToken->z[1]);
          330  +    pExpr->iTable = i = atoi((char*)&pToken->z[1]);
   331    331       if( i<1 || i>SQLITE_MAX_VARIABLE_NUMBER ){
   332    332         sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",
   333    333             SQLITE_MAX_VARIABLE_NUMBER);
   334    334       }
   335    335       if( i>pParse->nVar ){
   336    336         pParse->nVar = i;
   337    337       }
................................................................................
   411    411   Expr *sqlite3ExprDup(Expr *p){
   412    412     Expr *pNew;
   413    413     if( p==0 ) return 0;
   414    414     pNew = sqliteMallocRaw( sizeof(*p) );
   415    415     if( pNew==0 ) return 0;
   416    416     memcpy(pNew, p, sizeof(*pNew));
   417    417     if( p->token.z!=0 ){
   418         -    pNew->token.z = sqliteStrNDup(p->token.z, p->token.n);
          418  +    pNew->token.z = (u8*)sqliteStrNDup((char*)p->token.z, p->token.n);
   419    419       pNew->token.dyn = 1;
   420    420     }else{
   421    421       assert( pNew->token.z==0 );
   422    422     }
   423    423     pNew->span.z = 0;
   424    424     pNew->pLeft = sqlite3ExprDup(p->pLeft);
   425    425     pNew->pRight = sqlite3ExprDup(p->pRight);
................................................................................
   428    428     pNew->pTab = p->pTab;
   429    429     return pNew;
   430    430   }
   431    431   void sqlite3TokenCopy(Token *pTo, Token *pFrom){
   432    432     if( pTo->dyn ) sqliteFree((char*)pTo->z);
   433    433     if( pFrom->z ){
   434    434       pTo->n = pFrom->n;
   435         -    pTo->z = sqliteStrNDup(pFrom->z, pFrom->n);
          435  +    pTo->z = (u8*)sqliteStrNDup((char*)pFrom->z, pFrom->n);
   436    436       pTo->dyn = 1;
   437    437     }else{
   438    438       pTo->z = 0;
   439    439     }
   440    440   }
   441    441   ExprList *sqlite3ExprListDup(ExprList *p){
   442    442     ExprList *pNew;
................................................................................
   748    748   ** to fit in a 32-bit integer, return 1 and put the value of the integer
   749    749   ** in *pValue.  If the expression is not an integer or if it is too big
   750    750   ** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.
   751    751   */
   752    752   int sqlite3ExprIsInteger(Expr *p, int *pValue){
   753    753     switch( p->op ){
   754    754       case TK_INTEGER: {
   755         -      if( sqlite3GetInt32(p->token.z, pValue) ){
          755  +      if( sqlite3GetInt32((char*)p->token.z, pValue) ){
   756    756           return 1;
   757    757         }
   758    758         break;
   759    759       }
   760    760       case TK_UPLUS: {
   761    761         return sqlite3ExprIsInteger(p->pLeft, pValue);
   762    762       }
................................................................................
  1146   1146         int is_agg = 0;             /* True if is an aggregate function */
  1147   1147         int i;
  1148   1148         int nId;                    /* Number of characters in function name */
  1149   1149         const char *zId;            /* The function name. */
  1150   1150         FuncDef *pDef;              /* Information about the function */
  1151   1151         int enc = pParse->db->enc;  /* The database encoding */
  1152   1152   
  1153         -      zId = pExpr->token.z;
         1153  +      zId = (char*)pExpr->token.z;
  1154   1154         nId = pExpr->token.n;
  1155   1155         pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0);
  1156   1156         if( pDef==0 ){
  1157   1157           pDef = sqlite3FindFunction(pParse->db, zId, nId, -1, enc, 0);
  1158   1158           if( pDef==0 ){
  1159   1159             no_such_func = 1;
  1160   1160           }else{
................................................................................
  1398   1398   
  1399   1399       case TK_EXISTS:
  1400   1400       case TK_SELECT: {
  1401   1401         /* This has to be a scalar SELECT.  Generate code to put the
  1402   1402         ** value of this select in a memory cell and record the number
  1403   1403         ** of the memory cell in iColumn.
  1404   1404         */
  1405         -      static const Token one = { "1", 0, 1 };
         1405  +      static const Token one = { (u8*)"1", 0, 1 };
  1406   1406         Select *pSel;
  1407   1407         int iMem;
  1408   1408         int sop;
  1409   1409   
  1410   1410         pExpr->iColumn = iMem = pParse->nMem++;
  1411   1411         pSel = pExpr->pSelect;
  1412   1412         if( pExpr->op==TK_SELECT ){
................................................................................
  1499   1499   #endif
  1500   1500         }else{
  1501   1501           sqlite3VdbeAddOp(v, OP_Rowid, pExpr->iTable, 0);
  1502   1502         }
  1503   1503         break;
  1504   1504       }
  1505   1505       case TK_INTEGER: {
  1506         -      codeInteger(v, pExpr->token.z, pExpr->token.n);
         1506  +      codeInteger(v, (char*)pExpr->token.z, pExpr->token.n);
  1507   1507         break;
  1508   1508       }
  1509   1509       case TK_FLOAT:
  1510   1510       case TK_STRING: {
  1511   1511         assert( TK_FLOAT==OP_Real );
  1512   1512         assert( TK_STRING==OP_String8 );
  1513   1513         sqlite3DequoteExpr(pExpr);
  1514         -      sqlite3VdbeOp3(v, op, 0, 0, pExpr->token.z, pExpr->token.n);
         1514  +      sqlite3VdbeOp3(v, op, 0, 0, (char*)pExpr->token.z, pExpr->token.n);
  1515   1515         break;
  1516   1516       }
  1517   1517       case TK_NULL: {
  1518   1518         sqlite3VdbeAddOp(v, OP_Null, 0, 0);
  1519   1519         break;
  1520   1520       }
  1521   1521   #ifndef SQLITE_OMIT_BLOB_LITERAL
  1522   1522       case TK_BLOB: {
  1523   1523         int n;
  1524   1524         const char *z;
  1525   1525         assert( TK_BLOB==OP_HexBlob );
  1526   1526         n = pExpr->token.n - 3;
  1527         -      z = pExpr->token.z + 2;
         1527  +      z = (char*)pExpr->token.z + 2;
  1528   1528         assert( n>=0 );
  1529   1529         if( n==0 ){
  1530   1530           z = "";
  1531   1531         }
  1532   1532         sqlite3VdbeOp3(v, op, 0, 0, z, n);
  1533   1533         break;
  1534   1534       }
  1535   1535   #endif
  1536   1536       case TK_VARIABLE: {
  1537   1537         sqlite3VdbeAddOp(v, OP_Variable, pExpr->iTable, 0);
  1538   1538         if( pExpr->token.n>1 ){
  1539         -        sqlite3VdbeChangeP3(v, -1, pExpr->token.z, pExpr->token.n);
         1539  +        sqlite3VdbeChangeP3(v, -1, (char*)pExpr->token.z, pExpr->token.n);
  1540   1540         }
  1541   1541         break;
  1542   1542       }
  1543   1543       case TK_REGISTER: {
  1544   1544         sqlite3VdbeAddOp(v, OP_MemLoad, pExpr->iTable, 0);
  1545   1545         break;
  1546   1546       }
................................................................................
  1663   1663         FuncDef *pDef;
  1664   1664         int nId;
  1665   1665         const char *zId;
  1666   1666         int constMask = 0;
  1667   1667         int i;
  1668   1668         u8 enc = pParse->db->enc;
  1669   1669         CollSeq *pColl = 0;
  1670         -      zId = pExpr->token.z;
         1670  +      zId = (char*)pExpr->token.z;
  1671   1671         nId = pExpr->token.n;
  1672   1672         pDef = sqlite3FindFunction(pParse->db, zId, nId, nExpr, enc, 0);
  1673   1673         assert( pDef!=0 );
  1674   1674         nExpr = sqlite3ExprCodeExprList(pParse, pList);
  1675   1675         for(i=0; i<nExpr && i<32; i++){
  1676   1676           if( sqlite3ExprIsConstant(pList->a[i].pExpr) ){
  1677   1677             constMask |= (1<<i);
................................................................................
  1799   1799         }
  1800   1800         if( pExpr->iColumn!=OE_Ignore ){
  1801   1801            assert( pExpr->iColumn==OE_Rollback ||
  1802   1802                    pExpr->iColumn == OE_Abort ||
  1803   1803                    pExpr->iColumn == OE_Fail );
  1804   1804            sqlite3DequoteExpr(pExpr);
  1805   1805            sqlite3VdbeOp3(v, OP_Halt, SQLITE_CONSTRAINT, pExpr->iColumn,
  1806         -                        pExpr->token.z, pExpr->token.n);
         1806  +                        (char*)pExpr->token.z, pExpr->token.n);
  1807   1807         } else {
  1808   1808            assert( pExpr->iColumn == OE_Ignore );
  1809   1809            sqlite3VdbeAddOp(v, OP_ContextPop, 0, 0);
  1810   1810            sqlite3VdbeAddOp(v, OP_Goto, 0, pParse->trigStack->ignoreJump);
  1811   1811            VdbeComment((v, "# raise(IGNORE)"));
  1812   1812         }
  1813   1813         stackChng = 0;
................................................................................
  2102   2102       return 0;
  2103   2103     }
  2104   2104     if( pA->pSelect || pB->pSelect ) return 0;
  2105   2105     if( pA->iTable!=pB->iTable || pA->iColumn!=pB->iColumn ) return 0;
  2106   2106     if( pA->token.z ){
  2107   2107       if( pB->token.z==0 ) return 0;
  2108   2108       if( pB->token.n!=pA->token.n ) return 0;
  2109         -    if( sqlite3StrNICmp(pA->token.z, pB->token.z, pB->token.n)!=0 ) return 0;
         2109  +    if( sqlite3StrNICmp((char*)pA->token.z,(char*)pB->token.z,pB->token.n)!=0 ){
         2110  +      return 0;
         2111  +    }
  2110   2112     }
  2111   2113     return 1;
  2112   2114   }
  2113   2115   
  2114   2116   
  2115   2117   /*
  2116   2118   ** Add a new element to the pAggInfo->aCol[] array.  Return the index of
................................................................................
  2233   2235             u8 enc = pParse->db->enc;
  2234   2236             i = addAggInfoFunc(pAggInfo);
  2235   2237             if( i>=0 ){
  2236   2238               pItem = &pAggInfo->aFunc[i];
  2237   2239               pItem->pExpr = pExpr;
  2238   2240               pItem->iMem = pParse->nMem++;
  2239   2241               pItem->pFunc = sqlite3FindFunction(pParse->db,
  2240         -                   pExpr->token.z, pExpr->token.n,
         2242  +                   (char*)pExpr->token.z, pExpr->token.n,
  2241   2243                      pExpr->pList ? pExpr->pList->nExpr : 0, enc, 0);
  2242   2244               if( pExpr->flags & EP_Distinct ){
  2243   2245                 pItem->iDistinct = pParse->nTab++;
  2244   2246               }else{
  2245   2247                 pItem->iDistinct = -1;
  2246   2248               }
  2247   2249             }

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.112 2005/12/06 17:19:11 danielk1977 Exp $
           19  +** $Id: func.c,v 1.113 2005/12/09 20:02:05 drh Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   #include <ctype.h>
    23     23   /* #include <math.h> */
    24     24   #include <stdlib.h>
    25     25   #include <assert.h>
    26     26   #include "vdbeInt.h"
................................................................................
    97     97       case SQLITE_BLOB:
    98     98       case SQLITE_INTEGER:
    99     99       case SQLITE_FLOAT: {
   100    100         sqlite3_result_int(context, sqlite3_value_bytes(argv[0]));
   101    101         break;
   102    102       }
   103    103       case SQLITE_TEXT: {
   104         -      const char *z = sqlite3_value_text(argv[0]);
          104  +      const unsigned char *z = sqlite3_value_text(argv[0]);
   105    105         for(len=0; *z; z++){ if( (0xc0&*z)!=0x80 ) len++; }
   106    106         sqlite3_result_int(context, len);
   107    107         break;
   108    108       }
   109    109       default: {
   110    110         sqlite3_result_null(context);
   111    111         break;
................................................................................
   142    142   ** Implementation of the substr() function
   143    143   */
   144    144   static void substrFunc(
   145    145     sqlite3_context *context,
   146    146     int argc,
   147    147     sqlite3_value **argv
   148    148   ){
   149         -  const char *z;
   150         -  const char *z2;
          149  +  const unsigned char *z;
          150  +  const unsigned char *z2;
   151    151     int i;
   152    152     int p1, p2, len;
   153    153   
   154    154     assert( argc==3 );
   155    155     z = sqlite3_value_text(argv[0]);
   156    156     if( z==0 ) return;
   157    157     p1 = sqlite3_value_int(argv[1]);
................................................................................
   174    174     }
   175    175     while( z[i] && (z[i]&0xc0)==0x80 ){ i++; p1++; }
   176    176     for(; i<p1+p2 && z[i]; i++){
   177    177       if( (z[i]&0xc0)==0x80 ) p2++;
   178    178     }
   179    179     while( z[i] && (z[i]&0xc0)==0x80 ){ i++; p2++; }
   180    180     if( p2<0 ) p2 = 0;
   181         -  sqlite3_result_text(context, &z[p1], p2, SQLITE_TRANSIENT);
          181  +  sqlite3_result_text(context, (char*)&z[p1], p2, SQLITE_TRANSIENT);
   182    182   }
   183    183   
   184    184   /*
   185    185   ** Implementation of the round() function
   186    186   */
   187    187   static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
   188    188     int n = 0;
................................................................................
   206    206   */
   207    207   static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
   208    208     unsigned char *z;
   209    209     int i;
   210    210     if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
   211    211     z = sqliteMalloc(sqlite3_value_bytes(argv[0])+1);
   212    212     if( z==0 ) return;
   213         -  strcpy(z, sqlite3_value_text(argv[0]));
          213  +  strcpy((char*)z, (char*)sqlite3_value_text(argv[0]));
   214    214     for(i=0; z[i]; i++){
   215    215       z[i] = toupper(z[i]);
   216    216     }
   217         -  sqlite3_result_text(context, z, -1, SQLITE_TRANSIENT);
          217  +  sqlite3_result_text(context, (char*)z, -1, SQLITE_TRANSIENT);
   218    218     sqliteFree(z);
   219    219   }
   220    220   static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
   221    221     unsigned char *z;
   222    222     int i;
   223    223     if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
   224    224     z = sqliteMalloc(sqlite3_value_bytes(argv[0])+1);
   225    225     if( z==0 ) return;
   226         -  strcpy(z, sqlite3_value_text(argv[0]));
          226  +  strcpy((char*)z, (char*)sqlite3_value_text(argv[0]));
   227    227     for(i=0; z[i]; i++){
   228    228       z[i] = tolower(z[i]);
   229    229     }
   230         -  sqlite3_result_text(context, z, -1, SQLITE_TRANSIENT);
          230  +  sqlite3_result_text(context, (char*)z, -1, SQLITE_TRANSIENT);
   231    231     sqliteFree(z);
   232    232   }
   233    233   
   234    234   /*
   235    235   ** Implementation of the IFNULL(), NVL(), and COALESCE() functions.  
   236    236   ** All three do the same thing.  They return the first non-NULL
   237    237   ** argument.
................................................................................
   491    491     const unsigned char *zB = sqlite3_value_text(argv[1]);
   492    492     int escape = 0;
   493    493     if( argc==3 ){
   494    494       /* The escape character string must consist of a single UTF-8 character.
   495    495       ** Otherwise, return an error.
   496    496       */
   497    497       const unsigned char *zEsc = sqlite3_value_text(argv[2]);
   498         -    if( sqlite3utf8CharLen(zEsc, -1)!=1 ){
          498  +    if( sqlite3utf8CharLen((char*)zEsc, -1)!=1 ){
   499    499         sqlite3_result_error(context, 
   500    500             "ESCAPE expression must be a single character", -1);
   501    501         return;
   502    502       }
   503    503       escape = sqlite3ReadUtf8(zEsc);
   504    504     }
   505    505     if( zA && zB ){
................................................................................
   588    588           sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT);
   589    589           sqliteFree(zText);
   590    590         }
   591    591         break;
   592    592       }
   593    593       case SQLITE_TEXT: {
   594    594         int i,j,n;
   595         -      const char *zArg = sqlite3_value_text(argv[0]);
          595  +      const unsigned char *zArg = sqlite3_value_text(argv[0]);
   596    596         char *z;
   597    597   
   598    598         for(i=n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; }
   599    599         z = sqliteMalloc( i+n+3 );
   600    600         if( z==0 ) return;
   601    601         z[0] = '\'';
   602    602         for(i=0, j=1; zArg[i]; i++){
................................................................................
   688    688     }
   689    689     assert( n<sizeof(zBuf) );
   690    690     sqlite3Randomness(n, zBuf);
   691    691     for(i=0; i<n; i++){
   692    692       zBuf[i] = zSrc[zBuf[i]%(sizeof(zSrc)-1)];
   693    693     }
   694    694     zBuf[n] = 0;
   695         -  sqlite3_result_text(context, zBuf, n, SQLITE_TRANSIENT);
          695  +  sqlite3_result_text(context, (char*)zBuf, n, SQLITE_TRANSIENT);
   696    696   }
   697    697   #endif /* SQLITE_TEST */
   698    698   
   699    699   #ifdef SQLITE_TEST
   700    700   /*
   701    701   ** The following two SQL functions are used to test returning a text
   702    702   ** result with a destructor. Function 'test_destructor' takes one argument
................................................................................
   772    772     int nArg,
   773    773     sqlite3_value **argv
   774    774   ){
   775    775     int i;
   776    776     char *zRet = sqliteMalloc(nArg*2);
   777    777     if( !zRet ) return;
   778    778     for(i=0; i<nArg; i++){
   779         -    char const *z = sqlite3_value_text(argv[i]);
          779  +    char const *z = (char*)sqlite3_value_text(argv[i]);
   780    780       if( z ){
   781    781         char *zAux = sqlite3_get_auxdata(pCtx, i);
   782    782         if( zAux ){
   783    783           zRet[i*2] = '1';
   784    784           if( strcmp(zAux, z) ){
   785    785             sqlite3_result_error(pCtx, "Auxilary data corruption", -1);
   786    786             return;
................................................................................
   803    803   ** returns a copy of it's first argument as an error.
   804    804   */
   805    805   static void test_error(
   806    806     sqlite3_context *pCtx, 
   807    807     int nArg,
   808    808     sqlite3_value **argv
   809    809   ){
   810         -  sqlite3_result_error(pCtx, sqlite3_value_text(argv[0]), 0);
          810  +  sqlite3_result_error(pCtx, (char*)sqlite3_value_text(argv[0]), 0);
   811    811   }
   812    812   #endif /* SQLITE_TEST */
   813    813   
   814    814   /*
   815    815   ** An instance of the following structure holds the context of a
   816    816   ** sum() or avg() aggregate computation.
   817    817   */
................................................................................
  1096   1096     FuncDef *pDef;
  1097   1097     if( pExpr->op!=TK_FUNCTION ){
  1098   1098       return 0;
  1099   1099     }
  1100   1100     if( pExpr->pList->nExpr!=2 ){
  1101   1101       return 0;
  1102   1102     }
  1103         -  pDef = sqlite3FindFunction(db, pExpr->token.z, pExpr->token.n, 2,
         1103  +  pDef = sqlite3FindFunction(db, (char*)pExpr->token.z, pExpr->token.n, 2,
  1104   1104                                SQLITE_UTF8, 0);
  1105   1105     if( pDef==0 || (pDef->flags & SQLITE_FUNC_LIKE)==0 ){
  1106   1106       return 0;
  1107   1107     }
  1108   1108   
  1109   1109     /* The memcpy() statement assumes that the wildcard characters are
  1110   1110     ** the first three statements in the compareInfo structure.  The

Changes to src/main.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Main file for the SQLite library.  The routines in this file
    13     13   ** implement the programmer interface to the library.  Routines in
    14     14   ** other files are for internal use by SQLite and should not be
    15     15   ** accessed by users of the library.
    16     16   **
    17         -** $Id: main.c,v 1.306 2005/12/06 13:19:08 drh Exp $
           17  +** $Id: main.c,v 1.307 2005/12/09 20:02:05 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <ctype.h>
    22     22   
    23     23   /*
    24     24   ** The following constant value is used by the SQLITE_BIGENDIAN and
................................................................................
   637    637     const char *z;
   638    638     if( sqlite3Tsd()->mallocFailed ){
   639    639       return sqlite3ErrStr(SQLITE_NOMEM);
   640    640     }
   641    641     if( sqlite3SafetyCheck(db) || db->errCode==SQLITE_MISUSE ){
   642    642       return sqlite3ErrStr(SQLITE_MISUSE);
   643    643     }
   644         -  z = sqlite3_value_text(db->pErr);
          644  +  z = (char*)sqlite3_value_text(db->pErr);
   645    645     if( z==0 ){
   646    646       z = sqlite3ErrStr(db->errCode);
   647    647     }
   648    648     return z;
   649    649   }
   650    650   
   651    651   #ifndef SQLITE_OMIT_UTF16

Changes to src/os_unix.c.

   629    629   ** On success, write the file handle into *id and return SQLITE_OK.
   630    630   **
   631    631   ** On failure, return SQLITE_CANTOPEN.
   632    632   */
   633    633   static int unixOpenExclusive(const char *zFilename, OsFile **pId, int delFlag){
   634    634     int rc;
   635    635     unixFile f;
   636         -  int fd;
   637    636   
   638    637     assert( 0==*pId );
   639    638     if( access(zFilename, 0)==0 ){
   640    639       return SQLITE_CANTOPEN;
   641    640     }
   642    641     SET_THREADID(&f);
   643    642     f.dirfd = -1;

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.223 2005/12/06 12:52:59 danielk1977 Exp $
           21  +** @(#) $Id: pager.c,v 1.224 2005/12/09 20:02:05 drh Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   #include "os.h"
    26     26   #include "pager.h"
    27     27   #include <assert.h>
    28     28   #include <string.h>
................................................................................
   946    946   ** though fast and simple, catches the mostly likely kind of corruption.
   947    947   **
   948    948   ** FIX ME:  Consider adding every 200th (or so) byte of the data to the
   949    949   ** checksum.  That way if a single page spans 3 or more disk sectors and
   950    950   ** only the middle sector is corrupt, we will still have a reasonable
   951    951   ** chance of failing the checksum and thus detecting the problem.
   952    952   */
   953         -static u32 pager_cksum(Pager *pPager, Pgno pgno, const char *aData){
          953  +static u32 pager_cksum(Pager *pPager, Pgno pgno, const u8 *aData){
   954    954     u32 cksum = pPager->cksumInit;
   955    955     int i = pPager->pageSize-200;
   956    956     while( i>0 ){
   957    957       cksum += aData[i];
   958    958       i -= 200;
   959    959     }
   960    960     return cksum;

Changes to src/parse.y.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains SQLite's grammar for SQL.  Process this file
    13     13   ** using the lemon parser generator to generate C code that runs
    14     14   ** the parser.  Lemon will also generate a header file containing
    15     15   ** numeric codes for all of the tokens.
    16     16   **
    17         -** @(#) $Id: parse.y,v 1.186 2005/12/06 17:19:11 danielk1977 Exp $
           17  +** @(#) $Id: parse.y,v 1.187 2005/12/09 20:02:05 drh Exp $
    18     18   */
    19     19   
    20     20   // All token codes are small integers with #defines that begin with "TK_"
    21     21   %token_prefix TK_
    22     22   
    23     23   // The type of the data attached to each token is Token.  This is also the
    24     24   // default type for non-terminals.
................................................................................
   226    226     A.z = X.z;
   227    227     A.n = &Y.z[Y.n] - X.z;
   228    228   }
   229    229   %type typename {Token}
   230    230   typename(A) ::= ids(X).             {A = X;}
   231    231   typename(A) ::= typename(X) ids(Y). {A.z=X.z; A.n=Y.n+(Y.z-X.z);}
   232    232   %type signed {int}
   233         -signed(A) ::= plus_num(X).    { A = atoi(X.z); }
   234         -signed(A) ::= minus_num(X).   { A = -atoi(X.z); }
          233  +signed(A) ::= plus_num(X).    { A = atoi((char*)X.z); }
          234  +signed(A) ::= minus_num(X).   { A = -atoi((char*)X.z); }
   235    235   
   236    236   // "carglist" is a list of additional constraints that come after the
   237    237   // column name and column type in a CREATE TABLE statement.
   238    238   //
   239    239   carglist ::= carglist carg.
   240    240   carglist ::= .
   241    241   carg ::= CONSTRAINT nm ccons.
................................................................................
   260    260   ccons ::= PRIMARY KEY sortorder onconf(R) autoinc(I).
   261    261                                        {sqlite3AddPrimaryKey(pParse,0,R,I);}
   262    262   ccons ::= UNIQUE onconf(R).          {sqlite3CreateIndex(pParse,0,0,0,0,R,0,0);}
   263    263   ccons ::= CHECK LP expr(X) RP.       {sqlite3AddCheckConstraint(pParse,X);}
   264    264   ccons ::= REFERENCES nm(T) idxlist_opt(TA) refargs(R).
   265    265                                   {sqlite3CreateForeignKey(pParse,0,&T,TA,R);}
   266    266   ccons ::= defer_subclause(D).   {sqlite3DeferForeignKey(pParse,D);}
   267         -ccons ::= COLLATE id(C).  {sqlite3AddCollateType(pParse, C.z, C.n);}
          267  +ccons ::= COLLATE id(C).  {sqlite3AddCollateType(pParse, (char*)C.z, C.n);}
   268    268   
   269    269   // The optional AUTOINCREMENT keyword
   270    270   %type autoinc {int}
   271    271   autoinc(X) ::= .          {X = 0;}
   272    272   autoinc(X) ::= AUTOINCR.  {X = 1;}
   273    273   
   274    274   // The next group of rules parses the arguments to a REFERENCES clause
................................................................................
   849    849   
   850    850   idxlist_opt(A) ::= .                         {A = 0;}
   851    851   idxlist_opt(A) ::= LP idxlist(X) RP.         {A = X;}
   852    852   idxlist(A) ::= idxlist(X) COMMA idxitem(Y) collate(C) sortorder.  {
   853    853     Expr *p = 0;
   854    854     if( C.n>0 ){
   855    855       p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
   856         -    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, C.z, C.n);
          856  +    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (char*)C.z, C.n);
   857    857     }
   858    858     A = sqlite3ExprListAppend(X, p, &Y);
   859    859   }
   860    860   idxlist(A) ::= idxitem(Y) collate(C) sortorder. {
   861    861     Expr *p = 0;
   862    862     if( C.n>0 ){
   863    863       p = sqlite3Expr(TK_COLUMN, 0, 0, 0);
   864         -    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, C.z, C.n);
          864  +    if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (char*)C.z, C.n);
   865    865     }
   866    866     A = sqlite3ExprListAppend(0, p, &Y);
   867    867   }
   868    868   idxitem(A) ::= nm(X).              {A = X;}
   869    869   
   870    870   
   871    871   ///////////////////////////// The DROP INDEX command /////////////////////////

Changes to src/pragma.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 implement the PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.106 2005/12/08 18:12:56 drh Exp $
           14  +** $Id: pragma.c,v 1.107 2005/12/09 20:02:05 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include "os.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /* Ignore this whole file if pragmas are disabled
    21     21   */
................................................................................
    32     32   ** unrecognized string argument.
    33     33   **
    34     34   ** Note that the values returned are one less that the values that
    35     35   ** should be passed into sqlite3BtreeSetSafetyLevel().  The is done
    36     36   ** to support legacy SQL code.  The safety level used to be boolean
    37     37   ** and older scripts may have used numbers 0 for OFF and 1 for ON.
    38     38   */
    39         -static int getSafetyLevel(const u8 *z){
           39  +static int getSafetyLevel(const char *z){
    40     40                                /* 123456789 123456789 */
    41     41     static const char zText[] = "onoffalseyestruefull";
    42     42     static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16};
    43     43     static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4};
    44     44     static const u8 iValue[] =  {1, 0, 0, 0, 1, 1, 2};
    45     45     int i, n;
    46     46     if( isdigit(*z) ){
................................................................................
    54     54     }
    55     55     return 1;
    56     56   }
    57     57   
    58     58   /*
    59     59   ** Interpret the given string as a boolean value.
    60     60   */
    61         -static int getBoolean(const u8 *z){
           61  +static int getBoolean(const char *z){
    62     62     return getSafetyLevel(z)&1;
    63     63   }
    64     64   
    65     65   #ifndef SQLITE_OMIT_PAGER_PRAGMAS
    66     66   /*
    67     67   ** Interpret the given string as a temp db location. Return 1 for file
    68     68   ** backed temporary databases, 2 for the Red-Black tree in memory database

Changes to src/prepare.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains the implementation of the sqlite3_prepare()
    13     13   ** interface, and routines that contribute to loading the database schema
    14     14   ** from disk.
    15     15   **
    16         -** $Id: prepare.c,v 1.6 2005/12/09 14:25:08 danielk1977 Exp $
           16  +** $Id: prepare.c,v 1.7 2005/12/09 20:02:05 drh Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "os.h"
    20     20   #include <ctype.h>
    21     21   
    22     22   /*
    23     23   ** Fill the InitData structure with an error message that indicates
................................................................................
   474    474         sqlite3VdbeSetColName(sParse.pVdbe, 2, "p1", P3_STATIC);
   475    475         sqlite3VdbeSetColName(sParse.pVdbe, 3, "p2", P3_STATIC);
   476    476         sqlite3VdbeSetColName(sParse.pVdbe, 4, "p3", P3_STATIC);
   477    477       }
   478    478     } 
   479    479   #endif
   480    480   
   481         -prepare_out:
   482    481     if( sqlite3SafetyOff(db) ){
   483    482       rc = SQLITE_MISUSE;
   484    483     }
   485    484     if( rc==SQLITE_OK ){
   486    485       *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
   487    486     }else if( sParse.pVdbe ){
   488    487       sqlite3_finalize((sqlite3_stmt*)sParse.pVdbe);

Changes to src/printf.c.

   623    623           length = j;
   624    624           if( precision>=0 && precision<length ) length = precision;
   625    625           break;
   626    626         }
   627    627         case etTOKEN: {
   628    628           Token *pToken = va_arg(ap, Token*);
   629    629           if( pToken && pToken->z ){
   630         -          (*func)(arg, pToken->z, pToken->n);
          630  +          (*func)(arg, (char*)pToken->z, pToken->n);
   631    631           }
   632    632           length = width = 0;
   633    633           break;
   634    634         }
   635    635         case etSRCLIST: {
   636    636           SrcList *pSrc = va_arg(ap, SrcList*);
   637    637           int k = va_arg(ap, int);

Changes to src/select.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 SELECT statements in SQLite.
    14     14   **
    15         -** $Id: select.c,v 1.281 2005/12/06 12:52:59 danielk1977 Exp $
           15  +** $Id: select.c,v 1.282 2005/12/09 20:02:05 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   
    20     20   /*
    21     21   ** Allocate a new Select structure and return a pointer to that
    22     22   ** structure.
................................................................................
   105    105     apAll[0] = pA;
   106    106     apAll[1] = pB;
   107    107     apAll[2] = pC;
   108    108     for(i=0; i<3 && apAll[i]; i++){
   109    109       p = apAll[i];
   110    110       for(j=0; j<sizeof(keywords)/sizeof(keywords[0]); j++){
   111    111         if( p->n==keywords[j].nChar 
   112         -          && sqlite3StrNICmp(p->z, keywords[j].zKeyword, p->n)==0 ){
          112  +          && sqlite3StrNICmp((char*)p->z, keywords[j].zKeyword, p->n)==0 ){
   113    113           jointype |= keywords[j].code;
   114    114           break;
   115    115         }
   116    116       }
   117    117       if( j>=sizeof(keywords)/sizeof(keywords[0]) ){
   118    118         jointype |= JT_ERROR;
   119    119         break;
................................................................................
   150    150     return -1;
   151    151   }
   152    152   
   153    153   /*
   154    154   ** Set the value of a token to a '\000'-terminated string.
   155    155   */
   156    156   static void setToken(Token *p, const char *z){
   157         -  p->z = z;
          157  +  p->z = (u8*)z;
   158    158     p->n = z ? strlen(z) : 0;
   159    159     p->dyn = 0;
   160    160   }
   161    161   
   162    162   /*
   163    163   ** Create an expression node for an identifier with the name of zName
   164    164   */
................................................................................
   628    628     KeyInfo *pInfo;
   629    629     struct ExprList_item *pItem;
   630    630     int i;
   631    631   
   632    632     nExpr = pList->nExpr;
   633    633     pInfo = sqliteMalloc( sizeof(*pInfo) + nExpr*(sizeof(CollSeq*)+1) );
   634    634     if( pInfo ){
   635         -    pInfo->aSortOrder = (char*)&pInfo->aColl[nExpr];
          635  +    pInfo->aSortOrder = (u8*)&pInfo->aColl[nExpr];
   636    636       pInfo->nField = nExpr;
   637    637       pInfo->enc = db->enc;
   638    638       for(i=0, pItem=pList->a; i<nExpr; i++, pItem++){
   639    639         CollSeq *pColl;
   640    640         pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
   641    641         if( !pColl ){
   642    642           pColl = db->pDfltColl;
................................................................................
   881    881         assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
   882    882         if( iCol<0 ){
   883    883           zCol = "rowid";
   884    884         }else{
   885    885           zCol = pTab->aCol[iCol].zName;
   886    886         }
   887    887         if( !shortNames && !fullNames && p->span.z && p->span.z[0] ){
   888         -        sqlite3VdbeSetColName(v, i, p->span.z, p->span.n);
          888  +        sqlite3VdbeSetColName(v, i, (char*)p->span.z, p->span.n);
   889    889         }else if( fullNames || (!shortNames && pTabList->nSrc>1) ){
   890    890           char *zName = 0;
   891    891           char *zTab;
   892    892    
   893    893           zTab = pTabList->a[j].zAlias;
   894    894           if( fullNames || zTab==0 ) zTab = pTab->zName;
   895    895           sqlite3SetString(&zName, zTab, ".", zCol, 0);
   896    896           sqlite3VdbeSetColName(v, i, zName, P3_DYNAMIC);
   897    897         }else{
   898    898           sqlite3VdbeSetColName(v, i, zCol, strlen(zCol));
   899    899         }
   900    900       }else if( p->span.z && p->span.z[0] ){
   901         -      sqlite3VdbeSetColName(v, i, p->span.z, p->span.n);
          901  +      sqlite3VdbeSetColName(v, i, (char*)p->span.z, p->span.n);
   902    902         /* sqlite3VdbeCompressSpace(v, addr); */
   903    903       }else{
   904    904         char zName[30];
   905    905         assert( p->op!=TK_COLUMN || pTabList==0 );
   906    906         sprintf(zName, "column%d", i+1);
   907    907         sqlite3VdbeSetColName(v, i, zName, 0);
   908    908       }
................................................................................
  2113   2113     ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10".
  2114   2114     */
  2115   2115     substExprList(p->pEList, iParent, pSub->pEList);
  2116   2116     pList = p->pEList;
  2117   2117     for(i=0; i<pList->nExpr; i++){
  2118   2118       Expr *pExpr;
  2119   2119       if( pList->a[i].zName==0 && (pExpr = pList->a[i].pExpr)->span.z!=0 ){
  2120         -      pList->a[i].zName = sqliteStrNDup(pExpr->span.z, pExpr->span.n);
         2120  +      pList->a[i].zName = sqliteStrNDup((char*)pExpr->span.z, pExpr->span.n);
  2121   2121       }
  2122   2122     }
  2123   2123     if( isAgg ){
  2124   2124       substExprList(p->pGroupBy, iParent, pSub->pEList);
  2125   2125       substExpr(p->pHaving, iParent, pSub->pEList);
  2126   2126     }
  2127   2127     if( pSub->pOrderBy ){
................................................................................
  2212   2212     pEList = p->pEList;
  2213   2213     if( pEList->nExpr!=1 ) return 0;
  2214   2214     pExpr = pEList->a[0].pExpr;
  2215   2215     if( pExpr->op!=TK_AGG_FUNCTION ) return 0;
  2216   2216     pList = pExpr->pList;
  2217   2217     if( pList==0 || pList->nExpr!=1 ) return 0;
  2218   2218     if( pExpr->token.n!=3 ) return 0;
  2219         -  if( sqlite3StrNICmp(pExpr->token.z,"min",3)==0 ){
         2219  +  if( sqlite3StrNICmp((char*)pExpr->token.z,"min",3)==0 ){
  2220   2220       seekOp = OP_Rewind;
  2221         -  }else if( sqlite3StrNICmp(pExpr->token.z,"max",3)==0 ){
         2221  +  }else if( sqlite3StrNICmp((char*)pExpr->token.z,"max",3)==0 ){
  2222   2222       seekOp = OP_Last;
  2223   2223     }else{
  2224   2224       return 0;
  2225   2225     }
  2226   2226     pExpr = pList->a[0].pExpr;
  2227   2227     if( pExpr->op!=TK_COLUMN ) return 0;
  2228   2228     iCol = pExpr->iColumn;

Changes to src/sqliteInt.h.

     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   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.432 2005/12/09 14:39:04 danielk1977 Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.433 2005/12/09 20:02:06 drh Exp $
    15     15   */
    16     16   #ifndef _SQLITEINT_H_
    17     17   #define _SQLITEINT_H_
    18     18   
    19     19   /*
    20     20   ** Many people are failing to set -DNDEBUG=1 when compiling SQLite.
    21     21   ** Setting NDEBUG makes the code smaller and run faster.  So the following
................................................................................
  1431   1431   char *sqlite3VMPrintf(const char*, va_list);
  1432   1432   void sqlite3DebugPrintf(const char*, ...);
  1433   1433   void *sqlite3TextToPtr(const char*);
  1434   1434   void sqlite3SetString(char **, ...);
  1435   1435   void sqlite3ErrorMsg(Parse*, const char*, ...);
  1436   1436   void sqlite3Dequote(char*);
  1437   1437   void sqlite3DequoteExpr(Expr*);
  1438         -int sqlite3KeywordCode(const char*, int);
         1438  +int sqlite3KeywordCode(const unsigned char*, int);
  1439   1439   int sqlite3RunParser(Parse*, const char*, char **);
  1440   1440   void sqlite3FinishCoding(Parse*);
  1441   1441   Expr *sqlite3Expr(int, Expr*, Expr*, const Token*);
  1442   1442   Expr *sqlite3RegisterExpr(Parse*,Token*);
  1443   1443   Expr *sqlite3ExprAnd(Expr*, Expr*);
  1444   1444   void sqlite3ExprSpan(Expr*,Token*,Token*);
  1445   1445   Expr *sqlite3ExprFunction(ExprList*, Token*);

Changes to src/tokenize.c.

    11     11   *************************************************************************
    12     12   ** An tokenizer for SQL
    13     13   **
    14     14   ** This file contains C code that splits an SQL input string up into
    15     15   ** individual tokens and sends those tokens one-by-one over to the
    16     16   ** parser for analysis.
    17     17   **
    18         -** $Id: tokenize.c,v 1.109 2005/12/06 12:53:00 danielk1977 Exp $
           18  +** $Id: tokenize.c,v 1.110 2005/12/09 20:02:06 drh Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   #include "os.h"
    22     22   #include <ctype.h>
    23     23   #include <stdlib.h>
    24     24   
    25     25   /*
................................................................................
   356    356     assert( pParse->nVar==0 );
   357    357     assert( pParse->nVarExpr==0 );
   358    358     assert( pParse->nVarExprAlloc==0 );
   359    359     assert( pParse->apVarExpr==0 );
   360    360     pParse->zTail = pParse->zSql = zSql;
   361    361     while( sqlite3Tsd()->mallocFailed==0 && zSql[i]!=0 ){
   362    362       assert( i>=0 );
   363         -    pParse->sLastToken.z = &zSql[i];
          363  +    pParse->sLastToken.z = (u8*)&zSql[i];
   364    364       assert( pParse->sLastToken.dyn==0 );
   365    365       pParse->sLastToken.n = getToken((unsigned char*)&zSql[i],&tokenType);
   366    366       i += pParse->sLastToken.n;
   367    367       switch( tokenType ){
   368    368         case TK_SPACE:
   369    369         case TK_COMMENT: {
   370    370           if( (db->flags & SQLITE_Interrupt)!=0 ){

Changes to src/trigger.c.

   233    233       v = sqlite3GetVdbe(pParse);
   234    234       if( v==0 ) goto triggerfinish_cleanup;
   235    235       sqlite3BeginWriteOperation(pParse, 0, pTrig->iDb);
   236    236       sqlite3OpenMasterTable(v, pTrig->iDb);
   237    237       addr = sqlite3VdbeAddOpList(v, ArraySize(insertTrig), insertTrig);
   238    238       sqlite3VdbeChangeP3(v, addr+2, pTrig->name, 0); 
   239    239       sqlite3VdbeChangeP3(v, addr+3, pTrig->table, 0); 
   240         -    sqlite3VdbeChangeP3(v, addr+6, pAll->z, pAll->n);
          240  +    sqlite3VdbeChangeP3(v, addr+6, (char*)pAll->z, pAll->n);
   241    241       sqlite3ChangeCookie(db, v, pTrig->iDb);
   242    242       sqlite3VdbeAddOp(v, OP_Close, 0, 0);
   243    243       sqlite3VdbeOp3(v, OP_ParseSchema, pTrig->iDb, 0, 
   244    244          sqlite3MPrintf("type='trigger' AND name='%q'", pTrig->name), P3_DYNAMIC);
   245    245     }
   246    246   
   247    247     if( db->init.busy ){
................................................................................
   274    274   ** string is ephemeral - it will go away as soon as the sqlite3_exec()
   275    275   ** call that started the parser exits.  This routine makes a persistent
   276    276   ** copy of all the Expr.token.z strings so that the TriggerStep structure
   277    277   ** will be valid even after the sqlite3_exec() call returns.
   278    278   */
   279    279   static void sqlitePersistTriggerStep(TriggerStep *p){
   280    280     if( p->target.z ){
   281         -    p->target.z = sqliteStrNDup(p->target.z, p->target.n);
          281  +    p->target.z = (u8*)sqliteStrNDup((char*)p->target.z, p->target.n);
   282    282       p->target.dyn = 1;
   283    283     }
   284    284     if( p->pSelect ){
   285    285       Select *pNew = sqlite3SelectDup(p->pSelect);
   286    286       sqlite3SelectDelete(p->pSelect);
   287    287       p->pSelect = pNew;
   288    288     }
................................................................................
   619    619     Token sDb;           /* Dummy database name token */
   620    620     int iDb;             /* Index of the database to use */
   621    621     SrcList *pSrc;       /* SrcList to be returned */
   622    622   
   623    623     iDb = pStep->pTrig->iDb;
   624    624     if( iDb==0 || iDb>=2 ){
   625    625       assert( iDb<pParse->db->nDb );
   626         -    sDb.z = pParse->db->aDb[iDb].zName;
   627         -    sDb.n = strlen(sDb.z);
          626  +    sDb.z = (u8*)pParse->db->aDb[iDb].zName;
          627  +    sDb.n = strlen((char*)sDb.z);
   628    628       pSrc = sqlite3SrcListAppend(0, &sDb, &pStep->target);
   629    629     } else {
   630    630       pSrc = sqlite3SrcListAppend(0, &pStep->target, 0);
   631    631     }
   632    632     return pSrc;
   633    633   }
   634    634   

Changes to src/utf.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 routines used to translate between UTF-8, 
    13     13   ** UTF-16, UTF-16BE, and UTF-16LE.
    14     14   **
    15         -** $Id: utf.c,v 1.32 2005/01/28 01:29:08 drh Exp $
           15  +** $Id: utf.c,v 1.33 2005/12/09 20:02:06 drh Exp $
    16     16   **
    17     17   ** Notes on UTF-8:
    18     18   **
    19     19   **   Byte-0    Byte-1    Byte-2    Byte-3    Value
    20     20   **  0xxxxxxx                                 00000000 00000000 0xxxxxxx
    21     21   **  110yyyyy  10xxxxxx                       00000000 00000yyy yyxxxxxx
    22     22   **  1110zzzz  10yyyyyy  10xxxxxx             00000000 zzzzyyyy yyxxxxxx
................................................................................
   268    268       u8 temp;
   269    269       int rc;
   270    270       rc = sqlite3VdbeMemMakeWriteable(pMem);
   271    271       if( rc!=SQLITE_OK ){
   272    272         assert( rc==SQLITE_NOMEM );
   273    273         return SQLITE_NOMEM;
   274    274       }
   275         -    zIn = pMem->z;
          275  +    zIn = (u8*)pMem->z;
   276    276       zTerm = &zIn[pMem->n];
   277    277       while( zIn<zTerm ){
   278    278         temp = *zIn;
   279    279         *zIn = *(zIn+1);
   280    280         zIn++;
   281    281         *zIn++ = temp;
   282    282       }
................................................................................
   304    304     /* Set zIn to point at the start of the input buffer and zTerm to point 1
   305    305     ** byte past the end.
   306    306     **
   307    307     ** Variable zOut is set to point at the output buffer. This may be space
   308    308     ** obtained from malloc(), or Mem.zShort, if it large enough and not in
   309    309     ** use, or the zShort array on the stack (see above).
   310    310     */
   311         -  zIn = pMem->z;
          311  +  zIn = (u8*)pMem->z;
   312    312     zTerm = &zIn[pMem->n];
   313    313     if( len>NBFS ){
   314    314       zOut = sqliteMallocRaw(len);
   315    315       if( !zOut ) return SQLITE_NOMEM;
   316    316     }else{
   317    317       zOut = zShort;
   318    318     }
................................................................................
   356    356     assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );
   357    357   
   358    358     sqlite3VdbeMemRelease(pMem);
   359    359     pMem->flags &= ~(MEM_Static|MEM_Dyn|MEM_Ephem|MEM_Short);
   360    360     pMem->enc = desiredEnc;
   361    361     if( zOut==zShort ){
   362    362       memcpy(pMem->zShort, zOut, len);
   363         -    zOut = pMem->zShort;
          363  +    zOut = (u8*)pMem->zShort;
   364    364       pMem->flags |= (MEM_Term|MEM_Short);
   365    365     }else{
   366    366       pMem->flags |= (MEM_Term|MEM_Dyn);
   367    367     }
   368         -  pMem->z = zOut;
          368  +  pMem->z = (char*)zOut;
   369    369   
   370    370   translate_out:
   371    371   #if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)
   372    372     {
   373    373       char zBuf[100];
   374    374       sqlite3VdbeMemPrettyPrint(pMem, zBuf, 100);
   375    375       fprintf(stderr, "OUTPUT: %s\n", zBuf);

Changes to src/vacuum.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the VACUUM command.
    13     13   **
    14     14   ** Most of the code in this file may be omitted by defining the
    15     15   ** SQLITE_OMIT_VACUUM macro.
    16     16   **
    17         -** $Id: vacuum.c,v 1.52 2005/12/09 14:25:09 danielk1977 Exp $
           17  +** $Id: vacuum.c,v 1.53 2005/12/09 20:02:06 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "vdbeInt.h"
    21     21   #include "os.h"
    22     22   
    23     23   #ifndef SQLITE_OMIT_VACUUM
    24     24   /*
................................................................................
    55     55     sqlite3_stmt *pStmt;
    56     56     int rc;
    57     57   
    58     58     rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);
    59     59     if( rc!=SQLITE_OK ) return rc;
    60     60   
    61     61     while( SQLITE_ROW==sqlite3_step(pStmt) ){
    62         -    rc = execSql(db, sqlite3_column_text(pStmt, 0));
           62  +    rc = execSql(db, (char*)sqlite3_column_text(pStmt, 0));
    63     63       if( rc!=SQLITE_OK ){
    64     64         sqlite3_finalize(pStmt);
    65     65         return rc;
    66     66       }
    67     67     }
    68     68   
    69     69     return sqlite3_finalize(pStmt);

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.503 2005/12/09 14:25:09 danielk1977 Exp $
           46  +** $Id: vdbe.c,v 1.504 2005/12/09 20:02:06 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
  1881   1881       if( rc ) goto abort_due_to_error;
  1882   1882       zRec = 0;
  1883   1883       pCrsr = pC->pCursor;
  1884   1884       if( pC->nullRow ){
  1885   1885         payloadSize = 0;
  1886   1886       }else if( pC->cacheValid ){
  1887   1887         payloadSize = pC->payloadSize;
  1888         -      zRec = pC->aRow;
         1888  +      zRec = (char*)pC->aRow;
  1889   1889       }else if( pC->isIndex ){
  1890   1890         i64 payloadSize64;
  1891   1891         sqlite3BtreeKeySize(pCrsr, &payloadSize64);
  1892   1892         payloadSize = payloadSize64;
  1893   1893       }else{
  1894   1894         sqlite3BtreeDataSize(pCrsr, &payloadSize);
  1895   1895       }
................................................................................
  1948   1948         }
  1949   1949         /* If KeyFetch()/DataFetch() managed to get the entire payload,
  1950   1950         ** save the payload in the pC->aRow cache.  That will save us from
  1951   1951         ** having to make additional calls to fetch the content portion of
  1952   1952         ** the record.
  1953   1953         */
  1954   1954         if( avail>=payloadSize ){
  1955         -        zRec = pC->aRow = zData;
         1955  +        zRec = zData;
         1956  +        pC->aRow = (u8*)zData;
  1956   1957         }else{
  1957   1958           pC->aRow = 0;
  1958   1959         }
  1959   1960       }
  1960         -    idx = sqlite3GetVarint32(zData, &szHdr);
         1961  +    idx = sqlite3GetVarint32((u8*)zData, &szHdr);
  1961   1962   
  1962   1963   
  1963   1964       /* The KeyFetch() or DataFetch() above are fast and will get the entire
  1964   1965       ** record header in most cases.  But they will fail to get the complete
  1965   1966       ** record header if the record header does not fit on a single page
  1966   1967       ** in the B-Tree.  When that happens, use sqlite3VdbeMemFromBtree() to
  1967   1968       ** acquire the complete header text.
................................................................................
  1980   1981       ** of the record to the start of the data for the i-th column
  1981   1982       */
  1982   1983       offset = szHdr;
  1983   1984       assert( offset>0 );
  1984   1985       i = 0;
  1985   1986       while( idx<szHdr && i<nField && offset<=payloadSize ){
  1986   1987         aOffset[i] = offset;
  1987         -      idx += sqlite3GetVarint32(&zData[idx], &aType[i]);
         1988  +      idx += sqlite3GetVarint32((u8*)&zData[idx], &aType[i]);
  1988   1989         offset += sqlite3VdbeSerialTypeLen(aType[i]);
  1989   1990         i++;
  1990   1991       }
  1991   1992       Release(&sMem);
  1992   1993       sMem.flags = MEM_Null;
  1993   1994   
  1994   1995       /* If i is less that nField, then there are less fields in this
................................................................................
  2034   2035         len = sqlite3VdbeSerialTypeLen(aType[p2]);
  2035   2036         rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len, pC->isIndex,&sMem);
  2036   2037         if( rc!=SQLITE_OK ){
  2037   2038           goto op_column_out;
  2038   2039         }
  2039   2040         zData = sMem.z;
  2040   2041       }
  2041         -    sqlite3VdbeSerialGet(zData, aType[p2], pTos);
         2042  +    sqlite3VdbeSerialGet((u8*)zData, aType[p2], pTos);
  2042   2043       pTos->enc = db->enc;
  2043   2044     }else{
  2044   2045       if( pOp->p3type==P3_MEM ){
  2045   2046         sqlite3VdbeMemShallowCopy(pTos, (Mem *)(pOp->p3), MEM_Static);
  2046   2047       }else{
  2047   2048         pTos->flags = MEM_Null;
  2048   2049       }
................................................................................
  2194   2195     /* Allocate space for the new record. */
  2195   2196     if( nByte>sizeof(zTemp) ){
  2196   2197       zNewRecord = sqliteMallocRaw(nByte);
  2197   2198       if( !zNewRecord ){
  2198   2199         goto no_mem;
  2199   2200       }
  2200   2201     }else{
  2201         -    zNewRecord = zTemp;
         2202  +    zNewRecord = (u8*)zTemp;
  2202   2203     }
  2203   2204   
  2204   2205     /* Write the record */
  2205   2206     zCsr = zNewRecord;
  2206   2207     zCsr += sqlite3PutVarint(zCsr, nHdr);
  2207   2208     for(pRec=pData0; pRec<=pTos; pRec++){
  2208   2209       serial_type = sqlite3VdbeSerialType(pRec);
................................................................................
  2228   2229     if( nByte<=sizeof(zTemp) ){
  2229   2230       assert( zNewRecord==(unsigned char *)zTemp );
  2230   2231       pTos->z = pTos->zShort;
  2231   2232       memcpy(pTos->zShort, zTemp, nByte);
  2232   2233       pTos->flags = MEM_Blob | MEM_Short;
  2233   2234     }else{
  2234   2235       assert( zNewRecord!=(unsigned char *)zTemp );
  2235         -    pTos->z = zNewRecord;
         2236  +    pTos->z = (char*)zNewRecord;
  2236   2237       pTos->flags = MEM_Blob | MEM_Dyn;
  2237   2238       pTos->xDel = 0;
  2238   2239     }
  2239   2240     pTos->enc = SQLITE_UTF8;  /* In case the blob is ever converted to text */
  2240   2241   
  2241   2242     /* If a NULL was encountered and jumpIfNull is non-zero, take the jump. */
  2242   2243     if( jumpIfNull && containsNull ){
................................................................................
  2925   2926   
  2926   2927       /* Make sure K is a string and make zKey point to K
  2927   2928       */
  2928   2929       Stringify(pNos, db->enc);
  2929   2930       zKey = pNos->z;
  2930   2931       nKey = pNos->n;
  2931   2932   
  2932         -    szRowid = sqlite3VdbeIdxRowidLen(nKey, zKey);
         2933  +    szRowid = sqlite3VdbeIdxRowidLen(nKey, (u8*)zKey);
  2933   2934       len = nKey-szRowid;
  2934   2935   
  2935   2936       /* Search for an entry in P1 where all but the last four bytes match K.
  2936   2937       ** If there is no such entry, jump immediately to P2.
  2937   2938       */
  2938   2939       assert( pCx->deferredMoveto==0 );
  2939   2940       pCx->cacheValid = 0;
................................................................................
  2942   2943       if( res<0 ){
  2943   2944         rc = sqlite3BtreeNext(pCrsr, &res);
  2944   2945         if( res ){
  2945   2946           pc = pOp->p2 - 1;
  2946   2947           break;
  2947   2948         }
  2948   2949       }
  2949         -    rc = sqlite3VdbeIdxKeyCompare(pCx, len, zKey, &res); 
         2950  +    rc = sqlite3VdbeIdxKeyCompare(pCx, len, (u8*)zKey, &res); 
  2950   2951       if( rc!=SQLITE_OK ) goto abort_due_to_error;
  2951   2952       if( res>0 ){
  2952   2953         pc = pOp->p2 - 1;
  2953   2954         break;
  2954   2955       }
  2955   2956   
  2956   2957       /* At this point, pCrsr is pointing to an entry in P1 where all but
................................................................................
  3718   3719       int res, rc;
  3719   3720    
  3720   3721       assert( pTos->flags & MEM_Blob );  /* Created using OP_Make*Key */
  3721   3722       Stringify(pTos, db->enc);
  3722   3723       assert( pC->deferredMoveto==0 );
  3723   3724       *pC->pIncrKey = pOp->p3!=0;
  3724   3725       assert( pOp->p3==0 || pOp->opcode!=OP_IdxGT );
  3725         -    rc = sqlite3VdbeIdxKeyCompare(pC, pTos->n, pTos->z, &res);
         3726  +    rc = sqlite3VdbeIdxKeyCompare(pC, pTos->n, (u8*)pTos->z, &res);
  3726   3727       *pC->pIncrKey = 0;
  3727   3728       if( rc!=SQLITE_OK ){
  3728   3729         break;
  3729   3730       }
  3730   3731       if( pOp->opcode==OP_IdxLT ){
  3731   3732         res = -res;
  3732   3733       }else if( pOp->opcode==OP_IdxGE ){
................................................................................
  3756   3757     const char *z;
  3757   3758     u32 serial_type;
  3758   3759   
  3759   3760     assert( pTos>=p->aStack );
  3760   3761     assert( pTos->flags & MEM_Blob );
  3761   3762     z = pTos->z;
  3762   3763     n = pTos->n;
  3763         -  k = sqlite3GetVarint32(z, &serial_type);
         3764  +  k = sqlite3GetVarint32((u8*)z, &serial_type);
  3764   3765     for(; k<n && i>0; i--){
  3765         -    k += sqlite3GetVarint32(&z[k], &serial_type);
         3766  +    k += sqlite3GetVarint32((u8*)&z[k], &serial_type);
  3766   3767       if( serial_type==0 ){   /* Serial type 0 is a NULL */
  3767   3768         pc = pOp->p2-1;
  3768   3769         break;
  3769   3770       }
  3770   3771     }
  3771   3772     Release(pTos);
  3772   3773     pTos--;

Changes to src/vdbeaux.c.

  1776   1776     if( nCellKey<=0 ){
  1777   1777       return SQLITE_CORRUPT_BKPT;
  1778   1778     }
  1779   1779     rc = sqlite3VdbeMemFromBtree(pCur, 0, nCellKey, 1, &m);
  1780   1780     if( rc ){
  1781   1781       return rc;
  1782   1782     }
  1783         -  sqlite3GetVarint32(m.z, &szHdr);
  1784         -  sqlite3GetVarint32(&m.z[szHdr-1], &typeRowid);
         1783  +  sqlite3GetVarint32((u8*)m.z, &szHdr);
         1784  +  sqlite3GetVarint32((u8*)&m.z[szHdr-1], &typeRowid);
  1785   1785     lenRowid = sqlite3VdbeSerialTypeLen(typeRowid);
  1786         -  sqlite3VdbeSerialGet(&m.z[m.n-lenRowid], typeRowid, &v);
         1786  +  sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v);
  1787   1787     *rowid = v.i;
  1788   1788     sqlite3VdbeMemRelease(&m);
  1789   1789     return SQLITE_OK;
  1790   1790   }
  1791   1791   
  1792   1792   /*
  1793   1793   ** Compare the key of the index entry that cursor pC is point to against
................................................................................
  1815   1815       *res = 0;
  1816   1816       return SQLITE_OK;
  1817   1817     }
  1818   1818     rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, nCellKey, 1, &m);
  1819   1819     if( rc ){
  1820   1820       return rc;
  1821   1821     }
  1822         -  lenRowid = sqlite3VdbeIdxRowidLen(m.n, m.z);
         1822  +  lenRowid = sqlite3VdbeIdxRowidLen(m.n, (u8*)m.z);
  1823   1823     *res = sqlite3VdbeRecordCompare(pC->pKeyInfo, m.n-lenRowid, m.z, nKey, pKey);
  1824   1824     sqlite3VdbeMemRelease(&m);
  1825   1825     return SQLITE_OK;
  1826   1826   }
  1827   1827   
  1828   1828   /*
  1829   1829   ** This routine sets the value to be returned by subsequent calls to

Changes to src/vdbemem.c.

    79     79       return SQLITE_NOMEM;
    80     80     }
    81     81     pMem->flags |= MEM_Dyn|MEM_Term;
    82     82     pMem->xDel = 0;
    83     83     memcpy(z, pMem->z, n );
    84     84     z[n] = 0;
    85     85     z[n+1] = 0;
    86         -  pMem->z = z;
           86  +  pMem->z = (char*)z;
    87     87     pMem->flags &= ~(MEM_Ephem|MEM_Static|MEM_Short);
    88     88     return SQLITE_OK;
    89     89   }
    90     90   
    91     91   /*
    92     92   ** Make the given Mem object either MEM_Short or MEM_Dyn so that bytes
    93     93   ** of the Mem.z[] array can be modified.
................................................................................
    99     99     u8 *z;
   100    100     if( (pMem->flags & (MEM_Ephem|MEM_Static))==0 ){
   101    101       return SQLITE_OK;
   102    102     }
   103    103     assert( (pMem->flags & MEM_Dyn)==0 );
   104    104     assert( pMem->flags & (MEM_Str|MEM_Blob) );
   105    105     if( (n = pMem->n)+2<sizeof(pMem->zShort) ){
   106         -    z = pMem->zShort;
          106  +    z = (u8*)pMem->zShort;
   107    107       pMem->flags |= MEM_Short|MEM_Term;
   108    108     }else{
   109    109       z = sqliteMallocRaw( n+2 );
   110    110       if( z==0 ){
   111    111         return SQLITE_NOMEM;
   112    112       }
   113    113       pMem->flags |= MEM_Dyn|MEM_Term;
   114    114       pMem->xDel = 0;
   115    115     }
   116    116     memcpy(z, pMem->z, n );
   117    117     z[n] = 0;
   118    118     z[n+1] = 0;
   119         -  pMem->z = z;
          119  +  pMem->z = (char*)z;
   120    120     pMem->flags &= ~(MEM_Ephem|MEM_Static);
   121    121     return SQLITE_OK;
   122    122   }
   123    123   
   124    124   /*
   125    125   ** Make sure the given Mem is \u0000 terminated.
   126    126   */
................................................................................
   168    168   ** sqlite3_value_text()), or for ensuring that values to be used as btree
   169    169   ** keys are strings. In the former case a NULL pointer is returned the
   170    170   ** user and the later is an internal programming error.
   171    171   */
   172    172   int sqlite3VdbeMemStringify(Mem *pMem, int enc){
   173    173     int rc = SQLITE_OK;
   174    174     int fg = pMem->flags;
   175         -  u8 *z = pMem->zShort;
          175  +  char *z = pMem->zShort;
   176    176   
   177    177     assert( !(fg&(MEM_Str|MEM_Blob)) );
   178    178     assert( fg&(MEM_Int|MEM_Real) );
   179    179   
   180    180     /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
   181    181     ** string representation of the value. Then, if the required encoding
   182    182     ** is UTF-16le or UTF-16be do a translation.
................................................................................
   795    795     if( !pExpr ){
   796    796       *ppVal = 0;
   797    797       return SQLITE_OK;
   798    798     }
   799    799     op = pExpr->op;
   800    800   
   801    801     if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
   802         -    zVal = sqliteStrNDup(pExpr->token.z, pExpr->token.n);
          802  +    zVal = sqliteStrNDup((char*)pExpr->token.z, pExpr->token.n);
   803    803       pVal = sqlite3ValueNew();
   804    804       if( !zVal || !pVal ) goto no_mem;
   805    805       sqlite3Dequote(zVal);
   806    806       sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, sqlite3FreeX);
   807    807       if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_NONE ){
   808    808         sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, enc);
   809    809       }else{
................................................................................
   815    815         pVal->r = -1.0 * pVal->r;
   816    816       }
   817    817     }
   818    818   #ifndef SQLITE_OMIT_BLOB_LITERAL
   819    819     else if( op==TK_BLOB ){
   820    820       int nVal;
   821    821       pVal = sqlite3ValueNew();
   822         -    zVal = sqliteStrNDup(pExpr->token.z+1, pExpr->token.n-1);
          822  +    zVal = sqliteStrNDup((char*)pExpr->token.z+1, pExpr->token.n-1);
   823    823       if( !zVal || !pVal ) goto no_mem;
   824    824       sqlite3Dequote(zVal);
   825    825       nVal = strlen(zVal)/2;
   826    826       sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(zVal), nVal, 0, sqlite3FreeX);
   827    827       sqliteFree(zVal);
   828    828     }
   829    829   #endif

Changes to tool/mkkeywordhash.c.

   491    491     printf("    if( aLen[i]==n &&"
   492    492                      " sqlite3StrNICmp(&zText[aOffset[i]],z,n)==0 ){\n");
   493    493     printf("      return aCode[i];\n");
   494    494     printf("    }\n");
   495    495     printf("  }\n");
   496    496     printf("  return TK_ID;\n");
   497    497     printf("}\n");
   498         -  printf("int sqlite3KeywordCode(const char *z, int n){\n");
   499         -  printf("  return keywordCode(z, n);\n");
          498  +  printf("int sqlite3KeywordCode(const unsigned char *z, int n){\n");
          499  +  printf("  return keywordCode((char*)z, n);\n");
   500    500     printf("}\n");
   501    501   
   502    502     return 0;
   503    503   }