/ Check-in [76005fdc]
Login

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

Overview
Comment:Merge the latest trunk changes into the apple-osx branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA1: 76005fdca05d86f91e424698d86942264419c616
User & Date: drh 2011-06-21 01:30:53
Context
2011-06-22
11:24
Update apple-osx branch with the latest trunk changes. check-in: fb7ad09d user: dan tags: apple-osx
2011-06-21
01:30
Merge the latest trunk changes into the apple-osx branch. check-in: 76005fdc user: drh tags: apple-osx
2011-06-20
23:51
More typo fixes in evidence marks. No code changes. check-in: e60eefc7 user: drh tags: trunk
11:57
Merge the latest trunk changes into the apple-osx branch. check-in: 4c69e827 user: drh tags: apple-osx
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

    22     22   #
    23     23   BCC = cl.exe -O2
    24     24   
    25     25   # C Compile and options for use in building executables that
    26     26   # will run on the target platform.  (BCC and TCC are usually the
    27     27   # same unless your are cross-compiling.)
    28     28   #
    29         -TCC = cl.exe -W3 -O2 -DSQLITE_OS_WIN=1 -I. -I$(TOP)\src
           29  +TCC = cl.exe -W3 -O2 -DSQLITE_OS_WIN=1 -I. -I$(TOP)\src -fp:precise
    30     30   
    31     31   # The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in 
    32     32   # any extension header files by default.  For non-amalgamation
    33     33   # builds, we need to make sure the compiler can find these.
    34     34   #
    35     35   !IF $(USE_AMALGAMATION)==0
    36     36   TCC = $(TCC) -I$(TOP)\ext\fts3
................................................................................
   101    101   
   102    102   # Add in any optional parameters specified on the make commane line
   103    103   # ie.  make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
   104    104   TCC = $(TCC) $(OPTS)
   105    105   
   106    106   # libtool compile/link
   107    107   LTCOMPILE = $(TCC) -Fo$@
   108         -LTLINK = $(TCC) -Fe$@
   109    108   LTLIB = lib.exe
          109  +LTLINK = $(TCC) -Fe$@
          110  +
          111  +# If a platform was set, force the linker to target that.
          112  +# Note that the vcvars*.bat family of batch files typically
          113  +# set this for you.  Otherwise, the linker will attempt
          114  +# to deduce the binary type based on the object files.
          115  +!IF "$(PLATFORM)"!=""
          116  +LTLINKOPTS = /MACHINE:$(PLATFORM)
          117  +!ENDIF
   110    118   
   111    119   # nawk compatible awk.
   112    120   NAWK = .\gawk.exe
   113    121   
   114    122   # You should not have to change anything below this line
   115    123   ###############################################################################
   116    124   
................................................................................
   436    444   	$(LTLIB) -OUT:$@ $(LIBOBJ) $(TLIBS)
   437    445   
   438    446   libtclsqlite3.lib:	tclsqlite.lo libsqlite3.lib
   439    447   	$(LTLIB) /LIBPATH:$(TCLLIBDIR) -OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS)
   440    448   
   441    449   sqlite3.exe:	$(TOP)\src\shell.c libsqlite3.lib sqlite3.h
   442    450   	$(LTLINK) $(READLINE_FLAGS) \
   443         -		$(TOP)\src\shell.c libsqlite3.lib \
   444         -		$(LIBREADLINE) $(TLIBS)
          451  +		$(TOP)\src\shell.c \
          452  +		/link $(LTLINKOPTS) libsqlite3.lib $(LIBREADLINE) $(TLIBS)
   445    453   
   446    454   # This target creates a directory named "tsrc" and fills it with
   447    455   # copies of all of the C source code and header files needed to
   448    456   # build on the target system.  Some of the C source code and header
   449    457   # files are automatically generated.  This target takes care of
   450    458   # all that automatic generation.
   451    459   #
................................................................................
   702    710   	$(LTCOMPILE) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
   703    711   
   704    712   tclsqlite-shell.lo:	$(TOP)\src\tclsqlite.c $(HDR)
   705    713   	$(LTCOMPILE) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
   706    714   
   707    715   tclsqlite3.exe:	tclsqlite-shell.lo libsqlite3.lib
   708    716   	$(LTLINK) tclsqlite-shell.lo \
   709         -		/link /LIBPATH:$(TCLLIBDIR) libsqlite3.lib $(LIBTCL)
          717  +		/link $(LTLINKOPTS) /LIBPATH:$(TCLLIBDIR) libsqlite3.lib $(LIBTCL)
   710    718   
   711    719   # Rules to build opcodes.c and opcodes.h
   712    720   #
   713    721   opcodes.c:	opcodes.h $(TOP)\mkopcodec.awk
   714    722   	$(NAWK) "/#define OP_/ { print }" opcodes.h | sort /+45 | $(NAWK) -f $(TOP)\mkopcodec.awk >opcodes.c
   715    723   
   716    724   opcodes.h:	parse.h $(TOP)\src\vdbe.c $(TOP)\mkopcodeh.awk
................................................................................
   812    820   !ELSE
   813    821   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
   814    822   !ENDIF
   815    823   
   816    824   testfixture.exe:	$(TESTFIXTURE_SRC) $(HDR)
   817    825   	$(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
   818    826   		-DBUILD_sqlite -I$(TCLINCDIR) \
   819         -		$(TESTFIXTURE_SRC) /link /LIBPATH:$(TCLLIBDIR) $(LIBTCL) $(TLIBS)
          827  +		$(TESTFIXTURE_SRC) \
          828  +		/link $(LTLINKOPTS) /LIBPATH:$(TCLLIBDIR) $(LIBTCL) $(TLIBS)
   820    829   
   821    830   fulltest:	testfixture.exe sqlite3.exe
   822    831   	.\testfixture.exe $(TOP)\test\all.test
   823    832   
   824    833   soaktest:	testfixture.exe sqlite3.exe
   825    834   	.\testfixture.exe $(TOP)\test\all.test -soak=1
   826    835   
................................................................................
   831    840   	$(NAWK) "/^[^#]/ { gsub(/\\/,\"\\\\\\\\\");gsub(/\\\"/,\"\\\\\\\"\");gsub(/^/,\"\\\"\");gsub(/$$/,\"\\n\\\"\");print }" \
   832    841   		$(TOP)\tool\spaceanal.tcl >spaceanal_tcl.h
   833    842   
   834    843   sqlite3_analyzer.exe:	$(TESTFIXTURE_SRC) spaceanal_tcl.h
   835    844   	$(LTLINK) -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \
   836    845   		-DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE \
   837    846   		-DBUILD_sqlite -I$(TCLINCDIR) \
   838         -		$(TESTFIXTURE_SRC) /link /LIBPATH:$(TCLLIBDIR) $(LIBTCL) $(TLIBS)
          847  +		$(TESTFIXTURE_SRC) \
          848  +		/link $(LTLINKOPTS) /LIBPATH:$(TCLLIBDIR) $(LIBTCL) $(TLIBS)
   839    849   
   840    850   clean:
   841    851   	del /Q *.lo *.lib *.obj sqlite3.exe libsqlite3.lib
   842    852   	del /Q sqlite3.h opcodes.c opcodes.h
   843    853   	del /Q lemon.exe lempar.c parse.*
   844    854   	del /Q mkkeywordhash.exe keywordhash.h
   845    855   	-rmdir /Q/S tsrc

Changes to config.h.in.

    70     70   #undef HAVE_UINTPTR_T
    71     71   
    72     72   /* Define to 1 if you have the <unistd.h> header file. */
    73     73   #undef HAVE_UNISTD_H
    74     74   
    75     75   /* Define to 1 if you have the `usleep' function. */
    76     76   #undef HAVE_USLEEP
           77  +
           78  +/* Define to 1 if you have the utime() library function. */
           79  +#undef HAVE_UTIME
    77     80   
    78     81   /* Define to the sub-directory in which libtool stores uninstalled libraries.
    79     82      */
    80     83   #undef LT_OBJDIR
    81     84   
    82     85   /* Define to the address where bug reports for this package should be sent. */
    83     86   #undef PACKAGE_BUGREPORT

Changes to configure.

 12141  12141   # Figure out whether or not we have these functions
 12142  12142   #
 12143  12143   
 12144  12144   
 12145  12145   
 12146  12146   
 12147  12147   
 12148         -for ac_func in usleep fdatasync localtime_r gmtime_r localtime_s
        12148  +
        12149  +for ac_func in usleep fdatasync localtime_r gmtime_r localtime_s utime
 12149  12150   do
 12150  12151   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 12151  12152   { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
 12152  12153   $as_echo_n "checking for $ac_func... " >&6; }
 12153  12154   if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
 12154  12155     $as_echo_n "(cached) " >&6
 12155  12156   else
................................................................................
 13436  13437     enableval=$enable_load_extension; use_loadextension=$enableval
 13437  13438   else
 13438  13439     use_loadextension=no
 13439  13440   fi
 13440  13441   
 13441  13442   if test "${use_loadextension}" = "yes" ; then
 13442  13443     OPT_FEATURE_FLAGS=""
        13444  +  { $as_echo "$as_me:$LINENO: checking for library containing dlopen" >&5
        13445  +$as_echo_n "checking for library containing dlopen... " >&6; }
        13446  +if test "${ac_cv_search_dlopen+set}" = set; then
        13447  +  $as_echo_n "(cached) " >&6
        13448  +else
        13449  +  ac_func_search_save_LIBS=$LIBS
        13450  +cat >conftest.$ac_ext <<_ACEOF
        13451  +/* confdefs.h.  */
        13452  +_ACEOF
        13453  +cat confdefs.h >>conftest.$ac_ext
        13454  +cat >>conftest.$ac_ext <<_ACEOF
        13455  +/* end confdefs.h.  */
        13456  +
        13457  +/* Override any GCC internal prototype to avoid an error.
        13458  +   Use char because int might match the return type of a GCC
        13459  +   builtin and then its argument prototype would still apply.  */
        13460  +#ifdef __cplusplus
        13461  +extern "C"
        13462  +#endif
        13463  +char dlopen ();
        13464  +int
        13465  +main ()
        13466  +{
        13467  +return dlopen ();
        13468  +  ;
        13469  +  return 0;
        13470  +}
        13471  +_ACEOF
        13472  +for ac_lib in '' dl; do
        13473  +  if test -z "$ac_lib"; then
        13474  +    ac_res="none required"
        13475  +  else
        13476  +    ac_res=-l$ac_lib
        13477  +    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
        13478  +  fi
        13479  +  rm -f conftest.$ac_objext conftest$ac_exeext
        13480  +if { (ac_try="$ac_link"
        13481  +case "(($ac_try" in
        13482  +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
        13483  +  *) ac_try_echo=$ac_try;;
        13484  +esac
        13485  +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
        13486  +$as_echo "$ac_try_echo") >&5
        13487  +  (eval "$ac_link") 2>conftest.er1
        13488  +  ac_status=$?
        13489  +  grep -v '^ *+' conftest.er1 >conftest.err
        13490  +  rm -f conftest.er1
        13491  +  cat conftest.err >&5
        13492  +  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
        13493  +  (exit $ac_status); } && {
        13494  +	 test -z "$ac_c_werror_flag" ||
        13495  +	 test ! -s conftest.err
        13496  +       } && test -s conftest$ac_exeext && {
        13497  +	 test "$cross_compiling" = yes ||
        13498  +	 $as_test_x conftest$ac_exeext
        13499  +       }; then
        13500  +  ac_cv_search_dlopen=$ac_res
        13501  +else
        13502  +  $as_echo "$as_me: failed program was:" >&5
        13503  +sed 's/^/| /' conftest.$ac_ext >&5
        13504  +
        13505  +
        13506  +fi
        13507  +
        13508  +rm -rf conftest.dSYM
        13509  +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
        13510  +      conftest$ac_exeext
        13511  +  if test "${ac_cv_search_dlopen+set}" = set; then
        13512  +  break
        13513  +fi
        13514  +done
        13515  +if test "${ac_cv_search_dlopen+set}" = set; then
        13516  +  :
        13517  +else
        13518  +  ac_cv_search_dlopen=no
        13519  +fi
        13520  +rm conftest.$ac_ext
        13521  +LIBS=$ac_func_search_save_LIBS
        13522  +fi
        13523  +{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_dlopen" >&5
        13524  +$as_echo "$ac_cv_search_dlopen" >&6; }
        13525  +ac_res=$ac_cv_search_dlopen
        13526  +if test "$ac_res" != no; then
        13527  +  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
        13528  +
        13529  +fi
        13530  +
 13443  13531   else
 13444  13532     OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
 13445  13533   fi
 13446  13534   
 13447  13535   #########
 13448  13536   # attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
 13449  13537   for option in $CFLAGS $CPPFLAGS

Changes to configure.ac.

   123    123   #########
   124    124   # Check for needed/wanted headers
   125    125   AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h])
   126    126   
   127    127   #########
   128    128   # Figure out whether or not we have these functions
   129    129   #
   130         -AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s])
          130  +AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime])
   131    131   
   132    132   #########
   133    133   # By default, we use the amalgamation (this may be changed below...)
   134    134   #
   135    135   USE_AMALGAMATION=1
   136    136   
   137    137   #########
................................................................................
   615    615   #########
   616    616   # See whether we should allow loadable extensions
   617    617   AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
   618    618         [Enable loading of external extensions]),
   619    619         [use_loadextension=$enableval],[use_loadextension=no])
   620    620   if test "${use_loadextension}" = "yes" ; then
   621    621     OPT_FEATURE_FLAGS=""
          622  +  AC_SEARCH_LIBS(dlopen, dl)
   622    623   else
   623    624     OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
   624    625   fi
   625    626   
   626    627   #########
   627    628   # attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
   628    629   for option in $CFLAGS $CPPFLAGS

Changes to ext/fts3/fts3.c.

  1090   1090     p->zDb = zCsr;
  1091   1091     memcpy(zCsr, argv[1], nDb);
  1092   1092     zCsr += nDb;
  1093   1093   
  1094   1094     /* Fill in the azColumn array */
  1095   1095     for(iCol=0; iCol<nCol; iCol++){
  1096   1096       char *z; 
  1097         -    int n;
         1097  +    int n = 0;
  1098   1098       z = (char *)sqlite3Fts3NextToken(aCol[iCol], &n);
  1099   1099       memcpy(zCsr, z, n);
  1100   1100       zCsr[n] = '\0';
  1101   1101       sqlite3Fts3Dequote(zCsr);
  1102   1102       p->azColumn[iCol] = zCsr;
  1103   1103       zCsr += n+1;
  1104   1104       assert( zCsr <= &((char *)p)[nByte] );
................................................................................
  2676   2676     return rc;
  2677   2677   }
  2678   2678   
  2679   2679   /*
  2680   2680   ** Implementation of xBegin() method. This is a no-op.
  2681   2681   */
  2682   2682   static int fts3BeginMethod(sqlite3_vtab *pVtab){
  2683         -  UNUSED_PARAMETER(pVtab);
  2684   2683     TESTONLY( Fts3Table *p = (Fts3Table*)pVtab );
         2684  +  UNUSED_PARAMETER(pVtab);
  2685   2685     assert( p->pSegments==0 );
  2686   2686     assert( p->nPendingData==0 );
  2687   2687     assert( p->inTransaction!=1 );
  2688   2688     TESTONLY( p->inTransaction = 1 );
  2689   2689     TESTONLY( p->mxSavepoint = -1; );
  2690   2690     return SQLITE_OK;
  2691   2691   }
................................................................................
  2692   2692   
  2693   2693   /*
  2694   2694   ** Implementation of xCommit() method. This is a no-op. The contents of
  2695   2695   ** the pending-terms hash-table have already been flushed into the database
  2696   2696   ** by fts3SyncMethod().
  2697   2697   */
  2698   2698   static int fts3CommitMethod(sqlite3_vtab *pVtab){
  2699         -  UNUSED_PARAMETER(pVtab);
  2700   2699     TESTONLY( Fts3Table *p = (Fts3Table*)pVtab );
         2700  +  UNUSED_PARAMETER(pVtab);
  2701   2701     assert( p->nPendingData==0 );
  2702   2702     assert( p->inTransaction!=0 );
  2703   2703     assert( p->pSegments==0 );
  2704   2704     TESTONLY( p->inTransaction = 0 );
  2705   2705     TESTONLY( p->mxSavepoint = -1; );
  2706   2706     return SQLITE_OK;
  2707   2707   }
................................................................................
  4350   4350     Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
  4351   4351     int rc = SQLITE_OK;
  4352   4352     int iCol;
  4353   4353   
  4354   4354     if( pExpr->bDeferred && pExpr->pParent->eType!=FTSQUERY_NEAR ){
  4355   4355       assert( pCsr->nDoc>0 );
  4356   4356       for(iCol=0; iCol<pTab->nColumn; iCol++){
  4357         -      aiOut[iCol*3 + 1] = pCsr->nDoc;
  4358         -      aiOut[iCol*3 + 2] = pCsr->nDoc;
         4357  +      aiOut[iCol*3 + 1] = (u32)pCsr->nDoc;
         4358  +      aiOut[iCol*3 + 2] = (u32)pCsr->nDoc;
  4359   4359       }
  4360   4360     }else{
  4361   4361       rc = fts3EvalGatherStats(pCsr, pExpr);
  4362   4362       if( rc==SQLITE_OK ){
  4363   4363         assert( pExpr->aMI );
  4364   4364         for(iCol=0; iCol<pTab->nColumn; iCol++){
  4365   4365           aiOut[iCol*3 + 1] = pExpr->aMI[iCol*3 + 1];

Changes to ext/fts3/fts3Int.h.

   245    245     sqlite3_int64 iPrevId;          /* Previous id read from aDoclist */
   246    246     char *pNextId;                  /* Pointer into the body of aDoclist */
   247    247     char *aDoclist;                 /* List of docids for full-text queries */
   248    248     int nDoclist;                   /* Size of buffer at aDoclist */
   249    249     u8 bDesc;                       /* True to sort in descending order */
   250    250     int eEvalmode;                  /* An FTS3_EVAL_XX constant */
   251    251     int nRowAvg;                    /* Average size of database rows, in pages */
   252         -  int nDoc;                       /* Documents in table */
          252  +  sqlite3_int64 nDoc;             /* Documents in table */
   253    253   
   254    254     int isMatchinfoNeeded;          /* True when aMatchinfo[] needs filling in */
   255    255     u32 *aMatchinfo;                /* Information about most recent match */
   256    256     int nMatchinfo;                 /* Number of elements in aMatchinfo[] */
   257    257     char *zMatchinfo;               /* Matchinfo specification */
   258    258   };
   259    259   

Changes to ext/fts3/fts3_snippet.c.

  1020   1020   
  1021   1021         case FTS3_MATCHINFO_NCOL:
  1022   1022           if( bGlobal ) pInfo->aMatchinfo[0] = pInfo->nCol;
  1023   1023           break;
  1024   1024           
  1025   1025         case FTS3_MATCHINFO_NDOC:
  1026   1026           if( bGlobal ){
  1027         -          sqlite3_int64 nDoc;
         1027  +          sqlite3_int64 nDoc = 0;
  1028   1028             rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, 0);
  1029   1029             pInfo->aMatchinfo[0] = (u32)nDoc;
  1030   1030           }
  1031   1031           break;
  1032   1032   
  1033   1033         case FTS3_MATCHINFO_AVGLENGTH: 
  1034   1034           if( bGlobal ){

Changes to ext/fts3/fts3_term.c.

    17     17   
    18     18   #include "fts3Int.h"
    19     19   #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
    20     20   #ifdef SQLITE_TEST
    21     21   
    22     22   #include <string.h>
    23     23   #include <assert.h>
           24  +#include <stdlib.h>
    24     25   
    25     26   typedef struct Fts3termTable Fts3termTable;
    26     27   typedef struct Fts3termCursor Fts3termCursor;
    27     28   
    28     29   struct Fts3termTable {
    29     30     sqlite3_vtab base;              /* Base class used by SQLite core */
    30     31     int iIndex;                     /* Index for Fts3Table.aIndex[] */

Changes to ext/fts3/fts3_test.c.

   275    275     Tcl_Interp *interp,
   276    276     int objc,
   277    277     Tcl_Obj *CONST objv[]
   278    278   ){
   279    279   #ifdef SQLITE_ENABLE_FTS3
   280    280     extern int test_fts3_node_chunksize;
   281    281     extern int test_fts3_node_chunk_threshold;
   282         -  int iArg1;
   283         -  int iArg2;
   284    282     Tcl_Obj *pRet;
   285    283   
   286    284     if( objc!=1 && objc!=3 ){
   287    285       Tcl_WrongNumArgs(interp, 1, objv, "?CHUNKSIZE THRESHOLD?");
   288    286       return TCL_ERROR;
   289    287     }
   290    288   

Changes to ext/fts3/fts3_tokenizer.c.

   152    152     Fts3Hash *pHash,                /* Tokenizer hash table */
   153    153     const char *zArg,               /* Tokenizer name */
   154    154     sqlite3_tokenizer **ppTok,      /* OUT: Tokenizer (if applicable) */
   155    155     char **pzErr                    /* OUT: Set to malloced error message */
   156    156   ){
   157    157     int rc;
   158    158     char *z = (char *)zArg;
   159         -  int n;
          159  +  int n = 0;
   160    160     char *zCopy;
   161    161     char *zEnd;                     /* Pointer to nul-term of zCopy */
   162    162     sqlite3_tokenizer_module *m;
   163    163   
   164    164     zCopy = sqlite3_mprintf("%s", zArg);
   165    165     if( !zCopy ) return SQLITE_NOMEM;
   166    166     zEnd = &zCopy[strlen(zCopy)];

Changes to ext/fts3/fts3_write.c.

  1319   1319     assert( pgsz>0 );
  1320   1320   
  1321   1321     for(ii=0; rc==SQLITE_OK && ii<pMsr->nSegment; ii++){
  1322   1322       Fts3SegReader *pReader = pMsr->apSegment[ii];
  1323   1323       if( !fts3SegReaderIsPending(pReader) 
  1324   1324        && !fts3SegReaderIsRootOnly(pReader) 
  1325   1325       ){
  1326         -      int jj;
         1326  +      sqlite3_int64 jj;
  1327   1327         for(jj=pReader->iStartBlock; jj<=pReader->iLeafEndBlock; jj++){
  1328   1328           int nBlob;
  1329   1329           rc = sqlite3Fts3ReadBlock(p, jj, 0, &nBlob, 0);
  1330   1330           if( rc!=SQLITE_OK ) break;
  1331   1331           if( (nBlob+35)>pgsz ){
  1332   1332             nOvfl += (nBlob + 34)/pgsz;
  1333   1333           }

Changes to ext/rtree/rtree.c.

  1418   1418   /*
  1419   1419   ** Return the N-dimensional volumn of the cell stored in *p.
  1420   1420   */
  1421   1421   static float cellArea(Rtree *pRtree, RtreeCell *p){
  1422   1422     float area = 1.0;
  1423   1423     int ii;
  1424   1424     for(ii=0; ii<(pRtree->nDim*2); ii+=2){
  1425         -    area = area * (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));
         1425  +    area = (float)(area * (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii])));
  1426   1426     }
  1427   1427     return area;
  1428   1428   }
  1429   1429   
  1430   1430   /*
  1431   1431   ** Return the margin length of cell p. The margin length is the sum
  1432   1432   ** of the objects size in each dimension.
  1433   1433   */
  1434   1434   static float cellMargin(Rtree *pRtree, RtreeCell *p){
  1435   1435     float margin = 0.0;
  1436   1436     int ii;
  1437   1437     for(ii=0; ii<(pRtree->nDim*2); ii+=2){
  1438         -    margin += (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));
         1438  +    margin += (float)(DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));
  1439   1439     }
  1440   1440     return margin;
  1441   1441   }
  1442   1442   
  1443   1443   /*
  1444   1444   ** Store the union of cells p1 and p2 in p1.
  1445   1445   */
................................................................................
  1516   1516           x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj]));
  1517   1517           x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1]));
  1518   1518   
  1519   1519           if( x2<x1 ){
  1520   1520             o = 0.0;
  1521   1521             break;
  1522   1522           }else{
  1523         -          o = o * (x2-x1);
         1523  +          o = o * (float)(x2-x1);
  1524   1524           }
  1525   1525         }
  1526   1526         overlap += o;
  1527   1527       }
  1528   1528     }
  1529   1529     return overlap;
  1530   1530   }
................................................................................
  1535   1535     Rtree *pRtree, 
  1536   1536     RtreeCell *p, 
  1537   1537     RtreeCell *pInsert, 
  1538   1538     RtreeCell *aCell, 
  1539   1539     int nCell, 
  1540   1540     int iExclude
  1541   1541   ){
  1542         -  float before;
  1543         -  float after;
         1542  +  double before;
         1543  +  double after;
  1544   1544     before = cellOverlap(pRtree, p, aCell, nCell, iExclude);
  1545   1545     cellUnion(pRtree, p, pInsert);
  1546   1546     after = cellOverlap(pRtree, p, aCell, nCell, iExclude);
  1547         -  return after-before;
         1547  +  return (float)(after-before);
  1548   1548   }
  1549   1549   #endif
  1550   1550   
  1551   1551   
  1552   1552   /*
  1553   1553   ** This function implements the ChooseLeaf algorithm from Gutman[84].
  1554   1554   ** ChooseSubTree in r*tree terminology.
................................................................................
  1562   1562     int rc;
  1563   1563     int ii;
  1564   1564     RtreeNode *pNode;
  1565   1565     rc = nodeAcquire(pRtree, 1, 0, &pNode);
  1566   1566   
  1567   1567     for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){
  1568   1568       int iCell;
  1569         -    sqlite3_int64 iBest;
         1569  +    sqlite3_int64 iBest = 0;
  1570   1570   
  1571         -    float fMinGrowth;
  1572         -    float fMinArea;
  1573         -    float fMinOverlap;
         1571  +    float fMinGrowth = 0.0;
         1572  +    float fMinArea = 0.0;
         1573  +    float fMinOverlap = 0.0;
  1574   1574   
  1575   1575       int nCell = NCELL(pNode);
  1576   1576       RtreeCell cell;
  1577   1577       RtreeNode *pChild;
  1578   1578   
  1579   1579       RtreeCell *aCell = 0;
  1580   1580   
................................................................................
  1996   1996     RtreeCell *pBboxLeft,
  1997   1997     RtreeCell *pBboxRight
  1998   1998   ){
  1999   1999     int **aaSorted;
  2000   2000     int *aSpare;
  2001   2001     int ii;
  2002   2002   
  2003         -  int iBestDim;
  2004         -  int iBestSplit;
  2005         -  float fBestMargin;
         2003  +  int iBestDim = 0;
         2004  +  int iBestSplit = 0;
         2005  +  float fBestMargin = 0.0;
  2006   2006   
  2007   2007     int nByte = (pRtree->nDim+1)*(sizeof(int*)+nCell*sizeof(int));
  2008   2008   
  2009   2009     aaSorted = (int **)sqlite3_malloc(nByte);
  2010   2010     if( !aaSorted ){
  2011   2011       return SQLITE_NOMEM;
  2012   2012     }
................................................................................
  2020   2020         aaSorted[ii][jj] = jj;
  2021   2021       }
  2022   2022       SortByDimension(pRtree, aaSorted[ii], nCell, ii, aCell, aSpare);
  2023   2023     }
  2024   2024   
  2025   2025     for(ii=0; ii<pRtree->nDim; ii++){
  2026   2026       float margin = 0.0;
  2027         -    float fBestOverlap;
  2028         -    float fBestArea;
  2029         -    int iBestLeft;
         2027  +    float fBestOverlap = 0.0;
         2028  +    float fBestArea = 0.0;
         2029  +    int iBestLeft = 0;
  2030   2030       int nLeft;
  2031   2031   
  2032   2032       for(
  2033   2033         nLeft=RTREE_MINCELLS(pRtree); 
  2034   2034         nLeft<=(nCell-RTREE_MINCELLS(pRtree)); 
  2035   2035         nLeft++
  2036   2036       ){
................................................................................
  2337   2337   }
  2338   2338   
  2339   2339   static int deleteCell(Rtree *, RtreeNode *, int, int);
  2340   2340   
  2341   2341   static int removeNode(Rtree *pRtree, RtreeNode *pNode, int iHeight){
  2342   2342     int rc;
  2343   2343     int rc2;
  2344         -  RtreeNode *pParent;
         2344  +  RtreeNode *pParent = 0;
  2345   2345     int iCell;
  2346   2346   
  2347   2347     assert( pNode->nRef==1 );
  2348   2348   
  2349   2349     /* Remove the entry in the parent cell. */
  2350   2350     rc = nodeParentIndex(pRtree, pNode, &iCell);
  2351   2351     if( rc==SQLITE_OK ){
................................................................................
  2485   2485       if( ii==(nCell-1) ){
  2486   2486         memcpy(&aCell[ii], pCell, sizeof(RtreeCell));
  2487   2487       }else{
  2488   2488         nodeGetCell(pRtree, pNode, ii, &aCell[ii]);
  2489   2489       }
  2490   2490       aOrder[ii] = ii;
  2491   2491       for(iDim=0; iDim<pRtree->nDim; iDim++){
  2492         -      aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2]);
  2493         -      aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2+1]);
         2492  +      aCenterCoord[iDim] += (float)DCOORD(aCell[ii].aCoord[iDim*2]);
         2493  +      aCenterCoord[iDim] += (float)DCOORD(aCell[ii].aCoord[iDim*2+1]);
  2494   2494       }
  2495   2495     }
  2496   2496     for(iDim=0; iDim<pRtree->nDim; iDim++){
  2497         -    aCenterCoord[iDim] = aCenterCoord[iDim]/((float)nCell*2.0);
         2497  +    aCenterCoord[iDim] = (float)(aCenterCoord[iDim]/((float)nCell*2.0));
  2498   2498     }
  2499   2499   
  2500   2500     for(ii=0; ii<nCell; ii++){
  2501   2501       aDistance[ii] = 0.0;
  2502   2502       for(iDim=0; iDim<pRtree->nDim; iDim++){
  2503         -      float coord = DCOORD(aCell[ii].aCoord[iDim*2+1]) - 
  2504         -          DCOORD(aCell[ii].aCoord[iDim*2]);
         2503  +      float coord = (float)(DCOORD(aCell[ii].aCoord[iDim*2+1]) - 
         2504  +          DCOORD(aCell[ii].aCoord[iDim*2]));
  2505   2505         aDistance[ii] += (coord-aCenterCoord[iDim])*(coord-aCenterCoord[iDim]);
  2506   2506       }
  2507   2507     }
  2508   2508   
  2509   2509     SortByDistance(aOrder, nCell, aDistance, aSpare);
  2510   2510     nodeZero(pRtree, pNode);
  2511   2511   
................................................................................
  2596   2596       RtreeNode *pInsert;
  2597   2597       RtreeCell cell;
  2598   2598       nodeGetCell(pRtree, pNode, ii, &cell);
  2599   2599   
  2600   2600       /* Find a node to store this cell in. pNode->iNode currently contains
  2601   2601       ** the height of the sub-tree headed by the cell.
  2602   2602       */
  2603         -    rc = ChooseLeaf(pRtree, &cell, pNode->iNode, &pInsert);
         2603  +    rc = ChooseLeaf(pRtree, &cell, (int)pNode->iNode, &pInsert);
  2604   2604       if( rc==SQLITE_OK ){
  2605   2605         int rc2;
  2606         -      rc = rtreeInsertCell(pRtree, pInsert, &cell, pNode->iNode);
         2606  +      rc = rtreeInsertCell(pRtree, pInsert, &cell, (int)pNode->iNode);
  2607   2607         rc2 = nodeRelease(pRtree, pInsert);
  2608   2608         if( rc==SQLITE_OK ){
  2609   2609           rc = rc2;
  2610   2610         }
  2611   2611       }
  2612   2612     }
  2613   2613     return rc;
................................................................................
  2988   2988     sqlite3 *db,                    /* Database handle */
  2989   2989     Rtree *pRtree,                  /* Rtree handle */
  2990   2990     int isCreate                    /* True for xCreate, false for xConnect */
  2991   2991   ){
  2992   2992     int rc;
  2993   2993     char *zSql;
  2994   2994     if( isCreate ){
  2995         -    int iPageSize;
         2995  +    int iPageSize = 0;
  2996   2996       zSql = sqlite3_mprintf("PRAGMA %Q.page_size", pRtree->zDb);
  2997   2997       rc = getIntFromStmt(db, zSql, &iPageSize);
  2998   2998       if( rc==SQLITE_OK ){
  2999   2999         pRtree->iNodeSize = iPageSize-64;
  3000   3000         if( (4+pRtree->nBytesPerCell*RTREE_MAXCELLS)<pRtree->iNodeSize ){
  3001   3001           pRtree->iNodeSize = 4+pRtree->nBytesPerCell*RTREE_MAXCELLS;
  3002   3002         }

Changes to src/os_unix.c.

   134    134   # endif
   135    135   #endif /* SQLITE_ENABLE_LOCKING_STYLE */
   136    136   
   137    137   #if defined(__APPLE__) || (SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS)
   138    138   # include <sys/mount.h>
   139    139   #endif
   140    140   
          141  +#ifdef HAVE_UTIME
          142  +# include <utime.h>
          143  +#endif
          144  +
   141    145   /*
   142    146   ** Allowed values of unixFile.fsFlags
   143    147   */
   144    148   #define SQLITE_FSFLAGS_IS_MSDOS     0x1
   145    149   
   146    150   /*
   147    151   ** If we are to be thread-safe, include the pthreads header and define
................................................................................
  1935   1939   
  1936   1940   
  1937   1941     /* If we have any lock, then the lock file already exists.  All we have
  1938   1942     ** to do is adjust our internal record of the lock level.
  1939   1943     */
  1940   1944     if( pFile->eFileLock > NO_LOCK ){
  1941   1945       pFile->eFileLock = eFileLock;
  1942         -#if !OS_VXWORKS
  1943   1946       /* Always update the timestamp on the old file */
         1947  +#ifdef HAVE_UTIME
         1948  +    utime(zLockFile, NULL);
         1949  +#else
  1944   1950       utimes(zLockFile, NULL);
  1945   1951   #endif
  1946   1952       return SQLITE_OK;
  1947   1953     }
  1948   1954     
  1949   1955     /* grab an exclusive lock */
  1950   1956     fd = robust_open(zLockFile,O_RDONLY|O_CREAT|O_EXCL,0600);

Changes to src/os_win.c.

   874    874       if( nRem>0 ){
   875    875         pFile->lastErrno = GetLastError();
   876    876         rc = 1;
   877    877       }
   878    878     }
   879    879   
   880    880     if( rc ){
   881         -    if( pFile->lastErrno==ERROR_HANDLE_DISK_FULL ){
          881  +    if(   ( pFile->lastErrno==ERROR_HANDLE_DISK_FULL )
          882  +       || ( pFile->lastErrno==ERROR_DISK_FULL )){
   882    883         return SQLITE_FULL;
   883    884       }
   884    885       return winLogError(SQLITE_IOERR_WRITE, "winWrite", pFile->zPath);
   885    886     }
   886    887     return SQLITE_OK;
   887    888   }
   888    889   

Changes to src/sqlite.h.in.

   301    301   **
   302    302   ** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
   303    303   ** semicolon-separate SQL statements passed into its 2nd argument,
   304    304   ** in the context of the [database connection] passed in as its 1st
   305    305   ** argument.  ^If the callback function of the 3rd argument to
   306    306   ** sqlite3_exec() is not NULL, then it is invoked for each result row
   307    307   ** coming out of the evaluated SQL statements.  ^The 4th argument to
   308         -** to sqlite3_exec() is relayed through to the 1st argument of each
          308  +** sqlite3_exec() is relayed through to the 1st argument of each
   309    309   ** callback invocation.  ^If the callback pointer to sqlite3_exec()
   310    310   ** is NULL, then no callback is ever invoked and result rows are
   311    311   ** ignored.
   312    312   **
   313    313   ** ^If an error occurs while evaluating the SQL statements passed into
   314    314   ** sqlite3_exec(), then execution of the current statement stops and
   315    315   ** subsequent statements are skipped.  ^If the 5th parameter to sqlite3_exec()
................................................................................
   893    893   ** of good-quality randomness into zOut.  The return value is
   894    894   ** the actual number of bytes of randomness obtained.
   895    895   ** The xSleep() method causes the calling thread to sleep for at
   896    896   ** least the number of microseconds given.  ^The xCurrentTime()
   897    897   ** method returns a Julian Day Number for the current date and time as
   898    898   ** a floating point value.
   899    899   ** ^The xCurrentTimeInt64() method returns, as an integer, the Julian
   900         -** Day Number multipled by 86400000 (the number of milliseconds in 
          900  +** Day Number multiplied by 86400000 (the number of milliseconds in 
   901    901   ** a 24-hour day).  
   902    902   ** ^SQLite will use the xCurrentTimeInt64() method to get the current
   903    903   ** date and time if that method is available (if iVersion is 2 or 
   904    904   ** greater and the function pointer is not NULL) and will fall back
   905    905   ** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
   906    906   **
   907    907   ** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
................................................................................
  1331   1331   ** ^SQLite will never require a scratch buffer that is more than 6
  1332   1332   ** times the database page size. ^If SQLite needs needs additional
  1333   1333   ** scratch memory beyond what is provided by this configuration option, then 
  1334   1334   ** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
  1335   1335   **
  1336   1336   ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
  1337   1337   ** <dd> ^This option specifies a static memory buffer that SQLite can use for
  1338         -** the database page cache with the default page cache implemenation.  
         1338  +** the database page cache with the default page cache implementation.  
  1339   1339   ** This configuration should not be used if an application-define page
  1340   1340   ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option.
  1341   1341   ** There are three arguments to this option: A pointer to 8-byte aligned
  1342   1342   ** memory, the size of each page buffer (sz), and the number of pages (N).
  1343   1343   ** The sz argument should be the size of the largest database page
  1344   1344   ** (a power of two between 512 and 32768) plus a little extra for each
  1345   1345   ** page header.  ^The page header size is 20 to 40 bytes depending on
................................................................................
  2429   2429   ** automatically deleted as soon as the database connection is closed.
  2430   2430   **
  2431   2431   ** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3>
  2432   2432   **
  2433   2433   ** ^If [URI filename] interpretation is enabled, and the filename argument
  2434   2434   ** begins with "file:", then the filename is interpreted as a URI. ^URI
  2435   2435   ** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is
  2436         -** is set in the fourth argument to sqlite3_open_v2(), or if it has
         2436  +** set in the fourth argument to sqlite3_open_v2(), or if it has
  2437   2437   ** been enabled globally using the [SQLITE_CONFIG_URI] option with the
  2438   2438   ** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
  2439   2439   ** As of SQLite version 3.7.7, URI filename interpretation is turned off
  2440   2440   ** by default, but future releases of SQLite might enable URI filename
  2441         -** intepretation by default.  See "[URI filenames]" for additional
         2441  +** interpretation by default.  See "[URI filenames]" for additional
  2442   2442   ** information.
  2443   2443   **
  2444   2444   ** URI filenames are parsed according to RFC 3986. ^If the URI contains an
  2445   2445   ** authority, then it must be either an empty string or the string 
  2446   2446   ** "localhost". ^If the authority is not an empty string or "localhost", an 
  2447   2447   ** error is returned to the caller. ^The fragment component of a URI, if 
  2448   2448   ** present, is ignored.
................................................................................
  3253   3253   ** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].
  3254   3254   ** ^With the "v2" interface, any of the other [result codes] or
  3255   3255   ** [extended result codes] might be returned as well.
  3256   3256   **
  3257   3257   ** ^[SQLITE_BUSY] means that the database engine was unable to acquire the
  3258   3258   ** database locks it needs to do its job.  ^If the statement is a [COMMIT]
  3259   3259   ** or occurs outside of an explicit transaction, then you can retry the
  3260         -** statement.  If the statement is not a [COMMIT] and occurs within a
         3260  +** statement.  If the statement is not a [COMMIT] and occurs within an
  3261   3261   ** explicit transaction then you should rollback the transaction before
  3262   3262   ** continuing.
  3263   3263   **
  3264   3264   ** ^[SQLITE_DONE] means that the statement has finished executing
  3265   3265   ** successfully.  sqlite3_step() should not be called again on this virtual
  3266   3266   ** machine without first calling [sqlite3_reset()] to reset the virtual
  3267   3267   ** machine back to its initial state.
................................................................................
  3532   3532   int sqlite3_column_type(sqlite3_stmt*, int iCol);
  3533   3533   sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
  3534   3534   
  3535   3535   /*
  3536   3536   ** CAPI3REF: Destroy A Prepared Statement Object
  3537   3537   **
  3538   3538   ** ^The sqlite3_finalize() function is called to delete a [prepared statement].
  3539         -** ^If the most recent evaluation of the statement encountered no errors or
         3539  +** ^If the most recent evaluation of the statement encountered no errors
  3540   3540   ** or if the statement is never been evaluated, then sqlite3_finalize() returns
  3541   3541   ** SQLITE_OK.  ^If the most recent evaluation of statement S failed, then
  3542   3542   ** sqlite3_finalize(S) returns the appropriate [error code] or
  3543   3543   ** [extended error code].
  3544   3544   **
  3545   3545   ** ^The sqlite3_finalize(S) routine can be called at any point during
  3546   3546   ** the life cycle of [prepared statement] S:
................................................................................
  5446   5446   ** ^The implementation is not required to provided versions of these
  5447   5447   ** routines that actually work. If the implementation does not provide working
  5448   5448   ** versions of these routines, it should at least provide stubs that always
  5449   5449   ** return true so that one does not get spurious assertion failures.
  5450   5450   **
  5451   5451   ** ^If the argument to sqlite3_mutex_held() is a NULL pointer then
  5452   5452   ** the routine should return 1.   This seems counter-intuitive since
  5453         -** clearly the mutex cannot be held if it does not exist.  But the
         5453  +** clearly the mutex cannot be held if it does not exist.  But
  5454   5454   ** the reason the mutex does not exist is because the build is not
  5455   5455   ** using mutexes.  And we do not want the assert() containing the
  5456   5456   ** call to sqlite3_mutex_held() to fail, so a non-zero return is
  5457   5457   ** the appropriate thing to do.  ^The sqlite3_mutex_notheld()
  5458   5458   ** interface should also return 1 when given a NULL pointer.
  5459   5459   */
  5460   5460   #ifndef NDEBUG
................................................................................
  5955   5955   ** stored in the cache, both pinned and unpinned.
  5956   5956   ** 
  5957   5957   ** [[the xFetch() page cache methods]]
  5958   5958   ** The xFetch() method locates a page in the cache and returns a pointer to 
  5959   5959   ** the page, or a NULL pointer.
  5960   5960   ** A "page", in this context, means a buffer of szPage bytes aligned at an
  5961   5961   ** 8-byte boundary. The page to be fetched is determined by the key. ^The
  5962         -** mimimum key value is 1.  After it has been retrieved using xFetch, the page 
         5962  +** minimum key value is 1.  After it has been retrieved using xFetch, the page 
  5963   5963   ** is considered to be "pinned".
  5964   5964   **
  5965   5965   ** If the requested page is already in the page cache, then the page cache
  5966   5966   ** implementation must return a pointer to the page buffer with its content
  5967   5967   ** intact.  If the requested page is not already in the cache, then the
  5968   5968   ** cache implementation should use the value of the createFlag
  5969   5969   ** parameter to help it determined what action to take:

Changes to src/tclsqlite.c.

   757    757             int bytes = sqlite3_value_bytes(pIn);
   758    758             pVal = Tcl_NewByteArrayObj(sqlite3_value_blob(pIn), bytes);
   759    759             break;
   760    760           }
   761    761           case SQLITE_INTEGER: {
   762    762             sqlite_int64 v = sqlite3_value_int64(pIn);
   763    763             if( v>=-2147483647 && v<=2147483647 ){
   764         -            pVal = Tcl_NewIntObj(v);
          764  +            pVal = Tcl_NewIntObj((int)v);
   765    765             }else{
   766    766               pVal = Tcl_NewWideIntObj(v);
   767    767             }
   768    768             break;
   769    769           }
   770    770           case SQLITE_FLOAT: {
   771    771             double r = sqlite3_value_double(pIn);
................................................................................
  1437   1437         const char *zBlob = sqlite3_column_blob(pStmt, iCol);
  1438   1438         if( !zBlob ) bytes = 0;
  1439   1439         return Tcl_NewByteArrayObj((u8*)zBlob, bytes);
  1440   1440       }
  1441   1441       case SQLITE_INTEGER: {
  1442   1442         sqlite_int64 v = sqlite3_column_int64(pStmt, iCol);
  1443   1443         if( v>=-2147483647 && v<=2147483647 ){
  1444         -        return Tcl_NewIntObj(v);
         1444  +        return Tcl_NewIntObj((int)v);
  1445   1445         }else{
  1446   1446           return Tcl_NewWideIntObj(v);
  1447   1447         }
  1448   1448       }
  1449   1449       case SQLITE_FLOAT: {
  1450   1450         return Tcl_NewDoubleObj(sqlite3_column_double(pStmt, iCol));
  1451   1451       }
................................................................................
  2363   2363         int len;
  2364   2364         char *zNull = Tcl_GetStringFromObj(objv[2], &len);
  2365   2365         if( pDb->zNull ){
  2366   2366           Tcl_Free(pDb->zNull);
  2367   2367         }
  2368   2368         if( zNull && len>0 ){
  2369   2369           pDb->zNull = Tcl_Alloc( len + 1 );
  2370         -        strncpy(pDb->zNull, zNull, len);
         2370  +        memcpy(pDb->zNull, zNull, len);
  2371   2371           pDb->zNull[len] = '\0';
  2372   2372         }else{
  2373   2373           pDb->zNull = 0;
  2374   2374         }
  2375   2375       }
  2376   2376       Tcl_SetObjResult(interp, dbTextToObj(pDb->zNull));
  2377   2377       break;

Changes to src/test_config.c.

   221    221   
   222    222   #ifdef SQLITE_OMIT_COMPOUND_SELECT
   223    223     Tcl_SetVar2(interp, "sqlite_options", "compound", "0", TCL_GLOBAL_ONLY);
   224    224   #else
   225    225     Tcl_SetVar2(interp, "sqlite_options", "compound", "1", TCL_GLOBAL_ONLY);
   226    226   #endif
   227    227   
   228         -#ifdef SQLITE_OMIT_CONFLICT_CLAUSE
   229         -  Tcl_SetVar2(interp, "sqlite_options", "conflict", "0", TCL_GLOBAL_ONLY);
   230         -#else
   231    228     Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY);
   232         -#endif
   233    229   
   234    230   #if SQLITE_OS_UNIX
   235    231     Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY);
   236    232   #else
   237    233     Tcl_SetVar2(interp, "sqlite_options", "crashtest", "0", TCL_GLOBAL_ONLY);
   238    234   #endif
   239    235   

Changes to src/test_thread.c.

   400    400   
   401    401   /*
   402    402   ** A pointer to an instance of this structure is passed as the user-context
   403    403   ** pointer when registering for an unlock-notify callback.
   404    404   */
   405    405   typedef struct UnlockNotification UnlockNotification;
   406    406   struct UnlockNotification {
   407         -  int fired;                           /* True after unlock event has occured */
   408         -  pthread_cond_t cond;                 /* Condition variable to wait on */
   409         -  pthread_mutex_t mutex;               /* Mutex to protect structure */
          407  +  int fired;                         /* True after unlock event has occurred */
          408  +  pthread_cond_t cond;               /* Condition variable to wait on */
          409  +  pthread_mutex_t mutex;             /* Mutex to protect structure */
   410    410   };
   411    411   
   412    412   /*
   413    413   ** This function is an unlock-notify callback registered with SQLite.
   414    414   */
   415    415   static void unlock_notify_cb(void **apArg, int nArg){
   416    416     int i;

Changes to src/vdbe.c.

   793    793     REGISTER_TRACE(pOp->p1, pIn1);
   794    794     pc = pcDest;
   795    795     break;
   796    796   }
   797    797   
   798    798   /* Opcode:  HaltIfNull  P1 P2 P3 P4 *
   799    799   **
   800         -** Check the value in register P3.  If is is NULL then Halt using
          800  +** Check the value in register P3.  If it is NULL then Halt using
   801    801   ** parameter P1, P2, and P4 as if this were a Halt instruction.  If the
   802    802   ** value in register P3 is not NULL, then this routine is a no-op.
   803    803   */
   804    804   case OP_HaltIfNull: {      /* in3 */
   805    805     pIn3 = &aMem[pOp->p3];
   806    806     if( (pIn3->flags & MEM_Null)==0 ) break;
   807    807     /* Fall through into OP_Halt */
................................................................................
  1716   1716   ** This works just like the Lt opcode except that the jump is taken if
  1717   1717   ** the operands in registers P1 and P3 are not equal.  See the Lt opcode for
  1718   1718   ** additional information.
  1719   1719   **
  1720   1720   ** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either
  1721   1721   ** true or false and is never NULL.  If both operands are NULL then the result
  1722   1722   ** of comparison is false.  If either operand is NULL then the result is true.
  1723         -** If neither operand is NULL the the result is the same as it would be if
         1723  +** If neither operand is NULL the result is the same as it would be if
  1724   1724   ** the SQLITE_NULLEQ flag were omitted from P5.
  1725   1725   */
  1726   1726   /* Opcode: Eq P1 P2 P3 P4 P5
  1727   1727   **
  1728   1728   ** This works just like the Lt opcode except that the jump is taken if
  1729   1729   ** the operands in registers P1 and P3 are equal.
  1730   1730   ** See the Lt opcode for additional information.
  1731   1731   **
  1732   1732   ** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either
  1733   1733   ** true or false and is never NULL.  If both operands are NULL then the result
  1734   1734   ** of comparison is true.  If either operand is NULL then the result is false.
  1735         -** If neither operand is NULL the the result is the same as it would be if
         1735  +** If neither operand is NULL the result is the same as it would be if
  1736   1736   ** the SQLITE_NULLEQ flag were omitted from P5.
  1737   1737   */
  1738   1738   /* Opcode: Le P1 P2 P3 P4 P5
  1739   1739   **
  1740   1740   ** This works just like the Lt opcode except that the jump is taken if
  1741   1741   ** the content of register P3 is less than or equal to the content of
  1742   1742   ** register P1.  See the Lt opcode for additional information.
................................................................................
  2007   2007       sqlite3VdbeMemSetInt64(pOut, ~sqlite3VdbeIntValue(pIn1));
  2008   2008     }
  2009   2009     break;
  2010   2010   }
  2011   2011   
  2012   2012   /* Opcode: If P1 P2 P3 * *
  2013   2013   **
  2014         -** Jump to P2 if the value in register P1 is true.  The value is
         2014  +** Jump to P2 if the value in register P1 is true.  The value
  2015   2015   ** is considered true if it is numeric and non-zero.  If the value
  2016   2016   ** in P1 is NULL then take the jump if P3 is true.
  2017   2017   */
  2018   2018   /* Opcode: IfNot P1 P2 P3 * *
  2019   2019   **
  2020         -** Jump to P2 if the value in register P1 is False.  The value is
         2020  +** Jump to P2 if the value in register P1 is False.  The value
  2021   2021   ** is considered true if it has a numeric value of zero.  If the value
  2022   2022   ** in P1 is NULL then take the jump if P3 is true.
  2023   2023   */
  2024   2024   case OP_If:                 /* jump, in1 */
  2025   2025   case OP_IfNot: {            /* jump, in1 */
  2026   2026     int c;
  2027   2027     pIn1 = &aMem[pOp->p1];
................................................................................
  3631   3631       }
  3632   3632     }
  3633   3633     break;
  3634   3634   }
  3635   3635   
  3636   3636   /* Opcode: NotExists P1 P2 P3 * *
  3637   3637   **
  3638         -** Use the content of register P3 as a integer key.  If a record 
         3638  +** Use the content of register P3 as an integer key.  If a record 
  3639   3639   ** with that key does not exist in table of P1, then jump to P2. 
  3640   3640   ** If the record does exist, then fall through.  The cursor is left 
  3641   3641   ** pointing to the record if it exists.
  3642   3642   **
  3643   3643   ** The difference between this operation and NotFound is that this
  3644   3644   ** operation assumes the key is an integer and that P1 is a table whereas
  3645   3645   ** NotFound assumes key is a blob constructed from MakeRecord and
................................................................................
  3707   3707   ** The record number is not previously used as a key in the database
  3708   3708   ** table that cursor P1 points to.  The new record number is written
  3709   3709   ** written to register P2.
  3710   3710   **
  3711   3711   ** If P3>0 then P3 is a register in the root frame of this VDBE that holds 
  3712   3712   ** the largest previously generated record number. No new record numbers are
  3713   3713   ** allowed to be less than this value. When this value reaches its maximum, 
  3714         -** a SQLITE_FULL error is generated. The P3 register is updated with the '
         3714  +** an SQLITE_FULL error is generated. The P3 register is updated with the '
  3715   3715   ** generated record number. This P3 mechanism is used to help implement the
  3716   3716   ** AUTOINCREMENT feature.
  3717   3717   */
  3718   3718   case OP_NewRowid: {           /* out2-prerelease */
  3719   3719     i64 v;                 /* The new rowid */
  3720   3720     VdbeCursor *pC;        /* Cursor of table to get the new rowid */
  3721   3721     int res;               /* Result of an sqlite3BtreeLast() */
................................................................................
  4331   4331     }
  4332   4332     pC->rowidIsValid = 0;
  4333   4333     break;
  4334   4334   }
  4335   4335   
  4336   4336   /* Opcode: IdxInsert P1 P2 P3 * P5
  4337   4337   **
  4338         -** Register P2 holds a SQL index key made using the
         4338  +** Register P2 holds an SQL index key made using the
  4339   4339   ** MakeRecord instructions.  This opcode writes that key
  4340   4340   ** into the index P1.  Data for the entry is nil.
  4341   4341   **
  4342   4342   ** P3 is a flag that provides a hint to the b-tree layer that this
  4343   4343   ** insert is likely to be an append.
  4344   4344   **
  4345   4345   ** This instruction only works for indices.  The equivalent instruction

Changes to test/e_delete.test.

   436    436     2   "DELETE FROM t1 LIMIT 3"               {4 5}
   437    437     3   "DELETE FROM t1 LIMIT 1 OFFSET 0"      {2 3 4 5}
   438    438     4   "DELETE FROM t1 LIMIT 1 OFFSET 1"      {1 3 4 5}
   439    439     5   "DELETE FROM t1 LIMIT 1 OFFSET 2"      {1 2 4 5}
   440    440   }
   441    441   
   442    442   
   443         -# EVIDENCE-OF: R-26627-30313 The ORDER BY clause on an DELETE statement
          443  +# EVIDENCE-OF: R-07548-13422 The ORDER BY clause on a DELETE statement
   444    444   # is used only to determine which rows fall within the LIMIT. The order
   445    445   # in which rows are deleted is arbitrary and is not influenced by the
   446    446   # ORDER BY clause.
   447    447   #
   448    448   #     In practice, rows are always deleted in rowid order.
   449    449   #
   450    450   do_delete_tests e_delete-3.10 -repair {

Changes to test/e_expr.test.

  1594   1594   # truncate the fractional part of the REAL.
  1595   1595   #
  1596   1596   do_expr_test e_expr-31.1.1 { CAST(3.14159 AS INTEGER) } integer 3
  1597   1597   do_expr_test e_expr-31.1.2 { CAST(1.99999 AS INTEGER) } integer 1
  1598   1598   do_expr_test e_expr-31.1.3 { CAST(-1.99999 AS INTEGER) } integer -1
  1599   1599   do_expr_test e_expr-31.1.4 { CAST(-0.99999 AS INTEGER) } integer 0
  1600   1600   
  1601         -# EVIDENCE-OF: R-06126-36021 If an REAL is too large to be represented
  1602         -# as an INTEGER then the result of the cast is the largest negative
         1601  +# EVIDENCE-OF: R-49503-28105 If a REAL is too large to be represented as
         1602  +# an INTEGER then the result of the cast is the largest negative
  1603   1603   # integer: -9223372036854775808.
  1604   1604   #
  1605   1605   do_expr_test e_expr-31.2.1 { CAST(2e+50 AS INT) } integer -9223372036854775808
  1606   1606   do_expr_test e_expr-31.2.2 { CAST(-2e+50 AS INT) } integer -9223372036854775808
  1607   1607   do_expr_test e_expr-31.2.3 { 
  1608   1608     CAST(-9223372036854775809.0 AS INT)
  1609   1609   } integer -9223372036854775808
................................................................................
  1841   1841       2  { ( SELECT x FROM t4 WHERE y<'one' ORDER BY y )  }
  1842   1842   } {
  1843   1843     do_expr_test e_expr-36.4.$tn $expr null {}
  1844   1844   }
  1845   1845   
  1846   1846   
  1847   1847   finish_test
  1848         -

Changes to test/e_insert.test.

   148    148   } {
   149    149       1    "INSERT INTO a2 VALUES(1)"         {a2 3 1}
   150    150       2    "INSERT INTO a2 VALUES(1,2)"       {a2 3 2}
   151    151       3    "INSERT INTO a2 VALUES(1,2,3,4)"   {a2 3 4}
   152    152       4    "INSERT INTO a2 VALUES(1,2,3,4,5)" {a2 3 5}
   153    153   }
   154    154   
   155         -# EVIDENCE-OF: R-52422-65517 In this case the result of evaluting the
          155  +# EVIDENCE-OF: R-04006-57648 In this case the result of evaluating the
   156    156   # left-most expression in the VALUES list is inserted into the left-most
   157    157   # column of the new row, and so on.
   158    158   #
   159    159   delete_all_data
   160    160   do_insert_tests e_insert-1.3 {
   161    161       1a   "INSERT INTO a2 VALUES(1, 2, 3)"    {}
   162    162       1b   "SELECT * FROM a2 WHERE oid=last_insert_rowid()" {1 2 3}

Changes to test/e_select.test.

  1764   1764       3 1    8 1    7 1    -20 1    93 1    -1 1    -1 2    93 2
  1765   1765     }
  1766   1766     4  "SELECT z AS x, x AS z FROM d1 ORDER BY x" {
  1767   1767       -20 1    -1 2    -1 1    3 1    7 1    8 1    93 2    93 1
  1768   1768     }
  1769   1769   }
  1770   1770   
  1771         -# EVIDENCE-OF: R-27923-38747 Otherwise, if the ORDER BY expression is
  1772         -# any other expression, it is evaluated and the the returned value used
  1773         -# to order the output rows.
         1771  +# EVIDENCE-OF: R-65068-27207 Otherwise, if the ORDER BY expression is
         1772  +# any other expression, it is evaluated and the returned value used to
         1773  +# order the output rows.
  1774   1774   #
  1775   1775   # EVIDENCE-OF: R-03421-57988 If the SELECT statement is a simple SELECT,
  1776   1776   # then an ORDER BY may contain any arbitrary expressions.
  1777   1777   #
  1778   1778   do_select_tests e_select-8.6 {
  1779   1779     1   "SELECT * FROM d1 ORDER BY x+y+z" {
  1780   1780       1 2 -20    1 5 -1    1 2 3    2 5 -1 

Changes to test/e_update.test.

   229    229     6   "UPDATE t2 SET a = b WHERE rowid>2"
   230    230         {3 1 4   1 5 9   2 2 2}
   231    231   
   232    232     6   "UPDATE t2 SET b=6, c=5 WHERE a=b AND b=c"
   233    233         {3 1 4   1 5 9   2 6 5}
   234    234   }
   235    235   
   236         -# EVIDENCE-OF: R-09060-20018 If a single column-name appears more than
          236  +# EVIDENCE-OF: R-34751-18293 If a single column-name appears more than
   237    237   # once in the list of assignment expressions, all but the rightmost
   238         -# occurence is ignored.
          238  +# occurrence is ignored.
   239    239   #
   240    240   do_update_tests e_update-1.6 -query {
   241    241     SELECT * FROM t2
   242    242   } {
   243    243     1   "UPDATE t2 SET c=5, c=6, c=7 WHERE rowid=1" {3 1 7   1 5 9   2 6 5}
   244    244     2   "UPDATE t2 SET c=7, c=6, c=5 WHERE rowid=1" {3 1 5   1 5 9   2 6 5}
   245    245     3   "UPDATE t2 SET c=5, b=6, c=7 WHERE rowid=1" {3 6 7   1 5 9   2 6 5}
................................................................................
   601    601     4   "UPDATE t7 SET s = q ORDER BY q DESC LIMIT 5"    {6 7 8 9 10}
   602    602   }
   603    603   
   604    604   
   605    605   } ;# ifcapable update_delete_limit
   606    606    
   607    607   finish_test
   608         -

Changes to test/e_uri.test.

    44     44     set e
    45     45   }
    46     46   
    47     47   # EVIDENCE-OF: R-35840-33204 If URI filename interpretation is enabled,
    48     48   # and the filename argument begins with "file:", then the filename is
    49     49   # interpreted as a URI.
    50     50   #
    51         -# EVIDENCE-OF: R-32637-34037 URI filename interpretation is enabled if
    52         -# the SQLITE_OPEN_URI flag is is set in the fourth argument to
           51  +# EVIDENCE-OF: R-24124-56960 URI filename interpretation is enabled if
           52  +# the SQLITE_OPEN_URI flag is set in the fourth argument to
    53     53   # sqlite3_open_v2(), or if it has been enabled globally using the
    54     54   # SQLITE_CONFIG_URI option with the sqlite3_config() method or by the
    55     55   # SQLITE_USE_URI compile-time option.
    56     56   #
    57     57   if {$tcl_platform(platform) == "unix"} {
    58     58     set flags [list SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE]
    59     59   

Changes to test/enc4.test.

    57     57       do_test enc4-$i.$j.2 {
    58     58         set S [sqlite3_prepare_v2 db "SELECT $init+?" -1 dummy]
    59     59         sqlite3_expired $S
    60     60       } {0}
    61     61         
    62     62       set k 1
    63     63       foreach val $vals {
    64         -      for {set x 1} {$x<18} {incr x} {
           64  +      for {set x 1} {$x<16} {incr x} {
    65     65           set part [expr $init + [string range $val 0 [expr $x-1]]]
    66         -        regsub {e\+0} $part {e+} part
    67         -        regsub {^1e} $part {1.0e} part
    68     66   
    69         -        do_test enc4-$i.$j.$k.3.$x {
           67  +        do_realnum_test enc4-$i.$j.$k.3.$x {
    70     68             sqlite3_reset $S
    71     69             sqlite3_bind_text $S 1 $val $x
    72     70             sqlite3_step $S
    73     71             sqlite3_column_text $S 0
    74     72           } [list $part]
    75     73           
    76         -        do_test enc4-$i.$j.$k.4.$x {
           74  +        do_realnum_test enc4-$i.$j.$k.4.$x {
    77     75             sqlite3_reset $S
    78     76             sqlite3_bind_text16 $S 1 [encoding convertto unicode $val] [expr $x*2]
    79     77             sqlite3_step $S
    80     78             sqlite3_column_text $S 0
    81     79           } [list $part]
    82     80         }
    83     81         

Changes to test/fts4aa.test.

    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # If SQLITE_ENABLE_FTS3 is defined, omit this file.
    20     20   ifcapable !fts3 {
    21     21     finish_test
    22     22     return
    23     23   }
    24         -if {[db eval {SELECT sqlite_compileoption_used('ENABLE_FTS4')}]==0} {
    25         -  finish_test
    26         -  return
    27         -}
    28     24   
    29     25   do_test fts4aa-1.0 {
    30     26   db eval {
    31     27   CREATE VIRTUAL TABLE t1 USING fts4(words, tokenize porter);
    32     28   BEGIN TRANSACTION;
    33     29   INSERT INTO t1(docid,words) VALUES(1001001,'In the beginning God created the heaven and the earth.');
    34     30   INSERT INTO t1(docid,words) VALUES(1001002,'And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.');
................................................................................
  1585   1581     binary scan $blob $scan($::tcl_platform(byteOrder)) r
  1586   1582     return $r
  1587   1583   }
  1588   1584   db func mit mit
  1589   1585   
  1590   1586   do_test fts4aa-2.1 {
  1591   1587     db eval {
  1592         -    SELECT docid, mit(matchinfo(t1)) FROM t1 WHERE t1 MATCH 'melchizedek';
         1588  +    SELECT docid, mit(matchinfo(t1, 'pcxnal')) FROM t1 WHERE t1 MATCH 'melchizedek';
  1593   1589     }
  1594   1590   } {1014018 {1 1 1 1 1 1533 25 20}}
  1595   1591   do_test fts4aa-2.2 {
  1596   1592     db eval {
  1597         -    SELECT docid, mit(matchinfo(t1)) FROM t1
         1593  +    SELECT docid, mit(matchinfo(t1, 'pcxnal')) FROM t1
  1598   1594        WHERE t1 MATCH 'spake hebrew'
  1599   1595        ORDER BY docid;
  1600   1596     }
  1601   1597   } {1039014 {2 1 1 40 40 1 6 6 1533 25 42} 1039017 {2 1 1 40 40 1 6 6 1533 25 26}}
  1602   1598   do_test fts4aa-2.3 {
  1603   1599     db eval {
  1604         -    SELECT docid, mit(matchinfo(t1)) FROM t1
         1600  +    SELECT docid, mit(matchinfo(t1, 'pcxnal')) FROM t1
  1605   1601        WHERE t1 MATCH 'laban overtook jacob'
  1606   1602        ORDER BY docid;
  1607   1603     }
  1608   1604   } {1031025 {3 1 2 54 46 1 3 3 2 181 160 1533 25 24}}
  1609   1605   
  1610   1606   do_test fts4aa-9.1 {
  1611   1607     db eval {
  1612   1608       DELETE FROM t1 WHERE docid!=1050026;
  1613   1609       SELECT hex(size) FROM t1_docsize;
  1614   1610       SELECT hex(value) FROM t1_stat;
  1615   1611     }
  1616         -} {17 0117}
         1612  +} {17 01176F}
  1617   1613   
  1618   1614   do_test fts4aa-9.2 {
  1619   1615     db eval {
  1620   1616       SELECT docid FROM t1 EXCEPT SELECT docid FROM t1_docsize
  1621   1617     }
  1622   1618   } {}
  1623   1619   do_test fts4aa-9.3 {
  1624   1620     db eval {
  1625   1621       SELECT docid FROM t1_docsize EXCEPT SELECT docid FROM t1
  1626   1622     }
  1627   1623   } {}
  1628   1624   do_test fts4aa-9.4 {
         1625  +  # Note: Token 'in' is being deferred in the following query. 
  1629   1626     db eval {
  1630         -    SELECT docid, mit(matchinfo(t1)) FROM t1
         1627  +    SELECT docid, mit(matchinfo(t1, 'pcxnal')) FROM t1
  1631   1628        WHERE t1 MATCH 'joseph died in egypt'
  1632   1629        ORDER BY docid;
  1633   1630     }
  1634         -} {1050026 {4 1 1 1 1 1 1 1 2 2 1 1 1 1 1 23 23}}
         1631  +} {1050026 {4 1 1 1 1 1 1 1 2 1 1 1 1 1 1 23 23}}
  1635   1632   
  1636   1633   finish_test

Changes to test/tester.tcl.

   351    351     } else {
   352    352       puts " Ok"
   353    353     }
   354    354     flush stdout
   355    355   }
   356    356   
   357    357   proc realnum_normalize {r} {
   358         -  string map {1.#INF inf} [regsub -all {(e[+-])0+} $r {\1}]
          358  +  # different TCL versions display floating point values differently.
          359  +  string map {1.#INF inf Inf inf .0e e} [regsub -all {(e[+-])0+} $r {\1}]
   359    360   }
   360    361   proc do_realnum_test {name cmd expected} {
   361    362     uplevel [list do_test $name [
   362    363       subst -nocommands { realnum_normalize [ $cmd ] }
   363    364     ] [realnum_normalize $expected]]
   364    365   }
   365    366   

Changes to tool/lemon.c.

    37     37   #ifdef TEST
    38     38   #define MAXRHS 5       /* Set low to exercise exception code */
    39     39   #else
    40     40   #define MAXRHS 1000
    41     41   #endif
    42     42   
    43     43   static int showPrecedenceConflict = 0;
    44         -static const char **made_files = NULL;
    45         -static int made_files_count = 0;
    46         -static int successful_exit = 0;
    47         -static void LemonAtExit(void)
    48         -{
    49         -    /* if we failed, delete (most) files we made, to unconfuse build tools. */
    50         -    int i;
    51         -    for (i = 0; i < made_files_count; i++) {
    52         -        if (!successful_exit) {
    53         -            remove(made_files[i]);
    54         -        }
    55         -    }
    56         -    free(made_files);
    57         -    made_files_count = 0;
    58         -    made_files = NULL;
    59         -}
    60         -
    61     44   static char *msort(char*,char**,int(*)(const char*,const char*));
    62     45   
    63     46   /*
    64     47   ** Compilers are getting increasingly pedantic about type conversions
    65     48   ** as C evolves ever closer to Ada....  To work around the latest problems
    66     49   ** we have to define the following variant of strlen().
    67     50   */
................................................................................
  1429   1412       {OPT_FLAG, "x", (char*)&version, "Print the version number."},
  1430   1413       {OPT_FLAG,0,0,0}
  1431   1414     };
  1432   1415     int i;
  1433   1416     int exitcode;
  1434   1417     struct lemon lem;
  1435   1418   
  1436         -  atexit(LemonAtExit);
  1437         -
  1438   1419     OptInit(argv,options,stderr);
  1439   1420     if( version ){
  1440   1421        printf("Lemon version 1.0\n");
  1441   1422        exit(0); 
  1442   1423     }
  1443   1424     if( OptNArgs()!=1 ){
  1444   1425       fprintf(stderr,"Exactly one filename argument is required.\n");
................................................................................
  1533   1514     }
  1534   1515     if( lem.nconflict > 0 ){
  1535   1516       fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict);
  1536   1517     }
  1537   1518   
  1538   1519     /* return 0 on success, 1 on failure. */
  1539   1520     exitcode = ((lem.errorcnt > 0) || (lem.nconflict > 0)) ? 1 : 0;
  1540         -  successful_exit = (exitcode == 0);
  1541   1521     exit(exitcode);
  1542   1522     return (exitcode);
  1543   1523   }
  1544   1524   /******************** From the file "msort.c" *******************************/
  1545   1525   /*
  1546   1526   ** A generic merge-sort program.
  1547   1527   **
................................................................................
  2757   2737     lemp->outname = file_makename(lemp, suffix);
  2758   2738     fp = fopen(lemp->outname,mode);
  2759   2739     if( fp==0 && *mode=='w' ){
  2760   2740       fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname);
  2761   2741       lemp->errorcnt++;
  2762   2742       return 0;
  2763   2743     }
  2764         -
  2765         -  /* Add files we create to a list, so we can delete them if we fail. This
  2766         -  ** is to keep makefiles from getting confused. We don't include .out files,
  2767         -  ** though: this is debug information, and you don't want it deleted if there
  2768         -  ** was an error you need to track down.
  2769         -  */
  2770         -  if(( *mode=='w' ) && (strcmp(suffix, ".out") != 0)){
  2771         -    const char **ptr = (const char **)
  2772         -        realloc(made_files, sizeof (const char **) * (made_files_count + 1));
  2773         -    const char *fname = Strsafe(lemp->outname);
  2774         -    if ((ptr == NULL) || (fname == NULL)) {
  2775         -        free(ptr);
  2776         -        memory_error();
  2777         -    }
  2778         -    made_files = ptr;
  2779         -    made_files[made_files_count++] = fname;
  2780         -  }
  2781   2744     return fp;
  2782   2745   }
  2783   2746   
  2784   2747   /* Duplicate the input file without comments and without actions 
  2785   2748   ** on rules */
  2786   2749   void Reprint(struct lemon *lemp)
  2787   2750   {

Changes to tool/mksqlite3c.tcl.

    43     43   close $in
    44     44   
    45     45   # Open the output file and write a header comment at the beginning
    46     46   # of the file.
    47     47   #
    48     48   set out [open sqlite3.c w]
    49     49   # Force the output to use unix line endings, even on Windows.
    50         -# fconfigure $out -translation lf
           50  +fconfigure $out -translation lf
    51     51   set today [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S UTC" -gmt 1]
    52     52   puts $out [subst \
    53     53   {/******************************************************************************
    54     54   ** This file is an amalgamation of many separate C source files from SQLite
    55     55   ** version $VERSION.  By combining all the individual C code files into this 
    56     56   ** single large file, the entire code can be compiled as a single translation
    57     57   ** unit.  This allows many compilers to do optimizations that would not be