--- embedaddon/php/ext/intl/locale/locale_methods.c 2012/02/21 23:47:56 1.1.1.1 +++ embedaddon/php/ext/intl/locale/locale_methods.c 2014/06/15 20:03:49 1.1.1.4 @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: locale_methods.c,v 1.1.1.1 2012/02/21 23:47:56 misho Exp $ */ +/* $Id: locale_methods.c,v 1.1.1.4 2014/06/15 20:03:49 misho Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -127,6 +127,9 @@ static char* getPreferredTag(char* gf_tag) int grOffset = 0; grOffset = findOffset( LOC_GRANDFATHERED ,gf_tag); + if(grOffset < 0) { + return NULL; + } if( grOffset < LOC_PREFERRED_GRANDFATHERED_LEN ){ /* return preferred tag */ result = estrdup( LOC_PREFERRED_GRANDFATHERED[grOffset] ); @@ -527,7 +530,7 @@ static void get_icu_disp_value_src_php( char* tag_name /* Get the disp_value for the given locale */ do{ - disp_name = erealloc( disp_name , buflen ); + disp_name = erealloc( disp_name , buflen * sizeof(UChar) ); disp_name_len = buflen; if( strcmp(tag_name , LOC_LANG_TAG)==0 ){ @@ -542,6 +545,7 @@ static void get_icu_disp_value_src_php( char* tag_name buflen = uloc_getDisplayName ( mod_loc_name , disp_loc_name , disp_name , disp_name_len , &status); } + /* U_STRING_NOT_TERMINATED_WARNING is admissible here; don't look for it */ if( U_FAILURE( status ) ) { if( status == U_BUFFER_OVERFLOW_ERROR ) @@ -1562,11 +1566,11 @@ PHP_FUNCTION(locale_lookup) /* }}} */ /* {{{ proto string Locale::acceptFromHttp(string $http_accept) -* Tries to find out best available locale based on HTTP “Accept-Language” header +* Tries to find out best available locale based on HTTP �Accept-Language� header */ /* }}} */ /* {{{ proto string locale_accept_from_http(string $http_accept) -* Tries to find out best available locale based on HTTP “Accept-Language” header +* Tries to find out best available locale based on HTTP �Accept-Language� header */ PHP_FUNCTION(locale_accept_from_http) {