Martchus
b026866d2f
* Improve documentation * Switch back to patching win32-g++ rather than adding own mkspec to fix * https://github.com/Martchus/PKGBUILDs/issues/59 * https://github.com/Martchus/PKGBUILDs/issues/60 * Not tested yet
84 lines
3.3 KiB
Diff
84 lines
3.3 KiB
Diff
From 64a634598092a7cbeca267f3dc0860a3105ed329 Mon Sep 17 00:00:00 2001
|
|
From: Martchus <martchus@gmx.net>
|
|
Date: Wed, 25 Jan 2017 21:08:20 +0100
|
|
Subject: [PATCH 28/32] Enable and fix use of iconv
|
|
|
|
Change-Id: I5f0ab27afca0800dec11c7af74d196190820ae5c
|
|
---
|
|
config.tests/gnu-libiconv/gnu-libiconv.cpp | 2 +-
|
|
src/corelib/codecs/qiconvcodec.cpp | 7 +++----
|
|
src/corelib/configure.json | 4 ++--
|
|
3 files changed, 6 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/config.tests/gnu-libiconv/gnu-libiconv.cpp b/config.tests/gnu-libiconv/gnu-libiconv.cpp
|
|
index fe4b87b923..be4236436f 100644
|
|
--- a/config.tests/gnu-libiconv/gnu-libiconv.cpp
|
|
+++ b/config.tests/gnu-libiconv/gnu-libiconv.cpp
|
|
@@ -43,7 +43,7 @@ int main(int, char **)
|
|
{
|
|
iconv_t x = iconv_open("", "");
|
|
|
|
- const char *inp;
|
|
+ char *inp;
|
|
char *outp;
|
|
size_t inbytes, outbytes;
|
|
iconv(x, &inp, &inbytes, &outp, &outbytes);
|
|
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
|
|
index d6362b6fbc..4da4546a24 100644
|
|
--- a/src/corelib/codecs/qiconvcodec.cpp
|
|
+++ b/src/corelib/codecs/qiconvcodec.cpp
|
|
@@ -49,7 +49,6 @@ QT_REQUIRE_CONFIG(iconv);
|
|
#include <errno.h>
|
|
#include <locale.h>
|
|
#include <stdio.h>
|
|
-#include <dlfcn.h>
|
|
|
|
// unistd.h is needed for the _XOPEN_UNIX macro
|
|
#include <unistd.h>
|
|
@@ -182,7 +181,7 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState
|
|
IconvState *state = *pstate;
|
|
size_t inBytesLeft = len;
|
|
// best case assumption, each byte is converted into one UTF-16 character, plus 2 bytes for the BOM
|
|
-#if !QT_CONFIG(posix_libiconv)
|
|
+#if !QT_CONFIG(posix_libiconv) && !defined(Q_OS_WIN)
|
|
// GNU doesn't disagree with POSIX :/
|
|
const char *inBytes = chars;
|
|
#else
|
|
@@ -281,7 +280,7 @@ static bool setByteOrder(iconv_t cd)
|
|
size_t outBytesLeft = sizeof buf;
|
|
size_t inBytesLeft = sizeof bom;
|
|
|
|
-#if !QT_CONFIG(posix_libiconv)
|
|
+#if !QT_CONFIG(posix_libiconv) && !defined(Q_OS_WIN)
|
|
const char **inBytesPtr = const_cast<const char **>(&inBytes);
|
|
#else
|
|
char **inBytesPtr = &inBytes;
|
|
@@ -303,7 +302,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
|
|
char *outBytes;
|
|
size_t inBytesLeft;
|
|
|
|
-#if !QT_CONFIG(posix_libiconv)
|
|
+#if !QT_CONFIG(posix_libiconv) && !defined(Q_OS_WIN)
|
|
const char **inBytesPtr = const_cast<const char **>(&inBytes);
|
|
#else
|
|
char **inBytesPtr = &inBytes;
|
|
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
|
|
index 8cd73d6ce4..dd259157e3 100644
|
|
--- a/src/corelib/configure.json
|
|
+++ b/src/corelib/configure.json
|
|
@@ -521,9 +521,9 @@
|
|
},
|
|
"gnu-libiconv": {
|
|
"label": "GNU iconv",
|
|
- "enable": "input.iconv == 'gnu'",
|
|
+ "enable": "'enabling via -gnu-iconv fails' == 'enabling via -gnu-iconv fails'",
|
|
"disable": "input.iconv == 'posix' || input.iconv == 'sun' || input.iconv == 'no'",
|
|
- "condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && !features.posix-libiconv && !features.sun-libiconv && libs.gnu_iconv",
|
|
+ "condition": "!config.qnx && !config.android && !config.darwin && !features.posix-libiconv && !features.sun-libiconv && libs.gnu_iconv",
|
|
"output": [ "privateFeature" ]
|
|
},
|
|
"icu": {
|
|
--
|
|
2.16.2
|
|
|