Commit:    06954d1bc1966ade0815db3f4ec8983b954950c1
Author:    Stanislav Malyshev <s...@php.net>         Sun, 20 Oct 2013 22:32:20 
-0700
Parents:   444612cdc48d68e94c5a94aa47153a2b3933470a
Branches:  master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=06954d1bc1966ade0815db3f4ec8983b954950c1

Log:
fix const warnings in intl methods

Changed paths:
  M  ext/intl/collator/collator_create.c
  M  ext/intl/formatter/formatter_main.c
  M  ext/intl/locale/locale_methods.c
  M  ext/intl/msgformat/msgformat.c
  M  ext/intl/msgformat/msgformat_format.c
  M  ext/intl/msgformat/msgformat_parse.c

diff --git a/ext/intl/collator/collator_create.c 
b/ext/intl/collator/collator_create.c
index b2a8c7f..7ed4c53 100644
--- a/ext/intl/collator/collator_create.c
+++ b/ext/intl/collator/collator_create.c
@@ -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;
diff --git a/ext/intl/formatter/formatter_main.c 
b/ext/intl/formatter/formatter_main.c
index d0671a8..0a56847 100644
--- a/ext/intl/formatter/formatter_main.c
+++ b/ext/intl/formatter/formatter_main.c
@@ -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;
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 915f4d5..21b5847 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -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;
diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c
index 6a9f04f..7d8cd95 100644
--- a/ext/intl/msgformat/msgformat.c
+++ b/ext/intl/msgformat/msgformat.c
@@ -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;
diff --git a/ext/intl/msgformat/msgformat_format.c 
b/ext/intl/msgformat/msgformat_format.c
index 4b81cfe..55ec9e8 100644
--- a/ext/intl/msgformat/msgformat_format.c
+++ b/ext/intl/msgformat/msgformat_format.c
@@ -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;
diff --git a/ext/intl/msgformat/msgformat_parse.c 
b/ext/intl/msgformat/msgformat_parse.c
index 413d3b1..14a6363 100644
--- a/ext/intl/msgformat/msgformat_parse.c
+++ b/ext/intl/msgformat/msgformat_parse.c
@@ -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;
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to