Thomas Petazzoni | 6ebb930 | 2013-03-24 08:19:29 +0000 | [diff] [blame] | 1 | Fix build when iconv support is not available |
| 2 | |
| 3 | When iconv support is not available, the apr-util library does not |
| 4 | provide character set conversion features, and therefore APR_HAS_XLATE |
| 5 | is false. |
| 6 | |
| 7 | However, on Linux !defined(_WIN32) is always true, but the part of the |
| 8 | code that defines the APRCharsetDecoder and APRCharsetEncoder are only |
| 9 | enclosed in a #if APR_HAS_XLATE, without the "|| defined(_WIN32)" |
| 10 | which leads to build failures: the APRCharsetEncoder and |
| 11 | APRCharsetDecoder classes are used without being defined. |
| 12 | |
| 13 | This patch removes the || !defined(_WIN32) so that when iconv support |
| 14 | is not here, we fall back to raising an exception at runtime. |
| 15 | |
| 16 | Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> |
| 17 | |
| 18 | Index: 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); |
| 31 | Index: 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); |