Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Printing a value of 0 using %c terminates the string. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | printf-enhancement |
Files: | files | file ages | folders |
SHA3-256: |
255612f0a131f2f522cbca3cc5a1edcf |
User & Date: | drh 2018-02-19 21:58:16.694 |
Context
2018-02-19
| ||
22:46 | Enhance the string formatter (used by printf()) so that the width and precision of string substitution operators refer to characters instead of bytes when the alternate-form-2 flag ("!") is used. Also fix the %c substition to always work within unicode, regardless of the alternate-form-2 flag. (check-in: c883c4d33f user: drh tags: trunk) | |
21:58 | Printing a value of 0 using %c terminates the string. (Closed-Leaf check-in: 255612f0a1 user: drh tags: printf-enhancement) | |
20:41 | More test cases for unicode handling in printf. (check-in: ac18821111 user: drh tags: printf-enhancement) | |
Changes
Changes to src/printf.c.
︙ | ︙ | |||
620 621 622 623 624 625 626 | buf[0] = '%'; bufpt = buf; length = 1; break; case etCHARX: if( bArgList ){ bufpt = getTextArg(pArgList); | | < > > | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | buf[0] = '%'; bufpt = buf; length = 1; break; case etCHARX: if( bArgList ){ bufpt = getTextArg(pArgList); length = 1; if( bufpt ){ buf[0] = c = *(bufpt++); if( (c&0xc0)==0xc0 ){ while( length<4 && (bufpt[0]&0xc0)==0x80 ){ buf[length++] = *(bufpt++); } } }else{ buf[0] = 0; } }else{ unsigned int ch = va_arg(ap,unsigned int); if( ch<0x00080 ){ buf[0] = ch & 0xff; length = 1; }else if( ch<0x00800 ){ |
︙ | ︙ |