@@ -219,7 +219,7 @@ PHP_NAMED_FUNCTION(zif_locale_get_default)
219
219
/* {{{ proto static string Locale::setDefault( string $locale )
220
220
Set default locale */
221
221
/* }}} */
222
- /* {{{ proto static string locale_set_default( string $locale )
222
+ /* {{{ proto sta tic string locale_set_default( string $locale )
223
223
Set default locale */
224
224
PHP_NAMED_FUNCTION (zif_locale_set_default )
225
225
{
@@ -258,15 +258,15 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
258
258
*/
259
259
static zend_string * get_icu_value_internal ( const char * loc_name , char * tag_name , int * result , int fromParseLocale )
260
260
{
261
- zend_string * tag_value = NULL ;
262
- int32_t tag_value_len = 512 ;
261
+ zend_string * tag_value = NULL ;
262
+ int32_t tag_value_len = 512 ;
263
263
264
- int singletonPos = 0 ;
265
- char * mod_loc_name = NULL ;
266
- int grOffset = 0 ;
264
+ zend_off_t singletonPos = 0 ;
265
+ char * mod_loc_name = NULL ;
266
+ zend_off_t grOffset = 0 ;
267
267
268
- int32_t buflen = 512 ;
269
- UErrorCode status = U_ZERO_ERROR ;
268
+ int32_t buflen = 512 ;
269
+ UErrorCode status = U_ZERO_ERROR ;
270
270
271
271
272
272
if ( strcmp (tag_name , LOC_CANONICALIZE_TAG ) != 0 ){
@@ -433,12 +433,12 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
433
433
}
434
434
435
435
}
436
- /* }}} */
436
+ /* }}} */
437
437
438
- /* {{{ proto static string Locale::getScript($locale)
438
+ /* {{{ proto stat ic string Locale::getScript($locale)
439
439
* gets the script for the $locale
440
440
}}} */
441
- /* {{{ proto static string locale_get_script($locale)
441
+ /* {{{ proto stati c string locale_get_script($locale)
442
442
* gets the script for the $locale
443
443
*/
444
444
PHP_FUNCTION ( locale_get_script )
@@ -449,8 +449,8 @@ PHP_FUNCTION( locale_get_script )
449
449
450
450
/* {{{ proto static string Locale::getRegion($locale)
451
451
* gets the region for the $locale
452
- }}} */
453
- /* {{{ proto static string locale_get_region($locale)
452
+ }}} */
453
+ /* {{{ p roto static string locale_get_region($locale)
454
454
* gets the region for the $locale
455
455
*/
456
456
PHP_FUNCTION ( locale_get_region )
@@ -992,40 +992,36 @@ PHP_FUNCTION(locale_compose)
992
992
*/
993
993
static zend_string * get_private_subtags (const char * loc_name )
994
994
{
995
- zend_string * result = NULL ;
996
- int singletonPos = 0 ;
997
- int len = 0 ;
998
- const char * mod_loc_name = NULL ;
995
+ zend_string * result = NULL ;
996
+ zend_off_t singletonPos = 0 ;
997
+ size_t len = 0 ;
998
+ const char * mod_loc_name = NULL ;
999
999
1000
1000
if ( loc_name && (len = strlen (loc_name )> 0 ) ){
1001
1001
mod_loc_name = loc_name ;
1002
1002
len = strlen (mod_loc_name );
1003
- while ( (singletonPos = getSingletonPos (mod_loc_name ))!= -1 ){
1004
-
1005
- if ( singletonPos != -1 ){
1006
- if ( (* (mod_loc_name + singletonPos )== 'x' ) || (* (mod_loc_name + singletonPos )== 'X' ) ){
1007
- /* private subtag start found */
1008
- if ( singletonPos + 2 == len ){
1009
- /* loc_name ends with '-x-' ; return NULL */
1010
- }
1011
- else {
1012
- /* result = mod_loc_name + singletonPos +2; */
1013
- result = zend_string_init (mod_loc_name + singletonPos + 2 , (len - ( singletonPos + 2 ) ), 0 );
1014
- }
1015
- break ;
1003
+ while ( (singletonPos = getSingletonPos (mod_loc_name )) > -1 ){
1004
+ if ( (* (mod_loc_name + singletonPos )== 'x' ) || (* (mod_loc_name + singletonPos )== 'X' ) ){
1005
+ /* private subtag start found */
1006
+ if ( singletonPos + 2 == len ){
1007
+ /* loc_name ends with '-x-' ; return NULL */
1016
1008
}
1017
1009
else {
1018
- if ( singletonPos + 1 >= len ){
1019
- /* String end */
1020
- break ;
1021
- } else {
1022
- /* singleton found but not a private subtag , hence check further in the string for the private subtag */
1023
- mod_loc_name = mod_loc_name + singletonPos + 1 ;
1024
- len = strlen (mod_loc_name );
1025
- }
1010
+ /* result = mod_loc_name + singletonPos +2; */
1011
+ result = zend_string_init (mod_loc_name + singletonPos + 2 , (len - ( singletonPos + 2 ) ), 0 );
1012
+ }
1013
+ break ;
1014
+ }
1015
+ else {
1016
+ if ((size_t )(singletonPos + 1 ) >= len ){
1017
+ /* String end */
1018
+ break ;
1019
+ } else {
1020
+ /* singleton found but not a private subtag , hence check further in the string for the private subtag */
1021
+ mod_loc_name = mod_loc_name + singletonPos + 1 ;
1022
+ len = strlen (mod_loc_name );
1026
1023
}
1027
1024
}
1028
-
1029
1025
} /* end of while */
1030
1026
}
1031
1027
0 commit comments