Index: Makefile.msc ================================================================== --- Makefile.msc +++ Makefile.msc @@ -286,10 +286,15 @@ # the command line tools used during the compilation process. If # so, set the necessary macro now. # !IF $(USE_NATIVE_LIBPATHS)!=0 NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)" + +!IFDEF NUCRTLIBPATH +NUCRTLIBPATH = $(NUCRTLIBPATH:\\=\) +NLTLIBPATHS = $(NLTLIBPATHS) "/LIBPATH:$(NUCRTLIBPATH)" +!ENDIF !ENDIF # C compiler and options for use in building executables that # will run on the target platform. (BCC and TCC are usually the # same unless your are cross-compiling.) Index: ext/fts3/fts3_tokenizer.c ================================================================== --- ext/fts3/fts3_tokenizer.c +++ ext/fts3/fts3_tokenizer.c @@ -277,13 +277,13 @@ pHash = (Fts3Hash *)sqlite3_user_data(context); p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1); if( !p ){ - char *zErr = sqlite3_mprintf("unknown tokenizer: %s", zName); - sqlite3_result_error(context, zErr, -1); - sqlite3_free(zErr); + char *zErr2 = sqlite3_mprintf("unknown tokenizer: %s", zName); + sqlite3_result_error(context, zErr2, -1); + sqlite3_free(zErr2); return; } pRet = Tcl_NewObj(); Tcl_IncrRefCount(pRet); Index: ext/misc/fuzzer.c ================================================================== --- ext/misc/fuzzer.c +++ ext/misc/fuzzer.c @@ -874,11 +874,11 @@ pNew = sqlite3_malloc( sizeof(*pNew) + (int)strlen(zWord) + 1 ); if( pNew==0 ) return 0; memset(pNew, 0, sizeof(*pNew)); pNew->zBasis = (char*)&pNew[1]; - pNew->nBasis = (int)strlen(zWord); + pNew->nBasis = (fuzzer_len)strlen(zWord); memcpy(pNew->zBasis, zWord, pNew->nBasis+1); pRule = pCur->pVtab->pRule; while( fuzzerSkipRule(pRule, pNew, pCur->iRuleset) ){ pRule = pRule->pNext; } Index: src/insert.c ================================================================== --- src/insert.c +++ src/insert.c @@ -2023,11 +2023,10 @@ ** If any of the indexed columns use a collation sequence other than ** BINARY, this optimization is disabled. This is because the user ** might change the definition of a collation sequence and then run ** a VACUUM command. In that case keys may not be written in strictly ** sorted order. */ - int i; for(i=0; inColumn; i++){ char *zColl = pSrcIdx->azColl[i]; assert( zColl!=0 ); if( sqlite3_stricmp("BINARY", zColl) ) break; } Index: src/pager.c ================================================================== --- src/pager.c +++ src/pager.c @@ -3042,13 +3042,11 @@ Pgno nTruncate, /* Database size after this commit */ int isCommit /* True if this is a commit */ ){ int rc; /* Return code */ int nList; /* Number of pages in pList */ -#if defined(SQLITE_DEBUG) || defined(SQLITE_CHECK_PAGES) PgHdr *p; /* For looping over pages */ -#endif assert( pPager->pWal ); assert( pList ); #ifdef SQLITE_DEBUG /* Verify that the page list is in accending order */ @@ -3061,11 +3059,10 @@ if( isCommit ){ /* If a WAL transaction is being committed, there is no point in writing ** any pages with page numbers greater than nTruncate into the WAL file. ** They will never be read by any client. So remove them from the pDirty ** list here. */ - PgHdr *p; PgHdr **ppNext = &pList; nList = 0; for(p=pList; (*ppNext = p)!=0; p=p->pDirty){ if( p->pgno<=nTruncate ){ ppNext = &p->pDirty; @@ -3081,11 +3078,10 @@ if( pList->pgno==1 ) pager_write_changecounter(pList); rc = sqlite3WalFrames(pPager->pWal, pPager->pageSize, pList, nTruncate, isCommit, pPager->walSyncFlags ); if( rc==SQLITE_OK && pPager->pBackup ){ - PgHdr *p; for(p=pList; p; p=p->pDirty){ sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData); } } Index: src/pragma.c ================================================================== --- src/pragma.c +++ src/pragma.c @@ -162,19 +162,19 @@ /* ** Generate code to return a single integer value. */ static void returnSingleInt(Parse *pParse, const char *zLabel, i64 value){ Vdbe *v = sqlite3GetVdbe(pParse); - int mem = ++pParse->nMem; + int nMem = ++pParse->nMem; i64 *pI64 = sqlite3DbMallocRaw(pParse->db, sizeof(value)); if( pI64 ){ memcpy(pI64, &value, sizeof(value)); } - sqlite3VdbeAddOp4(v, OP_Int64, 0, mem, 0, (char*)pI64, P4_INT64); + sqlite3VdbeAddOp4(v, OP_Int64, 0, nMem, 0, (char*)pI64, P4_INT64); sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLabel, SQLITE_STATIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, mem, 1); + sqlite3VdbeAddOp2(v, OP_ResultRow, nMem, 1); } /* ** Set the safety_level and pager flags for pager iDb. Or if iDb<0 @@ -335,15 +335,15 @@ aFcntl[3] = 0; db->busyHandler.nBusy = 0; rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl); if( rc==SQLITE_OK ){ if( aFcntl[0] ){ - int mem = ++pParse->nMem; - sqlite3VdbeAddOp4(v, OP_String8, 0, mem, 0, aFcntl[0], 0); + int nMem = ++pParse->nMem; + sqlite3VdbeAddOp4(v, OP_String8, 0, nMem, 0, aFcntl[0], 0); sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "result", SQLITE_STATIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, mem, 1); + sqlite3VdbeAddOp2(v, OP_ResultRow, nMem, 1); sqlite3_free(aFcntl[0]); } goto pragma_out; } if( rc!=SQLITE_NOTFOUND ){ Index: src/shell.c ================================================================== --- src/shell.c +++ src/shell.c @@ -334,11 +334,11 @@ /* ** The following is the open SQLite database. We make a pointer ** to this database a static variable so that it can be accessed ** by the SIGINT handler to interrupt database processing. */ -static sqlite3 *db = 0; +static sqlite3 *globalDb = 0; /* ** True if an interrupt (Control-C) has been received. */ static volatile int seenInterrupt = 0; @@ -803,11 +803,11 @@ */ static void interrupt_handler(int NotUsed){ UNUSED_PARAMETER(NotUsed); seenInterrupt++; if( seenInterrupt>2 ) exit(1); - if( db ) sqlite3_interrupt(db); + if( globalDb ) sqlite3_interrupt(globalDb); } #endif /* ** This is the callback routine that the shell @@ -1907,27 +1907,27 @@ */ static void open_db(ShellState *p, int keepAlive){ if( p->db==0 ){ sqlite3_initialize(); sqlite3_open(p->zDbFilename, &p->db); - db = p->db; - if( db && sqlite3_errcode(db)==SQLITE_OK ){ - sqlite3_create_function(db, "shellstatic", 0, SQLITE_UTF8, 0, + globalDb = p->db; + if( p->db && sqlite3_errcode(p->db)==SQLITE_OK ){ + sqlite3_create_function(p->db, "shellstatic", 0, SQLITE_UTF8, 0, shellstaticFunc, 0, 0); } - if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){ + if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){ fprintf(stderr,"Error: unable to open database \"%s\": %s\n", - p->zDbFilename, sqlite3_errmsg(db)); + p->zDbFilename, sqlite3_errmsg(p->db)); if( keepAlive ) return; exit(1); } #ifndef SQLITE_OMIT_LOAD_EXTENSION sqlite3_enable_load_extension(p->db, 1); #endif - sqlite3_create_function(db, "readfile", 1, SQLITE_UTF8, 0, + sqlite3_create_function(p->db, "readfile", 1, SQLITE_UTF8, 0, readfileFunc, 0, 0); - sqlite3_create_function(db, "writefile", 2, SQLITE_UTF8, 0, + sqlite3_create_function(p->db, "writefile", 2, SQLITE_UTF8, 0, writefileFunc, 0, 0); } } /* @@ -2584,36 +2584,36 @@ ** process that line. ** ** Return 1 on error, 2 to exit, and 0 otherwise. */ static int do_meta_command(char *zLine, ShellState *p){ - int i = 1; + int h = 1; int nArg = 0; int n, c; int rc = 0; char *azArg[50]; /* Parse the input line into tokens. */ - while( zLine[i] && nArgdb, zSql, -1, &pStmt, 0); import_append_char(&sCtx, 0); /* To ensure sCtx.z is allocated */ - if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(db))==0 ){ + if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(p->db))==0 ){ char *zCreate = sqlite3_mprintf("CREATE TABLE %s", zTable); char cSep = '('; while( xRead(&sCtx) ){ zCreate = sqlite3_mprintf("%z%c\n \"%s\" TEXT", zCreate, cSep, sCtx.z); cSep = ','; @@ -3005,21 +3005,21 @@ zCreate = sqlite3_mprintf("%z\n)", zCreate); rc = sqlite3_exec(p->db, zCreate, 0, 0, 0); sqlite3_free(zCreate); if( rc ){ fprintf(stderr, "CREATE TABLE %s(...) failed: %s\n", zTable, - sqlite3_errmsg(db)); + sqlite3_errmsg(p->db)); sqlite3_free(sCtx.z); xCloser(sCtx.in); return 1; } rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); } sqlite3_free(zSql); if( rc ){ if (pStmt) sqlite3_finalize(pStmt); - fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db)); + fprintf(stderr,"Error: %s\n", sqlite3_errmsg(p->db)); xCloser(sCtx.in); return 1; } nCol = sqlite3_column_count(pStmt); sqlite3_finalize(pStmt); @@ -3040,17 +3040,17 @@ zSql[j++] = ')'; zSql[j] = 0; rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( rc ){ - fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db)); + fprintf(stderr, "Error: %s\n", sqlite3_errmsg(p->db)); if (pStmt) sqlite3_finalize(pStmt); xCloser(sCtx.in); return 1; } - needCommit = sqlite3_get_autocommit(db); - if( needCommit ) sqlite3_exec(db, "BEGIN", 0, 0, 0); + needCommit = sqlite3_get_autocommit(p->db); + if( needCommit ) sqlite3_exec(p->db, "BEGIN", 0, 0, 0); do{ int startLine = sCtx.nLine; for(i=0; i=nCol ){ sqlite3_step(pStmt); rc = sqlite3_reset(pStmt); if( rc!=SQLITE_OK ){ fprintf(stderr, "%s:%d: INSERT failed: %s\n", sCtx.zFile, startLine, - sqlite3_errmsg(db)); + sqlite3_errmsg(p->db)); } } }while( sCtx.cTerm!=EOF ); xCloser(sCtx.in); sqlite3_free(sCtx.z); sqlite3_finalize(pStmt); - if( needCommit ) sqlite3_exec(db, "COMMIT", 0, 0, 0); + if( needCommit ) sqlite3_exec(p->db, "COMMIT", 0, 0, 0); }else if( c=='i' && (strncmp(azArg[0], "indices", n)==0 || strncmp(azArg[0], "indexes", n)==0) ){ ShellState data; @@ -3647,17 +3647,17 @@ sqlite3_bind_text(pStmt, 1, "%", -1, SQLITE_STATIC); } while( sqlite3_step(pStmt)==SQLITE_ROW ){ if( nRow>=nAlloc ){ char **azNew; - int n = nAlloc*2 + 10; - azNew = sqlite3_realloc(azResult, sizeof(azResult[0])*n); + int n2 = nAlloc*2 + 10; + azNew = sqlite3_realloc(azResult, sizeof(azResult[0])*n2); if( azNew==0 ){ fprintf(stderr, "Error: out of memory\n"); break; } - nAlloc = n; + nAlloc = n2; azResult = azNew; } azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0)); if( azResult[nRow] ) nRow++; } @@ -3706,19 +3706,19 @@ { "byteorder", SQLITE_TESTCTRL_BYTEORDER }, { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT }, { "imposter", SQLITE_TESTCTRL_IMPOSTER }, }; int testctrl = -1; - int rc = 0; - int i, n; + int rc2 = 0; + int i, n2; open_db(p, 0); /* convert testctrl text option to value. allow any unique prefix ** of the option name, or a numerical value. */ - n = strlen30(azArg[1]); + n2 = strlen30(azArg[1]); for(i=0; i<(int)(sizeof(aCtrl)/sizeof(aCtrl[0])); i++){ - if( strncmp(azArg[1], aCtrl[i].zCtrlName, n)==0 ){ + if( strncmp(azArg[1], aCtrl[i].zCtrlName, n2)==0 ){ if( testctrl<0 ){ testctrl = aCtrl[i].ctrlCode; }else{ fprintf(stderr, "ambiguous option name: \"%s\"\n", azArg[1]); testctrl = -1; @@ -3735,12 +3735,12 @@ /* sqlite3_test_control(int, db, int) */ case SQLITE_TESTCTRL_OPTIMIZATIONS: case SQLITE_TESTCTRL_RESERVE: if( nArg==3 ){ int opt = (int)strtol(azArg[2], 0, 0); - rc = sqlite3_test_control(testctrl, p->db, opt); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); + rc2 = sqlite3_test_control(testctrl, p->db, opt); + fprintf(p->out, "%d (0x%08x)\n", rc2, rc2); } else { fprintf(stderr,"Error: testctrl %s takes a single int option\n", azArg[1]); } break; @@ -3749,23 +3749,23 @@ case SQLITE_TESTCTRL_PRNG_SAVE: case SQLITE_TESTCTRL_PRNG_RESTORE: case SQLITE_TESTCTRL_PRNG_RESET: case SQLITE_TESTCTRL_BYTEORDER: if( nArg==2 ){ - rc = sqlite3_test_control(testctrl); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); + rc2 = sqlite3_test_control(testctrl); + fprintf(p->out, "%d (0x%08x)\n", rc2, rc2); } else { fprintf(stderr,"Error: testctrl %s takes no options\n", azArg[1]); } break; /* sqlite3_test_control(int, uint) */ case SQLITE_TESTCTRL_PENDING_BYTE: if( nArg==3 ){ unsigned int opt = (unsigned int)integerValue(azArg[2]); - rc = sqlite3_test_control(testctrl, opt); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); + rc2 = sqlite3_test_control(testctrl, opt); + fprintf(p->out, "%d (0x%08x)\n", rc2, rc2); } else { fprintf(stderr,"Error: testctrl %s takes a single unsigned" " int option\n", azArg[1]); } break; @@ -3774,12 +3774,12 @@ case SQLITE_TESTCTRL_ASSERT: case SQLITE_TESTCTRL_ALWAYS: case SQLITE_TESTCTRL_NEVER_CORRUPT: if( nArg==3 ){ int opt = booleanValue(azArg[2]); - rc = sqlite3_test_control(testctrl, opt); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); + rc2 = sqlite3_test_control(testctrl, opt); + fprintf(p->out, "%d (0x%08x)\n", rc2, rc2); } else { fprintf(stderr,"Error: testctrl %s takes a single int option\n", azArg[1]); } break; @@ -3787,26 +3787,26 @@ /* sqlite3_test_control(int, char *) */ #ifdef SQLITE_N_KEYWORD case SQLITE_TESTCTRL_ISKEYWORD: if( nArg==3 ){ const char *opt = azArg[2]; - rc = sqlite3_test_control(testctrl, opt); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); + rc2 = sqlite3_test_control(testctrl, opt); + fprintf(p->out, "%d (0x%08x)\n", rc2, rc2); } else { fprintf(stderr,"Error: testctrl %s takes a single char * option\n", azArg[1]); } break; #endif case SQLITE_TESTCTRL_IMPOSTER: if( nArg==5 ){ - rc = sqlite3_test_control(testctrl, p->db, + rc2 = sqlite3_test_control(testctrl, p->db, azArg[2], integerValue(azArg[3]), integerValue(azArg[4])); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); + fprintf(p->out, "%d (0x%08x)\n", rc2, rc2); }else{ fprintf(stderr,"Usage: .testctrl imposter dbName onoff tnum\n"); } break; Index: src/tclsqlite.c ================================================================== --- src/tclsqlite.c +++ src/tclsqlite.c @@ -1189,11 +1189,11 @@ Tcl_Obj *pVar = Tcl_GetVar2Ex(interp, &zVar[1], 0, 0); if( pVar ){ int n; u8 *data; const char *zType = (pVar->typePtr ? pVar->typePtr->name : ""); - char c = zType[0]; + c = zType[0]; if( zVar[0]=='@' || (c=='b' && strcmp(zType,"bytearray")==0 && pVar->bytes==0) ){ /* Load a BLOB type if the Tcl variable is a bytearray and ** it has no string representation or the host ** parameter name begins with "@". */ @@ -2296,11 +2296,11 @@ Tcl_SetObjResult(interp, pRet); rc = TCL_OK; } Tcl_DecrRefCount(pRet); }else{ - ClientData cd[2]; + ClientData cd2[2]; DbEvalContext *p; Tcl_Obj *pArray = 0; Tcl_Obj *pScript; if( objc==5 && *(char *)Tcl_GetString(objv[3]) ){ @@ -2310,13 +2310,13 @@ Tcl_IncrRefCount(pScript); p = (DbEvalContext *)Tcl_Alloc(sizeof(DbEvalContext)); dbEvalInit(p, pDb, objv[2], pArray); - cd[0] = (void *)p; - cd[1] = (void *)pScript; - rc = DbEvalNextCmd(cd, interp, TCL_OK); + cd2[0] = (void *)p; + cd2[1] = (void *)pScript; + rc = DbEvalNextCmd(cd2, interp, TCL_OK); } break; } /* Index: src/test_malloc.c ================================================================== --- src/test_malloc.c +++ src/test_malloc.c @@ -209,19 +209,19 @@ } sqlite3_test_control(SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, faultsimBeginBenign, faultsimEndBenign ); }else{ - sqlite3_mem_methods m; + sqlite3_mem_methods m2; assert(memfault.m.xMalloc); /* One should be able to reset the default memory allocator by storing ** a zeroed allocator then calling GETMALLOC. */ - memset(&m, 0, sizeof(m)); - sqlite3_config(SQLITE_CONFIG_MALLOC, &m); - sqlite3_config(SQLITE_CONFIG_GETMALLOC, &m); - assert( memcmp(&m, &memfault.m, sizeof(m))==0 ); + memset(&m2, 0, sizeof(m2)); + sqlite3_config(SQLITE_CONFIG_MALLOC, &m2); + sqlite3_config(SQLITE_CONFIG_GETMALLOC, &m2); + assert( memcmp(&m2, &memfault.m, sizeof(m2))==0 ); rc = sqlite3_config(SQLITE_CONFIG_MALLOC, &memfault.m); sqlite3_test_control(SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, 0, 0); } Index: src/test_multiplex.c ================================================================== --- src/test_multiplex.c +++ src/test_multiplex.c @@ -566,19 +566,19 @@ if( rc==SQLITE_OK ){ pSubOpen = multiplexSubOpen(pGroup, 0, &rc, pOutFlags, 0); if( pSubOpen==0 && rc==SQLITE_OK ) rc = SQLITE_CANTOPEN; } if( rc==SQLITE_OK ){ - sqlite3_int64 sz; + sqlite3_int64 sz64; - rc = pSubOpen->pMethods->xFileSize(pSubOpen, &sz); + rc = pSubOpen->pMethods->xFileSize(pSubOpen, &sz64); if( rc==SQLITE_OK && zName ){ int bExists; if( flags & SQLITE_OPEN_MASTER_JOURNAL ){ pGroup->bEnabled = 0; }else - if( sz==0 ){ + if( sz64==0 ){ if( flags & SQLITE_OPEN_MAIN_JOURNAL ){ /* If opening a main journal file and the first chunk is zero ** bytes in size, delete any subsequent chunks from the ** file-system. */ int iChunk = 1; @@ -605,14 +605,14 @@ ** just disable the multiplexor all togethre. */ rc = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[1].z, SQLITE_ACCESS_EXISTS, &bExists); bExists = multiplexSubSize(pGroup, 1, &rc)>0; - if( rc==SQLITE_OK && bExists && sz==(sz&0xffff0000) && sz>0 - && sz!=pGroup->szChunk ){ - pGroup->szChunk = (int)sz; - }else if( rc==SQLITE_OK && !bExists && sz>pGroup->szChunk ){ + if( rc==SQLITE_OK && bExists && sz64==(sz64&0xffff0000) && sz64>0 + && sz64!=pGroup->szChunk ){ + pGroup->szChunk = (int)sz64; + }else if( rc==SQLITE_OK && !bExists && sz64>pGroup->szChunk ){ pGroup->bEnabled = 0; } } } } Index: src/test_onefile.c ================================================================== --- src/test_onefile.c +++ src/test_onefile.c @@ -593,13 +593,13 @@ int eType; int nName; int rc = SQLITE_OK; if( 0==(flags&(SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_MAIN_JOURNAL)) ){ - tmp_file *p = (tmp_file *)pFile; - memset(p, 0, sizeof(*p)); - p->base.pMethods = &tmp_io_methods; + tmp_file *p2 = (tmp_file *)pFile; + memset(p2, 0, sizeof(*p2)); + p2->base.pMethods = &tmp_io_methods; return SQLITE_OK; } eType = ((flags&(SQLITE_OPEN_MAIN_DB))?DATABASE_FILE:JOURNAL_FILE); p->base.pMethods = &fs_io_methods; Index: src/test_osinst.c ================================================================== --- src/test_osinst.c +++ src/test_osinst.c @@ -1129,11 +1129,10 @@ return TCL_ERROR; } switch( (enum VL_enum)iSub ){ case VL_ANNOTATE: { - int rc; char *zVfs; char *zMsg; if( objc!=4 ){ Tcl_WrongNumArgs(interp, 3, objv, "VFS"); return TCL_ERROR; @@ -1146,11 +1145,10 @@ return TCL_ERROR; } break; } case VL_FINALIZE: { - int rc; char *zVfs; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "VFS"); return TCL_ERROR; } @@ -1162,11 +1160,10 @@ } break; }; case VL_NEW: { - int rc; char *zVfs; char *zParent; char *zLog; if( objc!=5 ){ Tcl_WrongNumArgs(interp, 2, objv, "VFS PARENT LOGFILE"); Index: src/test_vfs.c ================================================================== --- src/test_vfs.c +++ src/test_vfs.c @@ -1078,11 +1078,11 @@ Tcl_ResetResult(interp); switch( aSubcmd[i].eCmd ){ case CMD_SHM: { Tcl_Obj *pObj; - int i, rc; + int rc; TestvfsBuffer *pBuffer; char *zName; if( objc!=3 && objc!=4 ){ Tcl_WrongNumArgs(interp, 2, objv, "FILE ?VALUE?"); return TCL_ERROR; @@ -1158,11 +1158,10 @@ { "xLock", TESTVFS_LOCK_MASK }, { "xCheckReservedLock", TESTVFS_CKLOCK_MASK }, }; Tcl_Obj **apElem = 0; int nElem = 0; - int i; int mask = 0; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "LIST"); return TCL_ERROR; } Index: src/where.c ================================================================== --- src/where.c +++ src/where.c @@ -6644,11 +6644,10 @@ if( pParse->nErr || NEVER(db->mallocFailed) ){ goto whereBeginError; } #ifdef WHERETRACE_ENABLED /* !=0 */ if( sqlite3WhereTrace ){ - int ii; sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut); if( pWInfo->nOBSat>0 ){ sqlite3DebugPrintf(" ORDERBY=%d,0x%llx", pWInfo->nOBSat, pWInfo->revMask); } switch( pWInfo->eDistinct ){ Index: tool/build-all-msvc.bat ================================================================== --- tool/build-all-msvc.bat +++ tool/build-all-msvc.bat @@ -26,30 +26,76 @@ REM REM In the example above, "C:\dev\sqlite\core" represents the root of the REM source tree for SQLite and "C:\Temp" represents the final destination REM directory for the generated output files. REM +REM Please note that the SQLite build process performed by the Makefile +REM associated with this batch script requires both Gawk ^(gawk.exe^) and Tcl +REM 8.5 ^(tclsh85.exe^) to be present in a directory contained in the PATH +REM environment variable unless a pre-existing amalgamation file is used. +REM REM There are several environment variables that may be set to modify the REM behavior of this batch script and its associated Makefile. The list of REM platforms to build may be overriden by using the PLATFORMS environment REM variable, which should contain a list of platforms ^(e.g. x86 x86_amd64 REM x86_arm^). All platforms must be supported by the version of Visual Studio REM being used. The list of configurations to build may be overridden by REM setting the CONFIGURATIONS environment variable, which should contain a REM list of configurations to build ^(e.g. Debug Retail^). Neither of these REM variable values may contain any double quotes, surrounding or embedded. -REM Finally, the NCRTLIBPATH and NSDKLIBPATH environment variables may be set -REM to specify the location of the CRT and SDK, respectively, needed to compile -REM executables native to the architecture of the build machine during any -REM cross-compilation that may be necessary, depending on the platforms to be -REM built. These values in these two variables should be surrounded by double -REM quotes if they contain spaces. +REM +REM Finally, the NCRTLIBPATH, NUCRTLIBPATH, and NSDKLIBPATH environment +REM variables may be set to specify the location of the CRT, Universal CRT, and +REM Windows SDK, respectively, that may be needed to compile executables native +REM to the architecture of the build machine during any cross-compilation that +REM may be necessary, depending on the platforms to be built. These values in +REM these three variables should be surrounded by double quotes if they contain +REM spaces. +REM +REM There are a few other environment variables that impact the build process +REM when set ^(to anything^), they are: +REM +REM NOCLEAN +REM +REM When set, the "clean" target will not be used during each build iteration. +REM However, the target binaries, if any, will still be deleted manually prior +REM to being rebuilt. Setting this environment variable is only rarely needed +REM and could cause issues in some circumstances; therefore, setting it is not +REM recommended. +REM +REM NOSYMBOLS +REM +REM When set, copying of symbol files ^(*.pdb^) created during the build will +REM be skipped and they will not appear in the final destination directory. +REM Setting this environment variable is never strictly needed and could cause +REM issues in some circumstances; therefore, setting it is not recommended. +REM +REM BUILD_ALL_SHELL +REM +REM When set, the command line shell will be built for each selected platform +REM and configuration as well. In addition, the command line shell binaries +REM will be copied, with their symbols, to the final destination directory. +REM +REM USE_WINV63_NSDKLIBPATH +REM +REM When set, modifies how the NSDKLIBPATH environment variable is built, based +REM on the WindowsSdkDir environment variable. It forces this batch script to +REM assume the Windows 8.1 SDK location should be used. +REM +REM USE_WINV100_NSDKLIBPATH +REM +REM When set, modifies how the NSDKLIBPATH environment variable is built, based +REM on the WindowsSdkDir environment variable. It causes this batch script to +REM assume the Windows 10.0 SDK location should be used. +REM +REM NMAKE_ARGS +REM +REM When set, the value is expanded and passed to the NMAKE command line, after +REM its other arguments. This is used to specify additional NMAKE options, for +REM example: REM -REM Please note that the SQLite build process performed by the Makefile -REM associated with this batch script requires both Gawk ^(gawk.exe^) and Tcl -REM 8.5 ^(tclsh85.exe^) to be present in a directory contained in the PATH -REM environment variable unless a pre-existing amalgamation file is used. +REM SET NMAKE_ARGS=FOR_WINRT=1 REM SETLOCAL REM SET __ECHO=ECHO REM SET __ECHO2=ECHO @@ -215,12 +261,24 @@ SET TOOLPATH=%gawk.exe_PATH%;%tclsh85.exe_PATH% %_VECHO% ToolPath = '%TOOLPATH%' REM -REM NOTE: Check for MSVC 2012/2013 because the Windows SDK directory handling -REM is slightly different for those versions. +REM NOTE: Setting the Windows SDK library path is only required for MSVC +REM 2012, 2013, and 2015. +REM +CALL :fn_UnsetVariable SET_NSDKLIBPATH + +REM +REM NOTE: Setting the Universal CRT library path is only required for MSVC +REM 2015. +REM +CALL :fn_UnsetVariable SET_NUCRTLIBPATH + +REM +REM NOTE: Check for MSVC 2012, 2013, and 2015 specially because the Windows +REM SDK directory handling is slightly different for those versions. REM IF "%VisualStudioVersion%" == "11.0" ( REM REM NOTE: If the Windows SDK library path has already been set, do not set REM it to something else later on. @@ -234,12 +292,26 @@ REM it to something else later on. REM IF NOT DEFINED NSDKLIBPATH ( SET SET_NSDKLIBPATH=1 ) -) ELSE ( - CALL :fn_UnsetVariable SET_NSDKLIBPATH +) ELSE IF "%VisualStudioVersion%" == "14.0" ( + REM + REM NOTE: If the Windows SDK library path has already been set, do not set + REM it to something else later on. + REM + IF NOT DEFINED NSDKLIBPATH ( + SET SET_NSDKLIBPATH=1 + ) + + REM + REM NOTE: If the Universal CRT library path has already been set, do not set + REM it to something else later on. + REM + IF NOT DEFINED NUCRTLIBPATH ( + SET SET_NUCRTLIBPATH=1 + ) ) REM REM NOTE: Check if this is the Windows Phone SDK. If so, a different batch REM file is necessary to setup the build environment. Since the variable @@ -292,10 +364,11 @@ CALL :fn_UnsetVariable FSHARPINSTALLDIR CALL :fn_UnsetVariable INCLUDE CALL :fn_UnsetVariable LIB CALL :fn_UnsetVariable LIBPATH CALL :fn_UnsetVariable Platform + CALL :fn_UnsetVariable UniversalCRTSdkDir REM CALL :fn_UnsetVariable VCINSTALLDIR CALL :fn_UnsetVariable VSINSTALLDIR CALL :fn_UnsetVariable WindowsPhoneKitDir CALL :fn_UnsetVariable WindowsSdkDir CALL :fn_UnsetVariable WindowsSdkDir_35 @@ -383,12 +456,12 @@ ) ) ) REM - REM NOTE: When using MSVC 2012 and/or 2013, the native SDK path cannot - REM simply use the "lib" sub-directory beneath the location + REM NOTE: When using MSVC 2012, 2013, or 2015, the native SDK path + REM cannot simply be the "lib" sub-directory beneath the location REM specified in the WindowsSdkDir environment variable because REM that location does not actually contain the necessary library REM files for x86. This must be done for each iteration because REM it relies upon the WindowsSdkDir environment variable being REM set by the batch file used to setup the MSVC environment. @@ -403,22 +476,40 @@ CALL :fn_AppendVariable NSDKLIBPATH \lib\x86 ) ELSE IF DEFINED WindowsSdkDir ( CALL :fn_CopyVariable WindowsSdkDir NSDKLIBPATH REM - REM NOTE: The Windows 8.1 SDK has a slightly different directory - REM naming convention. + REM NOTE: The Windows 8.x and Windows 10.0 SDKs have a slightly + REM different directory naming conventions. REM - IF DEFINED USE_WINV63_NSDKLIBPATH ( + IF DEFINED USE_WINV100_NSDKLIBPATH ( + CALL :fn_AppendVariable NSDKLIBPATH \..\10\lib\10.0.10030.0\um\x86 + ) ELSE IF DEFINED USE_WINV63_NSDKLIBPATH ( CALL :fn_AppendVariable NSDKLIBPATH \lib\winv6.3\um\x86 ) ELSE IF "%VisualStudioVersion%" == "12.0" ( + CALL :fn_AppendVariable NSDKLIBPATH \..\8.0\lib\win8\um\x86 + ) ELSE IF "%VisualStudioVersion%" == "14.0" ( CALL :fn_AppendVariable NSDKLIBPATH \..\8.0\lib\win8\um\x86 ) ELSE ( CALL :fn_AppendVariable NSDKLIBPATH \lib\win8\um\x86 ) ) ) + + REM + REM NOTE: When using MSVC 2015, setting the Universal CRT library path + REM for x86 may be required as well. This must also be done for + REM each iteration because it relies upon the UniversalCRTSdkDir + REM environment variable being set by the batch file used to + REM setup the MSVC environment. + REM + IF DEFINED SET_NUCRTLIBPATH ( + IF DEFINED UniversalCRTSdkDir ( + CALL :fn_CopyVariable UniversalCRTSdkDir NUCRTLIBPATH + CALL :fn_AppendVariable NUCRTLIBPATH \lib\winv10.0\ucrt\x86 + ) + ) REM REM NOTE: Unless prevented from doing so, invoke NMAKE with the MSVC REM makefile to clean any stale build output from previous REM iterations of this loop and/or previous runs of this batch Index: tool/lemon.c ================================================================== --- tool/lemon.c +++ tool/lemon.c @@ -1112,11 +1112,10 @@ Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); /* Resolve conflicts */ for(i=0; instate; i++){ struct action *ap, *nap; - struct state *stp; stp = lemp->sorted[i]; /* assert( stp->ap ); */ stp->ap = Action_sort(stp->ap); for(ap=stp->ap; ap && ap->next; ap=ap->next){ for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ @@ -3746,13 +3745,13 @@ tplt_xfer(lemp->name,in,out,&lineno); /* Generate the include code, if any */ tplt_print(out,lemp,lemp->include,&lineno); if( mhflag ){ - char *name = file_makename(lemp, ".h"); - fprintf(out,"#include \"%s\"\n", name); lineno++; - free(name); + char *incName = file_makename(lemp, ".h"); + fprintf(out,"#include \"%s\"\n", incName); lineno++; + free(incName); } tplt_xfer(lemp->name,in,out,&lineno); /* Generate #defines for all tokens */ if( mhflag ){ @@ -3789,11 +3788,10 @@ if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } name = lemp->name ? lemp->name : "Parse"; if( lemp->arg && lemp->arg[0] ){ - int i; i = lemonStrlen(lemp->arg); while( i>=1 && isspace(lemp->arg[i-1]) ) i--; while( i>=1 && (isalnum(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; @@ -4477,22 +4475,22 @@ } np = np->next; } if( x1a->count>=x1a->size ){ /* Need to make the hash table bigger */ - int i,size; + int i,arrSize; struct s_x1 array; - array.size = size = x1a->size*2; + array.size = arrSize = x1a->size*2; array.count = x1a->count; - array.tbl = (x1node*)calloc(size, sizeof(x1node) + sizeof(x1node*)); + array.tbl = (x1node*)calloc(arrSize, sizeof(x1node) + sizeof(x1node*)); if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x1node**)&(array.tbl[size]); - for(i=0; icount; i++){ x1node *oldnp, *newnp; oldnp = &(x1a->tbl[i]); - h = strhash(oldnp->data) & (size-1); + h = strhash(oldnp->data) & (arrSize-1); newnp = &(array.tbl[i]); if( array.ht[h] ) array.ht[h]->from = &(newnp->next); newnp->next = array.ht[h]; newnp->data = oldnp->data; newnp->from = &(array.ht[h]); @@ -4644,22 +4642,22 @@ } np = np->next; } if( x2a->count>=x2a->size ){ /* Need to make the hash table bigger */ - int i,size; + int i,arrSize; struct s_x2 array; - array.size = size = x2a->size*2; + array.size = arrSize = x2a->size*2; array.count = x2a->count; - array.tbl = (x2node*)calloc(size, sizeof(x2node) + sizeof(x2node*)); + array.tbl = (x2node*)calloc(arrSize, sizeof(x2node) + sizeof(x2node*)); if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x2node**)&(array.tbl[size]); - for(i=0; icount; i++){ x2node *oldnp, *newnp; oldnp = &(x2a->tbl[i]); - h = strhash(oldnp->key) & (size-1); + h = strhash(oldnp->key) & (arrSize-1); newnp = &(array.tbl[i]); if( array.ht[h] ) array.ht[h]->from = &(newnp->next); newnp->next = array.ht[h]; newnp->key = oldnp->key; newnp->data = oldnp->data; @@ -4720,16 +4718,16 @@ ** The array is obtained from malloc. Return NULL if memory allocation ** problems, or if the array is empty. */ struct symbol **Symbol_arrayof() { struct symbol **array; - int i,size; + int i,arrSize; if( x2a==0 ) return 0; - size = x2a->count; - array = (struct symbol **)calloc(size, sizeof(struct symbol *)); + arrSize = x2a->count; + array = (struct symbol **)calloc(arrSize, sizeof(struct symbol *)); if( array ){ - for(i=0; itbl[i].data; + for(i=0; itbl[i].data; } return array; } /* Compare two configurations */ @@ -4841,22 +4839,22 @@ } np = np->next; } if( x3a->count>=x3a->size ){ /* Need to make the hash table bigger */ - int i,size; + int i,arrSize; struct s_x3 array; - array.size = size = x3a->size*2; + array.size = arrSize = x3a->size*2; array.count = x3a->count; - array.tbl = (x3node*)calloc(size, sizeof(x3node) + sizeof(x3node*)); + array.tbl = (x3node*)calloc(arrSize, sizeof(x3node) + sizeof(x3node*)); if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x3node**)&(array.tbl[size]); - for(i=0; icount; i++){ x3node *oldnp, *newnp; oldnp = &(x3a->tbl[i]); - h = statehash(oldnp->key) & (size-1); + h = statehash(oldnp->key) & (arrSize-1); newnp = &(array.tbl[i]); if( array.ht[h] ) array.ht[h]->from = &(newnp->next); newnp->next = array.ht[h]; newnp->key = oldnp->key; newnp->data = oldnp->data; @@ -4899,16 +4897,16 @@ ** The array is obtained from malloc. Return NULL if memory allocation ** problems, or if the array is empty. */ struct state **State_arrayof() { struct state **array; - int i,size; + int i,arrSize; if( x3a==0 ) return 0; - size = x3a->count; - array = (struct state **)calloc(size, sizeof(struct state *)); + arrSize = x3a->count; + array = (struct state **)calloc(arrSize, sizeof(struct state *)); if( array ){ - for(i=0; itbl[i].data; + for(i=0; itbl[i].data; } return array; } /* Hash a configuration */ @@ -4981,22 +4979,22 @@ } np = np->next; } if( x4a->count>=x4a->size ){ /* Need to make the hash table bigger */ - int i,size; + int i,arrSize; struct s_x4 array; - array.size = size = x4a->size*2; + array.size = arrSize = x4a->size*2; array.count = x4a->count; - array.tbl = (x4node*)calloc(size, sizeof(x4node) + sizeof(x4node*)); + array.tbl = (x4node*)calloc(arrSize, sizeof(x4node) + sizeof(x4node*)); if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ - array.ht = (x4node**)&(array.tbl[size]); - for(i=0; icount; i++){ x4node *oldnp, *newnp; oldnp = &(x4a->tbl[i]); - h = confighash(oldnp->data) & (size-1); + h = confighash(oldnp->data) & (arrSize-1); newnp = &(array.tbl[i]); if( array.ht[h] ) array.ht[h]->from = &(newnp->next); newnp->next = array.ht[h]; newnp->data = oldnp->data; newnp->from = &(array.ht[h]); Index: tool/mkvsix.tcl ================================================================== --- tool/mkvsix.tcl +++ tool/mkvsix.tcl @@ -172,10 +172,13 @@ puts -nonewline $file_id $data close $file_id return "" } +# +# TODO: Modify this procedure when a new version of Visual Studio is released. +# proc getMinVsVersionXmlChunk { vsVersion } { switch -exact $vsVersion { 2012 { return [appendArgs \ "\r\n " {MinVSVersion="11.0"}] @@ -182,21 +185,30 @@ } 2013 { return [appendArgs \ "\r\n " {MinVSVersion="12.0"}] } + 2015 { + return [appendArgs \ + "\r\n " {MinVSVersion="14.0"}] + } default { return "" } } } +# +# TODO: Modify this procedure when a new version of Visual Studio is released. +# proc getMaxPlatformVersionXmlChunk { packageFlavor vsVersion } { # - # NOTE: Only Visual Studio 2013 supports this SDK manifest attribute. + # NOTE: Only Visual Studio 2013 and later support this attribute within the + # SDK manifest. # - if {![string equal $vsVersion 2013]} then { + if {![string equal $vsVersion 2013] && \ + ![string equal $vsVersion 2015]} then { return "" } switch -exact $packageFlavor { WinRT { @@ -219,10 +231,13 @@ return "" } } } +# +# TODO: Modify this procedure when a new version of Visual Studio is released. +# proc getExtraFileListXmlChunk { packageFlavor vsVersion } { # # NOTE: Windows Phone 8.0 does not require any extra attributes in its VSIX # package SDK manifests; however, it appears that Windows Phone 8.1 # does. @@ -243,10 +258,18 @@ 2013 { return [appendArgs \ "\r\n " AppliesTo=\" $appliesTo \" \ "\r\n " {DependsOn="Microsoft.VCLibs, version=12.0"}] } + 2015 { + # + # TODO: Is the ".AppLocal" suffix always needed here? + # + return [appendArgs \ + "\r\n " AppliesTo=\" $appliesTo \" \ + "\r\n " {DependsOn="Microsoft.VCLibs.AppLocal, version=14.0"}] + } default { return "" } } } @@ -352,14 +375,15 @@ if {[string length $vsVersion] == 0} then { fail "invalid Visual Studio version" } -if {![string equal $vsVersion 2012] && ![string equal $vsVersion 2013]} then { +if {![string equal $vsVersion 2012] && ![string equal $vsVersion 2013] && \ + ![string equal $vsVersion 2015]} then { fail [appendArgs \ "unsupported Visual Studio version, must be one of: " \ - [list 2012 2013]] + [list 2012 2013 2015]] } set shortNames(WinRT,2012) SQLite.WinRT set shortNames(WinRT,2013) SQLite.WinRT.2013 set shortNames(WinRT81,2013) SQLite.WinRT81 @@ -366,19 +390,21 @@ set shortNames(WP80,2012) SQLite.WP80 set shortNames(WP80,2013) SQLite.WP80.2013 set shortNames(WP81,2013) SQLite.WP81 set shortNames(Win32,2012) SQLite.Win32 set shortNames(Win32,2013) SQLite.Win32.2013 +set shortNames(UAP,2015) SQLite.UAP.2015 set displayNames(WinRT,2012) "SQLite for Windows Runtime" set displayNames(WinRT,2013) "SQLite for Windows Runtime" set displayNames(WinRT81,2013) "SQLite for Windows Runtime (Windows 8.1)" set displayNames(WP80,2012) "SQLite for Windows Phone" set displayNames(WP80,2013) "SQLite for Windows Phone" set displayNames(WP81,2013) "SQLite for Windows Phone 8.1" set displayNames(Win32,2012) "SQLite for Windows" set displayNames(Win32,2013) "SQLite for Windows" +set displayNames(UAP,2015) "SQLite for Universal App Platform" if {[string equal $packageFlavor WinRT]} then { set shortName $shortNames($packageFlavor,$vsVersion) set displayName $displayNames($packageFlavor,$vsVersion) set targetPlatformIdentifier Windows @@ -428,10 +454,26 @@ set targetPlatformVersion v8.1 set minVsVersion [getMinVsVersionXmlChunk $vsVersion] set maxPlatformVersion \ [getMaxPlatformVersionXmlChunk $packageFlavor $vsVersion] set extraSdkPath "\\..\\$targetPlatformIdentifier" + set extraFileListAttributes \ + [getExtraFileListXmlChunk $packageFlavor $vsVersion] +} elseif {[string equal $packageFlavor UAP]} then { + if {$vsVersion ne "2015"} then { + fail [appendArgs \ + "unsupported combination, package flavor " $packageFlavor \ + " is only supported with Visual Studio 2015"] + } + set shortName $shortNames($packageFlavor,$vsVersion) + set displayName $displayNames($packageFlavor,$vsVersion) + set targetPlatformIdentifier UAP + set targetPlatformVersion v0.8.0.0 + set minVsVersion [getMinVsVersionXmlChunk $vsVersion] + set maxPlatformVersion \ + [getMaxPlatformVersionXmlChunk $packageFlavor $vsVersion] + set extraSdkPath "\\..\\$targetPlatformIdentifier" set extraFileListAttributes \ [getExtraFileListXmlChunk $packageFlavor $vsVersion] } elseif {[string equal $packageFlavor Win32]} then { set shortName $shortNames($packageFlavor,$vsVersion) set displayName $displayNames($packageFlavor,$vsVersion) @@ -444,11 +486,11 @@ set extraFileListAttributes \ [getExtraFileListXmlChunk $packageFlavor $vsVersion] } else { fail [appendArgs \ "unsupported package flavor, must be one of: " \ - [list WinRT WinRT81 WP80 WP81 Win32]] + [list WinRT WinRT81 WP80 WP81 UAP Win32]] } ############################################################################### #