]> granicus.if.org Git - php/commitdiff
fix const warnings in intl methods
authorStanislav Malyshev <stas@php.net>
Mon, 21 Oct 2013 05:32:20 +0000 (22:32 -0700)
committerStanislav Malyshev <stas@php.net>
Mon, 21 Oct 2013 06:04:38 +0000 (23:04 -0700)
ext/intl/collator/collator_create.c
ext/intl/formatter/formatter_main.c
ext/intl/locale/locale_methods.c
ext/intl/msgformat/msgformat.c
ext/intl/msgformat/msgformat_format.c
ext/intl/msgformat/msgformat_parse.c

index b2a8c7f6bac074f37073350a63b1c54465def1ef..7ed4c534394b48fdebe25873d47c90dc57bf9b99 100644 (file)
@@ -27,7 +27,7 @@
 /* {{{ */
 static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
 {
-       char*            locale;
+       const char*      locale;
        int              locale_len = 0;
        zval*            object;
        Collator_object* co;
index d0671a88b5e47de5a818ce411d241116d078ec4d..0a568472c4835906c66d93096584fdcab029c6eb 100644 (file)
@@ -27,7 +27,7 @@
 /* {{{ */
 static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
 {
-       char*       locale;
+       const char* locale;
        char*       pattern = NULL;
        int         locale_len = 0, pattern_len = 0;
        long        style;
index 915f4d5af47d84ca3a25f0d974d9186184fdc3c2..21b5847f2d339428642b5060ef3c824d57f5d877 100644 (file)
@@ -121,7 +121,7 @@ static int16_t findOffset(const char* const* list, const char* key)
 }
 /*}}}*/
 
-static char* getPreferredTag(char* gf_tag)
+static char* getPreferredTag(const char* gf_tag)
 { 
        char* result = NULL;
        int grOffset = 0;
@@ -175,7 +175,7 @@ static int getStrrtokenPos(char* str, int savedPos)
 * returns -1 if no singleton
 * strtok equivalent search for singleton
 */
-static int getSingletonPos(char* str)
+static int getSingletonPos(const char* str)
 {
        int result =-1;
        int i=0;
@@ -251,7 +251,7 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
 * common code shared by get_primary_language,get_script or get_region or get_variant
 * result = 0 if error, 1 if successful , -1 if no value
 */
-static char* get_icu_value_internal( char* loc_name , char* tag_name, int* result , int fromParseLocale)
+static char* get_icu_value_internal( const char* loc_name , char* tag_name, int* result , int fromParseLocale)
 {
        char*           tag_value       = NULL;
        int32_t         tag_value_len   = 512;
@@ -281,7 +281,7 @@ static char* get_icu_value_internal( char* loc_name , char* tag_name, int* resul
                /* Handle singletons */
                if( strcmp(tag_name , LOC_LANG_TAG)==0 ){
                        if( strlen(loc_name)>1 && (isIDPrefix(loc_name) ==1 ) ){
-                               return loc_name;
+                               return (char *)loc_name;
                        }
                }
 
@@ -370,7 +370,7 @@ static char* get_icu_value_internal( char* loc_name , char* tag_name, int* resul
 static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) 
 {
 
-       char*       loc_name            = NULL;
+       const char* loc_name            = NULL;
        int         loc_name_len        = 0;
 
        char*       tag_value           = NULL;
@@ -465,10 +465,10 @@ PHP_FUNCTION(locale_get_primary_language )
  }}} */
 static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) 
 {
-       char*       loc_name            = NULL;
+       const char* loc_name            = NULL;
        int         loc_name_len        = 0;
 
-       char*       disp_loc_name       = NULL;
+       const char* disp_loc_name       = NULL;
        int         disp_loc_name_len   = 0;
        int         free_loc_name       = 0;
 
@@ -561,7 +561,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
                                efree( mod_loc_name );
                        }
                        if (free_loc_name) {
-                               efree(disp_loc_name);
+                               efree((void *)disp_loc_name);
                                disp_loc_name = NULL;
                        }
                        RETURN_FALSE;
@@ -572,7 +572,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
                efree( mod_loc_name );
        }
        if (free_loc_name) {
-               efree(disp_loc_name);
+               efree((void *)disp_loc_name);
                disp_loc_name = NULL;
        }
        /* Convert display locale name from UTF-16 to UTF-8. */
@@ -666,10 +666,10 @@ PHP_FUNCTION( locale_get_keywords )
     UEnumeration*   e        = NULL;
     UErrorCode      status   = U_ZERO_ERROR;
 
-       const char*             kw_key        = NULL;
+    const char*                kw_key        = NULL;
     int32_t         kw_key_len    = 0;
 
-    char*              loc_name        = NULL;
+    const char*        loc_name        = NULL;
     int                        loc_name_len    = 0;
 
 /* 
@@ -716,7 +716,7 @@ PHP_FUNCTION( locale_get_keywords )
                                kw_value = erealloc( kw_value , kw_value_len+1);
                        } 
                        if (U_FAILURE(status)) {
-                       intl_error_set( NULL, FAILURE, "locale_get_keywords: Error encountered while getting the keyword  value for the  keyword", 0 TSRMLS_CC );
+                               intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_get_keywords: Error encountered while getting the keyword  value for the  keyword", 0 TSRMLS_CC );
                                if( kw_value){
                                        efree( kw_value );
                                }
@@ -974,12 +974,12 @@ PHP_FUNCTION(locale_compose)
 * e.g. for locale='en_US-x-prv1-prv2-prv3'
 * returns a pointer to the string 'prv1-prv2-prv3'
 */
-static char* get_private_subtags(char* loc_name)
+static char* get_private_subtags(const char* loc_name)
 {
        char*   result =NULL;
        int     singletonPos = 0;
        int     len =0; 
-       char*   mod_loc_name =NULL;
+       const char*     mod_loc_name =NULL;
 
        if( loc_name && (len = strlen(loc_name)>0 ) ){
                mod_loc_name = loc_name ; 
@@ -1019,7 +1019,7 @@ static char* get_private_subtags(char* loc_name)
 
 /* {{{ code used by locale_parse
 */
-static int add_array_entry(char* loc_name, zval* hash_arr, char* key_name TSRMLS_DC)
+static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name TSRMLS_DC)
 {
        char*   key_value       = NULL;
        char*   cur_key_name    = NULL;
@@ -1084,7 +1084,7 @@ static int add_array_entry(char* loc_name, zval* hash_arr, char* key_name TSRMLS
 */
 PHP_FUNCTION(locale_parse)
 {
-    char*       loc_name        = NULL;
+    const char* loc_name        = NULL;
     int         loc_name_len    = 0;
     int         grOffset       = 0;
 
@@ -1128,8 +1128,8 @@ PHP_FUNCTION(locale_parse)
 */
 PHP_FUNCTION(locale_get_all_variants)
 {
-       char*   loc_name        = NULL;
-       int     loc_name_len    = 0;
+       const char*     loc_name        = NULL;
+       int             loc_name_len    = 0;
 
        int     result          = 0;
        char*   token           = NULL;
@@ -1182,10 +1182,10 @@ PHP_FUNCTION(locale_get_all_variants)
 /*{{{
 * Converts to lower case and also replaces all hyphens with the underscore
 */
-static int strToMatch(char* str ,char *retstr)
+static int strToMatch(const char* str ,char *retstr)
 {
        char*   anchor  = NULL;
-       char*   anchor1 = NULL;
+       const char*     anchor1 = NULL;
        int     result  = 0;
        int     len     = 0;
 
@@ -1225,7 +1225,7 @@ PHP_FUNCTION(locale_filter_matches)
 {
        char*           lang_tag        = NULL;
        int             lang_tag_len    = 0;
-       char*           loc_range       = NULL;
+       const char*     loc_range       = NULL;
        int             loc_range_len   = 0;
 
        int             result          = 0;
@@ -1401,7 +1401,7 @@ static void array_cleanup( char* arr[] , int arr_size)
 * returns the lookup result to lookup_loc_range_src_php 
 * internal function
 */
-static char* lookup_loc_range(char* loc_range, HashTable* hash_arr, int canonicalize  TSRMLS_DC)
+static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int canonicalize  TSRMLS_DC)
 {
        int     i = 0;
        int     cur_arr_len = 0;
@@ -1523,7 +1523,7 @@ PHP_FUNCTION(locale_lookup)
 {
        char*           fallback_loc            = NULL;
        int             fallback_loc_len        = 0;
-       char*           loc_range               = NULL;
+       const char*     loc_range               = NULL;
        int             loc_range_len           = 0;
 
        zval*           arr                             = NULL;
index 6a9f04f32b46390fcb72ea50ce380f6bc1c4a937..7d8cd958e3c08252c0c6db1271814ab7f7ddbe63 100644 (file)
@@ -28,7 +28,7 @@
 /* {{{ */
 static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) 
 {
-       char*       locale;
+       const char* locale;
        char*       pattern;
        int         locale_len = 0, pattern_len = 0;
        UChar*      spattern     = NULL;
index 4b81cfe2b454cbdd56988cadd064d53d8bec0805..55ec9e84ba0e8ed5243c59cf0481e0efd5d653b0 100644 (file)
@@ -103,7 +103,7 @@ PHP_FUNCTION( msgfmt_format_message )
        int         spattern_len = 0;
        char       *pattern = NULL;
        int         pattern_len = 0;
-       char       *slocale = NULL;
+       const char *slocale = NULL;
        int         slocale_len = 0;
        MessageFormatter_object mf = {0};
        MessageFormatter_object *mfo = &mf;
index 413d3b1f15d895cc36d97e22d85257360a4eec35..14a6363424bf099d565f79d5f1430b733c9938d8 100644 (file)
@@ -93,7 +93,7 @@ PHP_FUNCTION( msgfmt_parse_message )
        int         spattern_len = 0;
        char       *pattern = NULL;
        int         pattern_len = 0;
-       char       *slocale = NULL;
+       const char *slocale = NULL;
        int         slocale_len = 0;
        char       *source = NULL;
        int         src_len = 0;