Fossil SCM
Fix compiler warnings on windows. Fix the file_directory_size() function so that it works on windows.
Commit
6a7d2ad8f1dd5c542eba0b885418328803d8d80252382c3fb36b8c02803dd3ce
Parent
27e5e5ce65262f5…
4 files changed
+1
-2
+7
-2
+4
-2
+1
-1
+1
-2
| --- src/email.c | ||
| +++ src/email.c | ||
| @@ -1177,12 +1177,12 @@ | ||
| 1177 | 1177 | if( PB("st") ) ssub[nsub++] = 't'; |
| 1178 | 1178 | if( PB("sw") ) ssub[nsub++] = 'w'; |
| 1179 | 1179 | ssub[nsub] = 0; |
| 1180 | 1180 | if( g.perm.Admin ){ |
| 1181 | 1181 | const char *suname = PT("suname"); |
| 1182 | - if( suname && suname[0]==0 ) suname = 0; | |
| 1183 | 1182 | int sverified = PB("sverified"); |
| 1183 | + if( suname && suname[0]==0 ) suname = 0; | |
| 1184 | 1184 | db_multi_exec( |
| 1185 | 1185 | "UPDATE subscriber SET" |
| 1186 | 1186 | " sdonotcall=%d," |
| 1187 | 1187 | " sdigest=%d," |
| 1188 | 1188 | " ssub=%Q," |
| @@ -2035,11 +2035,10 @@ | ||
| 2035 | 2035 | ** to the entire mailing list (including people who have elected to |
| 2036 | 2036 | ** receive no announcements or notifications of any kind, or to |
| 2037 | 2037 | ** individual email to anyone. |
| 2038 | 2038 | */ |
| 2039 | 2039 | void announce_page(void){ |
| 2040 | - const char *zTo = PT("to"); | |
| 2041 | 2040 | login_check_credentials(); |
| 2042 | 2041 | if( !g.perm.Announce ){ |
| 2043 | 2042 | login_needed(0); |
| 2044 | 2043 | return; |
| 2045 | 2044 | } |
| 2046 | 2045 |
| --- src/email.c | |
| +++ src/email.c | |
| @@ -1177,12 +1177,12 @@ | |
| 1177 | if( PB("st") ) ssub[nsub++] = 't'; |
| 1178 | if( PB("sw") ) ssub[nsub++] = 'w'; |
| 1179 | ssub[nsub] = 0; |
| 1180 | if( g.perm.Admin ){ |
| 1181 | const char *suname = PT("suname"); |
| 1182 | if( suname && suname[0]==0 ) suname = 0; |
| 1183 | int sverified = PB("sverified"); |
| 1184 | db_multi_exec( |
| 1185 | "UPDATE subscriber SET" |
| 1186 | " sdonotcall=%d," |
| 1187 | " sdigest=%d," |
| 1188 | " ssub=%Q," |
| @@ -2035,11 +2035,10 @@ | |
| 2035 | ** to the entire mailing list (including people who have elected to |
| 2036 | ** receive no announcements or notifications of any kind, or to |
| 2037 | ** individual email to anyone. |
| 2038 | */ |
| 2039 | void announce_page(void){ |
| 2040 | const char *zTo = PT("to"); |
| 2041 | login_check_credentials(); |
| 2042 | if( !g.perm.Announce ){ |
| 2043 | login_needed(0); |
| 2044 | return; |
| 2045 | } |
| 2046 |
| --- src/email.c | |
| +++ src/email.c | |
| @@ -1177,12 +1177,12 @@ | |
| 1177 | if( PB("st") ) ssub[nsub++] = 't'; |
| 1178 | if( PB("sw") ) ssub[nsub++] = 'w'; |
| 1179 | ssub[nsub] = 0; |
| 1180 | if( g.perm.Admin ){ |
| 1181 | const char *suname = PT("suname"); |
| 1182 | int sverified = PB("sverified"); |
| 1183 | if( suname && suname[0]==0 ) suname = 0; |
| 1184 | db_multi_exec( |
| 1185 | "UPDATE subscriber SET" |
| 1186 | " sdonotcall=%d," |
| 1187 | " sdigest=%d," |
| 1188 | " ssub=%Q," |
| @@ -2035,11 +2035,10 @@ | |
| 2035 | ** to the entire mailing list (including people who have elected to |
| 2036 | ** receive no announcements or notifications of any kind, or to |
| 2037 | ** individual email to anyone. |
| 2038 | */ |
| 2039 | void announce_page(void){ |
| 2040 | login_check_credentials(); |
| 2041 | if( !g.perm.Announce ){ |
| 2042 | login_needed(0); |
| 2043 | return; |
| 2044 | } |
| 2045 |
+7
-2
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -1621,11 +1621,11 @@ | ||
| 1621 | 1621 | ** Count the number of objects (files and subdirectores) in a given |
| 1622 | 1622 | ** directory. Return the count. Return -1 of the object is not a |
| 1623 | 1623 | ** directory. |
| 1624 | 1624 | */ |
| 1625 | 1625 | int file_directory_size(const char *zDir, const char *zGlob, int omitDotFiles){ |
| 1626 | - char *zNative; | |
| 1626 | + void *zNative; | |
| 1627 | 1627 | DIR *d; |
| 1628 | 1628 | int n = -1; |
| 1629 | 1629 | zNative = fossil_utf8_to_path(zDir,1); |
| 1630 | 1630 | d = opendir(zNative); |
| 1631 | 1631 | if( d ){ |
| @@ -1632,11 +1632,16 @@ | ||
| 1632 | 1632 | struct dirent *pEntry; |
| 1633 | 1633 | n = 0; |
| 1634 | 1634 | while( (pEntry=readdir(d))!=0 ){ |
| 1635 | 1635 | if( pEntry->d_name[0]==0 ) continue; |
| 1636 | 1636 | if( omitDotFiles && pEntry->d_name[0]=='.' ) continue; |
| 1637 | - if( zGlob && sqlite3_strglob(zGlob, pEntry->d_name)!=0 ) continue; | |
| 1637 | + if( zGlob ){ | |
| 1638 | + char *zUtf8 = fossil_path_to_utf8(pEntry->d_name); | |
| 1639 | + int rc = sqlite3_strglob(zGlob, zUtf8); | |
| 1640 | + fossil_path_free(zUtf8); | |
| 1641 | + if( rc ) continue; | |
| 1642 | + } | |
| 1638 | 1643 | n++; |
| 1639 | 1644 | } |
| 1640 | 1645 | closedir(d); |
| 1641 | 1646 | } |
| 1642 | 1647 | fossil_path_free(zNative); |
| 1643 | 1648 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -1621,11 +1621,11 @@ | |
| 1621 | ** Count the number of objects (files and subdirectores) in a given |
| 1622 | ** directory. Return the count. Return -1 of the object is not a |
| 1623 | ** directory. |
| 1624 | */ |
| 1625 | int file_directory_size(const char *zDir, const char *zGlob, int omitDotFiles){ |
| 1626 | char *zNative; |
| 1627 | DIR *d; |
| 1628 | int n = -1; |
| 1629 | zNative = fossil_utf8_to_path(zDir,1); |
| 1630 | d = opendir(zNative); |
| 1631 | if( d ){ |
| @@ -1632,11 +1632,16 @@ | |
| 1632 | struct dirent *pEntry; |
| 1633 | n = 0; |
| 1634 | while( (pEntry=readdir(d))!=0 ){ |
| 1635 | if( pEntry->d_name[0]==0 ) continue; |
| 1636 | if( omitDotFiles && pEntry->d_name[0]=='.' ) continue; |
| 1637 | if( zGlob && sqlite3_strglob(zGlob, pEntry->d_name)!=0 ) continue; |
| 1638 | n++; |
| 1639 | } |
| 1640 | closedir(d); |
| 1641 | } |
| 1642 | fossil_path_free(zNative); |
| 1643 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -1621,11 +1621,11 @@ | |
| 1621 | ** Count the number of objects (files and subdirectores) in a given |
| 1622 | ** directory. Return the count. Return -1 of the object is not a |
| 1623 | ** directory. |
| 1624 | */ |
| 1625 | int file_directory_size(const char *zDir, const char *zGlob, int omitDotFiles){ |
| 1626 | void *zNative; |
| 1627 | DIR *d; |
| 1628 | int n = -1; |
| 1629 | zNative = fossil_utf8_to_path(zDir,1); |
| 1630 | d = opendir(zNative); |
| 1631 | if( d ){ |
| @@ -1632,11 +1632,16 @@ | |
| 1632 | struct dirent *pEntry; |
| 1633 | n = 0; |
| 1634 | while( (pEntry=readdir(d))!=0 ){ |
| 1635 | if( pEntry->d_name[0]==0 ) continue; |
| 1636 | if( omitDotFiles && pEntry->d_name[0]=='.' ) continue; |
| 1637 | if( zGlob ){ |
| 1638 | char *zUtf8 = fossil_path_to_utf8(pEntry->d_name); |
| 1639 | int rc = sqlite3_strglob(zGlob, zUtf8); |
| 1640 | fossil_path_free(zUtf8); |
| 1641 | if( rc ) continue; |
| 1642 | } |
| 1643 | n++; |
| 1644 | } |
| 1645 | closedir(d); |
| 1646 | } |
| 1647 | fossil_path_free(zNative); |
| 1648 |
+4
-2
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -77,16 +77,17 @@ | ||
| 77 | 77 | forum_verify_schema(); |
| 78 | 78 | style_header("Forum"); |
| 79 | 79 | itemId = atoi(PD("item","0")); |
| 80 | 80 | if( itemId>0 ){ |
| 81 | 81 | int iUp; |
| 82 | + double rNow; | |
| 82 | 83 | style_submenu_element("Topics", "%R/forum"); |
| 83 | 84 | iUp = db_int(0, "SELECT inreplyto FROM forumpost WHERE mpostid=%d", itemId); |
| 84 | 85 | if( iUp ){ |
| 85 | 86 | style_submenu_element("Parent", "%R/forum?item=%d", iUp); |
| 86 | 87 | } |
| 87 | - double rNow = db_double(0.0, "SELECT julianday('now')"); | |
| 88 | + rNow = db_double(0.0, "SELECT julianday('now')"); | |
| 88 | 89 | /* Show the post given by itemId and all its descendents */ |
| 89 | 90 | db_prepare(&q, |
| 90 | 91 | "WITH RECURSIVE" |
| 91 | 92 | " post(id,uname,mstat,mime,ipaddr,parent,mbody,depth,mtime) AS (" |
| 92 | 93 | " SELECT mpostid, uname, mstatus, mimetype, ipaddr, inreplyto, mbody," |
| @@ -254,13 +255,14 @@ | ||
| 254 | 255 | */ |
| 255 | 256 | void forum_edit_page(void){ |
| 256 | 257 | int itemId; |
| 257 | 258 | int parentId; |
| 258 | 259 | char *zErr = 0; |
| 259 | - login_check_credentials(); | |
| 260 | 260 | const char *zMime; |
| 261 | 261 | const char *zSub; |
| 262 | + | |
| 263 | + login_check_credentials(); | |
| 262 | 264 | if( !g.perm.WrForum ){ login_needed(g.anon.WrForum); return; } |
| 263 | 265 | forum_verify_schema(); |
| 264 | 266 | itemId = atoi(PD("item","0")); |
| 265 | 267 | parentId = atoi(PD("replyto","0")); |
| 266 | 268 | if( P("cancel")!=0 ){ |
| 267 | 269 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -77,16 +77,17 @@ | |
| 77 | forum_verify_schema(); |
| 78 | style_header("Forum"); |
| 79 | itemId = atoi(PD("item","0")); |
| 80 | if( itemId>0 ){ |
| 81 | int iUp; |
| 82 | style_submenu_element("Topics", "%R/forum"); |
| 83 | iUp = db_int(0, "SELECT inreplyto FROM forumpost WHERE mpostid=%d", itemId); |
| 84 | if( iUp ){ |
| 85 | style_submenu_element("Parent", "%R/forum?item=%d", iUp); |
| 86 | } |
| 87 | double rNow = db_double(0.0, "SELECT julianday('now')"); |
| 88 | /* Show the post given by itemId and all its descendents */ |
| 89 | db_prepare(&q, |
| 90 | "WITH RECURSIVE" |
| 91 | " post(id,uname,mstat,mime,ipaddr,parent,mbody,depth,mtime) AS (" |
| 92 | " SELECT mpostid, uname, mstatus, mimetype, ipaddr, inreplyto, mbody," |
| @@ -254,13 +255,14 @@ | |
| 254 | */ |
| 255 | void forum_edit_page(void){ |
| 256 | int itemId; |
| 257 | int parentId; |
| 258 | char *zErr = 0; |
| 259 | login_check_credentials(); |
| 260 | const char *zMime; |
| 261 | const char *zSub; |
| 262 | if( !g.perm.WrForum ){ login_needed(g.anon.WrForum); return; } |
| 263 | forum_verify_schema(); |
| 264 | itemId = atoi(PD("item","0")); |
| 265 | parentId = atoi(PD("replyto","0")); |
| 266 | if( P("cancel")!=0 ){ |
| 267 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -77,16 +77,17 @@ | |
| 77 | forum_verify_schema(); |
| 78 | style_header("Forum"); |
| 79 | itemId = atoi(PD("item","0")); |
| 80 | if( itemId>0 ){ |
| 81 | int iUp; |
| 82 | double rNow; |
| 83 | style_submenu_element("Topics", "%R/forum"); |
| 84 | iUp = db_int(0, "SELECT inreplyto FROM forumpost WHERE mpostid=%d", itemId); |
| 85 | if( iUp ){ |
| 86 | style_submenu_element("Parent", "%R/forum?item=%d", iUp); |
| 87 | } |
| 88 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 89 | /* Show the post given by itemId and all its descendents */ |
| 90 | db_prepare(&q, |
| 91 | "WITH RECURSIVE" |
| 92 | " post(id,uname,mstat,mime,ipaddr,parent,mbody,depth,mtime) AS (" |
| 93 | " SELECT mpostid, uname, mstatus, mimetype, ipaddr, inreplyto, mbody," |
| @@ -254,13 +255,14 @@ | |
| 255 | */ |
| 256 | void forum_edit_page(void){ |
| 257 | int itemId; |
| 258 | int parentId; |
| 259 | char *zErr = 0; |
| 260 | const char *zMime; |
| 261 | const char *zSub; |
| 262 | |
| 263 | login_check_credentials(); |
| 264 | if( !g.perm.WrForum ){ login_needed(g.anon.WrForum); return; } |
| 265 | forum_verify_schema(); |
| 266 | itemId = atoi(PD("item","0")); |
| 267 | parentId = atoi(PD("replyto","0")); |
| 268 | if( P("cancel")!=0 ){ |
| 269 |
+1
-1
| --- src/security_audit.c | ||
| +++ src/security_audit.c | ||
| @@ -407,14 +407,14 @@ | ||
| 407 | 407 | ** |
| 408 | 408 | ** Show the content of the error log. Only the administrator can view |
| 409 | 409 | ** this page. |
| 410 | 410 | */ |
| 411 | 411 | void errorlog_page(void){ |
| 412 | - login_check_credentials(); | |
| 413 | 412 | i64 szFile; |
| 414 | 413 | FILE *in; |
| 415 | 414 | char z[10000]; |
| 415 | + login_check_credentials(); | |
| 416 | 416 | if( !g.perm.Setup && !g.perm.Admin ){ |
| 417 | 417 | login_needed(0); |
| 418 | 418 | return; |
| 419 | 419 | } |
| 420 | 420 | style_header("Server Error Log"); |
| 421 | 421 |
| --- src/security_audit.c | |
| +++ src/security_audit.c | |
| @@ -407,14 +407,14 @@ | |
| 407 | ** |
| 408 | ** Show the content of the error log. Only the administrator can view |
| 409 | ** this page. |
| 410 | */ |
| 411 | void errorlog_page(void){ |
| 412 | login_check_credentials(); |
| 413 | i64 szFile; |
| 414 | FILE *in; |
| 415 | char z[10000]; |
| 416 | if( !g.perm.Setup && !g.perm.Admin ){ |
| 417 | login_needed(0); |
| 418 | return; |
| 419 | } |
| 420 | style_header("Server Error Log"); |
| 421 |
| --- src/security_audit.c | |
| +++ src/security_audit.c | |
| @@ -407,14 +407,14 @@ | |
| 407 | ** |
| 408 | ** Show the content of the error log. Only the administrator can view |
| 409 | ** this page. |
| 410 | */ |
| 411 | void errorlog_page(void){ |
| 412 | i64 szFile; |
| 413 | FILE *in; |
| 414 | char z[10000]; |
| 415 | login_check_credentials(); |
| 416 | if( !g.perm.Setup && !g.perm.Admin ){ |
| 417 | login_needed(0); |
| 418 | return; |
| 419 | } |
| 420 | style_header("Server Error Log"); |
| 421 |