Browse Source

Use recommended way to handle utf*.h headers and obsolete symbols

pull/3207/merge
Anatol Belski 8 years ago
parent
commit
9a8e7b5718
  1. 4
      acinclude.m4
  2. 2
      ext/intl/config.m4
  3. 2
      ext/intl/config.w32
  4. 4
      ext/intl/converter/converter.c
  5. 7
      ext/intl/grapheme/grapheme_string.c
  6. 3
      ext/intl/normalizer/normalizer_normalize.c
  7. 3
      ext/intl/uchar/uchar.c

4
acinclude.m4

@ -2241,6 +2241,10 @@ AC_DEFUN([PHP_SETUP_ICU],[
ICU_CXXFLAGS=`$ICU_CONFIG --cxxflags`
if test "$icu_version" -ge "49000"; then
ICU_CXXFLAGS="$ICU_CXXFLAGS -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit"
ICU_CFLAGS="-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
fi
if test "$icu_version" -ge "60000"; then
ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
fi
fi
])

2
ext/intl/config.m4

@ -9,7 +9,7 @@ if test "$PHP_INTL" != "no"; then
PHP_SETUP_ICU(INTL_SHARED_LIBADD)
PHP_SUBST(INTL_SHARED_LIBADD)
PHP_REQUIRE_CXX()
INTL_COMMON_FLAGS="$ICU_INCS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
INTL_COMMON_FLAGS="$ICU_INCS $ICU_CFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
if test "$icu_version" -ge "4002"; then
icu_spoof_src=" spoofchecker/spoofchecker_class.c \
spoofchecker/spoofchecker.c\

2
ext/intl/config.w32

@ -129,7 +129,7 @@ if (PHP_INTL != "no") {
ADD_FLAG("LIBS_INTL", "iculx.lib");
}
ADD_FLAG("CFLAGS_INTL", "/EHsc /DUNISTR_FROM_CHAR_EXPLICIT=explicit /DUNISTR_FROM_STRING_EXPLICIT=explicit");
ADD_FLAG("CFLAGS_INTL", "/EHsc /DUNISTR_FROM_CHAR_EXPLICIT=explicit /DUNISTR_FROM_STRING_EXPLICIT=explicit /DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 /DU_HIDE_OBSOLETE_UTF_OLD_H=1");
AC_DEFINE("HAVE_INTL", 1, "Internationalization support enabled");
} else {
WARNING("intl not enabled; libraries and/or headers not found");

4
ext/intl/converter/converter.c

@ -18,6 +18,10 @@
#include "zend_exceptions.h"
#include <unicode/utypes.h>
#if U_ICU_VERSION_MAJOR_NUM >= 49
#include <unicode/utf8.h>
#include <unicode/utf16.h>
#endif
#include <unicode/ucnv.h>
#include <unicode/ustring.h>

7
ext/intl/grapheme/grapheme_string.c

@ -24,6 +24,9 @@
#include "grapheme_util.h"
#include <unicode/utypes.h>
#if U_ICU_VERSION_MAJOR_NUM >= 49
#include <unicode/utf8.h>
#endif
#include <unicode/ucol.h>
#include <unicode/ustring.h>
#include <unicode/ubrk.h>
@ -835,10 +838,10 @@ PHP_FUNCTION(grapheme_extract)
pstr = str + start;
/* just in case pstr points in the middle of a character, move forward to the start of the next char */
if ( !UTF8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
if ( !U8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
char *str_end = str + str_len;
while ( !UTF8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
while ( !U8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
pstr++;
if ( pstr >= str_end ) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,

3
ext/intl/normalizer/normalizer_normalize.c

@ -24,6 +24,9 @@
#include "normalizer_class.h"
#include "normalizer_normalize.h"
#include "intl_convert.h"
#if U_ICU_VERSION_MAJOR_NUM >= 49
#include <unicode/utf8.h>
#endif
/* {{{ proto string Normalizer::normalize( string $input [, string $form = FORM_C] )
* Normalize a string. }}} */

3
ext/intl/uchar/uchar.c

@ -3,6 +3,9 @@
#include "intl_convert.h"
#include <unicode/uchar.h>
#if U_ICU_VERSION_MAJOR_NUM >= 49
#include <unicode/utf8.h>
#endif
#define IC_METHOD(mname) PHP_METHOD(IntlChar, mname)

Loading…
Cancel
Save