mirror of
https://github.com/php/php-src.git
synced 2024-09-24 19:37:26 +00:00
- Handle different cases of the actual strings correctly
This commit is contained in:
parent
8b9c131f55
commit
d0c6d77b9e
@ -126,14 +126,22 @@
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define INS_STRING(unicode, xbuf, s, slen) do { \
|
#define INS_STRING(unicode, s_uni, xbuf, s, slen) \
|
||||||
if (unicode) { \
|
do { \
|
||||||
smart_str_appendl(xbuf, s, slen); \
|
if (unicode) {
|
||||||
} else { \
|
size_t newlen, p, sz = 2*(slen); \
|
||||||
size_t newlen, sz = 2*(slen); \
|
|
||||||
smart_str_alloc(xbuf, (sz), 0); \
|
smart_str_alloc(xbuf, (sz), 0); \
|
||||||
memcpy(xbuf->c + xbuf->len, s, (sz)); \
|
if (s_uni) { \
|
||||||
|
memcpy(xbuf->c + xbuf->len, s, (sz)); \
|
||||||
|
} else { \
|
||||||
|
p = (slen); \
|
||||||
|
while(p--) { \
|
||||||
|
smart_str_append2c(xbuf, *s++); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
xbuf->len += (sz); \
|
xbuf->len += (sz); \
|
||||||
|
} else { \
|
||||||
|
smart_str_appendl(xbuf, s, slen); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -151,7 +159,7 @@
|
|||||||
p = sz; \
|
p = sz; \
|
||||||
sz <<= 1; \
|
sz <<= 1; \
|
||||||
smart_str_alloc(xbuf, sz, 0); \
|
smart_str_alloc(xbuf, sz, 0); \
|
||||||
while(p--) smart_str_appendc(xbuf, ch); \
|
while(p--) smart_str_append2c(xbuf, ch);\
|
||||||
} else { \
|
} else { \
|
||||||
smart_str_alloc(xbuf, sz, 0); \
|
smart_str_alloc(xbuf, sz, 0); \
|
||||||
memset(xbuf->c + xbuf->len, ch, sz); \
|
memset(xbuf->c + xbuf->len, ch, sz); \
|
||||||
@ -786,7 +794,7 @@ fmt_error:
|
|||||||
/*
|
/*
|
||||||
* Print the string s.
|
* Print the string s.
|
||||||
*/
|
*/
|
||||||
INS_STRING(s_unicode, xbuf, s, s_len);
|
INS_STRING(unicode, s_unicode, xbuf, s, s_len);
|
||||||
if (free_s) efree(s);
|
if (free_s) efree(s);
|
||||||
|
|
||||||
if (adjust_width && adjust == LEFT && min_width > s_len) {
|
if (adjust_width && adjust == LEFT && min_width > s_len) {
|
||||||
|
Loading…
Reference in New Issue
Block a user