Fossil

Check-in [3d62a9fb39]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a few C99-isms in the code so that the code will build on older C compilers.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3d62a9fb39579b5b941dd22a27ebbc2007977638
User & Date: drh 2008-10-06 11:33:23.000
References
2008-10-26
06:09 New ticket [568f679627] Version mismatch on precompiled binary. ... (artifact: 2e36cb1549 user: anonymous)
2008-10-16
13:01 New ticket [a5fba652a6] remote `fossil clone` failed. ... (artifact: 703a989edf user: anonymous)
Context
2008-10-09
18:09
Fixed a number of small typos. ... (check-in: d0e8e88d54 user: aku tags: trunk)
2008-10-06
11:33
Fix a few C99-isms in the code so that the code will build on older C compilers. ... (check-in: 3d62a9fb39 user: drh tags: trunk)
11:28
Minor edits to the Questions and Criticisms document. ... (check-in: 5cbfe0cde2 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/cgi.c.
197
198
199
200
201
202
203

204
205
206
207
208
209
210
211
212
  const char *zName,    /* Name of the cookie */
  const char *zValue,   /* Value of the cookie.  Automatically escaped */
  const char *zPath,    /* Path cookie applies to.  NULL means "/" */
  int lifetime          /* Expiration of the cookie in seconds from now */
){
  if( zPath==0 ) zPath = g.zTop;
  if( lifetime>0 ){

    lifetime += (int)time(0);
    char * zDate = cgi_rfc822_datestamp(lifetime);
    blob_appendf(&extraHeader,
       "Set-Cookie: %s=%t; Path=%s; expires=%s; Version=1\r\n",
        zName, zValue, zPath, zDate);
    if( zDate[0] ) free( zDate );
  }else{
    blob_appendf(&extraHeader,
       "Set-Cookie: %s=%t; Path=%s; Version=1\r\n",







>

|







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
  const char *zName,    /* Name of the cookie */
  const char *zValue,   /* Value of the cookie.  Automatically escaped */
  const char *zPath,    /* Path cookie applies to.  NULL means "/" */
  int lifetime          /* Expiration of the cookie in seconds from now */
){
  if( zPath==0 ) zPath = g.zTop;
  if( lifetime>0 ){
    char *zDate;
    lifetime += (int)time(0);
    zDate = cgi_rfc822_datestamp(lifetime);
    blob_appendf(&extraHeader,
       "Set-Cookie: %s=%t; Path=%s; expires=%s; Version=1\r\n",
        zName, zValue, zPath, zDate);
    if( zDate[0] ) free( zDate );
  }else{
    blob_appendf(&extraHeader,
       "Set-Cookie: %s=%t; Path=%s; Version=1\r\n",
285
286
287
288
289
290
291

292
293
294
295
296
297
298
299
300
    */
    iReplyStatus = 304;
    zReplyStatus = "Not Modified";
  }
#endif

  if( g.fullHttpReply ){

    fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus);
    char * zDate = cgi_rfc822_datestamp(time(0));
    fprintf(g.httpOut, "Date: %s\r\n", zDate );
    if( zDate[0] ) free( zDate );
    fprintf(g.httpOut, "Connection: close\r\n");
  }else{
    fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus);
  }








>

<







286
287
288
289
290
291
292
293
294

295
296
297
298
299
300
301
    */
    iReplyStatus = 304;
    zReplyStatus = "Not Modified";
  }
#endif

  if( g.fullHttpReply ){
    char *zDate = cgi_rfc822_datestamp(time(0));
    fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus);

    fprintf(g.httpOut, "Date: %s\r\n", zDate );
    if( zDate[0] ) free( zDate );
    fprintf(g.httpOut, "Connection: close\r\n");
  }else{
    fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus);
  }

Changes to src/tagview.c.
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
}

/*
** WEBPAGE: /tagview
*/
void tagview_page(void){
  char const *zName = 0;
  int zTcount = 0;
  login_check_credentials();
  if( !g.okRead ){
    login_needed();
  }
  login_anonymous_available();
  if( 0 != (zName = P("name")) ){
    Blob uuid;







|







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
}

/*
** WEBPAGE: /tagview
*/
void tagview_page(void){
  char const *zName = 0;
  int nTag = 0;
  login_check_credentials();
  if( !g.okRead ){
    login_needed();
  }
  login_anonymous_available();
  if( 0 != (zName = P("name")) ){
    Blob uuid;
219
220
221
222
223
224
225
226
227

228
229
230
231
232
233
234
      " AND tagname NOT GLOB 'wiki-*'"
      " AND tagname NOT GLOB 'tkt-*'"
      " ORDER BY tagname",
      MAX_INT_TAG
    );
    @ <ul>
    while( db_step(&q)==SQLITE_ROW ){
      zTcount++;
      const char *name = db_column_text(&q, 0);

      if( g.okHistory ){
        if( strncmp(name, prefix, preflen)==0 ){
          @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name+preflen)>
          @ %s(name+preflen)</a>
        }else{
          @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name)>
          @ %s(name)</a>







<

>







219
220
221
222
223
224
225

226
227
228
229
230
231
232
233
234
      " AND tagname NOT GLOB 'wiki-*'"
      " AND tagname NOT GLOB 'tkt-*'"
      " ORDER BY tagname",
      MAX_INT_TAG
    );
    @ <ul>
    while( db_step(&q)==SQLITE_ROW ){

      const char *name = db_column_text(&q, 0);
      nTag++;
      if( g.okHistory ){
        if( strncmp(name, prefix, preflen)==0 ){
          @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name+preflen)>
          @ %s(name+preflen)</a>
        }else{
          @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name)>
          @ %s(name)</a>
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
      }
      if( strncmp(name, prefix, preflen)==0 ){
        @ (symbolic label)
      }
      @ </li>
    }
    @ </ul>
    if( zTcount == 0) {
      @ There are no relevant tags.
    }
    db_finalize(&q);
  }
  /*
   * Put in dummy functions since www_print_timeline has generated calls to
   * them. Some browsers don't seem to care, but better to be safe.







|







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
      }
      if( strncmp(name, prefix, preflen)==0 ){
        @ (symbolic label)
      }
      @ </li>
    }
    @ </ul>
    if( nTag == 0) {
      @ There are no relevant tags.
    }
    db_finalize(&q);
  }
  /*
   * Put in dummy functions since www_print_timeline has generated calls to
   * them. Some browsers don't seem to care, but better to be safe.