[PHP-DEV] cvs: /php3 ChangeLog /php3/functions var.c From: Thies C. Arntzen (thies <email protected>)
Date: 08/31/99

thies Tue Aug 31 09:20:04 1999 EDT

  Modified files:
    /php3 ChangeLog
    /php3/functions var.c
  Log:
  fix #2033
  we need to rethink the "use _php3_sprintf or sprintf function" question!
  
  
Index: php3/ChangeLog
diff -u php3/ChangeLog:1.747 php3/ChangeLog:1.748
--- php3/ChangeLog:1.747 Thu Aug 26 09:24:15 1999
+++ php3/ChangeLog Tue Aug 31 09:20:04 1999
@@ -2,7 +2,8 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
 ???? ??, 1999, Version 3.0.13
-- fixed a crash that would occur if wddx_deserialize did not receive
+- Fixed serialize on SunOS 4.1.3 (Thies from elfchief <email protected>)
+- Fixed a crash that would occur if wddx_deserialize did not receive
   a valid packet (Andrey)
 - Fixed sem_get() on AIX (Sascha)
 - Removed --with-shared-apache to avoid problems with Apache 1.3.9 (Sascha)
Index: php3/functions/var.c
diff -u php3/functions/var.c:1.14 php3/functions/var.c:1.15
--- php3/functions/var.c:1.14 Wed Jun 16 07:34:22 1999
+++ php3/functions/var.c Tue Aug 31 09:20:04 1999
@@ -27,7 +27,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: var.c,v 1.14 1999/06/16 11:34:22 ssb Exp $ */
+/* $Id: var.c,v 1.15 1999/08/31 13:20:04 thies Exp $ */
 
 #ifdef THREAD_SAFE
 #include "tls.h"
@@ -42,6 +42,7 @@
 #include "reg.h"
 #include "post.h"
 #include "php3_string.h"
+#include "snprintf.h"
 #ifdef HAVE_LOCALE_H
 # include <locale.h>
 #endif
@@ -60,17 +61,17 @@
 
         switch (struc->type) {
                 case IS_LONG:
- i = sprintf(buf, "%*cint(%ld)\n", level, ' ', struc->value.lval);
+ i = _php3_sprintf(buf, "%*cint(%ld)\n", level, ' ', struc->value.lval);
                         PHPWRITE(&buf[1], i - 1);
                         break;
 
                 case IS_DOUBLE:
- i = sprintf(buf, "%*cfloat(%g)\n", level, ' ', struc->value.dval);
+ i = _php3_sprintf(buf, "%*cfloat(%g)\n", level, ' ', struc->value.dval);
                         PHPWRITE(&buf[1], i - 1);
                         break;
 
                 case IS_STRING:
- i = sprintf(buf, "%*cstring(%d) \"", level, ' ', struc->value.str.len);
+ i = _php3_sprintf(buf, "%*cstring(%d) \"", level, ' ', struc->value.str.len);
                         PHPWRITE(&buf[1], i - 1);
                         PHPWRITE(struc->value.str.val, struc->value.str.len);
                         strcpy(buf, "\"\n");
@@ -78,12 +79,12 @@
                         break;
 
                 case IS_ARRAY:
- i = sprintf(buf, "%*carray(%d) {\n", level, ' ', _php3_hash_num_elements(struc->value.ht));
+ i = _php3_sprintf(buf, "%*carray(%d) {\n", level, ' ', _php3_hash_num_elements(struc->value.ht));
                         PHPWRITE(&buf[1], i - 1);
                         goto head_done;
 
                 case IS_OBJECT:
- i = sprintf(buf, "%*cobject(%d) {\n", level, ' ', _php3_hash_num_elements(struc->value.ht));
+ i = _php3_sprintf(buf, "%*cobject(%d) {\n", level, ' ', _php3_hash_num_elements(struc->value.ht));
                         PHPWRITE(&buf[1], i - 1);
                   head_done:
 
@@ -124,12 +125,12 @@
                                 }
                                 php3api_var_dump(data, level + 2);
                         }
- i = sprintf(buf, "%*c}\n", level, ' ');
+ i = _php3_sprintf(buf, "%*c}\n", level, ' ');
                         PHPWRITE(&buf[1], i - 1);
                         break;
 
                 default:
- i = sprintf(buf, "%*ci:0\n", level, ' ');
+ i = _php3_sprintf(buf, "%*ci:0\n", level, ' ');
                         PHPWRITE(&buf[1], i - 1);
         }
 }
@@ -170,12 +171,12 @@
 
         switch (struc->type) {
                 case IS_LONG:
- slen = sprintf(s, "i:%ld;", struc->value.lval);
+ slen = _php3_sprintf(s, "i:%ld;", struc->value.lval);
                         STR_CAT(buf, s, slen);
                         return;
 
                 case IS_DOUBLE:
- slen = sprintf(s, "d:%g;", struc->value.dval);
+ slen = _php3_sprintf(s, "d:%g;", struc->value.dval);
                         STR_CAT(buf, s, slen);
                         return;
 
@@ -183,7 +184,7 @@
                                 char *p;
                                 
                                 i = buf->value.str.len;
- slen = sprintf(s, "s:%d:\"", struc->value.str.len);
+ slen = _php3_sprintf(s, "s:%d:\"", struc->value.str.len);
                                 STR_CAT(buf, s, slen + struc->value.str.len + 2);
                                 p = buf->value.str.val + i + slen;
                                 if (struc->value.str.len > 0) {
@@ -205,7 +206,7 @@
 
                   got_array:
                         i = _php3_hash_num_elements(struc->value.ht);
- slen = sprintf(s, "%c:%d:{", ch, i);
+ slen = _php3_sprintf(s, "%c:%d:{", ch, i);
                         STR_CAT(buf, s, slen);
                         if (i > 0) {
                                 char *key;

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>