Fossil SCM

Fix the /vpatch webpage output, apparently broken by check-in [3a561322cafbc337]. [forum:/forumpost/2a0e4c729e|Forum post 2a0e4c729e].

drh 2021-09-08 01:01 trunk
Commit ebcad739e82d2a637135fc2be312330823852a15a5651751abd5f79307206fb8
1 file changed +10 -4
+10 -4
--- src/blob.c
+++ src/blob.c
@@ -276,11 +276,12 @@
276276
pBlob->xRealloc = blobReallocStatic;
277277
}
278278
279279
/*
280280
** Append text or data to the end of a blob. Or, if pBlob==NULL, send
281
-** the text to standard output.
281
+** the text to standard output in terminal mode, or to standard CGI output
282
+** in CGI mode.
282283
**
283284
** If nData<0 then output all of aData up to the first 0x00 byte.
284285
**
285286
** Use the blob_append() routine in all application code. The blob_append()
286287
** routine is faster, but blob_append_full() handles all the corner cases.
@@ -292,12 +293,16 @@
292293
/* assert( aData!=0 || nData==0 ); // omitted for speed */
293294
/* blob_is_init(pBlob); // omitted for speed */
294295
if( nData<0 ) nData = strlen(aData);
295296
if( nData==0 ) return;
296297
if( pBlob==0 ){
297
- fossil_puts(aData, 0, nData);
298
- return;
298
+ if( g.cgiOutput ){
299
+ pBlob = cgi_output_blob();
300
+ }else{
301
+ fossil_puts(aData, 0, nData);
302
+ return;
303
+ }
299304
}
300305
nNew = pBlob->nUsed;
301306
nNew += nData;
302307
if( nNew >= pBlob->nAlloc ){
303308
nNew += pBlob->nAlloc;
@@ -356,11 +361,12 @@
356361
}
357362
358363
/*
359364
** Append the second blob onto the end of the first blob and reset the
360365
** second blob. If the first blob (pTo) is NULL, then the content
361
-** of the second blob is written to stdout.
366
+** of the second blob is written to stdout or to CGI depending on if the
367
+** Fossil is running in terminal or CGI mode.
362368
*/
363369
void blob_append_xfer(Blob *pTo, Blob *pFrom){
364370
blob_append(pTo, blob_buffer(pFrom), blob_size(pFrom));
365371
blob_reset(pFrom);
366372
}
367373
--- src/blob.c
+++ src/blob.c
@@ -276,11 +276,12 @@
276 pBlob->xRealloc = blobReallocStatic;
277 }
278
279 /*
280 ** Append text or data to the end of a blob. Or, if pBlob==NULL, send
281 ** the text to standard output.
 
282 **
283 ** If nData<0 then output all of aData up to the first 0x00 byte.
284 **
285 ** Use the blob_append() routine in all application code. The blob_append()
286 ** routine is faster, but blob_append_full() handles all the corner cases.
@@ -292,12 +293,16 @@
292 /* assert( aData!=0 || nData==0 ); // omitted for speed */
293 /* blob_is_init(pBlob); // omitted for speed */
294 if( nData<0 ) nData = strlen(aData);
295 if( nData==0 ) return;
296 if( pBlob==0 ){
297 fossil_puts(aData, 0, nData);
298 return;
 
 
 
 
299 }
300 nNew = pBlob->nUsed;
301 nNew += nData;
302 if( nNew >= pBlob->nAlloc ){
303 nNew += pBlob->nAlloc;
@@ -356,11 +361,12 @@
356 }
357
358 /*
359 ** Append the second blob onto the end of the first blob and reset the
360 ** second blob. If the first blob (pTo) is NULL, then the content
361 ** of the second blob is written to stdout.
 
362 */
363 void blob_append_xfer(Blob *pTo, Blob *pFrom){
364 blob_append(pTo, blob_buffer(pFrom), blob_size(pFrom));
365 blob_reset(pFrom);
366 }
367
--- src/blob.c
+++ src/blob.c
@@ -276,11 +276,12 @@
276 pBlob->xRealloc = blobReallocStatic;
277 }
278
279 /*
280 ** Append text or data to the end of a blob. Or, if pBlob==NULL, send
281 ** the text to standard output in terminal mode, or to standard CGI output
282 ** in CGI mode.
283 **
284 ** If nData<0 then output all of aData up to the first 0x00 byte.
285 **
286 ** Use the blob_append() routine in all application code. The blob_append()
287 ** routine is faster, but blob_append_full() handles all the corner cases.
@@ -292,12 +293,16 @@
293 /* assert( aData!=0 || nData==0 ); // omitted for speed */
294 /* blob_is_init(pBlob); // omitted for speed */
295 if( nData<0 ) nData = strlen(aData);
296 if( nData==0 ) return;
297 if( pBlob==0 ){
298 if( g.cgiOutput ){
299 pBlob = cgi_output_blob();
300 }else{
301 fossil_puts(aData, 0, nData);
302 return;
303 }
304 }
305 nNew = pBlob->nUsed;
306 nNew += nData;
307 if( nNew >= pBlob->nAlloc ){
308 nNew += pBlob->nAlloc;
@@ -356,11 +361,12 @@
361 }
362
363 /*
364 ** Append the second blob onto the end of the first blob and reset the
365 ** second blob. If the first blob (pTo) is NULL, then the content
366 ** of the second blob is written to stdout or to CGI depending on if the
367 ** Fossil is running in terminal or CGI mode.
368 */
369 void blob_append_xfer(Blob *pTo, Blob *pFrom){
370 blob_append(pTo, blob_buffer(pFrom), blob_size(pFrom));
371 blob_reset(pFrom);
372 }
373

Keyboard Shortcuts

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