Disable iconv in tinygettext
This commit is contained in:
parent
842278ffd9
commit
22fb981fca
@ -162,7 +162,7 @@ LOCAL_MODULE := tinygettext
|
||||
LOCAL_PATH := .
|
||||
LOCAL_CPP_FEATURES += rtti exceptions
|
||||
LOCAL_SRC_FILES := $(wildcard ../lib/tinygettext/src/*.cpp)
|
||||
LOCAL_CFLAGS := -I../lib/tinygettext/include
|
||||
LOCAL_CFLAGS := -I../lib/tinygettext/include -DDISABLE_ICONV
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@ -267,6 +267,7 @@ LOCAL_CFLAGS := -I../lib/angelscript/include \
|
||||
-DENABLE_IPV6 \
|
||||
-DENABLE_CRYPTO_OPENSSL \
|
||||
-DNDEBUG \
|
||||
-DDISABLE_ICONV \
|
||||
-DANDROID_PACKAGE_NAME=\"$(PACKAGE_NAME)\" \
|
||||
-DANDROID_APP_DIR_NAME=\"$(APP_DIR_NAME)\" \
|
||||
-DSUPERTUXKART_VERSION=\"$(PROJECT_VERSION)\" \
|
||||
|
@ -47,6 +47,9 @@ endif(COMMAND cmake_policy)
|
||||
## Reveal library type choice to users
|
||||
option(BUILD_SHARED_LIBS "Produce dynamic library instead of static archive" OFF)
|
||||
|
||||
# STK addition: disable libiconv
|
||||
option(USE_ICONV "Use libiconv" OFF)
|
||||
if (USE_ICONV)
|
||||
## Add iconv to include directories
|
||||
|
||||
find_package(ICONV REQUIRED)
|
||||
@ -74,6 +77,9 @@ if(HAVE_ICONV_CONST)
|
||||
else(HAVE_ICONV_CONST)
|
||||
remove_definitions(-DHAVE_ICONV_CONST)
|
||||
endif(HAVE_ICONV_CONST)
|
||||
else()
|
||||
add_definitions(-DDISABLE_ICONV)
|
||||
endif()
|
||||
|
||||
## TinyGetText library compilation
|
||||
|
||||
|
@ -22,7 +22,9 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
#ifdef DISABLE_ICONV
|
||||
# define tinygettext_iconv_t int
|
||||
#elif defined(HAVE_SDL)
|
||||
# include "SDL.h"
|
||||
|
||||
# define tinygettext_ICONV_CONST const
|
||||
|
@ -50,13 +50,16 @@ IConv::IConv(const std::string& from_charset_, const std::string& to_charset_)
|
||||
|
||||
IConv::~IConv()
|
||||
{
|
||||
#ifndef DISABLE_ICONV
|
||||
if (cd)
|
||||
tinygettext_iconv_close(cd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
IConv::set_charsets(const std::string& from_charset_, const std::string& to_charset_)
|
||||
{
|
||||
#ifndef DISABLE_ICONV
|
||||
if (cd)
|
||||
tinygettext_iconv_close(cd);
|
||||
|
||||
@ -93,12 +96,16 @@ IConv::set_charsets(const std::string& from_charset_, const std::string& to_char
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Convert a string from encoding to another.
|
||||
std::string
|
||||
IConv::convert(const std::string& text)
|
||||
{
|
||||
#ifdef DISABLE_ICONV
|
||||
return text;
|
||||
#else
|
||||
if (!cd)
|
||||
{
|
||||
return text;
|
||||
@ -143,6 +150,7 @@ IConv::convert(const std::string& text)
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace tinygettext
|
||||
|
Loading…
Reference in New Issue
Block a user