From: VMware, Inc <> Date: Thu, 27 Oct 2011 18:36:48 +0000 (-0700) Subject: lib/misc: allow disabling ICU at compile time. X-Git-Tag: 2011.10.26-514583~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=456240cd854f849d5ff710eabcd32bf917709272;p=thirdparty%2Fopen-vm-tools.git lib/misc: allow disabling ICU at compile time. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac index ca7a04485..0407e21dd 100644 --- a/open-vm-tools/configure.ac +++ b/open-vm-tools/configure.ac @@ -744,6 +744,8 @@ if test "$with_icu" = "yes"; then # Easier to give all modules the ICU defines/includes... CPPFLAGS="$CPPFLAGS $ICU_CPPFLAGS" +else + CPPFLAGS="$CPPFLAGS -DNO_ICU" fi AC_PATH_PROG( diff --git a/open-vm-tools/lib/misc/Makefile.am b/open-vm-tools/lib/misc/Makefile.am index 0089f56ab..933f2b9ea 100644 --- a/open-vm-tools/lib/misc/Makefile.am +++ b/open-vm-tools/lib/misc/Makefile.am @@ -20,6 +20,7 @@ noinst_LTLIBRARIES = libMisc.la libMisc_la_SOURCES = libMisc_la_SOURCES += atomic.c libMisc_la_SOURCES += base64.c +libMisc_la_SOURCES += codeset.c libMisc_la_SOURCES += codesetBase.c libMisc_la_SOURCES += codesetOld.c libMisc_la_SOURCES += dynarray.c @@ -46,7 +47,3 @@ libMisc_la_SOURCES += vmstdio.c libMisc_la_SOURCES += strutil.c libMisc_la_SOURCES += vthreadBase.c -if HAVE_ICU -libMisc_la_SOURCES += codeset.c -endif - diff --git a/open-vm-tools/lib/misc/codeset.c b/open-vm-tools/lib/misc/codeset.c index f315851f9..ac0e845b8 100644 --- a/open-vm-tools/lib/misc/codeset.c +++ b/open-vm-tools/lib/misc/codeset.c @@ -74,9 +74,11 @@ #include "vmware.h" #include "vm_product.h" #include "vm_atomic.h" -#include "unicode/ucnv.h" -#include "unicode/udata.h" -#include "unicode/putil.h" +#if !defined(NO_ICU) +# include "unicode/ucnv.h" +# include "unicode/udata.h" +# include "unicode/putil.h" +#endif #include "file.h" #include "util.h" #include "codeset.h" @@ -137,6 +139,8 @@ static Bool dontUseIcu = TRUE; * Functions */ +#if !defined NO_ICU + #ifdef _WIN32 /* @@ -274,6 +278,8 @@ CodeSetGetModulePath(uint32 priv) #endif // _WIN32 +#endif // !NO_ICU + /* *----------------------------------------------------------------------------- @@ -383,6 +389,10 @@ Bool CodeSet_Init(const char *icuDataDir) // IN: ICU data file location in Current code page. // Default is used if NULL. { +#ifdef NO_ICU + /* Nothing required if not using ICU. */ + return TRUE; +#else // NO_ICU DynBuf dbpath; #ifdef _WIN32 DWORD attribs; @@ -690,6 +700,7 @@ found: DynBuf_Destroy(&dbpath); return ret; +#endif } @@ -837,30 +848,6 @@ CodeSet_Utf8Normalize(const char *bufIn, // IN #endif /* defined(__APPLE__) */ -/* - *----------------------------------------------------------------------------- - * - * CodeSet_GetCurrentCodeSet -- - * - * Return native code set name. Always calls down to - * CodeSetOld_GetCurrentCodeSet. See there for more details. - * - * Results: - * See CodeSetOld_GetCurrentCodeSet. - * - * Side effects: - * See CodeSetOld_GetCurrentCodeSet. - * - *----------------------------------------------------------------------------- - */ - -const char * -CodeSet_GetCurrentCodeSet(void) -{ - return CodeSetOld_GetCurrentCodeSet(); -} - - /* *----------------------------------------------------------------------------- * @@ -887,6 +874,10 @@ CodeSet_GenericToGenericDb(const char *codeIn, // IN unsigned int flags, // IN DynBuf *db) // IN/OUT { +#if defined(NO_ICU) + return CodeSetOld_GenericToGenericDb(codeIn, bufIn, sizeIn, codeOut, + flags, db); +#else Bool result = FALSE; UErrorCode uerr; const char *bufInCur; @@ -1055,6 +1046,7 @@ CodeSet_GenericToGenericDb(const char *codeIn, // IN } return result; +#endif } @@ -1604,6 +1596,9 @@ CodeSet_Utf16beToCurrent(const char *bufIn, // IN Bool CodeSet_IsEncodingSupported(const char *name) // IN { +#if defined(NO_ICU) + return CodeSetOld_IsEncodingSupported(name); +#else UConverter *cv; UErrorCode uerr; @@ -1626,6 +1621,7 @@ CodeSet_IsEncodingSupported(const char *name) // IN } return FALSE; +#endif } @@ -1651,6 +1647,9 @@ CodeSet_Validate(const char *buf, // IN: the string size_t size, // IN: length of string const char *code) // IN: encoding { +#if defined(NO_ICU) + return CodeSetOld_Validate(buf, size, code); +#else UConverter *cv; UErrorCode uerr; @@ -1685,5 +1684,6 @@ CodeSet_Validate(const char *buf, // IN: the string ucnv_close(cv); return uerr == U_BUFFER_OVERFLOW_ERROR; +#endif } diff --git a/open-vm-tools/lib/misc/codesetBase.c b/open-vm-tools/lib/misc/codesetBase.c index dfdecdd75..8c4611b14 100644 --- a/open-vm-tools/lib/misc/codesetBase.c +++ b/open-vm-tools/lib/misc/codesetBase.c @@ -25,8 +25,34 @@ #include #include "vmware.h" #include "codeset.h" +#include "codesetOld.h" #include "util.h" + +/* + *----------------------------------------------------------------------------- + * + * CodeSet_GetCurrentCodeSet -- + * + * Return native code set name. Always calls down to + * CodeSetOld_GetCurrentCodeSet. See there for more details. + * + * Results: + * See CodeSetOld_GetCurrentCodeSet. + * + * Side effects: + * See CodeSetOld_GetCurrentCodeSet. + * + *----------------------------------------------------------------------------- + */ + +const char * +CodeSet_GetCurrentCodeSet(void) +{ + return CodeSetOld_GetCurrentCodeSet(); +} + + /* *----------------------------------------------------------------------------- *