CVS update: php3/functions
| From: | sas | Date: | Sun, 10 Jan 1999 17:20:14 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3447@lists.php.net to get a copy of this message | ||
Date: Sunday January 10, 1999 @ 12:20
Author: sas
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv8955/functions
Modified Files:
wddx.c
Log Message:
Extend the unserializer
Index: php3/functions/wddx.c
diff -c php3/functions/wddx.c:1.4 php3/functions/wddx.c:1.5
*** php3/functions/wddx.c:1.4 Sun Jan 10 09:35:00 1999
--- php3/functions/wddx.c Sun Jan 10 12:20:13 1999
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: wddx.c,v 1.4 1999/01/10 14:35:00 sas Exp $ */
#include "php.h"
#include "internal_functions.h"
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: wddx.c,v 1.5 1999/01/10 17:20:13 sas Exp $ */
#include "php.h"
#include "internal_functions.h"
***************
*** 63,68 ****
--- 63,69 ----
char *var_name;
char *buf;
int len;
+ int depth;
} _php3_wddx_parser;
/* }}} */
***************
*** 152,157 ****
--- 153,159 ----
char *buf;
char *new;
int len = 40;
+ ulong ikey = 0;
pval *obj;
char *key;
char *off;
***************
*** 161,167 ****
_php3_hash_internal_pointer_reset(ht);
while(_php3_hash_get_current_data(ht, (void **) &obj) == SUCCESS) {
! _php3_hash_get_current_key(ht, &key, NULL);
new = _php3_wddx_build(key, obj);
efree(key);
len += strlen(new);
--- 163,173 ----
_php3_hash_internal_pointer_reset(ht);
while(_php3_hash_get_current_data(ht, (void **) &obj) == SUCCESS) {
! if(_php3_hash_get_current_key(ht, &key, &ikey) ==
! HASH_KEY_IS_LONG) {
! key = emalloc(20);
! sprintf(key, "%ld", ikey);
! }
new = _php3_wddx_build(key, obj);
efree(key);
len += strlen(new);
***************
*** 312,327 ****
/* is this the first element of a list? */
#define FIRST \
if(wddx->notfirst) \
! ATTACH(", ") \
else \
wddx->notfirst++
! /* do we have a var name? indicates sth associative */
#define VAR_NAME \
if(wddx->var_name) { \
! ATTACH("\""); \
! ATTACH(wddx->var_name); \
! ATTACH("\" => "); \
efree(wddx->var_name); \
wddx->var_name = NULL; \
}
--- 318,339 ----
/* is this the first element of a list? */
#define FIRST \
if(wddx->notfirst) \
! if(wddx->depth) ATTACH(", ") else ATTACH("; ") \
else \
wddx->notfirst++
! /* do we have a var name? could be an associative array or a top level assign */
#define VAR_NAME \
if(wddx->var_name) { \
! if(wddx->depth) { \
! ATTACH("\""); \
! ATTACH(wddx->var_name); \
! ATTACH("\" => "); \
! } else { \
! ATTACH("$"); \
! ATTACH(wddx->var_name); \
! ATTACH(" = "); \
! } \
efree(wddx->var_name); \
wddx->var_name = NULL; \
}
***************
*** 346,351 ****
--- 358,364 ----
} else if(!strcmp(name, "number")) {
wddx->last_type = LT_NUMBER;
} else if(!strcmp(name, "array") || !strcmp(name, "struct")) {
+ wddx->depth++;
wddx->last_type = LT_ARRAY;
FIRST;
VAR_NAME;
***************
*** 361,366 ****
--- 374,380 ----
_php3_wddx_parser *wddx = (_php3_wddx_parser *) data;
if(!strcmp(name, "array") || !strcmp(name, "struct")) {
+ wddx->depth--;
ATTACH(")");
}
}
***************
*** 433,439 ****
WRONG_PARAM_COUNT;
}
! if(ac == 1 && args[0]->type & IS_HASH) {
str = _php3_wddx_struct_or_array(args[0]->value.ht);
} else {
str = _php3_wddx_args_array(ht, args, ac);
--- 447,454 ----
WRONG_PARAM_COUNT;
}
! if(ac == 1 && args[0]->type & IS_HASH &&
! !ParameterPassedByReference(ht, 1)) {
str = _php3_wddx_struct_or_array(args[0]->value.ht);
} else {
str = _php3_wddx_args_array(ht, args, ac);
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net