Fossil SCM
Fix a few C99-isms in the code so that the code will build on older C compilers.
Commit
3d62a9fb39579b5b941dd22a27ebbc2007977638
Parent
5cbfe0cde22ca9d…
2 files changed
+3
-2
+3
-3
+3
-2
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -199,12 +199,13 @@ | ||
| 199 | 199 | const char *zPath, /* Path cookie applies to. NULL means "/" */ |
| 200 | 200 | int lifetime /* Expiration of the cookie in seconds from now */ |
| 201 | 201 | ){ |
| 202 | 202 | if( zPath==0 ) zPath = g.zTop; |
| 203 | 203 | if( lifetime>0 ){ |
| 204 | + char *zDate; | |
| 204 | 205 | lifetime += (int)time(0); |
| 205 | - char * zDate = cgi_rfc822_datestamp(lifetime); | |
| 206 | + zDate = cgi_rfc822_datestamp(lifetime); | |
| 206 | 207 | blob_appendf(&extraHeader, |
| 207 | 208 | "Set-Cookie: %s=%t; Path=%s; expires=%s; Version=1\r\n", |
| 208 | 209 | zName, zValue, zPath, zDate); |
| 209 | 210 | if( zDate[0] ) free( zDate ); |
| 210 | 211 | }else{ |
| @@ -287,12 +288,12 @@ | ||
| 287 | 288 | zReplyStatus = "Not Modified"; |
| 288 | 289 | } |
| 289 | 290 | #endif |
| 290 | 291 | |
| 291 | 292 | if( g.fullHttpReply ){ |
| 293 | + char *zDate = cgi_rfc822_datestamp(time(0)); | |
| 292 | 294 | fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus); |
| 293 | - char * zDate = cgi_rfc822_datestamp(time(0)); | |
| 294 | 295 | fprintf(g.httpOut, "Date: %s\r\n", zDate ); |
| 295 | 296 | if( zDate[0] ) free( zDate ); |
| 296 | 297 | fprintf(g.httpOut, "Connection: close\r\n"); |
| 297 | 298 | }else{ |
| 298 | 299 | fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus); |
| 299 | 300 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -199,12 +199,13 @@ | |
| 199 | const char *zPath, /* Path cookie applies to. NULL means "/" */ |
| 200 | int lifetime /* Expiration of the cookie in seconds from now */ |
| 201 | ){ |
| 202 | if( zPath==0 ) zPath = g.zTop; |
| 203 | if( lifetime>0 ){ |
| 204 | lifetime += (int)time(0); |
| 205 | char * zDate = cgi_rfc822_datestamp(lifetime); |
| 206 | blob_appendf(&extraHeader, |
| 207 | "Set-Cookie: %s=%t; Path=%s; expires=%s; Version=1\r\n", |
| 208 | zName, zValue, zPath, zDate); |
| 209 | if( zDate[0] ) free( zDate ); |
| 210 | }else{ |
| @@ -287,12 +288,12 @@ | |
| 287 | zReplyStatus = "Not Modified"; |
| 288 | } |
| 289 | #endif |
| 290 | |
| 291 | if( g.fullHttpReply ){ |
| 292 | fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus); |
| 293 | char * zDate = cgi_rfc822_datestamp(time(0)); |
| 294 | fprintf(g.httpOut, "Date: %s\r\n", zDate ); |
| 295 | if( zDate[0] ) free( zDate ); |
| 296 | fprintf(g.httpOut, "Connection: close\r\n"); |
| 297 | }else{ |
| 298 | fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus); |
| 299 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -199,12 +199,13 @@ | |
| 199 | const char *zPath, /* Path cookie applies to. NULL means "/" */ |
| 200 | int lifetime /* Expiration of the cookie in seconds from now */ |
| 201 | ){ |
| 202 | if( zPath==0 ) zPath = g.zTop; |
| 203 | if( lifetime>0 ){ |
| 204 | char *zDate; |
| 205 | lifetime += (int)time(0); |
| 206 | zDate = cgi_rfc822_datestamp(lifetime); |
| 207 | blob_appendf(&extraHeader, |
| 208 | "Set-Cookie: %s=%t; Path=%s; expires=%s; Version=1\r\n", |
| 209 | zName, zValue, zPath, zDate); |
| 210 | if( zDate[0] ) free( zDate ); |
| 211 | }else{ |
| @@ -287,12 +288,12 @@ | |
| 288 | zReplyStatus = "Not Modified"; |
| 289 | } |
| 290 | #endif |
| 291 | |
| 292 | if( g.fullHttpReply ){ |
| 293 | char *zDate = cgi_rfc822_datestamp(time(0)); |
| 294 | fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus); |
| 295 | fprintf(g.httpOut, "Date: %s\r\n", zDate ); |
| 296 | if( zDate[0] ) free( zDate ); |
| 297 | fprintf(g.httpOut, "Connection: close\r\n"); |
| 298 | }else{ |
| 299 | fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus); |
| 300 |
+3
-3
| --- src/tagview.c | ||
| +++ src/tagview.c | ||
| @@ -185,11 +185,11 @@ | ||
| 185 | 185 | /* |
| 186 | 186 | ** WEBPAGE: /tagview |
| 187 | 187 | */ |
| 188 | 188 | void tagview_page(void){ |
| 189 | 189 | char const *zName = 0; |
| 190 | - int zTcount = 0; | |
| 190 | + int nTag = 0; | |
| 191 | 191 | login_check_credentials(); |
| 192 | 192 | if( !g.okRead ){ |
| 193 | 193 | login_needed(); |
| 194 | 194 | } |
| 195 | 195 | login_anonymous_available(); |
| @@ -221,12 +221,12 @@ | ||
| 221 | 221 | " ORDER BY tagname", |
| 222 | 222 | MAX_INT_TAG |
| 223 | 223 | ); |
| 224 | 224 | @ <ul> |
| 225 | 225 | while( db_step(&q)==SQLITE_ROW ){ |
| 226 | - zTcount++; | |
| 227 | 226 | const char *name = db_column_text(&q, 0); |
| 227 | + nTag++; | |
| 228 | 228 | if( g.okHistory ){ |
| 229 | 229 | if( strncmp(name, prefix, preflen)==0 ){ |
| 230 | 230 | @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name+preflen)> |
| 231 | 231 | @ %s(name+preflen)</a> |
| 232 | 232 | }else{ |
| @@ -244,11 +244,11 @@ | ||
| 244 | 244 | @ (symbolic label) |
| 245 | 245 | } |
| 246 | 246 | @ </li> |
| 247 | 247 | } |
| 248 | 248 | @ </ul> |
| 249 | - if( zTcount == 0) { | |
| 249 | + if( nTag == 0) { | |
| 250 | 250 | @ There are no relevant tags. |
| 251 | 251 | } |
| 252 | 252 | db_finalize(&q); |
| 253 | 253 | } |
| 254 | 254 | /* |
| 255 | 255 |
| --- src/tagview.c | |
| +++ src/tagview.c | |
| @@ -185,11 +185,11 @@ | |
| 185 | /* |
| 186 | ** WEBPAGE: /tagview |
| 187 | */ |
| 188 | void tagview_page(void){ |
| 189 | char const *zName = 0; |
| 190 | int zTcount = 0; |
| 191 | login_check_credentials(); |
| 192 | if( !g.okRead ){ |
| 193 | login_needed(); |
| 194 | } |
| 195 | login_anonymous_available(); |
| @@ -221,12 +221,12 @@ | |
| 221 | " ORDER BY tagname", |
| 222 | MAX_INT_TAG |
| 223 | ); |
| 224 | @ <ul> |
| 225 | while( db_step(&q)==SQLITE_ROW ){ |
| 226 | zTcount++; |
| 227 | const char *name = db_column_text(&q, 0); |
| 228 | if( g.okHistory ){ |
| 229 | if( strncmp(name, prefix, preflen)==0 ){ |
| 230 | @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name+preflen)> |
| 231 | @ %s(name+preflen)</a> |
| 232 | }else{ |
| @@ -244,11 +244,11 @@ | |
| 244 | @ (symbolic label) |
| 245 | } |
| 246 | @ </li> |
| 247 | } |
| 248 | @ </ul> |
| 249 | if( zTcount == 0) { |
| 250 | @ There are no relevant tags. |
| 251 | } |
| 252 | db_finalize(&q); |
| 253 | } |
| 254 | /* |
| 255 |
| --- src/tagview.c | |
| +++ src/tagview.c | |
| @@ -185,11 +185,11 @@ | |
| 185 | /* |
| 186 | ** WEBPAGE: /tagview |
| 187 | */ |
| 188 | void tagview_page(void){ |
| 189 | char const *zName = 0; |
| 190 | int nTag = 0; |
| 191 | login_check_credentials(); |
| 192 | if( !g.okRead ){ |
| 193 | login_needed(); |
| 194 | } |
| 195 | login_anonymous_available(); |
| @@ -221,12 +221,12 @@ | |
| 221 | " ORDER BY tagname", |
| 222 | MAX_INT_TAG |
| 223 | ); |
| 224 | @ <ul> |
| 225 | while( db_step(&q)==SQLITE_ROW ){ |
| 226 | const char *name = db_column_text(&q, 0); |
| 227 | nTag++; |
| 228 | if( g.okHistory ){ |
| 229 | if( strncmp(name, prefix, preflen)==0 ){ |
| 230 | @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name+preflen)> |
| 231 | @ %s(name+preflen)</a> |
| 232 | }else{ |
| @@ -244,11 +244,11 @@ | |
| 244 | @ (symbolic label) |
| 245 | } |
| 246 | @ </li> |
| 247 | } |
| 248 | @ </ul> |
| 249 | if( nTag == 0) { |
| 250 | @ There are no relevant tags. |
| 251 | } |
| 252 | db_finalize(&q); |
| 253 | } |
| 254 | /* |
| 255 |