File sqlite.diff of Package sqlite2

---
 Makefile.in    |   16 ++++++++--------
 configure.ac   |    3 ---
 main.mk        |    2 +-
 src/attach.c   |    4 ++--
 src/build.c    |   16 ++++++++--------
 src/expr.c     |    2 +-
 src/pragma.c   |    2 +-
 src/printf.c   |   12 +++++-------
 src/select.c   |   14 +++++++-------
 src/tokenize.c |    2 +-
 src/vdbe.c     |    2 +-
 11 files changed, 35 insertions(+), 40 deletions(-)

Index: Makefile.in
===================================================================
--- Makefile.in.orig
+++ Makefile.in
@@ -24,11 +24,11 @@ BCC = @BUILD_CC@ @BUILD_CFLAGS@
 
 # C Compile 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.)
 #
-TCC = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src
+TCC = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src -DTHREADSAFE=1
 
 # Some standard variables and programs
 #
 prefix = @prefix@
 exec_prefix = @exec_prefix@
@@ -181,15 +181,15 @@ Makefile: $(TOP)/Makefile.in
 
 # Generate the file "last_change" which contains the date of change
 # of the most recently modified source code file
 #
 last_change:	$(SRC)
-	cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \
+	cat $(SRC) | grep '$$Id: ' | sort +4 | tail -n 1 \
           | awk '{print $$5,$$6}' >last_change
 
 libsqlite.la:	$(LIBOBJ)
-	$(LTLINK) -o libsqlite.la $(LIBOBJ) ${RELEASE} -rpath @exec_prefix@/lib \
+	$(LTLINK) -o libsqlite.la $(LIBOBJ) ${RELEASE} -rpath @libdir@ \
 		-version-info "8:6:8"
 
 libtclsqlite.la:	tclsqlite.lo libsqlite.la
 	$(LTLINK) -o libtclsqlite.la tclsqlite.lo \
 		libsqlite.la $(LIBTCL) -rpath @exec_prefix@/lib/sqlite \
@@ -361,11 +361,11 @@ tclsqlite:	tclsqlite-sh.lo libsqlite.la
 	$(LTLINK) $(TCL_FLAGS) -o tclsqlite tclsqlite-sh.lo libsqlite.la $(LIBTCL)
 
 testfixture@TARGET_EXEEXT@:	$(TOP)/src/tclsqlite.c libtclsqlite.la libsqlite.la $(TESTSRC)
 	$(LTLINK) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1\
                 -o testfixture $(TESTSRC) $(TOP)/src/tclsqlite.c \
-		libtclsqlite.la libsqlite.la $(LIBTCL)
+		libtclsqlite.la libsqlite.la $(LIBTCL) -lpthread
 
 fulltest:	testfixture@TARGET_EXEEXT@ sqlite@TARGET_EXEEXT@
 	./testfixture $(TOP)/test/all.test
 
 test:	testfixture@TARGET_EXEEXT@ sqlite@TARGET_EXEEXT@
@@ -463,18 +463,18 @@ DOC = \
 doc:	$(DOC)
 	mkdir -p doc
 	mv $(DOC) doc
 
 install:	sqlite libsqlite.la sqlite.h
-	$(INSTALL) -d $(DESTDIR)$(exec_prefix)/lib
-	$(LTINSTALL) libsqlite.la $(DESTDIR)$(exec_prefix)/lib
+	$(INSTALL) -d $(DESTDIR)@libdir@
+	$(LTINSTALL) libsqlite.la $(DESTDIR)@libdir@
 	$(INSTALL) -d $(DESTDIR)$(exec_prefix)/bin
 	$(LTINSTALL) sqlite $(DESTDIR)$(exec_prefix)/bin
 	$(INSTALL) -d $(DESTDIR)$(prefix)/include
 	$(INSTALL) -m 0644 sqlite.h $(DESTDIR)$(prefix)/include
-	$(INSTALL) -d $(DESTDIR)$(exec_prefix)/lib/pkgconfig; 
-	$(INSTALL) -m 0644 sqlite.pc $(DESTDIR)$(exec_prefix)/lib/pkgconfig; 
+	$(INSTALL) -d $(DESTDIR)@libdir@/pkgconfig; 
+	$(INSTALL) -m 0644 sqlite.pc $(DESTDIR)@libdir@/pkgconfig; 
 
 clean:	
 	rm -f *.lo *.la *.o sqlite@TARGET_EXEEXT@ libsqlite.la sqlite.h opcodes.*
 	rm -rf .libs .deps 
 	rm -f lemon@BUILD_EXEEXT@ lempar.c parse.* sqlite*.tar.gz
Index: configure.ac
===================================================================
--- configure.ac.orig
+++ configure.ac
@@ -376,13 +376,10 @@ if test "$config_BUILD_EXEEXT" = ".exe";
   CYGWIN=yes
   AC_MSG_RESULT(yes)
 else
   AC_MSG_RESULT(unknown)
 fi
-if test "$CYGWIN" != "yes"; then
-  AC_CYGWIN
-fi
 if test "$CYGWIN" = "yes"; then
   BUILD_EXEEXT=.exe
 else
   BUILD_EXEEXT=$EXEEXT
 fi
Index: main.mk
===================================================================
--- main.mk.orig
+++ main.mk
@@ -143,11 +143,11 @@ all:	sqlite.h config.h libsqlite.a sqlit
 
 # Generate the file "last_change" which contains the date of change
 # of the most recently modified source code file
 #
 last_change:	$(SRC)
-	cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \
+	cat $(SRC) | grep '$$Id: ' | sort +4 | tail -n 1 \
           | awk '{print $$5,$$6}' >last_change
 
 libsqlite.a:	$(LIBOBJ)
 	$(AR) libsqlite.a $(LIBOBJ)
 	$(RANLIB) libsqlite.a
Index: src/attach.c
===================================================================
--- src/attach.c.orig
+++ src/attach.c
@@ -46,22 +46,22 @@ void sqliteAttach(Parse *pParse, Token *
     pParse->rc = SQLITE_ERROR;
     return;
   }
 
   zFile = 0;
-  sqliteSetNString(&zFile, pFilename->z, pFilename->n, 0);
+  sqliteSetNString(&zFile, pFilename->z, pFilename->n, (char*)0);
   if( zFile==0 ) return;
   sqliteDequote(zFile);
 #ifndef SQLITE_OMIT_AUTHORIZATION
   if( sqliteAuthCheck(pParse, SQLITE_ATTACH, zFile, 0, 0)!=SQLITE_OK ){
     sqliteFree(zFile);
     return;
   }
 #endif /* SQLITE_OMIT_AUTHORIZATION */
 
   zName = 0;
-  sqliteSetNString(&zName, pDbname->z, pDbname->n, 0);
+  sqliteSetNString(&zName, pDbname->z, pDbname->n, (char*)0);
   if( zName==0 ) return;
   sqliteDequote(zName);
   for(i=0; i<db->nDb; i++){
     if( db->aDb[i].zName && sqliteStrICmp(db->aDb[i].zName, zName)==0 ){
       sqliteErrorMsg(pParse, "database %z is already in use", zName);
Index: src/build.c
===================================================================
--- src/build.c.orig
+++ src/build.c
@@ -557,11 +557,11 @@ void sqliteAddColumn(Parse *pParse, Toke
   Table *p;
   int i;
   char *z = 0;
   Column *pCol;
   if( (p = pParse->pNewTable)==0 ) return;
-  sqliteSetNString(&z, pName->z, pName->n, 0);
+  sqliteSetNString(&z, pName->z, pName->n, (char*)0);
   if( z==0 ) return;
   sqliteDequote(z);
   for(i=0; i<p->nCol; i++){
     if( sqliteStrICmp(z, p->aCol[i].zName)==0 ){
       sqliteErrorMsg(pParse, "duplicate column name: %s", z);
@@ -615,11 +615,11 @@ void sqliteAddColumnType(Parse *pParse,
   i = p->nCol-1;
   if( i<0 ) return;
   pCol = &p->aCol[i];
   pz = &pCol->zType;
   n = pLast->n + Addr(pLast->z) - Addr(pFirst->z);
-  sqliteSetNString(pz, pFirst->z, n, 0);
+  sqliteSetNString(pz, pFirst->z, n, (char*)0);
   z = *pz;
   if( z==0 ) return;
   for(i=j=0; z[i]; i++){
     int c = z[i];
     if( isspace(c) ) continue;
@@ -648,13 +648,13 @@ void sqliteAddDefaultValue(Parse *pParse
   if( (p = pParse->pNewTable)==0 ) return;
   i = p->nCol-1;
   if( i<0 ) return;
   pz = &p->aCol[i].zDflt;
   if( minusFlag ){
-    sqliteSetNString(pz, "-", 1, pVal->z, pVal->n, 0);
+    sqliteSetNString(pz, "-", 1, pVal->z, pVal->n, (char*)0);
   }else{
-    sqliteSetNString(pz, pVal->z, pVal->n, 0);
+    sqliteSetNString(pz, pVal->z, pVal->n, (char*)0);
   }
   sqliteDequote(*pz);
 }
 
 /*
@@ -1854,11 +1854,11 @@ IdList *sqliteIdListAppend(IdList *pList
     pList->a = a;
   }
   memset(&pList->a[pList->nId], 0, sizeof(pList->a[0]));
   if( pToken ){
     char **pz = &pList->a[pList->nId].zName;
-    sqliteSetNString(pz, pToken->z, pToken->n, 0);
+    sqliteSetNString(pz, pToken->z, pToken->n, (char*)0);
     if( *pz==0 ){
       sqliteIdListDelete(pList);
       return 0;
     }else{
       sqliteDequote(*pz);
@@ -1919,21 +1919,21 @@ SrcList *sqliteSrcListAppend(SrcList *pL
     pDatabase = pTable;
     pTable = pTemp;
   }
   if( pTable ){
     char **pz = &pList->a[pList->nSrc].zName;
-    sqliteSetNString(pz, pTable->z, pTable->n, 0);
+    sqliteSetNString(pz, pTable->z, pTable->n, (char*)0);
     if( *pz==0 ){
       sqliteSrcListDelete(pList);
       return 0;
     }else{
       sqliteDequote(*pz);
     }
   }
   if( pDatabase ){
     char **pz = &pList->a[pList->nSrc].zDatabase;
-    sqliteSetNString(pz, pDatabase->z, pDatabase->n, 0);
+    sqliteSetNString(pz, pDatabase->z, pDatabase->n, (char*)0);
     if( *pz==0 ){
       sqliteSrcListDelete(pList);
       return 0;
     }else{
       sqliteDequote(*pz);
@@ -1960,11 +1960,11 @@ void sqliteSrcListAssignCursors(Parse *p
 ** Add an alias to the last identifier on the given identifier list.
 */
 void sqliteSrcListAddAlias(SrcList *pList, Token *pToken){
   if( pList && pList->nSrc>0 ){
     int i = pList->nSrc - 1;
-    sqliteSetNString(&pList->a[i].zAlias, pToken->z, pToken->n, 0);
+    sqliteSetNString(&pList->a[i].zAlias, pToken->z, pToken->n, (char*)0);
     sqliteDequote(pList->a[i].zAlias);
   }
 }
 
 /*
Index: src/expr.c
===================================================================
--- src/expr.c.orig
+++ src/expr.c
@@ -267,11 +267,11 @@ ExprList *sqliteExprListAppend(ExprList
   if( pExpr || pName ){
     struct ExprList_item *pItem = &pList->a[pList->nExpr++];
     memset(pItem, 0, sizeof(*pItem));
     pItem->pExpr = pExpr;
     if( pName ){
-      sqliteSetNString(&pItem->zName, pName->z, pName->n, 0);
+      sqliteSetNString(&pItem->zName, pName->z, pName->n, (char*)0);
       sqliteDequote(pItem->zName);
     }
   }
   return pList;
 }
Index: src/pragma.c
===================================================================
--- src/pragma.c.orig
+++ src/pragma.c
@@ -165,11 +165,11 @@ void sqlitePragma(Parse *pParse, Token *
 
   zLeft = sqliteStrNDup(pLeft->z, pLeft->n);
   sqliteDequote(zLeft);
   if( minusFlag ){
     zRight = 0;
-    sqliteSetNString(&zRight, "-", 1, pRight->z, pRight->n, 0);
+    sqliteSetNString(&zRight, "-", 1, pRight->z, pRight->n, (char*)0);
   }else{
     zRight = sqliteStrNDup(pRight->z, pRight->n);
     sqliteDequote(zRight);
   }
   if( sqliteAuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, 0) ){
Index: src/printf.c
===================================================================
--- src/printf.c.orig
+++ src/printf.c
@@ -645,11 +645,11 @@ struct sgMprintf {
   char *zBase;     /* A base allocation */
   char *zText;     /* The string collected so far */
   int  nChar;      /* Length of the string so far */
   int  nTotal;     /* Output size if unconstrained */
   int  nAlloc;     /* Amount of space allocated in zText */
-  void *(*xRealloc)(void*,int);  /* Function used to realloc memory */
+  void *(*xRealloc)(void*,size_t);  /* Function used to realloc memory */
 };
 
 /* 
 ** This function implements the callback from vxprintf. 
 **
@@ -686,11 +686,11 @@ static void mout(void *arg, const char *
 /*
 ** This routine is a wrapper around xprintf() that invokes mout() as
 ** the consumer.  
 */
 static char *base_vprintf(
-  void *(*xRealloc)(void*,int),   /* Routine to realloc memory. May be NULL */
+  void *(*xRealloc)(void*,size_t),/* Routine to realloc memory. May be NULL */
   int useInternal,                /* Use internal %-conversions if true */
   char *zInitBuf,                 /* Initially write here, before mallocing */
   int nInitBuf,                   /* Size of zInitBuf[] */
   const char *zFormat,            /* format string */
   va_list ap                      /* arguments */
@@ -713,11 +713,11 @@ static char *base_vprintf(
 }
 
 /*
 ** Realloc that is a real function, not a macro.
 */
-static void *printf_realloc(void *old, int size){
+static void *printf_realloc(void *old, size_t size){
   return sqliteRealloc(old,size);
 }
 
 /*
 ** Print into memory obtained from sqliteMalloc().  Use the internal
@@ -750,22 +750,20 @@ char *sqlite_mprintf(const char *zFormat
   va_list ap;
   char *z;
   char zBuf[200];
 
   va_start(ap,zFormat);
-  z = base_vprintf((void*(*)(void*,int))realloc, 0, 
-                   zBuf, sizeof(zBuf), zFormat, ap);
+  z = base_vprintf(realloc, 0, zBuf, sizeof(zBuf), zFormat, ap);
   va_end(ap);
   return z;
 }
 
 /* This is the varargs version of sqlite_mprintf.  
 */
 char *sqlite_vmprintf(const char *zFormat, va_list ap){
   char zBuf[200];
-  return base_vprintf((void*(*)(void*,int))realloc, 0,
-                      zBuf, sizeof(zBuf), zFormat, ap);
+  return base_vprintf(realloc, 0, zBuf, sizeof(zBuf), zFormat, ap);
 }
 
 /*
 ** sqlite_snprintf() works like snprintf() except that it ignores the
 ** current locale settings.  This is important for SQLite because we
Index: src/select.c
===================================================================
--- src/select.c.orig
+++ src/select.c
@@ -119,11 +119,11 @@ int sqliteJoinType(Parse *pParse, Token
     static Token dummy = { 0, 0 };
     char *zSp1 = " ", *zSp2 = " ";
     if( pB==0 ){ pB = &dummy; zSp1 = 0; }
     if( pC==0 ){ pC = &dummy; zSp2 = 0; }
     sqliteSetNString(&pParse->zErrMsg, "unknown or unsupported join type: ", 0,
-       pA->z, pA->n, zSp1, 1, pB->z, pB->n, zSp2, 1, pC->z, pC->n, 0);
+       pA->z, pA->n, zSp1, 1, pB->z, pB->n, zSp2, 1, pC->z, pC->n, (char*)0);
     pParse->nErr++;
     jointype = JT_INNER;
   }else if( jointype & JT_RIGHT ){
     sqliteErrorMsg(pParse, 
       "RIGHT and FULL OUTER JOINs are not currently supported");
@@ -742,11 +742,11 @@ static void generateColumnNames(
         char *zName = 0;
         char *zTab;
  
         zTab = pTabList->a[j].zAlias;
         if( fullNames || zTab==0 ) zTab = pTab->zName;
-        sqliteSetString(&zName, zTab, ".", zCol, 0);
+        sqliteSetString(&zName, zTab, ".", zCol, (char*)0);
         sqliteVdbeOp3(v, OP_ColumnName, i, p2, zName, P3_DYNAMIC);
       }else{
         sqliteVdbeOp3(v, OP_ColumnName, i, p2, zCol, 0);
       }
     }else if( p->span.z && p->span.z[0] ){
@@ -807,23 +807,23 @@ Table *sqliteResultSetOfSelect(Parse *pP
     if( pEList->a[i].zName ){
       aCol[i].zName = sqliteStrDup(pEList->a[i].zName);
     }else if( (p=pEList->a[i].pExpr)->op==TK_DOT 
                && (pR=p->pRight)!=0 && pR->token.z && pR->token.z[0] ){
       int cnt;
-      sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, 0);
+      sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, (char*)0);
       for(j=cnt=0; j<i; j++){
         if( sqliteStrICmp(aCol[j].zName, aCol[i].zName)==0 ){
           int n;
           char zBuf[30];
           sprintf(zBuf,"_%d",++cnt);
           n = strlen(zBuf);
-          sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, zBuf, n,0);
+          sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, zBuf, n, (char*)0);
           j = -1;
         }
       }
     }else if( p->span.z && p->span.z[0] ){
-      sqliteSetNString(&pTab->aCol[i].zName, p->span.z, p->span.n, 0);
+      sqliteSetNString(&pTab->aCol[i].zName, p->span.z, p->span.n, (char*)0);
     }else{
       char zBuf[30];
       sprintf(zBuf, "column%d", i+1);
       aCol[i].zName = sqliteStrDup(zBuf);
     }
@@ -877,11 +877,11 @@ static int fillInColumnList(Parse *pPars
       assert( pTabList->a[i].pSelect!=0 );
       if( pTabList->a[i].zAlias==0 ){
         char zFakeName[60];
         sprintf(zFakeName, "sqlite_subquery_%p_",
            (void*)pTabList->a[i].pSelect);
-        sqliteSetString(&pTabList->a[i].zAlias, zFakeName, 0);
+        sqliteSetString(&pTabList->a[i].zAlias, zFakeName, (char*)0);
       }
       pTabList->a[i].pTab = pTab = 
         sqliteResultSetOfSelect(pParse, pTabList->a[i].zAlias,
                                         pTabList->a[i].pSelect);
       if( pTab==0 ){
@@ -1001,11 +1001,11 @@ static int fillInColumnList(Parse *pPars
               pExpr = sqliteExpr(TK_DOT, pLeft, pRight, 0);
               if( pExpr==0 ) break;
               pLeft->token.z = zTabName;
               pLeft->token.n = strlen(zTabName);
               pLeft->token.dyn = 0;
-              sqliteSetString((char**)&pExpr->span.z, zTabName, ".", zName, 0);
+              sqliteSetString((char**)&pExpr->span.z, zTabName, ".", zName, (char*)0);
               pExpr->span.n = strlen(pExpr->span.z);
               pExpr->span.dyn = 1;
               pExpr->token.z = 0;
               pExpr->token.n = 0;
               pExpr->token.dyn = 0;
Index: src/tokenize.c
===================================================================
--- src/tokenize.c.orig
+++ src/tokenize.c
@@ -432,11 +432,11 @@ int sqliteRunParser(Parse *pParse, const
         }
         break;
       }
       case TK_ILLEGAL: {
         sqliteSetNString(pzErrMsg, "unrecognized token: \"", -1, 
-           pParse->sLastToken.z, pParse->sLastToken.n, "\"", 1, 0);
+           pParse->sLastToken.z, pParse->sLastToken.n, "\"", 1, (char*)0);
         nErr++;
         goto abort_parse;
       }
       case TK_SEMI: {
         pParse->zTail = &zSql[i];
Index: src/vdbe.c
===================================================================
--- src/vdbe.c.orig
+++ src/vdbe.c
@@ -112,11 +112,11 @@ int sqlite_step(
 ){
   Vdbe *p = (Vdbe*)pVm;
   sqlite *db;
   int rc;
 
-  if( p->magic!=VDBE_MAGIC_RUN ){
+  if( !p || p->magic!=VDBE_MAGIC_RUN ){
     return SQLITE_MISUSE;
   }
   db = p->db;
   if( sqliteSafetyOn(db) ){
     p->rc = SQLITE_MISUSE;
openSUSE Build Service is sponsored by