blob: 75567fdad198ca335cce536e6f52d8cd365af2a2 [file] [log] [blame]
Thomas Petazzoni6ebb9302013-03-24 08:19:29 +00001Fix build when iconv support is not available
2
3When iconv support is not available, the apr-util library does not
4provide character set conversion features, and therefore APR_HAS_XLATE
5is false.
6
7However, on Linux !defined(_WIN32) is always true, but the part of the
8code that defines the APRCharsetDecoder and APRCharsetEncoder are only
9enclosed in a #if APR_HAS_XLATE, without the "|| defined(_WIN32)"
10which leads to build failures: the APRCharsetEncoder and
11APRCharsetDecoder classes are used without being defined.
12
13This patch removes the || !defined(_WIN32) so that when iconv support
14is not here, we fall back to raising an exception at runtime.
15
16Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
17
18Index: b/src/main/cpp/charsetdecoder.cpp
19===================================================================
20--- a/src/main/cpp/charsetdecoder.cpp
21+++ b/src/main/cpp/charsetdecoder.cpp
22@@ -476,7 +476,7 @@
23 StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-LATIN-1"), LOG4CXX_STR("iso-latin-1"))) {
24 return new ISOLatinCharsetDecoder();
25 }
26-#if APR_HAS_XLATE || !defined(_WIN32)
27+#if APR_HAS_XLATE
28 return new APRCharsetDecoder(charset);
29 #else
30 throw IllegalArgumentException(charset);
31Index: b/src/main/cpp/charsetencoder.cpp
32===================================================================
33--- a/src/main/cpp/charsetencoder.cpp
34+++ b/src/main/cpp/charsetencoder.cpp
35@@ -484,7 +484,7 @@
36 } else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16LE"), LOG4CXX_STR("utf-16le"))) {
37 return new UTF16LECharsetEncoder();
38 }
39-#if APR_HAS_XLATE || !defined(_WIN32)
40+#if APR_HAS_XLATE
41 return new APRCharsetEncoder(charset);
42 #else
43 throw IllegalArgumentException(charset);