Fossil SCM

Fix use of sqlite3_strglob: 0 means there is a match

jan.nijtmans 2014-01-04 23:00 UTC sqlite-min-to-3.7.17
Commit 70a374d9a38d2acde512091e07d6a9edbf4bfc43
+2 -2
--- src/cgi.c
+++ src/cgi.c
@@ -277,12 +277,12 @@
277277
** Return true if the response should be sent with Content-Encoding: gzip.
278278
*/
279279
static int is_gzippable(void){
280280
if( strstr(PD("HTTP_ACCEPT_ENCODING", ""), "gzip")==0 ) return 0;
281281
return strncmp(zContentType, "text/", 5)==0
282
- || sqlite3_strglob("application/*xml", zContentType)
283
- || sqlite3_strglob("application/*javascript", zContentType);
282
+ || !sqlite3_strglob("application/*xml", zContentType)
283
+ || !sqlite3_strglob("application/*javascript", zContentType);
284284
}
285285
286286
/*
287287
** Do a normal HTTP reply
288288
*/
289289
--- src/cgi.c
+++ src/cgi.c
@@ -277,12 +277,12 @@
277 ** Return true if the response should be sent with Content-Encoding: gzip.
278 */
279 static int is_gzippable(void){
280 if( strstr(PD("HTTP_ACCEPT_ENCODING", ""), "gzip")==0 ) return 0;
281 return strncmp(zContentType, "text/", 5)==0
282 || sqlite3_strglob("application/*xml", zContentType)
283 || sqlite3_strglob("application/*javascript", zContentType);
284 }
285
286 /*
287 ** Do a normal HTTP reply
288 */
289
--- src/cgi.c
+++ src/cgi.c
@@ -277,12 +277,12 @@
277 ** Return true if the response should be sent with Content-Encoding: gzip.
278 */
279 static int is_gzippable(void){
280 if( strstr(PD("HTTP_ACCEPT_ENCODING", ""), "gzip")==0 ) return 0;
281 return strncmp(zContentType, "text/", 5)==0
282 || !sqlite3_strglob("application/*xml", zContentType)
283 || !sqlite3_strglob("application/*javascript", zContentType);
284 }
285
286 /*
287 ** Do a normal HTTP reply
288 */
289
+4 -4
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -923,17 +923,17 @@
923923
blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v",
924924
g.nameOfExe, zSubCmd);
925925
for(i=firstArg; i<g.argc; i++){
926926
const char *z = g.argv[i];
927927
if( z[0]=='-' ){
928
- if( sqlite3_strglob("*-html",z) ) continue;
929
- if( sqlite3_strglob("*-y",z) ) continue;
930
- if( sqlite3_strglob("*-i",z) ) continue;
928
+ if( !sqlite3_strglob("*-html",z) ) continue;
929
+ if( !sqlite3_strglob("*-y",z) ) continue;
930
+ if( !sqlite3_strglob("*-i",z) ) continue;
931931
/* The undocumented --script FILENAME option causes the Tk script to
932932
** be written into the FILENAME instead of being run. This is used
933933
** for testing and debugging. */
934
- if( sqlite3_strglob("*-script",z) && i<g.argc-1 ){
934
+ if( !sqlite3_strglob("*-script",z) && i<g.argc-1 ){
935935
i++;
936936
zTempFile = g.argv[i];
937937
continue;
938938
}
939939
}
940940
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -923,17 +923,17 @@
923 blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v",
924 g.nameOfExe, zSubCmd);
925 for(i=firstArg; i<g.argc; i++){
926 const char *z = g.argv[i];
927 if( z[0]=='-' ){
928 if( sqlite3_strglob("*-html",z) ) continue;
929 if( sqlite3_strglob("*-y",z) ) continue;
930 if( sqlite3_strglob("*-i",z) ) continue;
931 /* The undocumented --script FILENAME option causes the Tk script to
932 ** be written into the FILENAME instead of being run. This is used
933 ** for testing and debugging. */
934 if( sqlite3_strglob("*-script",z) && i<g.argc-1 ){
935 i++;
936 zTempFile = g.argv[i];
937 continue;
938 }
939 }
940
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -923,17 +923,17 @@
923 blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v",
924 g.nameOfExe, zSubCmd);
925 for(i=firstArg; i<g.argc; i++){
926 const char *z = g.argv[i];
927 if( z[0]=='-' ){
928 if( !sqlite3_strglob("*-html",z) ) continue;
929 if( !sqlite3_strglob("*-y",z) ) continue;
930 if( !sqlite3_strglob("*-i",z) ) continue;
931 /* The undocumented --script FILENAME option causes the Tk script to
932 ** be written into the FILENAME instead of being run. This is used
933 ** for testing and debugging. */
934 if( !sqlite3_strglob("*-script",z) && i<g.argc-1 ){
935 i++;
936 zTempFile = g.argv[i];
937 continue;
938 }
939 }
940
+1 -1
--- src/glob.c
+++ src/glob.c
@@ -149,11 +149,11 @@
149149
*/
150150
int glob_match(Glob *pGlob, const char *zString){
151151
int i;
152152
if( pGlob==0 ) return 0;
153153
for(i=0; i<pGlob->nPattern; i++){
154
- if( sqlite3_strglob(pGlob->azPattern[i], zString) ) return i+1;
154
+ if( !sqlite3_strglob(pGlob->azPattern[i], zString) ) return i+1;
155155
}
156156
return 0;
157157
}
158158
159159
/*
160160
--- src/glob.c
+++ src/glob.c
@@ -149,11 +149,11 @@
149 */
150 int glob_match(Glob *pGlob, const char *zString){
151 int i;
152 if( pGlob==0 ) return 0;
153 for(i=0; i<pGlob->nPattern; i++){
154 if( sqlite3_strglob(pGlob->azPattern[i], zString) ) return i+1;
155 }
156 return 0;
157 }
158
159 /*
160
--- src/glob.c
+++ src/glob.c
@@ -149,11 +149,11 @@
149 */
150 int glob_match(Glob *pGlob, const char *zString){
151 int i;
152 if( pGlob==0 ) return 0;
153 for(i=0; i<pGlob->nPattern; i++){
154 if( !sqlite3_strglob(pGlob->azPattern[i], zString) ) return i+1;
155 }
156 return 0;
157 }
158
159 /*
160
+5 -5
--- src/login.c
+++ src/login.c
@@ -395,15 +395,15 @@
395395
/* If a URI appears in the User-Agent, it is probably a bot */
396396
if( strncmp("http", zAgent+i,4)==0 ) return 0;
397397
}
398398
if( strncmp(zAgent, "Mozilla/", 8)==0 ){
399399
if( atoi(&zAgent[8])<4 ) return 0; /* Many bots advertise as Mozilla/3 */
400
- if( sqlite3_strglob("*Firefox/[1-9]*", zAgent) ) return 1;
401
- if( sqlite3_strglob("*Chrome/[1-9]*", zAgent) ) return 1;
402
- if( sqlite3_strglob("*(compatible;?MSIE?[1789]*", zAgent) ) return 1;
403
- if( sqlite3_strglob("*Trident/[1-9]*;?rv:[1-9]*", zAgent) ) return 1; /* IE11+ */
404
- if( sqlite3_strglob("*AppleWebKit/[1-9]*(KHTML*", zAgent) ) return 1;
400
+ if( sqlite3_strglob("*Firefox/[1-9]*", zAgent)==0 ) return 1;
401
+ if( sqlite3_strglob("*Chrome/[1-9]*", zAgent)==0 ) return 1;
402
+ if( sqlite3_strglob("*(compatible;?MSIE?[1789]*", zAgent)==0 ) return 1;
403
+ if( sqlite3_strglob("*Trident/[1-9]*;?rv:[1-9]*", zAgent)==0 ) return 1; /* IE11+ */
404
+ if( sqlite3_strglob("*AppleWebKit/[1-9]*(KHTML*", zAgent)==0 ) return 1;
405405
return 0;
406406
}
407407
if( strncmp(zAgent, "Opera/", 6)==0 ) return 1;
408408
if( strncmp(zAgent, "Safari/", 7)==0 ) return 1;
409409
if( strncmp(zAgent, "Lynx/", 5)==0 ) return 1;
410410
--- src/login.c
+++ src/login.c
@@ -395,15 +395,15 @@
395 /* If a URI appears in the User-Agent, it is probably a bot */
396 if( strncmp("http", zAgent+i,4)==0 ) return 0;
397 }
398 if( strncmp(zAgent, "Mozilla/", 8)==0 ){
399 if( atoi(&zAgent[8])<4 ) return 0; /* Many bots advertise as Mozilla/3 */
400 if( sqlite3_strglob("*Firefox/[1-9]*", zAgent) ) return 1;
401 if( sqlite3_strglob("*Chrome/[1-9]*", zAgent) ) return 1;
402 if( sqlite3_strglob("*(compatible;?MSIE?[1789]*", zAgent) ) return 1;
403 if( sqlite3_strglob("*Trident/[1-9]*;?rv:[1-9]*", zAgent) ) return 1; /* IE11+ */
404 if( sqlite3_strglob("*AppleWebKit/[1-9]*(KHTML*", zAgent) ) return 1;
405 return 0;
406 }
407 if( strncmp(zAgent, "Opera/", 6)==0 ) return 1;
408 if( strncmp(zAgent, "Safari/", 7)==0 ) return 1;
409 if( strncmp(zAgent, "Lynx/", 5)==0 ) return 1;
410
--- src/login.c
+++ src/login.c
@@ -395,15 +395,15 @@
395 /* If a URI appears in the User-Agent, it is probably a bot */
396 if( strncmp("http", zAgent+i,4)==0 ) return 0;
397 }
398 if( strncmp(zAgent, "Mozilla/", 8)==0 ){
399 if( atoi(&zAgent[8])<4 ) return 0; /* Many bots advertise as Mozilla/3 */
400 if( sqlite3_strglob("*Firefox/[1-9]*", zAgent)==0 ) return 1;
401 if( sqlite3_strglob("*Chrome/[1-9]*", zAgent)==0 ) return 1;
402 if( sqlite3_strglob("*(compatible;?MSIE?[1789]*", zAgent)==0 ) return 1;
403 if( sqlite3_strglob("*Trident/[1-9]*;?rv:[1-9]*", zAgent)==0 ) return 1; /* IE11+ */
404 if( sqlite3_strglob("*AppleWebKit/[1-9]*(KHTML*", zAgent)==0 ) return 1;
405 return 0;
406 }
407 if( strncmp(zAgent, "Opera/", 6)==0 ) return 1;
408 if( strncmp(zAgent, "Safari/", 7)==0 ) return 1;
409 if( strncmp(zAgent, "Lynx/", 5)==0 ) return 1;
410
+1 -1
--- src/main.c
+++ src/main.c
@@ -1318,11 +1318,11 @@
13181318
continue;
13191319
}
13201320
if( pFileGlob!=0
13211321
&& file_isfile(zRepo)
13221322
&& glob_match(pFileGlob, zRepo)
1323
- && sqlite3_strglob("*.fossil*",zRepo)==0
1323
+ && sqlite3_strglob("*.fossil*",zRepo)!=0
13241324
&& (zMimetype = mimetype_from_name(zRepo))!=0
13251325
&& strcmp(zMimetype, "application/x-fossil-artifact")!=0
13261326
){
13271327
Blob content;
13281328
blob_read_from_file(&content, zRepo);
13291329
--- src/main.c
+++ src/main.c
@@ -1318,11 +1318,11 @@
1318 continue;
1319 }
1320 if( pFileGlob!=0
1321 && file_isfile(zRepo)
1322 && glob_match(pFileGlob, zRepo)
1323 && sqlite3_strglob("*.fossil*",zRepo)==0
1324 && (zMimetype = mimetype_from_name(zRepo))!=0
1325 && strcmp(zMimetype, "application/x-fossil-artifact")!=0
1326 ){
1327 Blob content;
1328 blob_read_from_file(&content, zRepo);
1329
--- src/main.c
+++ src/main.c
@@ -1318,11 +1318,11 @@
1318 continue;
1319 }
1320 if( pFileGlob!=0
1321 && file_isfile(zRepo)
1322 && glob_match(pFileGlob, zRepo)
1323 && sqlite3_strglob("*.fossil*",zRepo)!=0
1324 && (zMimetype = mimetype_from_name(zRepo))!=0
1325 && strcmp(zMimetype, "application/x-fossil-artifact")!=0
1326 ){
1327 Blob content;
1328 blob_read_from_file(&content, zRepo);
1329
+1 -1
--- src/style.c
+++ src/style.c
@@ -175,11 +175,11 @@
175175
}
176176
for(i=0; i<nFormAction; i++){
177177
@ gebi("form%d(i+1)").action="%s(aFormAction[i])";
178178
}
179179
@ }
180
- if( sqlite3_strglob("*Opera Mini/[1-9]*", P("HTTP_USER_AGENT")) ){
180
+ if( sqlite3_strglob("*Opera Mini/[1-9]*", P("HTTP_USER_AGENT"))==0 ){
181181
/* Special case for Opera Mini, which executes JS server-side */
182182
@ var isOperaMini = Object.prototype.toString.call(window.operamini)
183183
@ === "[object OperaMini]";
184184
@ if( isOperaMini ){
185185
@ setTimeout("setAllHrefs();",%d(nDelay));
186186
--- src/style.c
+++ src/style.c
@@ -175,11 +175,11 @@
175 }
176 for(i=0; i<nFormAction; i++){
177 @ gebi("form%d(i+1)").action="%s(aFormAction[i])";
178 }
179 @ }
180 if( sqlite3_strglob("*Opera Mini/[1-9]*", P("HTTP_USER_AGENT")) ){
181 /* Special case for Opera Mini, which executes JS server-side */
182 @ var isOperaMini = Object.prototype.toString.call(window.operamini)
183 @ === "[object OperaMini]";
184 @ if( isOperaMini ){
185 @ setTimeout("setAllHrefs();",%d(nDelay));
186
--- src/style.c
+++ src/style.c
@@ -175,11 +175,11 @@
175 }
176 for(i=0; i<nFormAction; i++){
177 @ gebi("form%d(i+1)").action="%s(aFormAction[i])";
178 }
179 @ }
180 if( sqlite3_strglob("*Opera Mini/[1-9]*", P("HTTP_USER_AGENT"))==0 ){
181 /* Special case for Opera Mini, which executes JS server-side */
182 @ var isOperaMini = Object.prototype.toString.call(window.operamini)
183 @ === "[object OperaMini]";
184 @ if( isOperaMini ){
185 @ setTimeout("setAllHrefs();",%d(nDelay));
186
+2 -2
--- src/vfile.c
+++ src/vfile.c
@@ -393,13 +393,13 @@
393393
"original",
394394
"output",
395395
};
396396
int i, j, n;
397397
398
- if( sqlite3_strglob("ci-comment-????????????.txt", zName) ) return 1;
398
+ if( sqlite3_strglob("ci-comment-????????????.txt", zName)==0 ) return 1;
399399
for(; zName[0]!=0; zName++){
400
- if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName) ){
400
+ if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
401401
return 1;
402402
}
403403
if( zName[0]!='-' ) continue;
404404
for(i=0; i<sizeof(azTemp)/sizeof(azTemp[0]); i++){
405405
n = (int)strlen(azTemp[i]);
406406
--- src/vfile.c
+++ src/vfile.c
@@ -393,13 +393,13 @@
393 "original",
394 "output",
395 };
396 int i, j, n;
397
398 if( sqlite3_strglob("ci-comment-????????????.txt", zName) ) return 1;
399 for(; zName[0]!=0; zName++){
400 if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName) ){
401 return 1;
402 }
403 if( zName[0]!='-' ) continue;
404 for(i=0; i<sizeof(azTemp)/sizeof(azTemp[0]); i++){
405 n = (int)strlen(azTemp[i]);
406
--- src/vfile.c
+++ src/vfile.c
@@ -393,13 +393,13 @@
393 "original",
394 "output",
395 };
396 int i, j, n;
397
398 if( sqlite3_strglob("ci-comment-????????????.txt", zName)==0 ) return 1;
399 for(; zName[0]!=0; zName++){
400 if( zName[0]=='/' && sqlite3_strglob("/ci-comment-????????????.txt", zName)==0 ){
401 return 1;
402 }
403 if( zName[0]!='-' ) continue;
404 for(i=0; i<sizeof(azTemp)/sizeof(azTemp[0]); i++){
405 n = (int)strlen(azTemp[i]);
406
+1 -1
--- src/xfer.c
+++ src/xfer.c
@@ -1785,11 +1785,11 @@
17851785
** to the next cycle.
17861786
*/
17871787
if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
17881788
char *zMsg = blob_terminate(&xfer.aToken[1]);
17891789
defossilize(zMsg);
1790
- if( (syncFlags & SYNC_PUSH) && zMsg && sqlite3_strglob("pull only *", zMsg) ){
1790
+ if( (syncFlags & SYNC_PUSH) && zMsg && sqlite3_strglob("pull only *", zMsg)==0 ){
17911791
syncFlags &= ~SYNC_PUSH;
17921792
zMsg = 0;
17931793
}
17941794
if( zMsg && zMsg[0] ){
17951795
fossil_force_newline();
17961796
--- src/xfer.c
+++ src/xfer.c
@@ -1785,11 +1785,11 @@
1785 ** to the next cycle.
1786 */
1787 if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
1788 char *zMsg = blob_terminate(&xfer.aToken[1]);
1789 defossilize(zMsg);
1790 if( (syncFlags & SYNC_PUSH) && zMsg && sqlite3_strglob("pull only *", zMsg) ){
1791 syncFlags &= ~SYNC_PUSH;
1792 zMsg = 0;
1793 }
1794 if( zMsg && zMsg[0] ){
1795 fossil_force_newline();
1796
--- src/xfer.c
+++ src/xfer.c
@@ -1785,11 +1785,11 @@
1785 ** to the next cycle.
1786 */
1787 if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
1788 char *zMsg = blob_terminate(&xfer.aToken[1]);
1789 defossilize(zMsg);
1790 if( (syncFlags & SYNC_PUSH) && zMsg && sqlite3_strglob("pull only *", zMsg)==0 ){
1791 syncFlags &= ~SYNC_PUSH;
1792 zMsg = 0;
1793 }
1794 if( zMsg && zMsg[0] ){
1795 fossil_force_newline();
1796

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button