]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/misc: allow disabling ICU at compile time.
authorVMware, Inc <>
Thu, 27 Oct 2011 18:36:48 +0000 (11:36 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 27 Oct 2011 18:36:48 +0000 (11:36 -0700)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/configure.ac
open-vm-tools/lib/misc/Makefile.am
open-vm-tools/lib/misc/codeset.c
open-vm-tools/lib/misc/codesetBase.c

index ca7a044857dd98d37eb0283a4f18c87c2fafd1d5..0407e21dd5c78d689b0dd342f87bfae9539b4d1f 100644 (file)
@@ -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(
index 0089f56ab30753f75fd0884142c213f0c55018a4..933f2b9eaa18bbff7b457238145bd78410e73b76 100644 (file)
@@ -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
-
index f315851f9237bc7aa26d1b33bb9c393e5bfbfa9f..ac0e845b8525b792ba7d3ce0c4df907eacf93f9d 100644 (file)
 #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
 }
 
index dfdecdd7542b20cbc1caaeafe6d82a9d06ce3d59..8c4611b1446a70c33658e19485cc9dd4a9a69f23 100644 (file)
 #include <stdlib.h>
 #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();
+}
+
+
 /*
  *-----------------------------------------------------------------------------
  *