Fossil SCM
Fix the /vpatch webpage output, apparently broken by check-in [3a561322cafbc337]. [forum:/forumpost/2a0e4c729e|Forum post 2a0e4c729e].
Commit
ebcad739e82d2a637135fc2be312330823852a15a5651751abd5f79307206fb8
Parent
be9602d0dfca004…
1 file changed
+10
-4
+10
-4
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -276,11 +276,12 @@ | ||
| 276 | 276 | pBlob->xRealloc = blobReallocStatic; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /* |
| 280 | 280 | ** 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. | |
| 282 | 283 | ** |
| 283 | 284 | ** If nData<0 then output all of aData up to the first 0x00 byte. |
| 284 | 285 | ** |
| 285 | 286 | ** Use the blob_append() routine in all application code. The blob_append() |
| 286 | 287 | ** routine is faster, but blob_append_full() handles all the corner cases. |
| @@ -292,12 +293,16 @@ | ||
| 292 | 293 | /* assert( aData!=0 || nData==0 ); // omitted for speed */ |
| 293 | 294 | /* blob_is_init(pBlob); // omitted for speed */ |
| 294 | 295 | if( nData<0 ) nData = strlen(aData); |
| 295 | 296 | if( nData==0 ) return; |
| 296 | 297 | 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 | + } | |
| 299 | 304 | } |
| 300 | 305 | nNew = pBlob->nUsed; |
| 301 | 306 | nNew += nData; |
| 302 | 307 | if( nNew >= pBlob->nAlloc ){ |
| 303 | 308 | nNew += pBlob->nAlloc; |
| @@ -356,11 +361,12 @@ | ||
| 356 | 361 | } |
| 357 | 362 | |
| 358 | 363 | /* |
| 359 | 364 | ** Append the second blob onto the end of the first blob and reset the |
| 360 | 365 | ** 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. | |
| 362 | 368 | */ |
| 363 | 369 | void blob_append_xfer(Blob *pTo, Blob *pFrom){ |
| 364 | 370 | blob_append(pTo, blob_buffer(pFrom), blob_size(pFrom)); |
| 365 | 371 | blob_reset(pFrom); |
| 366 | 372 | } |
| 367 | 373 |
| --- 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 |