Fossil SCM

Fix a few C99-isms in the code so that the code will build on older C compilers.

drh 2008-10-06 11:33 trunk
Commit 3d62a9fb39579b5b941dd22a27ebbc2007977638
2 files changed +3 -2 +3 -3
+3 -2
--- src/cgi.c
+++ src/cgi.c
@@ -199,12 +199,13 @@
199199
const char *zPath, /* Path cookie applies to. NULL means "/" */
200200
int lifetime /* Expiration of the cookie in seconds from now */
201201
){
202202
if( zPath==0 ) zPath = g.zTop;
203203
if( lifetime>0 ){
204
+ char *zDate;
204205
lifetime += (int)time(0);
205
- char * zDate = cgi_rfc822_datestamp(lifetime);
206
+ zDate = cgi_rfc822_datestamp(lifetime);
206207
blob_appendf(&extraHeader,
207208
"Set-Cookie: %s=%t; Path=%s; expires=%s; Version=1\r\n",
208209
zName, zValue, zPath, zDate);
209210
if( zDate[0] ) free( zDate );
210211
}else{
@@ -287,12 +288,12 @@
287288
zReplyStatus = "Not Modified";
288289
}
289290
#endif
290291
291292
if( g.fullHttpReply ){
293
+ char *zDate = cgi_rfc822_datestamp(time(0));
292294
fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus);
293
- char * zDate = cgi_rfc822_datestamp(time(0));
294295
fprintf(g.httpOut, "Date: %s\r\n", zDate );
295296
if( zDate[0] ) free( zDate );
296297
fprintf(g.httpOut, "Connection: close\r\n");
297298
}else{
298299
fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus);
299300
--- 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 @@
185185
/*
186186
** WEBPAGE: /tagview
187187
*/
188188
void tagview_page(void){
189189
char const *zName = 0;
190
- int zTcount = 0;
190
+ int nTag = 0;
191191
login_check_credentials();
192192
if( !g.okRead ){
193193
login_needed();
194194
}
195195
login_anonymous_available();
@@ -221,12 +221,12 @@
221221
" ORDER BY tagname",
222222
MAX_INT_TAG
223223
);
224224
@ <ul>
225225
while( db_step(&q)==SQLITE_ROW ){
226
- zTcount++;
227226
const char *name = db_column_text(&q, 0);
227
+ nTag++;
228228
if( g.okHistory ){
229229
if( strncmp(name, prefix, preflen)==0 ){
230230
@ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name+preflen)>
231231
@ %s(name+preflen)</a>
232232
}else{
@@ -244,11 +244,11 @@
244244
@ (symbolic label)
245245
}
246246
@ </li>
247247
}
248248
@ </ul>
249
- if( zTcount == 0) {
249
+ if( nTag == 0) {
250250
@ There are no relevant tags.
251251
}
252252
db_finalize(&q);
253253
}
254254
/*
255255
--- 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

Keyboard Shortcuts

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