I don't think %zd is portable. We need to come up with some alternative solution, or some check.

Zeev

At 18:27 13/09/2003, Ard Biesheuvel wrote:
abies Sat Sep 13 11:27:11 2003 EDT

  Modified files:
    /php-src/main       SAPI.c
    /php-src/main/streams       streams.c userspace.c
    /php-src/tests/lang bug24054.phpt
  Log:
  Fixed for 64bit archs

Index: php-src/main/SAPI.c
diff -u php-src/main/SAPI.c:1.178 php-src/main/SAPI.c:1.179
--- php-src/main/SAPI.c:1.178   Wed Sep 10 04:47:37 2003
+++ php-src/main/SAPI.c Sat Sep 13 11:27:04 2003
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */

-/* $Id: SAPI.c,v 1.178 2003/09/10 08:47:37 sr Exp $ */
+/* $Id: SAPI.c,v 1.179 2003/09/13 15:27:04 abies Exp $ */

 #include <ctype.h>
 #include <sys/stat.h>
@@ -517,7 +517,7 @@

        switch (op) {
        case SAPI_HEADER_SET_STATUS:
-               sapi_update_response_code((int) arg TSRMLS_CC);
+               sapi_update_response_code((long) arg TSRMLS_CC);
                return SUCCESS;

case SAPI_HEADER_REPLACE:
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.35 php-src/main/streams/streams.c:1.36
--- php-src/main/streams/streams.c:1.35 Thu Sep 11 01:07:26 2003
+++ php-src/main/streams/streams.c Sat Sep 13 11:27:08 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/


-/* $Id: streams.c,v 1.35 2003/09/11 05:07:26 iliaa Exp $ */
+/* $Id: streams.c,v 1.36 2003/09/13 15:27:08 abies Exp $ */

#define _GNU_SOURCE
#include "php.h"
@@ -368,7 +368,7 @@
* as leaked; it will log a warning, but lets help it out and display what kind
* of stream it was. */
char leakbuf[512];
- snprintf(leakbuf, sizeof(leakbuf), __FILE__ "(%d) : Stream of type '%s' 0x%08X (path:%s) was not closed\n", __LINE__, stream->ops->label, (unsigned int)stream, stream->__orig_path);
+ snprintf(leakbuf, sizeof(leakbuf), __FILE__ "(%d) : Stream of type '%s' %p (path:%s) was not closed\n", __LINE__, stream->ops->label, stream, stream->__orig_path);


if (stream->__orig_path) {
pefree(stream->__orig_path, stream->is_persistent);
Index: php-src/main/streams/userspace.c
diff -u php-src/main/streams/userspace.c:1.9 php-src/main/streams/userspace.c:1.10
--- php-src/main/streams/userspace.c:1.9 Mon Jun 16 15:13:39 2003
+++ php-src/main/streams/userspace.c Sat Sep 13 11:27:08 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/


-/* $Id: userspace.c,v 1.9 2003/06/16 19:13:39 pollita Exp $ */
+/* $Id: userspace.c,v 1.10 2003/09/13 15:27:08 abies Exp $ */

 #include "php.h"
 #include "php_globals.h"
@@ -430,7 +430,7 @@

/* don't allow strange buffer overruns due to bogus return */
if (didwrite > count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " wrote %d bytes more data than requested (%d written, %d max)",
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " wrote %zd bytes more data than requested (%zd written, %zd max)",
us->wrapper->classname,
didwrite - count, didwrite, count);
didwrite = count;
@@ -471,7 +471,7 @@
convert_to_string(retval);
didread = Z_STRLEN_P(retval);
if (didread > count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read %d bytes more data than requested (%d read, %d max) - excess data will be lost",
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read %zd bytes more data than requested (%zd read, %zd max) - excess data will be lost",
us->wrapper->classname, didread - count, didread, count);
didread = count;
}
Index: php-src/tests/lang/bug24054.phpt
diff -u php-src/tests/lang/bug24054.phpt:1.1 php-src/tests/lang/bug24054.phpt:1.2
--- php-src/tests/lang/bug24054.phpt:1.1 Fri Jun 6 07:09:55 2003
+++ php-src/tests/lang/bug24054.phpt Sat Sep 13 11:27:09 2003
@@ -3,15 +3,24 @@
--FILE--
<?php


- $i = 10000000;
- $i *= 1001;
+define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
+define('LONG_MIN', -LONG_MAX - 1);
+printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));


-       $j = 10000000;
-       $j = $j * 1001;
+       $i = LONG_MAX;

-       var_dump($i,$j);
+       $j = $i * 1001;
+       $i *= 1001;
+

-?>
+$tests = <<<TESTS
+
+$i === $j
+TESTS;
+
+ include(dirname(__FILE__) . '/../quicktester.inc');
+
 --EXPECT--
-float(1.001E+10)
-float(1.001E+10)
+1,1,0,0
+OK

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

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



Reply via email to