Fossil SCM
Fix use of sqlite3_strglob: 0 means there is a match
Commit
70a374d9a38d2acde512091e07d6a9edbf4bfc43
Parent
107b959b22f0ea2…
8 files changed
+2
-2
+4
-4
+1
-1
+5
-5
+1
-1
+1
-1
+2
-2
+1
-1
+2
-2
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -277,12 +277,12 @@ | ||
| 277 | 277 | ** Return true if the response should be sent with Content-Encoding: gzip. |
| 278 | 278 | */ |
| 279 | 279 | static int is_gzippable(void){ |
| 280 | 280 | if( strstr(PD("HTTP_ACCEPT_ENCODING", ""), "gzip")==0 ) return 0; |
| 281 | 281 | 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); | |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /* |
| 287 | 287 | ** Do a normal HTTP reply |
| 288 | 288 | */ |
| 289 | 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 |
| --- 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 @@ | ||
| 923 | 923 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", |
| 924 | 924 | g.nameOfExe, zSubCmd); |
| 925 | 925 | for(i=firstArg; i<g.argc; i++){ |
| 926 | 926 | const char *z = g.argv[i]; |
| 927 | 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; | |
| 928 | + if( !sqlite3_strglob("*-html",z) ) continue; | |
| 929 | + if( !sqlite3_strglob("*-y",z) ) continue; | |
| 930 | + if( !sqlite3_strglob("*-i",z) ) continue; | |
| 931 | 931 | /* The undocumented --script FILENAME option causes the Tk script to |
| 932 | 932 | ** be written into the FILENAME instead of being run. This is used |
| 933 | 933 | ** for testing and debugging. */ |
| 934 | - if( sqlite3_strglob("*-script",z) && i<g.argc-1 ){ | |
| 934 | + if( !sqlite3_strglob("*-script",z) && i<g.argc-1 ){ | |
| 935 | 935 | i++; |
| 936 | 936 | zTempFile = g.argv[i]; |
| 937 | 937 | continue; |
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 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 |
| --- 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 @@ | ||
| 149 | 149 | */ |
| 150 | 150 | int glob_match(Glob *pGlob, const char *zString){ |
| 151 | 151 | int i; |
| 152 | 152 | if( pGlob==0 ) return 0; |
| 153 | 153 | 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; | |
| 155 | 155 | } |
| 156 | 156 | return 0; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /* |
| 160 | 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 |
| --- 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 @@ | ||
| 395 | 395 | /* If a URI appears in the User-Agent, it is probably a bot */ |
| 396 | 396 | if( strncmp("http", zAgent+i,4)==0 ) return 0; |
| 397 | 397 | } |
| 398 | 398 | if( strncmp(zAgent, "Mozilla/", 8)==0 ){ |
| 399 | 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; | |
| 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 | 405 | return 0; |
| 406 | 406 | } |
| 407 | 407 | if( strncmp(zAgent, "Opera/", 6)==0 ) return 1; |
| 408 | 408 | if( strncmp(zAgent, "Safari/", 7)==0 ) return 1; |
| 409 | 409 | if( strncmp(zAgent, "Lynx/", 5)==0 ) return 1; |
| 410 | 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) ) 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 @@ | ||
| 1318 | 1318 | continue; |
| 1319 | 1319 | } |
| 1320 | 1320 | if( pFileGlob!=0 |
| 1321 | 1321 | && file_isfile(zRepo) |
| 1322 | 1322 | && glob_match(pFileGlob, zRepo) |
| 1323 | - && sqlite3_strglob("*.fossil*",zRepo)==0 | |
| 1323 | + && sqlite3_strglob("*.fossil*",zRepo)!=0 | |
| 1324 | 1324 | && (zMimetype = mimetype_from_name(zRepo))!=0 |
| 1325 | 1325 | && strcmp(zMimetype, "application/x-fossil-artifact")!=0 |
| 1326 | 1326 | ){ |
| 1327 | 1327 | Blob content; |
| 1328 | 1328 | blob_read_from_file(&content, zRepo); |
| 1329 | 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 |
| --- 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 @@ | ||
| 175 | 175 | } |
| 176 | 176 | for(i=0; i<nFormAction; i++){ |
| 177 | 177 | @ gebi("form%d(i+1)").action="%s(aFormAction[i])"; |
| 178 | 178 | } |
| 179 | 179 | @ } |
| 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 ){ | |
| 181 | 181 | /* Special case for Opera Mini, which executes JS server-side */ |
| 182 | 182 | @ var isOperaMini = Object.prototype.toString.call(window.operamini) |
| 183 | 183 | @ === "[object OperaMini]"; |
| 184 | 184 | @ if( isOperaMini ){ |
| 185 | 185 | @ setTimeout("setAllHrefs();",%d(nDelay)); |
| 186 | 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")) ){ |
| 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 @@ | ||
| 393 | 393 | "original", |
| 394 | 394 | "output", |
| 395 | 395 | }; |
| 396 | 396 | int i, j, n; |
| 397 | 397 | |
| 398 | - if( sqlite3_strglob("ci-comment-????????????.txt", zName) ) return 1; | |
| 398 | + if( sqlite3_strglob("ci-comment-????????????.txt", zName)==0 ) return 1; | |
| 399 | 399 | 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 ){ | |
| 401 | 401 | return 1; |
| 402 | 402 | } |
| 403 | 403 | if( zName[0]!='-' ) continue; |
| 404 | 404 | for(i=0; i<sizeof(azTemp)/sizeof(azTemp[0]); i++){ |
| 405 | 405 | n = (int)strlen(azTemp[i]); |
| 406 | 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) ) 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 @@ | ||
| 1785 | 1785 | ** to the next cycle. |
| 1786 | 1786 | */ |
| 1787 | 1787 | if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){ |
| 1788 | 1788 | char *zMsg = blob_terminate(&xfer.aToken[1]); |
| 1789 | 1789 | 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 ){ | |
| 1791 | 1791 | syncFlags &= ~SYNC_PUSH; |
| 1792 | 1792 | zMsg = 0; |
| 1793 | 1793 | } |
| 1794 | 1794 | if( zMsg && zMsg[0] ){ |
| 1795 | 1795 | fossil_force_newline(); |
| 1796 | 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) ){ |
| 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 |