[PHP-DEV] cvs: /php3/functions hw.c From: Uwe Steinmann (Uwe.Steinmann <email protected>)
Date: 08/31/99

steinm Tue Aug 31 09:13:09 1999 EDT

  Modified files:
    /php3/functions hw.c
  Log:
  - make_objrec_from_array() is now able to handle not associated arrays
    for multiple attributes (e.g. the Group attribute for User-Objects)
  
  
Index: php3/functions/hw.c
diff -u php3/functions/hw.c:1.47 php3/functions/hw.c:1.48
--- php3/functions/hw.c:1.47 Sat Aug 28 20:53:23 1999
+++ php3/functions/hw.c Tue Aug 31 09:13:09 1999
@@ -23,8 +23,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: hw.c,v 1.47 1999/08/29 00:53:23 jim Exp $ */
-#if HYPERWAVE
+/* $Id: hw.c,v 1.48 1999/08/31 13:13:09 steinm Exp $ */
 
 #if COMPILE_DL
 #include "dl/phpdl.h"
@@ -38,6 +37,7 @@
 #include "internal_functions.h"
 #include "php3_list.h"
 
+#if HYPERWAVE
 #include "hw.h"
 
 #if APACHE
@@ -375,14 +375,20 @@
         *objrec = '\0';
         for(i=0; i<count; i++) {
                 keytype = _php3_hash_get_current_key(lht, &key, &length);
- if(HASH_KEY_IS_STRING == keytype) {
+// if(HASH_KEY_IS_STRING == keytype) {
                         _php3_hash_get_current_data(lht, (void **) &keydata);
                         switch(keydata->type) {
                                 case IS_STRING:
- snprintf(str, BUFFERLEN, "%s=%s\n", key, keydata->value.str.val);
+ if(HASH_KEY_IS_STRING == keytype)
+ snprintf(str, BUFFERLEN, "%s=%s\n", key, keydata->value.str.val);
+ else
+ snprintf(str, BUFFERLEN, "%s\n", keydata->value.str.val);
                                         break;
                                 case IS_LONG:
- snprintf(str, BUFFERLEN, "%s=0x%lX\n", key, keydata->value.lval);
+ if(HASH_KEY_IS_STRING == keytype)
+ snprintf(str, BUFFERLEN, "%s=0x%lX\n", key, keydata->value.lval);
+ else
+ snprintf(str, BUFFERLEN, "0x%lX\n", keydata->value.lval);
                                         break;
                                 case IS_ARRAY: {
                                         int i, len, keylen, count;
@@ -417,10 +423,10 @@
                                         break;
                                 }
                         }
- efree(key);
+ if(HASH_KEY_IS_STRING == keytype) efree(key);
                         objrec = realloc(objrec, strlen(objrec)+strlen(str)+1);
                         strcat(objrec, str);
- }
+// }
                 _php3_hash_move_forward(lht);
         }
         return objrec;

-- 
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>