mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
use more suitable types here, too
and simplify the loop
This commit is contained in:
parent
198c2ec5f0
commit
2334d8335b
1 changed files with 35 additions and 39 deletions
|
@ -261,9 +261,9 @@ static zend_string* get_icu_value_internal( const char* loc_name , char* tag_nam
|
||||||
zend_string* tag_value = NULL;
|
zend_string* tag_value = NULL;
|
||||||
int32_t tag_value_len = 512;
|
int32_t tag_value_len = 512;
|
||||||
|
|
||||||
int singletonPos = 0;
|
zend_off_t singletonPos = 0;
|
||||||
char* mod_loc_name = NULL;
|
char* mod_loc_name = NULL;
|
||||||
int grOffset = 0;
|
zend_off_t grOffset = 0;
|
||||||
|
|
||||||
int32_t buflen = 512;
|
int32_t buflen = 512;
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
|
@ -993,16 +993,14 @@ PHP_FUNCTION(locale_compose)
|
||||||
static zend_string* get_private_subtags(const char* loc_name)
|
static zend_string* get_private_subtags(const char* loc_name)
|
||||||
{
|
{
|
||||||
zend_string* result = NULL;
|
zend_string* result = NULL;
|
||||||
int singletonPos = 0;
|
zend_off_t singletonPos = 0;
|
||||||
int len =0;
|
size_t len = 0;
|
||||||
const char* mod_loc_name =NULL;
|
const char* mod_loc_name =NULL;
|
||||||
|
|
||||||
if( loc_name && (len = strlen(loc_name)>0 ) ){
|
if( loc_name && (len = strlen(loc_name)>0 ) ){
|
||||||
mod_loc_name = loc_name ;
|
mod_loc_name = loc_name ;
|
||||||
len = strlen(mod_loc_name);
|
len = strlen(mod_loc_name);
|
||||||
while( (singletonPos = getSingletonPos(mod_loc_name))!= -1){
|
while( (singletonPos = getSingletonPos(mod_loc_name)) > -1){
|
||||||
|
|
||||||
if( singletonPos!=-1){
|
|
||||||
if( (*(mod_loc_name+singletonPos)=='x') || (*(mod_loc_name+singletonPos)=='X') ){
|
if( (*(mod_loc_name+singletonPos)=='x') || (*(mod_loc_name+singletonPos)=='X') ){
|
||||||
/* private subtag start found */
|
/* private subtag start found */
|
||||||
if( singletonPos + 2 == len){
|
if( singletonPos + 2 == len){
|
||||||
|
@ -1015,7 +1013,7 @@ static zend_string* get_private_subtags(const char* loc_name)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if( singletonPos + 1 >= len){
|
if((size_t)(singletonPos + 1) >= len){
|
||||||
/* String end */
|
/* String end */
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1024,8 +1022,6 @@ static zend_string* get_private_subtags(const char* loc_name)
|
||||||
len = strlen(mod_loc_name);
|
len = strlen(mod_loc_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} /* end of while */
|
} /* end of while */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue