/ Check-in [c4cd38a0]
Login

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

Overview
Comment:Fix compiler warnings in the TCL test harness.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c4cd38a0c71e2887e47bebb9d10baf30802a7f13
User & Date: drh 2012-01-30 18:00:31
Context
2012-01-30
18:40
Bring the documentation and implementation of sqlite3_uri_boolean() into closer agreement. Ticket [5f41597f7c9c] check-in: 7b053d69 user: drh tags: trunk
18:00
Fix compiler warnings in the TCL test harness. check-in: c4cd38a0 user: drh tags: trunk
16:02
Do not rely on the _WIN32_WINNT macro as vs2005 does not define it by default. Instead, always assume winNT unless the makefile explicitly sets SQLITE_OS_WINNT=0. check-in: 1ce4d21d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test1.c.

   664    664   */
   665    665   static int test_key(
   666    666     void *NotUsed,
   667    667     Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
   668    668     int argc,              /* Number of arguments */
   669    669     char **argv            /* Text of each argument */
   670    670   ){
          671  +#ifdef SQLITE_HAS_CODEC
   671    672     sqlite3 *db;
   672    673     const char *zKey;
   673    674     int nKey;
   674    675     if( argc!=3 ){
   675    676       Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
   676    677          " FILENAME\"", 0);
   677    678       return TCL_ERROR;
   678    679     }
   679    680     if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
   680    681     zKey = argv[2];
   681    682     nKey = strlen(zKey);
   682         -#ifdef SQLITE_HAS_CODEC
   683    683     sqlite3_key(db, zKey, nKey);
   684    684   #endif
   685    685     return TCL_OK;
   686    686   }
   687    687   
   688    688   /*
   689    689   ** Usage:  sqlite3_rekey DB KEY
................................................................................
   692    692   */
   693    693   static int test_rekey(
   694    694     void *NotUsed,
   695    695     Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
   696    696     int argc,              /* Number of arguments */
   697    697     char **argv            /* Text of each argument */
   698    698   ){
          699  +#ifdef SQLITE_HAS_CODEC
   699    700     sqlite3 *db;
   700    701     const char *zKey;
   701    702     int nKey;
   702    703     if( argc!=3 ){
   703    704       Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
   704    705          " FILENAME\"", 0);
   705    706       return TCL_ERROR;
   706    707     }
   707    708     if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
   708    709     zKey = argv[2];
   709    710     nKey = strlen(zKey);
   710         -#ifdef SQLITE_HAS_CODEC
   711    711     sqlite3_rekey(db, zKey, nKey);
   712    712   #endif
   713    713     return TCL_OK;
   714    714   }
   715    715   
   716    716   /*
   717    717   ** Usage:  sqlite3_close DB
................................................................................
  2365   2365   static int uses_stmt_journal(
  2366   2366     void * clientData,
  2367   2367     Tcl_Interp *interp,
  2368   2368     int objc,
  2369   2369     Tcl_Obj *CONST objv[]
  2370   2370   ){
  2371   2371     sqlite3_stmt *pStmt;
  2372         -  int rc;
  2373   2372   
  2374   2373     if( objc!=2 ){
  2375   2374       Tcl_AppendResult(interp, "wrong # args: should be \"",
  2376   2375           Tcl_GetStringFromObj(objv[0], 0), " STMT", 0);
  2377   2376       return TCL_ERROR;
  2378   2377     }
  2379   2378   
  2380   2379     if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
  2381         -  rc = sqlite3_stmt_readonly(pStmt);
         2380  +  sqlite3_stmt_readonly(pStmt);
  2382   2381     Tcl_SetObjResult(interp, Tcl_NewBooleanObj(((Vdbe *)pStmt)->usesStmtJournal));
  2383   2382     return TCL_OK;
  2384   2383   }
  2385   2384   
  2386   2385   
  2387   2386   /*
  2388   2387   ** Usage:  sqlite3_reset  STMT 
................................................................................
  3854   3853     void * clientData,
  3855   3854     Tcl_Interp *interp,
  3856   3855     int objc,
  3857   3856     Tcl_Obj *CONST objv[]
  3858   3857   ){
  3859   3858     const char *zFilename;
  3860   3859     sqlite3 *db;
  3861         -  int rc;
  3862   3860     char zBuf[100];
  3863   3861   
  3864   3862     if( objc!=3 && objc!=2 && objc!=1 ){
  3865   3863       Tcl_AppendResult(interp, "wrong # args: should be \"", 
  3866   3864          Tcl_GetString(objv[0]), " filename options-list", 0);
  3867   3865       return TCL_ERROR;
  3868   3866     }
  3869   3867   
  3870   3868     zFilename = objc>1 ? Tcl_GetString(objv[1]) : 0;
  3871         -  rc = sqlite3_open(zFilename, &db);
         3869  +  sqlite3_open(zFilename, &db);
  3872   3870     
  3873   3871     if( sqlite3TestMakePointerStr(interp, zBuf, db) ) return TCL_ERROR;
  3874   3872     Tcl_AppendResult(interp, zBuf, 0);
  3875   3873     return TCL_OK;
  3876   3874   }
  3877   3875   
  3878   3876   /*
................................................................................
  3953   3951     Tcl_Interp *interp,
  3954   3952     int objc,
  3955   3953     Tcl_Obj *CONST objv[]
  3956   3954   ){
  3957   3955   #ifndef SQLITE_OMIT_UTF16
  3958   3956     const void *zFilename;
  3959   3957     sqlite3 *db;
  3960         -  int rc;
  3961   3958     char zBuf[100];
  3962   3959   
  3963   3960     if( objc!=3 ){
  3964   3961       Tcl_AppendResult(interp, "wrong # args: should be \"", 
  3965   3962          Tcl_GetString(objv[0]), " filename options-list", 0);
  3966   3963       return TCL_ERROR;
  3967   3964     }
  3968   3965   
  3969   3966     zFilename = Tcl_GetByteArrayFromObj(objv[1], 0);
  3970         -  rc = sqlite3_open16(zFilename, &db);
         3967  +  sqlite3_open16(zFilename, &db);
  3971   3968     
  3972   3969     if( sqlite3TestMakePointerStr(interp, zBuf, db) ) return TCL_ERROR;
  3973   3970     Tcl_AppendResult(interp, zBuf, 0);
  3974   3971   #endif /* SQLITE_OMIT_UTF16 */
  3975   3972     return TCL_OK;
  3976   3973   }
  3977   3974   
................................................................................
  5110   5107   static int file_control_lockproxy_test(
  5111   5108     ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
  5112   5109     Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  5113   5110     int objc,              /* Number of arguments */
  5114   5111     Tcl_Obj *CONST objv[]  /* Command arguments */
  5115   5112   ){
  5116   5113     sqlite3 *db;
  5117         -  const char *zPwd;
  5118         -  int nPwd;
  5119   5114     
  5120   5115     if( objc!=3 ){
  5121   5116       Tcl_AppendResult(interp, "wrong # args: should be \"",
  5122   5117                        Tcl_GetStringFromObj(objv[0], 0), " DB PWD", 0);
  5123   5118       return TCL_ERROR;
  5124   5119     }
  5125   5120     if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
  5126   5121      return TCL_ERROR;
  5127   5122     }
  5128         -  zPwd = Tcl_GetStringFromObj(objv[2], &nPwd);
  5129   5123     
  5130   5124   #if !defined(SQLITE_ENABLE_LOCKING_STYLE)
  5131   5125   #  if defined(__APPLE__)
  5132   5126   #    define SQLITE_ENABLE_LOCKING_STYLE 1
  5133   5127   #  else
  5134   5128   #    define SQLITE_ENABLE_LOCKING_STYLE 0
  5135   5129   #  endif
  5136   5130   #endif
  5137   5131   #if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
  5138   5132     {
  5139   5133       char *testPath;
  5140   5134       int rc;
         5135  +    int nPwd;
         5136  +    const char *zPwd;
  5141   5137       char proxyPath[400];
  5142   5138       
         5139  +    zPwd = Tcl_GetStringFromObj(objv[2], &nPwd);
  5143   5140       if( sizeof(proxyPath)<nPwd+20 ){
  5144   5141         Tcl_AppendResult(interp, "PWD too big", (void*)0);
  5145   5142         return TCL_ERROR;
  5146   5143       }
  5147   5144       sprintf(proxyPath, "%s/test.proxy", zPwd);
  5148   5145       rc = sqlite3_file_control(db, NULL, SQLITE_SET_LOCKPROXYFILE, proxyPath);
  5149   5146       if( rc ){

Changes to src/test5.c.

    60     60     int objc,
    61     61     Tcl_Obj *CONST objv[]
    62     62   ){
    63     63     int do_calls;
    64     64     int repeat_count;
    65     65     int i;
    66     66     Mem val;
    67         -  const char *zVal;
    68     67   
    69     68     if( objc!=3 ){
    70     69       Tcl_AppendResult(interp, "wrong # args: should be \"",
    71     70           Tcl_GetStringFromObj(objv[0], 0), " <repeat-count> <do-calls>", 0);
    72     71       return TCL_ERROR;
    73     72     }
    74     73   
................................................................................
    78     77     val.flags = MEM_Str|MEM_Term|MEM_Static;
    79     78     val.z = "hello world";
    80     79     val.type = SQLITE_TEXT;
    81     80     val.enc = SQLITE_UTF8;
    82     81   
    83     82     for(i=0; i<repeat_count; i++){
    84     83       if( do_calls ){
    85         -      zVal = (char*)sqlite3_value_text(&val);
           84  +      sqlite3_value_text(&val);
    86     85       }
    87     86     }
    88     87   
    89     88     return TCL_OK;
    90     89   }
    91     90   
    92     91   static u8 name_to_enc(Tcl_Interp *interp, Tcl_Obj *pObj){

Changes to src/test_malloc.c.

   709    709   */
   710    710   static int test_memdebug_settitle(
   711    711     void * clientData,
   712    712     Tcl_Interp *interp,
   713    713     int objc,
   714    714     Tcl_Obj *CONST objv[]
   715    715   ){
   716         -  const char *zTitle;
   717    716     if( objc!=2 ){
   718    717       Tcl_WrongNumArgs(interp, 1, objv, "TITLE");
   719    718       return TCL_ERROR;
   720    719     }
   721         -  zTitle = Tcl_GetString(objv[1]);
   722    720   #ifdef SQLITE_MEMDEBUG
   723    721     {
          722  +    const char *zTitle;
          723  +    zTitle = Tcl_GetString(objv[1]);
   724    724       extern int sqlite3MemdebugSettitle(const char*);
   725    725       sqlite3MemdebugSettitle(zTitle);
   726    726     }
   727    727   #endif
   728    728     return TCL_OK;
   729    729   }
   730    730   
................................................................................
  1029   1029   */
  1030   1030   static int test_config_lookaside(
  1031   1031     void * clientData,
  1032   1032     Tcl_Interp *interp,
  1033   1033     int objc,
  1034   1034     Tcl_Obj *CONST objv[]
  1035   1035   ){
  1036         -  int rc;
  1037   1036     int sz, cnt;
  1038   1037     Tcl_Obj *pRet;
  1039   1038     if( objc!=3 ){
  1040   1039       Tcl_WrongNumArgs(interp, 1, objv, "SIZE COUNT");
  1041   1040       return TCL_ERROR;
  1042   1041     }
  1043   1042     if( Tcl_GetIntFromObj(interp, objv[1], &sz) ) return TCL_ERROR;
................................................................................
  1045   1044     pRet = Tcl_NewObj();
  1046   1045     Tcl_ListObjAppendElement(
  1047   1046         interp, pRet, Tcl_NewIntObj(sqlite3GlobalConfig.szLookaside)
  1048   1047     );
  1049   1048     Tcl_ListObjAppendElement(
  1050   1049         interp, pRet, Tcl_NewIntObj(sqlite3GlobalConfig.nLookaside)
  1051   1050     );
  1052         -  rc = sqlite3_config(SQLITE_CONFIG_LOOKASIDE, sz, cnt);
         1051  +  sqlite3_config(SQLITE_CONFIG_LOOKASIDE, sz, cnt);
  1053   1052     Tcl_SetObjResult(interp, pRet);
  1054   1053     return TCL_OK;
  1055   1054   }
  1056   1055   
  1057   1056   
  1058   1057   /*
  1059   1058   ** Usage:    sqlite3_db_config_lookaside  CONNECTION  BUFID  SIZE  COUNT
................................................................................
  1102   1101   static int test_config_heap(
  1103   1102     void * clientData, 
  1104   1103     Tcl_Interp *interp,
  1105   1104     int objc,
  1106   1105     Tcl_Obj *CONST objv[]
  1107   1106   ){
  1108   1107     static char *zBuf; /* Use this memory */
  1109         -  static int szBuf;  /* Bytes allocated for zBuf */
  1110   1108     int nByte;         /* Size of buffer to pass to sqlite3_config() */
  1111   1109     int nMinAlloc;     /* Size of minimum allocation */
  1112   1110     int rc;            /* Return code of sqlite3_config() */
  1113   1111   
  1114   1112     Tcl_Obj * CONST *aArg = &objv[1];
  1115   1113     int nArg = objc-1;
  1116   1114   
................................................................................
  1120   1118     }
  1121   1119     if( Tcl_GetIntFromObj(interp, aArg[0], &nByte) ) return TCL_ERROR;
  1122   1120     if( Tcl_GetIntFromObj(interp, aArg[1], &nMinAlloc) ) return TCL_ERROR;
  1123   1121   
  1124   1122     if( nByte==0 ){
  1125   1123       free( zBuf );
  1126   1124       zBuf = 0;
  1127         -    szBuf = 0;
  1128   1125       rc = sqlite3_config(SQLITE_CONFIG_HEAP, (void*)0, 0, 0);
  1129   1126     }else{
  1130   1127       zBuf = realloc(zBuf, nByte);
  1131         -    szBuf = nByte;
  1132   1128       rc = sqlite3_config(SQLITE_CONFIG_HEAP, zBuf, nByte, nMinAlloc);
  1133   1129     }
  1134   1130   
  1135   1131     Tcl_SetResult(interp, (char *)sqlite3TestErrorName(rc), TCL_VOLATILE);
  1136   1132     return TCL_OK;
  1137   1133   }
  1138   1134   

Changes to src/test_thread.c.

   269    269     int objc,
   270    270     Tcl_Obj *CONST objv[]
   271    271   ){
   272    272     int sqlite3TestMakePointerStr(Tcl_Interp *interp, char *zPtr, void *p);
   273    273   
   274    274     const char *zFilename;
   275    275     sqlite3 *db;
   276         -  int rc;
   277    276     char zBuf[100];
   278    277     extern void Md5_Register(sqlite3*);
   279    278   
   280    279     UNUSED_PARAMETER(clientData);
   281    280     UNUSED_PARAMETER(objc);
   282    281   
   283    282     zFilename = Tcl_GetString(objv[2]);
   284         -  rc = sqlite3_open(zFilename, &db);
          283  +  sqlite3_open(zFilename, &db);
   285    284   #ifdef SQLITE_HAS_CODEC
   286    285     if( db && objc>=4 ){
   287    286       const char *zKey;
   288    287       int nKey;
          288  +    int rc;
   289    289       zKey = Tcl_GetStringFromObj(objv[3], &nKey);
   290    290       rc = sqlite3_key(db, zKey, nKey);
   291    291       if( rc!=SQLITE_OK ){
   292    292         char *zErrMsg = sqlite3_mprintf("error %d: %s", rc, sqlite3_errmsg(db));
   293    293         sqlite3_close(db);
   294    294         Tcl_AppendResult(interp, zErrMsg, (char*)0);
   295    295         sqlite3_free(zErrMsg);