nlopess Fri Dec 12 23:55:49 2008 UTC Modified files: /php-src configure.in /php-src/main spprintf.c Log: MFB http://cvs.php.net/viewvc.cgi/php-src/configure.in?r1=1.668&r2=1.669&diff_format=u Index: php-src/configure.in diff -u php-src/configure.in:1.668 php-src/configure.in:1.669 --- php-src/configure.in:1.668 Thu Dec 4 00:41:17 2008 +++ php-src/configure.in Fri Dec 12 23:55:48 2008 @@ -1,4 +1,4 @@ -## $Id: configure.in,v 1.668 2008/12/04 00:41:17 dsp Exp $ -*- autoconf -*- +## $Id: configure.in,v 1.669 2008/12/12 23:55:48 nlopess Exp $ -*- autoconf -*- dnl ## Process this file with autoconf to produce a configure script. divert(1) @@ -625,6 +625,7 @@ strdup \ strerror \ strftime \ +strnlen \ strptime \ strstr \ strtok_r \ http://cvs.php.net/viewvc.cgi/php-src/main/spprintf.c?r1=1.53&r2=1.54&diff_format=u Index: php-src/main/spprintf.c diff -u php-src/main/spprintf.c:1.53 php-src/main/spprintf.c:1.54 --- php-src/main/spprintf.c:1.53 Thu Feb 7 18:40:29 2008 +++ php-src/main/spprintf.c Fri Dec 12 23:55:48 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spprintf.c,v 1.53 2008/02/07 18:40:29 helly Exp $ */ +/* $Id: spprintf.c,v 1.54 2008/12/12 23:55:48 nlopess Exp $ */ /* This is the spprintf implementation. * It has emerged from apache snprintf. See original header: @@ -77,6 +77,7 @@ * <pa...@alumni.cs.colorado.edu> for xinetd. */ +#define _GNU_SOURCE #include "php.h" #include <stddef.h> @@ -209,6 +210,14 @@ /* }}} */ + +#if !HAVE_STRNLEN +static size_t strnlen(const char *s, size_t maxlen) { + char *r = memchr(s, '\0', maxlen); + return r ? r-s : maxlen; +} +#endif + /* * Do format conversion placing the output in buffer */ @@ -656,9 +665,11 @@ fmt_string: s = va_arg(ap, char *); if (s != NULL) { - s_len = strlen(s); - if (adjust_precision && precision < s_len) - s_len = precision; + if (!adjust_precision) { + s_len = strlen(s); + } else { + s_len = strnlen(s, precision); + } } else { s = S_NULL; s_len = S_NULL_LEN;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php