diff options
author | Nils Christian Roscher-Nielsen <nils.christian@trolltech.com> | 2009-11-25 17:21:36 (GMT) |
---|---|---|
committer | Nils Christian Roscher-Nielsen <nils.christian@trolltech.com> | 2009-11-25 17:21:36 (GMT) |
commit | 70236685b09e76b48949cc16fa2a7a1f8350bbb7 (patch) | |
tree | d4fc8212464816fd55a4fcf7b08a1eaabe3b3392 /src/corelib | |
parent | 5c2783411ad4bcd2772b2dcbc0d38694af72e414 (diff) | |
download | Qt-70236685b09e76b48949cc16fa2a7a1f8350bbb7.zip Qt-70236685b09e76b48949cc16fa2a7a1f8350bbb7.tar.gz Qt-70236685b09e76b48949cc16fa2a7a1f8350bbb7.tar.bz2 |
Checks for len = 0 in QIconvCodec::convertFromUnicode
iconv hangs when len is initially 0 on some Solaris platforms. This can
be seen in the standarddialogs example when calling
QFileDialog::getOpenFileName() for instance.
Reviewed-by: ddenis
Task-number: QTBUG-4976
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/codecs/qiconvcodec.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index 8c4cc82..0fb78d5 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -378,7 +378,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt } int invalidCount = 0; - do { + while (inBytesLeft != 0) { if (iconv(state->cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) { if (errno == EINVAL && convState) { // buffer ends in a surrogate @@ -418,7 +418,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt } } } - } while (inBytesLeft != 0); + } // reset to initial state iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft); |