Commit: 9c5074a484b7f10e65471a21a7ef50dda8391509 Author: Gustavo André dos Santos Lopes <cataphr...@php.net> Mon, 25 Jun 2012 10:59:58 +0200 Parents: ee8b9d5c6f7390a56b277b170e2e3baee5c74bf4 Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9c5074a484b7f10e65471a21a7ef50dda8391509 Log: Fix undeclared intl_locale_get_default() This was causing segfaults at least in the resourcebundle constructor. Also moved intl_locale_get_default() to a more central location and fixed a constness warning in resourcebundle_ctor(). Changed paths: M ext/intl/calendar/calendar_methods.cpp M ext/intl/calendar/gregoriancalendar_methods.cpp M ext/intl/locale/locale.h M ext/intl/locale/locale_methods.c M ext/intl/php_intl.c M ext/intl/php_intl.h M ext/intl/resourcebundle/resourcebundle_class.c M ext/intl/timezone/timezone_methods.cpp Diff: diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 8562a2d..539b11a 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -25,12 +25,12 @@ #include <unicode/ustring.h> #include "../intl_convertcpp.h" extern "C" { +#include "../php_intl.h" #define USE_TIMEZONE_POINTER 1 #include "../timezone/timezone_class.h" #define USE_CALENDAR_POINTER 1 #include "calendar_class.h" #include "../intl_convert.h" -#include "../locale/locale.h" #include <zend_exceptions.h> #include <zend_interfaces.h> #include <ext/date/php_date.h> diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index 47e8463..3c05253 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -24,11 +24,11 @@ #include <unicode/calendar.h> #include <unicode/gregocal.h> extern "C" { +#include "../php_intl.h" #define USE_TIMEZONE_POINTER 1 #include "../timezone/timezone_class.h" #define USE_CALENDAR_POINTER 1 #include "calendar_class.h" -#include "../locale/locale.h" #include <ext/date/php_date.h> } diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h index 0aaab4b..f3859c7 100755 --- a/ext/intl/locale/locale.h +++ b/ext/intl/locale/locale.h @@ -22,8 +22,6 @@ #include <php.h> void locale_register_constants( INIT_FUNC_ARGS ); - -const char *intl_locale_get_default( TSRMLS_D ); #define OPTION_DEFAULT NULL #define LOC_LANG_TAG "language" diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 466dba1..936e314 100755 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -201,14 +201,6 @@ static int getSingletonPos(char* str) } /* }}} */ -const char *intl_locale_get_default( TSRMLS_D ) -{ - if( INTL_G(default_locale) == NULL ) { - return uloc_getDefault(); - } - return INTL_G(default_locale); -} - /* {{{ proto static string Locale::getDefault( ) Get default locale */ /* }}} */ diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 59272db..e0d1081 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -109,6 +109,14 @@ ZEND_DECLARE_MODULE_GLOBALS( intl ) +const char *intl_locale_get_default( TSRMLS_D ) +{ + if( INTL_G(default_locale) == NULL ) { + return uloc_getDefault(); + } + return INTL_G(default_locale); +} + /* {{{ Arguments info */ ZEND_BEGIN_ARG_INFO_EX(collator_static_0_args, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h index c3d5c60..7a71123 100755 --- a/ext/intl/php_intl.h +++ b/ext/intl/php_intl.h @@ -69,6 +69,8 @@ PHP_RINIT_FUNCTION(intl); PHP_RSHUTDOWN_FUNCTION(intl); PHP_MINFO_FUNCTION(intl); +const char *intl_locale_get_default( TSRMLS_D ); + #define PHP_INTL_VERSION "1.1.0" #endif /* PHP_INTL_H */ diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 3d7fd5f..7f1529e 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -78,13 +78,11 @@ static zend_object_value ResourceBundle_object_create( zend_class_entry *ce TSRM /* {{{ ResourceBundle_ctor */ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) { - char * bundlename; - int bundlename_len = 0; - char * locale; - int locale_len = 0; - zend_bool fallback = 1; - - char * pbuf; + const char *bundlename; + int bundlename_len = 0; + const char *locale; + int locale_len = 0; + zend_bool fallback = 1; zval *object = return_value; ResourceBundle_object *rb = (ResourceBundle_object *) zend_object_store_get_object( object TSRMLS_CC); @@ -116,6 +114,7 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) if (!fallback && (INTL_DATA_ERROR_CODE(rb) == U_USING_FALLBACK_WARNING || INTL_DATA_ERROR_CODE(rb) == U_USING_DEFAULT_WARNING)) { + char *pbuf; intl_errors_set_code(NULL, INTL_DATA_ERROR_CODE(rb) TSRMLS_CC); spprintf(&pbuf, 0, "resourcebundle_ctor: Cannot load libICU resource " "'%s' without fallback from %s to %s", diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index 1435679..caf5dcd 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -25,10 +25,10 @@ #include <unicode/ustring.h> #include "intl_convertcpp.h" extern "C" { +#include "../php_intl.h" #define USE_TIMEZONE_POINTER 1 #include "timezone_class.h" #include "intl_convert.h" -#include "../locale/locale.h" #include <zend_exceptions.h> #include <ext/date/php_date.h> } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php