Skip to content

Commit

Permalink
Clean up some of the Android icu4c hacks.
Browse files Browse the repository at this point in the history
We don't need the ustr_wcs.cpp hack: bionic's stdlib.h contains
the same #define.

We don't need the digitlst.cpp hack: we can just modify the makefile
so we can use stlport.

We don't need most of the putil.cpp hacks, and the two we do need can
be done in the makefile.

Change-Id: If67d307688347f9c04febed3ecfe6f36b7effc9d
  • Loading branch information
enh-google committed Nov 28, 2012
1 parent a65434f commit 239e8b5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 35 deletions.
13 changes: 10 additions & 3 deletions common/Android.mk
Expand Up @@ -123,8 +123,15 @@ c_includes := \
local_cflags := '-DICU_DATA_DIR_PREFIX_ENV_VAR="ANDROID_ROOT"'
local_cflags += '-DICU_DATA_DIR="/usr/icu"'

local_cflags += -D_REENTRANT -DU_COMMON_IMPLEMENTATION -O3 -fvisibility=hidden
local_ldlibs := -lpthread -lm
# bionic doesn't have <langinfo.h>.
local_cflags += -DU_HAVE_NL_LANGINFO_CODESET=0
# bionic has timezone instead of __timezone.
local_cflags += -DU_TIMEZONE=timezone

local_cflags += -D_REENTRANT -DU_COMMON_IMPLEMENTATION

local_cflags += -O3 -fvisibility=hidden
local_ldlibs := -ldl -lm -lpthread


#
Expand All @@ -137,7 +144,7 @@ LOCAL_C_INCLUDES := $(c_includes) \
abi/cpp/include
LOCAL_CFLAGS := $(local_cflags) -DPIC -fPIC
LOCAL_RTTI_FLAG := -frtti
LOCAL_SHARED_LIBRARIES += libgabi++
LOCAL_SHARED_LIBRARIES += libgabi++ libdl
LOCAL_LDLIBS += $(local_ldlibs)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libicuuc
Expand Down
9 changes: 0 additions & 9 deletions common/putil.cpp
Expand Up @@ -128,15 +128,6 @@
*
*/

/* BEGIN android-changed */
/* TODO(ccornelius): move to right place. Use __ANDROID__ */
#define HAVE_DLOPEN 0
#define U_HAVE_NL_LANGINFO_CODESET 0
#undef U_TZSET
#undef U_TIMEZONE
#undef U_TZNAME
/* END android-changed */

#if U_HAVE_NL_LANGINFO_CODESET
#include <langinfo.h>
#endif
Expand Down
7 changes: 0 additions & 7 deletions common/ustr_wcs.cpp
Expand Up @@ -25,13 +25,6 @@
#include "ustr_imp.h"
#include "ustr_cnv.h"

/* BEGIN android-changed */
#ifdef HAVE_ANDROID_OS
/* Android has stubbed out wchar support, where sizeof(wchar_t) == 1. */
#define MB_CUR_MAX (1)
#endif
/* END android-changed */

#if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION

#define _STACK_BUFFER_CAPACITY 1000
Expand Down
9 changes: 6 additions & 3 deletions i18n/Android.mk
Expand Up @@ -96,11 +96,14 @@ local_ldlibs := -lpthread -lm

include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(src_files)
LOCAL_C_INCLUDES := $(c_includes) \
abi/cpp/include
LOCAL_C_INCLUDES += $(c_includes) \
abi/cpp/include \
bionic \
bionic/libstdc++/include \
external/stlport/stlport
LOCAL_CFLAGS += $(local_cflags) -DPIC -fPIC
LOCAL_RTTI_FLAG := -frtti
LOCAL_SHARED_LIBRARIES += libicuuc libgabi++
LOCAL_SHARED_LIBRARIES += libicuuc libgabi++ libstlport
LOCAL_LDLIBS += $(local_ldlibs)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libicui18n
Expand Down
13 changes: 0 additions & 13 deletions i18n/digitlst.cpp
Expand Up @@ -38,11 +38,7 @@
#include <limits.h>
#include <string.h>
#include <stdio.h>
#ifdef ANDROID
#include <math.h>
#else
#include <limits>
#endif

// ***************************************************************************
// class DigitList
Expand Down Expand Up @@ -445,20 +441,11 @@ DigitList::getDouble() const
tDouble /= -1;
}
} else if (isInfinite()) {
// BEGIN android-changed
// There is no numeric_limits template member in Android std nor
// INFINITY defined in math.h of ICU Linux build.
#ifdef INFINITY
tDouble = INFINITY;
#else
if (std::numeric_limits<double>::has_infinity) {
tDouble = std::numeric_limits<double>::infinity();
} else {
tDouble = std::numeric_limits<double>::max();
}
#endif
// END android-changed

if (!isPositive()) {
tDouble = -tDouble; //this was incorrectly "-fDouble" originally.
}
Expand Down

0 comments on commit 239e8b5

Please sign in to comment.