Shouldn't we have a macro that does this?
I see lots of places that require the same code.
- RETVAL_STRING(md5str, 1);
+ if (UG(unicode)) {
+ UChar *u_temp = zend_ascii_to_unicode(md5str, 33
ZEND_FILE_LINE_CC);
+ RETVAL_UNICODE(u_temp, 0);
+ } else {
+ RETVAL_STRING(md5str, 1);
+ }
}
Andi
At 10:18 AM 8/16/2005 +0000, Dmitry Stogov wrote:
dmitry Tue Aug 16 06:18:43 2005 EDT
Modified files:
/php-src/ext/standard md5.c
/php-src/ext/standard/tests/strings explode.phpt strcspn.phpt
strspn.phpt strstr.phpt
Log:
Unicode support
http://cvs.php.net/diff.php/php-src/ext/standard/md5.c?r1=1.39&r2=1.40&ty=u
Index: php-src/ext/standard/md5.c
diff -u php-src/ext/standard/md5.c:1.39 php-src/ext/standard/md5.c:1.40
--- php-src/ext/standard/md5.c:1.39 Wed Aug 3 10:08:09 2005
+++ php-src/ext/standard/md5.c Tue Aug 16 06:18:41 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: md5.c,v 1.39 2005/08/03 14:08:09 sniper Exp $ */
+/* $Id: md5.c,v 1.40 2005/08/16 10:18:41 dmitry Exp $ */
/*
* md5.c - Copyright 1997 Lachlan Roche
@@ -61,7 +61,12 @@
RETURN_STRINGL(digest, 16, 1);
} else {
make_digest(md5str, digest);
- RETVAL_STRING(md5str, 1);
+ if (UG(unicode)) {
+ UChar *u_temp = zend_ascii_to_unicode(md5str, 33
ZEND_FILE_LINE_CC);
+ RETVAL_UNICODE(u_temp, 0);
+ } else {
+ RETVAL_STRING(md5str, 1);
+ }
}
}
@@ -108,7 +113,12 @@
RETURN_STRINGL(digest, 16, 1);
} else {
make_digest(md5str, digest);
- RETVAL_STRING(md5str, 1);
+ if (UG(unicode)) {
+ UChar *u_temp = zend_ascii_to_unicode(md5str, 33
ZEND_FILE_LINE_CC);
+ RETVAL_UNICODE(u_temp, 0);
+ } else {
+ RETVAL_STRING(md5str, 1);
+ }
}
}
/* }}} */
http://cvs.php.net/diff.php/php-src/ext/standard/tests/strings/explode.phpt?r1=1.4&r2=1.5&ty=u
Index: php-src/ext/standard/tests/strings/explode.phpt
diff -u php-src/ext/standard/tests/strings/explode.phpt:1.4
php-src/ext/standard/tests/strings/explode.phpt:1.5
--- php-src/ext/standard/tests/strings/explode.phpt:1.4 Sun Jul 18
07:34:28 2004
+++ php-src/ext/standard/tests/strings/explode.phpt Tue Aug 16
06:18:43 2005
@@ -152,3 +152,127 @@
[0]=>
string(10) "a lazy dog"
}
+--UEXPECTF--
+26d4e18734cb2582df5055e2175223df
+bool(false)
+bool(false)
+bool(false)
+array(1) {
+ [0]=>
+ unicode(0) ""
+}
+array(2) {
+ [0]=>
+ unicode(0) ""
+ [1]=>
+ unicode(0) ""
+}
+array(1) {
+ [0]=>
+ unicode(0) ""
+}
+bool(false)
+array(1) {
+ [0]=>
+ unicode(3) "acb"
+}
+array(1) {
+ [0]=>
+ unicode(11) "otherstring"
+}
+array(7) {
+ [0]=>
+ unicode(0) ""
+ [1]=>
+ unicode(0) ""
+ [2]=>
+ unicode(0) ""
+ [3]=>
+ unicode(0) ""
+ [4]=>
+ unicode(0) ""
+ [5]=>
+ unicode(0) ""
+ [6]=>
+ unicode(0) ""
+}
+array(1) {
+ [0]=>
+ unicode(60) "-=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=-"
+}
+array(21) {
+ [0]=>
+ unicode(1) "-"
+ [1]=>
+ unicode(2) "48"
+ [2]=>
+ unicode(2) "--"
+ [3]=>
+ unicode(2) "48"
+ [4]=>
+ unicode(2) "--"
+ [5]=>
+ unicode(2) "48"
+ [6]=>
+ unicode(2) "--"
+ [7]=>
+ unicode(2) "48"
+ [8]=>
+ unicode(2) "--"
+ [9]=>
+ unicode(2) "48"
+ [10]=>
+ unicode(2) "--"
+ [11]=>
+ unicode(2) "48"
+ [12]=>
+ unicode(2) "--"
+ [13]=>
+ unicode(2) "48"
+ [14]=>
+ unicode(2) "--"
+ [15]=>
+ unicode(2) "48"
+ [16]=>
+ unicode(2) "--"
+ [17]=>
+ unicode(2) "48"
+ [18]=>
+ unicode(2) "--"
+ [19]=>
+ unicode(2) "48"
+ [20]=>
+ unicode(1) "-"
+}
+array(3) {
+ [0]=>
+ unicode(10) "a lazy dog"
+ [1]=>
+ unicode(5) "jumps"
+ [2]=>
+ unicode(4) "over"
+}
+array(2) {
+ [0]=>
+ unicode(10) "a lazy dog"
+ [1]=>
+ unicode(5) "jumps"
+}
+array(1) {
+ [0]=>
+ unicode(10) "a lazy dog"
+}
+array(0) {
+}
+array(0) {
+}
+array(2) {
+ [0]=>
+ unicode(10) "a lazy dog"
+ [1]=>
+ unicode(11) "jumps::over"
+}
+array(1) {
+ [0]=>
+ unicode(10) "a lazy dog"
+}
http://cvs.php.net/diff.php/php-src/ext/standard/tests/strings/strcspn.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/standard/tests/strings/strcspn.phpt
diff -u php-src/ext/standard/tests/strings/strcspn.phpt:1.1
php-src/ext/standard/tests/strings/strcspn.phpt:1.2
--- php-src/ext/standard/tests/strings/strcspn.phpt:1.1 Sat Oct 26
12:48:03 2002
+++ php-src/ext/standard/tests/strings/strcspn.phpt Tue Aug 16
06:18:43 2005
@@ -16,3 +16,9 @@
int(0)
int(7)
int(6)
+--UEXPECT--
+unicode(25) "22222222aaaa bbb1111 cccc"
+unicode(4) "1234"
+int(0)
+int(7)
+int(6)
http://cvs.php.net/diff.php/php-src/ext/standard/tests/strings/strspn.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/standard/tests/strings/strspn.phpt
diff -u php-src/ext/standard/tests/strings/strspn.phpt:1.1
php-src/ext/standard/tests/strings/strspn.phpt:1.2
--- php-src/ext/standard/tests/strings/strspn.phpt:1.1 Sat Oct 26
12:48:03 2002
+++ php-src/ext/standard/tests/strings/strspn.phpt Tue Aug 16
06:18:43 2005
@@ -16,3 +16,9 @@
int(8)
int(6)
int(3)
+--UEXPECT--
+unicode(25) "22222222aaaa bbb1111 cccc"
+unicode(4) "1234"
+int(8)
+int(6)
+int(3)
http://cvs.php.net/diff.php/php-src/ext/standard/tests/strings/strstr.phpt?r1=1.3&r2=1.4&ty=u
Index: php-src/ext/standard/tests/strings/strstr.phpt
diff -u php-src/ext/standard/tests/strings/strstr.phpt:1.3
php-src/ext/standard/tests/strings/strstr.phpt:1.4
--- php-src/ext/standard/tests/strings/strstr.phpt:1.3 Tue Aug 9
16:49:19 2005
+++ php-src/ext/standard/tests/strings/strstr.phpt Tue Aug 16
06:18:43 2005
@@ -32,3 +32,18 @@
string(32) "6ec19f52f0766c463f3bb240f4396913"
string(7) " string"
string(4) "test"
+--UEXPECT--
+unicode(11) "test string"
+unicode(6) "string"
+unicode(6) "string"
+unicode(8) "t string"
+unicode(1) "g"
+unicode(32) "7272696018bdeb2c9a3f8d01fc2a9273"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+unicode(32) "6ec19f52f0766c463f3bb240f4396913"
+unicode(7) " string"
+unicode(4) "test"
--
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