Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/intl/grapheme grapheme_string.c

2009-04-27 Thread Kalle Sommer Nielsen
Hi

2009/4/27 Kirti Velankar :
> kirtig          Mon Apr 27 18:18:04 2009 UTC
>
>  Modified files:              (Branch: PHP_5_3)
>    /php-src/ext/intl/grapheme  grapheme_string.c
>  Log:
>  Fix in grapheme_extract
>
> http://cvs.php.net/viewvc.cgi/php-src/ext/intl/grapheme/grapheme_string.c?r1=1.1.2.3&r2=1.1.2.4&diff_format=u
> Index: php-src/ext/intl/grapheme/grapheme_string.c
> diff -u php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.3 
> php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.4
> --- php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.3 Fri Apr 10 16:53:35 
> 2009
> +++ php-src/ext/intl/grapheme/grapheme_string.c Mon Apr 27 18:18:04 2009
> @@ -852,10 +852,11 @@
>         */
>
>        if ( -1 != grapheme_ascii_check(pstr, size + 1 < str_len ? size + 1 : 
> str_len ) ) {
> +        long nsize = ( size < str_len ? size : str_len );
>                if ( NULL != next ) {
> -                       ZVAL_LONG(next, start+size);
> +                       ZVAL_LONG(next, start+nsize);
>                }
> -               RETURN_STRINGL(((char *)pstr), size, 1);
> +               RETURN_STRINGL(((char *)pstr), nsize, 1);
>        }
>
>        /* convert the strings to UTF-16. */
>

Shouldn't this be in HEAD aswell?

>
>



-- 
Kalle Sommer Nielsen
ka...@php.net

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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/intl/grapheme grapheme_string.c

2009-04-27 Thread Kirti Velankar
kirtig  Mon Apr 27 18:18:04 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/intl/grapheme  grapheme_string.c 
  Log:
  Fix in grapheme_extract
  
http://cvs.php.net/viewvc.cgi/php-src/ext/intl/grapheme/grapheme_string.c?r1=1.1.2.3&r2=1.1.2.4&diff_format=u
Index: php-src/ext/intl/grapheme/grapheme_string.c
diff -u php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.3 
php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.4
--- php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.3 Fri Apr 10 16:53:35 2009
+++ php-src/ext/intl/grapheme/grapheme_string.c Mon Apr 27 18:18:04 2009
@@ -852,10 +852,11 @@
 */

if ( -1 != grapheme_ascii_check(pstr, size + 1 < str_len ? size + 1 : 
str_len ) ) {
+long nsize = ( size < str_len ? size : str_len ); 
if ( NULL != next ) {
-   ZVAL_LONG(next, start+size);
+   ZVAL_LONG(next, start+nsize);
}
-   RETURN_STRINGL(((char *)pstr), size, 1);
+   RETURN_STRINGL(((char *)pstr), nsize, 1);
}
 
/* convert the strings to UTF-16. */



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/intl/grapheme grapheme_string.c /ext/intl/tests grapheme.phpt

2009-04-10 Thread Stanislav Malyshev
stasFri Apr 10 16:53:35 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/intl/grapheme  grapheme_string.c 
/php-src/ext/intl/tests grapheme.phpt 
  Log:
  merge grapheme substr fix
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/intl/grapheme/grapheme_string.c?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/intl/grapheme/grapheme_string.c
diff -u php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.2 
php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.3
--- php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.2 Mon Aug 11 19:48:00 2008
+++ php-src/ext/intl/grapheme/grapheme_string.c Fri Apr 10 16:53:35 2009
@@ -542,7 +542,7 @@
length += iter_val;
}

-   if ( UBRK_DONE == sub_str_end_pos ) {
+   if ( UBRK_DONE == sub_str_end_pos && length < 0) {

intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, 
"grapheme_substr: length not contained in string", 1 TSRMLS_CC );

http://cvs.php.net/viewvc.cgi/php-src/ext/intl/tests/grapheme.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/intl/tests/grapheme.phpt
diff -u php-src/ext/intl/tests/grapheme.phpt:1.1.2.1 
php-src/ext/intl/tests/grapheme.phpt:1.1.2.2
--- php-src/ext/intl/tests/grapheme.phpt:1.1.2.1Mon Jul  7 22:51:04 2008
+++ php-src/ext/intl/tests/grapheme.phptFri Apr 10 16:53:35 2009
@@ -334,7 +334,9 @@
array( "abc", 0, 2, "ab" ),
array( "Abc", -4, 1, "false" ),
array( "ababc", 1, 2, "ba" ),
+   array( "ababc", 0, 10, "ababc" ),

+   array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . 
"Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . 
"Opq", 5, "Opq" ),
array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . 
"Opq", 5, -1, "Op" ),
array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . 
"Opq", 5, -2, "O" ),
@@ -953,6 +955,8 @@
 substring of "abc" from "0" - grapheme_substr with length 2 = ab == ab
 substring of "Abc" from "-4" - grapheme_substr with length 1 = false == false
 substring of "ababc" from "1" - grapheme_substr with length 2 = ba == ba
+substring of "ababc" from "0" - grapheme_substr with length 10 = ababc == ababc
+substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length 10 
= aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
 substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr = Opq == Opq
 substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -1 
= Op == Op
 substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -2 
= O == O



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