helly Thu Jan 18 21:39:50 2007 UTC
Modified files:
/php-src/main spprintf.c spprintf.h
Log:
- Fix [v]uspprintf()
- Add [v]zspprintf
http://cvs.php.net/viewvc.cgi/php-src/main/spprintf.c?r1=1.41&r2=1.42&diff_format=u
Index: php-src/main/spprintf.c
diff -u php-src/main/spprintf.c:1.41 php-src/main/spprintf.c:1.42
--- php-src/main/spprintf.c:1.41 Mon Jan 1 09:29:35 2007
+++ php-src/main/spprintf.c Thu Jan 18 21:39:50 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spprintf.c,v 1.41 2007/01/01 09:29:35 sebastian Exp $ */
+/* $Id: spprintf.c,v 1.42 2007/01/18 21:39:50 helly Exp $ */
/* This is the spprintf implementation.
* It has emerged from apache snprintf. See original header:
@@ -859,7 +859,7 @@
return (cc);
}
-PHPAPI int vuspprintf(char **pbuf, size_t max_len, const char *format, va_list
ap)
+PHPAPI int vuspprintf(UChar **pbuf, size_t max_len, const char *format,
va_list ap)
{
smart_str xbuf = {0};
@@ -870,13 +870,12 @@
}
smart_str_0(&xbuf);
- *pbuf = xbuf.c;
+ *pbuf = (UChar*)xbuf.c;
return xbuf.len;
}
-
-PHPAPI int uspprintf(char **pbuf, size_t max_len, const char *format, ...)
+PHPAPI int uspprintf(UChar **pbuf, size_t max_len, const char *format, ...)
{
int cc;
va_list ap;
@@ -887,6 +886,26 @@
return (cc);
}
+PHPAPI int vzspprintf(zend_uchar type, zstr *pbuf, size_t max_len, const char
*format, va_list ap)
+{
+ if (type == IS_UNICODE) {
+ return vuspprintf(&pbuf->u, max_len, format, ap);
+ } else {
+ return vspprintf(&pbuf->s, max_len, format, ap);
+ }
+}
+
+PHPAPI int zspprintf( zend_uchar type, zstr *pbuf, size_t max_len, const char
*format, ...)
+{
+ int cc;
+ va_list ap;
+
+ va_start(ap, format);
+ cc = vzspprintf(type, pbuf, max_len, format, ap);
+ va_end(ap);
+ return (cc);
+}
+
/*
* Local variables:
* tab-width: 4
http://cvs.php.net/viewvc.cgi/php-src/main/spprintf.h?r1=1.15&r2=1.16&diff_format=u
Index: php-src/main/spprintf.h
diff -u php-src/main/spprintf.h:1.15 php-src/main/spprintf.h:1.16
--- php-src/main/spprintf.h:1.15 Mon Jan 1 09:29:35 2007
+++ php-src/main/spprintf.h Thu Jan 18 21:39:50 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spprintf.h,v 1.15 2007/01/01 09:29:35 sebastian Exp $ */
+/* $Id: spprintf.h,v 1.16 2007/01/18 21:39:50 helly Exp $ */
/*
@@ -37,10 +37,12 @@
#include "snprintf.h"
BEGIN_EXTERN_C()
-PHPAPI int spprintf( char **pbuf, size_t max_len, const char *format, ...);
-PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list
ap);
-PHPAPI int uspprintf( char **pbuf, size_t max_len, const char *format, ...);
-PHPAPI int vuspprintf(char **pbuf, size_t max_len, const char *format, va_list
ap);
+PHPAPI int spprintf( char **pbuf, size_t max_len, const char *format, ...);
+PHPAPI int vspprintf( char **pbuf, size_t max_len, const char *format,
va_list ap);
+PHPAPI int uspprintf( UChar **pbuf, size_t max_len, const char *format, ...);
+PHPAPI int vuspprintf(UChar **pbuf, size_t max_len, const char *format,
va_list ap);
+PHPAPI int zspprintf( zend_uchar type, zstr *pbuf, size_t max_len, const char
*format, ...);
+PHPAPI int vzspprintf(zend_uchar type, zstr *pbuf, size_t max_len, const char
*format, va_list ap);
END_EXTERN_C()
#endif /* SNPRINTF_H */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php