Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added a parameter to encode_json_string_literal() to allow it to return its output string length, saving a strlen() call in vxprintf() %j. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | fileedit-ajaxify |
| Files: | files | file ages | folders |
| SHA3-256: |
57edd1814461ef2dea885b89d211ee3a |
| User & Date: | stephan 2020-05-14 04:13:46.862 |
Context
|
2020-05-14
| ||
| 04:14 | Removed some dead code. check-in: 4619c9a772 user: stephan tags: fileedit-ajaxify | |
| 04:13 | Added a parameter to encode_json_string_literal() to allow it to return its output string length, saving a strlen() call in vxprintf() %j. check-in: 57edd18144 user: stephan tags: fileedit-ajaxify | |
| 03:55 | Minor help text, style, and layout tweaks. check-in: 28b2261b75 user: stephan tags: fileedit-ajaxify | |
Changes
Changes to src/encode.c.
| ︙ | ︙ | |||
378 379 380 381 382 383 384 385 | return c; } /* ** Encode a UTF8 string as a JSON string literal (without the surrounding ** "...") and return a pointer to the encoding. Space to hold the encoding ** is obtained from fossil_malloc() and must be freed by the caller. */ | > > > > | | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
return c;
}
/*
** Encode a UTF8 string as a JSON string literal (without the surrounding
** "...") and return a pointer to the encoding. Space to hold the encoding
** is obtained from fossil_malloc() and must be freed by the caller.
**
** If nOut is not NULL then it is assigned to the length, in bytes, of
** the returned string (its strlen(), not counting the terminating
** NUL).
*/
char *encode_json_string_literal(const char *zStr, int * nOut){
const unsigned char *z;
char *zOut;
u32 c;
int n, i, j;
z = (const unsigned char*)zStr;
n = 0;
while( (c = fossil_utf8_read(&z))!=0 ){
|
| ︙ | ︙ | |||
426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
i += 4;
}
}else{
zOut[i++] = c;
}
}
zOut[i] = 0;
return zOut;
}
/*
** The characters used for HTTP base64 encoding.
*/
static unsigned char zBase[] =
| > > > | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
i += 4;
}
}else{
zOut[i++] = c;
}
}
zOut[i] = 0;
if(nOut!=0){
*nOut = i;
}
return zOut;
}
/*
** The characters used for HTTP base64 encoding.
*/
static unsigned char zBase[] =
|
| ︙ | ︙ |
Changes to src/printf.c.
| ︙ | ︙ | |||
796 797 798 799 800 801 802 |
char *zMem = va_arg(ap,char*);
if( limit!=0 ){
/* Ignore the limit flag, if set, for JSON string
** output. This block exists to squelch the associated
** "unused variable" compiler warning. */
}
if( zMem==0 ) zMem = "";
| | < | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 |
char *zMem = va_arg(ap,char*);
if( limit!=0 ){
/* Ignore the limit flag, if set, for JSON string
** output. This block exists to squelch the associated
** "unused variable" compiler warning. */
}
if( zMem==0 ) zMem = "";
zExtra = bufpt = encode_json_string_literal(zMem, &length);
if( precision>=0 && precision<length ) length = precision;
break;
}
case etWIKISTR: {
int limit = flag_alternateform ? va_arg(ap,int) : -1;
char *zWiki = va_arg(ap, char*);
Blob wiki;
|
| ︙ | ︙ |