dmitry          Fri Oct 28 04:07:20 2005 EDT

  Modified files:              
    /php-src/ext/spl    spl_iterators.c 
  Log:
  Unicode support
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.92&r2=1.93&ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.92 
php-src/ext/spl/spl_iterators.c:1.93
--- php-src/ext/spl/spl_iterators.c:1.92        Wed Oct 12 18:52:08 2005
+++ php-src/ext/spl/spl_iterators.c     Fri Oct 28 04:07:17 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_iterators.c,v 1.92 2005/10/12 22:52:08 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.93 2005/10/28 08:07:17 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -465,10 +465,22 @@
                char *str_key;
                uint str_key_len;
                ulong int_key;
-               if (iterator->funcs->get_current_key(iterator, &str_key, 
&str_key_len, &int_key TSRMLS_CC) == HASH_KEY_IS_LONG) {
-                       RETURN_LONG(int_key);
-               } else {
-                       RETURN_STRINGL(str_key, str_key_len-1, 0);
+               
+               switch (iterator->funcs->get_current_key(iterator, &str_key, 
&str_key_len, &int_key TSRMLS_CC)) {
+                       case HASH_KEY_IS_LONG:
+                               RETURN_LONG(int_key);
+                               break;
+                       case HASH_KEY_IS_STRING:
+                               RETURN_STRINGL(str_key, str_key_len-1, 0);
+                               break;
+                       case HASH_KEY_IS_UNICODE:
+                               RETURN_UNICODEL(str_key, str_key_len-1, 0);
+                               break;
+                       case HASH_KEY_IS_BINARY:
+                               RETURN_BINARYL(str_key, str_key_len-1, 0);
+                               break;
+                       default:
+                               RETURN_NULL();
                }
        } else {
                RETURN_NULL();
@@ -1721,6 +1733,10 @@
        if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) {
                if (intern->current.key_type == HASH_KEY_IS_STRING) {
                        RETURN_STRINGL(intern->current.str_key, 
intern->current.str_key_len, 1);
+               } else if (intern->current.key_type == HASH_KEY_IS_UNICODE) {
+                       RETURN_UNICODEL(intern->current.str_key, 
intern->current.str_key_len, 1);
+               } else if (intern->current.key_type == HASH_KEY_IS_BINARY) {
+                       RETURN_BINARYL(intern->current.str_key, 
intern->current.str_key_len, 1);
                } else {
                        RETVAL_LONG(intern->current.int_key);
                        convert_to_string(return_value);
@@ -2029,10 +2045,21 @@
                char *str_key;
                uint str_key_len;
                ulong int_key;
-               if 
(intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, 
&str_key, &str_key_len, &int_key TSRMLS_CC) == HASH_KEY_IS_LONG) {
-                       RETURN_LONG(int_key);
-               } else {
-                       RETURN_STRINGL(str_key, str_key_len-1, 0);
+               switch 
(intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, 
&str_key, &str_key_len, &int_key TSRMLS_CC)) {
+                       case HASH_KEY_IS_LONG:
+                               RETURN_LONG(int_key);
+                               break;  
+                       case HASH_KEY_IS_STRING:
+                               RETURN_STRINGL(str_key, str_key_len-1, 0);
+                               break;
+                       case HASH_KEY_IS_UNICODE:
+                               RETURN_UNICODEL(str_key, str_key_len-1, 0);
+                               break;
+                       case HASH_KEY_IS_BINARY:
+                               RETURN_BINARYL(str_key, str_key_len-1, 0);
+                               break;
+                       default:
+                               RETURN_NULL();
                }
        } else {
                RETURN_NULL();

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

Reply via email to