From 511351bf9986032f40ddc05aefbaa7084b49b70a Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Thu, 18 Jan 2007 23:11:42 +0000 Subject: [PATCH] - We need to return the length not the byte size --- main/spprintf.c | 2 +- main/spprintf.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/main/spprintf.c b/main/spprintf.c index 425a6105e1..740479a6de 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -872,7 +872,7 @@ PHPAPI int vuspprintf(UChar **pbuf, size_t max_len, const char *format, va_list *pbuf = (UChar*)xbuf.c; - return xbuf.len; + return xbuf.len >> 1; } PHPAPI int uspprintf(UChar **pbuf, size_t max_len, const char *format, ...) diff --git a/main/spprintf.h b/main/spprintf.h index 3480e4e9bd..23c5cb4d02 100644 --- a/main/spprintf.h +++ b/main/spprintf.h @@ -27,6 +27,9 @@ the function can be used to calculate the required size of the buffer but for that purpose snprintf is faster. When both pbuf and the return value are 0 than you are out of memory. +All functions return the number of character printed (e.g. length), not the +number of bytes. + There is also snprintf: See difference explained in snprintf.h */ -- 2.50.1