iliaa           Wed Feb  4 15:03:12 2009 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    configure.in 
    /php-src/main       spprintf.c 
  Log:
  
  Syn spprintf fix with that of 5.3 and above
  
http://cvs.php.net/viewvc.cgi/php-src/configure.in?r1=1.579.2.52.2.121&r2=1.579.2.52.2.122&diff_format=u
Index: php-src/configure.in
diff -u php-src/configure.in:1.579.2.52.2.121 
php-src/configure.in:1.579.2.52.2.122
--- php-src/configure.in:1.579.2.52.2.121       Sun Feb  1 21:52:32 2009
+++ php-src/configure.in        Wed Feb  4 15:03:11 2009
@@ -1,4 +1,4 @@
-## $Id: configure.in,v 1.579.2.52.2.121 2009/02/01 21:52:32 dsp Exp $ -*- 
autoconf -*-
+## $Id: configure.in,v 1.579.2.52.2.122 2009/02/04 15:03:11 iliaa Exp $ -*- 
autoconf -*-
 dnl ## Process this file with autoconf to produce a configure script.
 
 divert(1)
@@ -579,6 +579,7 @@
 strdup \
 strerror \
 strftime \
+strnlen \
 strptime \
 strstr \
 strtok_r \
http://cvs.php.net/viewvc.cgi/php-src/main/spprintf.c?r1=1.25.2.2.2.14&r2=1.25.2.2.2.15&diff_format=u
Index: php-src/main/spprintf.c
diff -u php-src/main/spprintf.c:1.25.2.2.2.14 
php-src/main/spprintf.c:1.25.2.2.2.15
--- php-src/main/spprintf.c:1.25.2.2.2.14       Sun Feb  1 19:42:48 2009
+++ php-src/main/spprintf.c     Wed Feb  4 15:03:12 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: spprintf.c,v 1.25.2.2.2.14 2009/02/01 19:42:48 iliaa Exp $ */
+/* $Id: spprintf.c,v 1.25.2.2.2.15 2009/02/04 15:03:12 iliaa Exp $ */
 
 /* This is the spprintf implementation.
  * It has emerged from apache snprintf. See original header:
@@ -180,6 +180,13 @@
 
 /* }}} */
 
+#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
  */
@@ -547,10 +554,10 @@
                                case 'v':
                                        s = va_arg(ap, char *);
                                        if (s != NULL) {
-                                               if (adjust_precision && 
precision) {
-                                                       s_len = precision;
-                                               } else {
+                                               if (!adjust_precision) {
                                                        s_len = strlen(s);
+                                               } else {
+                                                       s_len = strnlen(s, 
precision);
                                                }
                                        } else {
                                                s = S_NULL;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to