]> granicus.if.org Git - php/commitdiff
Make vprintf() and printf() return the length of the string printed.
authorIlia Alshanetsky <iliaa@php.net>
Tue, 11 May 2004 19:51:46 +0000 (19:51 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 11 May 2004 19:51:46 +0000 (19:51 +0000)
Make fprintf() and vfprints() return the correct length of the string
printed.

ext/standard/formatted_print.c

index e12d0eebc982520f083265f82dbb16632510117e..ee33b17f36e2a5f84fa4127fa0ebd95d82e8ff92 100644 (file)
@@ -781,6 +781,7 @@ PHP_FUNCTION(user_printf)
        }
        PHPWRITE(result, len);
        efree(result);
+       RETURN_LONG(len);
 }
 /* }}} */
 
@@ -796,6 +797,7 @@ PHP_FUNCTION(vprintf)
        }
        PHPWRITE(result, len);
        efree(result);
+       RETURN_LONG(len);
 }
 /* }}} */
 
@@ -826,7 +828,7 @@ PHP_FUNCTION(fprintf)
 
        efree(result);
 
-       RETVAL_LONG(len - 1);
+       RETURN_LONG(len);
 }
 
 /* {{{ proto int vfprintf(resource stream, string format, array args)
@@ -856,7 +858,7 @@ PHP_FUNCTION(vfprintf)
 
        efree(result);
 
-       RETVAL_LONG(len - 1);
+       RETURN_LONG(len);
 }