- Fix linker errors after recent SQLite3 update. Certain non-public

SQLite3 functions were used by cvstrac, and they were recently made
  intern, causing the linker errors.

  See: http://osdir.com/ml/sqlite-users/2009-07/msg00300.html

Reported by:	pointyhat (pav)
This commit is contained in:
Greg Larkin 2009-11-09 22:28:39 +00:00
parent cf89c98aba
commit b0e1be97c3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=244044
7 changed files with 237 additions and 12 deletions

View file

@ -1,5 +1,5 @@
--- Makefile.orig Thu May 8 10:58:17 2003
+++ Makefile Thu May 8 10:58:32 2003
--- ./Makefile.orig 2009-11-09 17:15:57.000000000 -0500
+++ ./Makefile 2009-11-09 17:15:57.000000000 -0500
@@ -0,0 +1,34 @@
+#!/usr/bin/make
+#
@ -21,7 +21,7 @@
+# will run on the target platform. This is usually the same
+# as BCC, unless you are cross-compiling.
+#
+TCC = gcc -g -O0 -Wall -I$(LOCALBASE)/include -lm
+TCC = gcc -g -O0 -Wall -I$(LOCALBASE)/include
+
+#### Extra arguments for linking against SQLite
+#

View file

@ -0,0 +1,38 @@
--- ./cgi.c.orig 2006-12-13 19:45:51.000000000 -0500
+++ ./cgi.c 2009-11-09 17:15:57.000000000 -0500
@@ -57,13 +57,6 @@
#endif /* INTERFACE */
/*
-** Provide a reliable implementation of a caseless string comparison
-** function.
-*/
-#define stricmp sqlite3StrICmp
-extern int sqlite3StrICmp(const char*, const char*);
-
-/*
** The body of the HTTP reply text is stored here.
*/
static int nAllocTxt = 0; /* Amount of space allocated for HTTP reply text */
@@ -669,17 +662,17 @@
nArg = tokenize_line(zLine, sizeof(azArg)/sizeof(azArg[0]), azArg);
for(i=0; i<nArg; i++){
int c = tolower(azArg[i][0]);
- if( c=='c' && stricmp(azArg[i],"content-disposition:")==0 ){
+ if( c=='c' && strcasecmp(azArg[i],"content-disposition:")==0 ){
i++;
- }else if( c=='n' && stricmp(azArg[i],"name=")==0 ){
+ }else if( c=='n' && strcasecmp(azArg[i],"name=")==0 ){
zName = azArg[++i];
- }else if( c=='f' && stricmp(azArg[i],"filename=")==0 ){
+ }else if( c=='f' && strcasecmp(azArg[i],"filename=")==0 ){
char *z = azArg[++i];
if( zName && z ){
cgi_set_parameter_nocopy(mprintf("%s:filename",zName), z);
}
showBytes = 1;
- }else if( c=='c' && stricmp(azArg[i],"content-type:")==0 ){
+ }else if( c=='c' && strcasecmp(azArg[i],"content-type:")==0 ){
char *z = azArg[++i];
if( zName && z ){
cgi_set_parameter_nocopy(mprintf("%s:mimetype",zName), z);

View file

@ -1,6 +1,64 @@
--- db.c.orig 2008-05-09 19:34:45.288709828 -0400
+++ db.c 2008-05-09 19:35:37.495027112 -0400
@@ -326,7 +326,7 @@
--- ./db.c.orig 2007-01-28 13:40:07.000000000 -0500
+++ ./db.c 2009-11-09 17:15:57.000000000 -0500
@@ -125,7 +125,6 @@
** routine NULLs-out fields of the database we do not want arbitrary
** users to see, such as the USER.PASSWD field.
*/
-extern int sqlite3StrICmp(const char*, const char*);
static int access_authorizer(
void *NotUsed,
int type,
@@ -141,34 +140,34 @@
return SQLITE_OK;
#endif
}else if( type==SQLITE_READ ){
- if( sqlite3StrICmp(zArg1,"user")==0 ){
- if( sqlite3StrICmp(zArg2,"passwd")==0 || sqlite3StrICmp(zArg2,"email")==0 ){
+ if( strcasecmp(zArg1,"user")==0 ){
+ if( strcasecmp(zArg2,"passwd")==0 || strcasecmp(zArg2,"email")==0 ){
return SQLITE_IGNORE;
}
- }else if( sqlite3StrICmp(zArg1, "cookie")==0 ){
+ }else if( strcasecmp(zArg1, "cookie")==0 ){
return SQLITE_IGNORE;
- }else if( sqlite3StrICmp(zArg1, "config")==0 ){
+ }else if( strcasecmp(zArg1, "config")==0 ){
return SQLITE_IGNORE;
- }else if( !g.okSetup && sqlite3StrICmp(zArg1, "access_load")==0 ){
+ }else if( !g.okSetup && strcasecmp(zArg1, "access_load")==0 ){
return SQLITE_IGNORE;
- }else if( (!g.okWrite || g.isAnon) && sqlite3StrICmp(zArg1,"ticket")==0
- && sqlite3StrICmp(zArg2,"contact")==0){
+ }else if( (!g.okWrite || g.isAnon) && strcasecmp(zArg1,"ticket")==0
+ && strcasecmp(zArg2,"contact")==0){
return SQLITE_IGNORE;
- }else if( !g.okCheckout && sqlite3StrICmp(zArg1,"chng")==0 ){
+ }else if( !g.okCheckout && strcasecmp(zArg1,"chng")==0 ){
return SQLITE_IGNORE;
- }else if( !g.okCheckout && sqlite3StrICmp(zArg1,"filechng")==0 ){
+ }else if( !g.okCheckout && strcasecmp(zArg1,"filechng")==0 ){
return SQLITE_IGNORE;
- }else if( !g.okCheckout && sqlite3StrICmp(zArg1,"file")==0 ){
+ }else if( !g.okCheckout && strcasecmp(zArg1,"file")==0 ){
return SQLITE_IGNORE;
- }else if( !g.okCheckout && sqlite3StrICmp(zArg1,"inspect")==0 ){
+ }else if( !g.okCheckout && strcasecmp(zArg1,"inspect")==0 ){
return SQLITE_IGNORE;
- }else if( !g.okRead && sqlite3StrICmp(zArg1,"ticket")==0 ){
+ }else if( !g.okRead && strcasecmp(zArg1,"ticket")==0 ){
return SQLITE_IGNORE;
- }else if( !g.okRead && sqlite3StrICmp(zArg1,"tktchng")==0 ){
+ }else if( !g.okRead && strcasecmp(zArg1,"tktchng")==0 ){
return SQLITE_IGNORE;
- }else if( !g.okRdWiki && sqlite3StrICmp(zArg1,"attachment")==0 ){
+ }else if( !g.okRdWiki && strcasecmp(zArg1,"attachment")==0 ){
return SQLITE_IGNORE;
- }else if( !g.okRdWiki && sqlite3StrICmp(zArg1,"wiki")==0 ){
+ }else if( !g.okRdWiki && strcasecmp(zArg1,"wiki")==0 ){
return SQLITE_IGNORE;
}
return SQLITE_OK;
@@ -326,7 +325,7 @@
db_err( zErrMsg ? zErrMsg : sqlite3_errmsg(pDb), zSql,
"db_query: Database query failed" );
}
@ -9,7 +67,7 @@
if( sResult.azElem==0 ){
db_query_callback(&sResult, 0, 0, 0);
}
@@ -385,7 +385,7 @@
@@ -385,7 +384,7 @@
db_err( zErrMsg ? zErrMsg : sqlite3_errmsg(pDb), zSql,
"db_short_query: Database query failed" );
}
@ -18,7 +76,7 @@
return zResult;
}
@@ -409,7 +409,7 @@
@@ -409,7 +408,7 @@
if( rc!=SQLITE_OK ){
db_err(zErrMsg, zSql, "db_execute: Database execute failed");
}
@ -27,7 +85,7 @@
}
/*
@@ -448,7 +448,7 @@
@@ -448,7 +447,7 @@
if( rc!=SQLITE_OK ){
db_err(zErrMsg, zSql, "db_exists: Database exists query failed");
}
@ -36,7 +94,7 @@
return iResult;
}
@@ -470,6 +470,7 @@
@@ -470,6 +469,7 @@
db_restrict_query(1);
rc = sqlite3_exec(pDb, zSql, 0, 0, &zErrMsg);
db_restrict_query(0);
@ -44,7 +102,7 @@
return (rc!=SQLITE_OK) ? zErrMsg : 0;
}
@@ -538,7 +539,7 @@
@@ -538,7 +538,7 @@
db_err(zErrMsg ? zErrMsg : sqlite3_errmsg(pDb), zSql,
"db_callback_query: Database query failed");
}
@ -53,7 +111,7 @@
}
/*
@@ -565,7 +566,7 @@
@@ -565,7 +565,7 @@
db_err(zErrMsg ? zErrMsg : sqlite3_errmsg(pDb), zSql,
"db_callback_execute: Database query failed");
}
@ -62,3 +120,37 @@
}
/*
@@ -672,7 +672,6 @@
** name as an argument and returns the value that the user enters in the
** resulting HTML form. A second optional parameter provides a default value.
*/
-extern int sqlite3StrICmp(const char*, const char*);
static void f_aux(sqlite3_context *context, int argc, sqlite3_value **argv){
int i;
const char *zParm;
@@ -682,7 +681,7 @@
if( zParm==0 ) return;
for(i=0; i<g.nAux && g.azAuxName[i]; i++){
- if( sqlite3StrICmp(zParm,g.azAuxName[i])==0 ){
+ if( strcasecmp(zParm,g.azAuxName[i])==0 ){
if( g.azAuxVal[i] ){
sqlite3_result_text(context, g.azAuxVal[i], -1, SQLITE_STATIC);
}
@@ -712,7 +711,6 @@
** currently selected value. Results may be a single value column or
** two value,description columns. The first result row is the default.
*/
-extern int sqlite3StrICmp(const char*, const char*);
static void f_option(sqlite3_context *context, int argc, sqlite3_value **argv){
const char *zParm;
int i;
@@ -722,7 +720,7 @@
if( zParm==0 ) return;
for(i=0; i<g.nAux && g.azAuxName[i]; i++){
- if( sqlite3StrICmp(zParm,g.azAuxName[i])==0 ){
+ if( strcasecmp(zParm,g.azAuxName[i])==0 ){
if( g.azAuxVal[i] ){
sqlite3_result_text(context, g.azAuxVal[i], -1, SQLITE_STATIC);
}

View file

@ -0,0 +1,32 @@
--- ./format.c.orig 2007-01-28 17:50:24.000000000 -0500
+++ ./format.c 2009-11-09 17:15:57.000000000 -0500
@@ -701,11 +701,10 @@
** Return TRUE if the HTML element given in the argument is a form of
** external reference (i.e. A, IMG, etc).
*/
-extern int sqlite3StrNICmp(const char *, const char*, int);
static int isLinkTag(const char *zElem, int nElem){
- return (nElem==1 && 0==sqlite3StrNICmp(zElem,"A",nElem))
- || (nElem==3 && 0==sqlite3StrNICmp(zElem,"IMG",nElem))
- || (nElem==4 && 0==sqlite3StrNICmp(zElem,"CITE",nElem));
+ return (nElem==1 && 0==sqlite3_strnicmp(zElem,"A",nElem))
+ || (nElem==3 && 0==sqlite3_strnicmp(zElem,"IMG",nElem))
+ || (nElem==4 && 0==sqlite3_strnicmp(zElem,"CITE",nElem));
}
/*
@@ -713,12 +712,11 @@
** before it ends, then return the number of characters through the end of
** the </html>. If the <html> or the </html> is missing, return 0.
*/
-extern int sqlite3StrNICmp(const char *, const char*, int);
static int is_html(const char *z){
int i;
- if( sqlite3StrNICmp(z, "<html>", 6) ) return 0;
+ if( sqlite3_strnicmp(z, "<html>", 6) ) return 0;
for(i=6; z[i]; i++){
- if( z[i]=='<' && sqlite3StrNICmp(&z[i],"</html>",7)==0 ) return i+7;
+ if( z[i]=='<' && sqlite3_strnicmp(&z[i],"</html>",7)==0 ) return i+7;
}
return 0;
}

View file

@ -0,0 +1,11 @@
--- ./main.mk.orig 2009-11-09 17:16:12.000000000 -0500
+++ ./main.mk 2009-11-09 17:16:19.000000000 -0500
@@ -115,7 +115,7 @@
$(BCC) -o maketestdb $(SRCDIR)/maketestdb.c $(LIBSQLITE)
$(APPNAME): headers $(OBJ)
- $(TCC) -o $(APPNAME) $(OBJ) $(LIBSQLITE)
+ $(TCC) -o $(APPNAME) $(OBJ) $(LIBSQLITE) -lm
index.html: $(SRCDIR)/webpage.html $(SRCDIR)/VERSION
sed -f $(SRCDIR)/VERSION $(SRCDIR)/webpage.html >index.html

View file

@ -0,0 +1,32 @@
--- ./search.c.orig 2006-12-13 19:27:25.000000000 -0500
+++ ./search.c 2009-11-09 17:15:57.000000000 -0500
@@ -29,11 +29,6 @@
/*
-** We'll use this routine in several places.
-*/
-extern int sqlite3StrNICmp(const char*,const char*,int);
-
-/*
** Search for a keyword in text. Return a matching score:
**
** 0 No sign of the word was found in the text
@@ -54,7 +49,7 @@
}
if( n<=0 ) n = strlen(zWord);
for(i=0; zText[i]; i++){
- if( (zText[i]==c1 || zText[i]==c2) && sqlite3StrNICmp(zWord,&zText[i],n)==0){
+ if( (zText[i]==c1 || zText[i]==c2) && sqlite3_strnicmp(zWord,&zText[i],n)==0){
int score = 6;
if( (i==0 || !isalnum(zText[i-1]))
&& (zText[i+n]==0 || !isalnum(zText[i+n])) ){
@@ -282,7 +277,7 @@
int n;
if( tolower(c)!=tolower(azKey[k][0]) ) continue;
n = keySize[k];
- if( sqlite3StrNICmp(&zAll[j],azKey[k],n)==0 ){
+ if( sqlite3_strnicmp(&zAll[j],azKey[k],n)==0 ){
strcpy(z,"<b>");
z += 3;
while( n ){

View file

@ -0,0 +1,20 @@
--- ./view.c.orig 2007-01-27 18:29:39.000000000 -0500
+++ ./view.c 2009-11-09 17:15:57.000000000 -0500
@@ -219,8 +219,6 @@
** pointer to an error message string (obtained from malloc) if
** there is a problem.
*/
-extern int sqlite3StrNICmp(const char*,const char*,int);
-extern int sqlite3StrICmp(const char*,const char*);
char *verify_sql_statement(char *zSql){
int i;
@@ -228,7 +226,7 @@
** the first token is "SELECT" and that there are no unquoted semicolons.
*/
for(i=0; isspace(zSql[i]); i++){}
- if( sqlite3StrNICmp(&zSql[i],"select",6)!=0 ){
+ if( sqlite3_strnicmp(&zSql[i],"select",6)!=0 ){
return mprintf("The SQL must be a SELECT statement");
}
for(i=0; zSql[i]; i++){