diff options
Diffstat (limited to 'ext/intl')
-rwxr-xr-x | ext/intl/msgformat/msgformat.c | 2 | ||||
-rwxr-xr-x | ext/intl/msgformat/msgformat_attr.c | 2 | ||||
-rwxr-xr-x | ext/intl/msgformat/msgformat_class.h | 12 | ||||
-rwxr-xr-x | ext/intl/msgformat/msgformat_data.c | 2 | ||||
-rwxr-xr-x | ext/intl/msgformat/msgformat_data.h | 7 | ||||
-rwxr-xr-x | ext/intl/msgformat/msgformat_format.c | 2 | ||||
-rwxr-xr-x | ext/intl/msgformat/msgformat_parse.c | 2 |
7 files changed, 24 insertions, 5 deletions
diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 84f14de1bd..0a01204fae 100755 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -64,9 +64,11 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) locale = INTL_G(default_locale); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { INTL_CTOR_CHECK_STATUS(mfo, "msgfmt_create: error converting pattern to quote-friendly format"); } +#endif if ((mfo)->mf_data.orig_format) { msgformat_data_free(&mfo->mf_data TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c index cf34665142..ed2dae27d1 100755 --- a/ext/intl/msgformat/msgformat_attr.c +++ b/ext/intl/msgformat/msgformat_attr.c @@ -82,11 +82,13 @@ PHP_FUNCTION( msgfmt_set_pattern ) intl_convert_utf8_to_utf16(&spattern, &spattern_len, value, value_len, &INTL_DATA_ERROR_CODE(mfo)); INTL_METHOD_CHECK_STATUS(mfo, "Error converting pattern to UTF-16" ); +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_set_pattern: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* TODO: add parse error information */ umsg_applyPattern(MSG_FORMAT_OBJECT(mfo), spattern, spattern_len, NULL, &INTL_DATA_ERROR_CODE(mfo)); diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h index 0afa792ae3..b6b8e33226 100755 --- a/ext/intl/msgformat/msgformat_class.h +++ b/ext/intl/msgformat/msgformat_class.h @@ -19,9 +19,11 @@ #include <php.h> -#include "intl_common.h" -#include "intl_error.h" -#include "intl_data.h" +#include <unicode/uconfig.h> + +#include "../intl_common.h" +#include "../intl_error.h" +#include "../intl_data.h" #include "msgformat_data.h" typedef struct { @@ -38,4 +40,8 @@ extern zend_class_entry *MessageFormatter_ce_ptr; #define MSG_FORMAT_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(MessageFormatter, mfo) #define MSG_FORMAT_OBJECT(mfo) (mfo)->mf_data.umsgf +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM < 48 +# define MSG_FORMAT_QUOTE_APOS 1 +#endif + #endif // #ifndef MSG_FORMAT_CLASS_H diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c index 95e81d3ea7..4f93d6d98c 100755 --- a/ext/intl/msgformat/msgformat_data.c +++ b/ext/intl/msgformat/msgformat_data.c @@ -69,6 +69,7 @@ msgformat_data* msgformat_data_create( TSRMLS_D ) } /* }}} */ +#ifdef MSG_FORMAT_QUOTE_APOS int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec) { if(*spattern && *spattern_len && u_strchr(*spattern, (UChar)'\'')) { @@ -86,6 +87,7 @@ int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *e } return SUCCESS; } +#endif /* diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h index 44001753b3..6479888f8f 100755 --- a/ext/intl/msgformat/msgformat_data.h +++ b/ext/intl/msgformat/msgformat_data.h @@ -19,9 +19,9 @@ #include <php.h> -#include <unicode/umsg.h> +#include "../intl_error.h" -#include "intl_error.h" +#include <unicode/umsg.h> typedef struct { // error hangling @@ -36,6 +36,9 @@ typedef struct { msgformat_data* msgformat_data_create( TSRMLS_D ); void msgformat_data_init( msgformat_data* mf_data TSRMLS_DC ); void msgformat_data_free( msgformat_data* mf_data TSRMLS_DC ); + +#ifdef MSG_FORMAT_QUOTE_APOS int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec); +#endif #endif // MSG_FORMAT_DATA_H diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index b664c83ec1..9a18ac0a70 100755 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -154,11 +154,13 @@ PHP_FUNCTION( msgfmt_format_message ) slocale = INTL_G(default_locale); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_format_message: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* Create an ICU message formatter. */ MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, slocale, NULL, &INTL_DATA_ERROR_CODE(mfo)); diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c index 8393d4c6e3..f540b1d0c4 100755 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -129,11 +129,13 @@ PHP_FUNCTION( msgfmt_parse_message ) slocale = INTL_G(default_locale); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_parse_message: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* Create an ICU message formatter. */ MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, slocale, NULL, &INTL_DATA_ERROR_CODE(mfo)); |