pkgsrc/x11/qt3-libs/patches/patch-ar
wiz 627d469e61 Apply patch reported by Gary Duzan in PR 37347 to fix finance/kmymoney2
after ld.elf_so fix from December 2007.

Bump PKGREVISION.
2009-05-20 01:00:40 +00:00

52 lines
1.8 KiB
Text

$NetBSD: patch-ar,v 1.2 2009/05/20 01:00:40 wiz Exp $
--- src/tools/qstring.cpp.orig 2007-02-02 14:01:05.000000000 +0000
+++ src/tools/qstring.cpp
@@ -1362,7 +1362,7 @@ QT_STATIC_CONST_IMPL QChar QChar::nbsp((
QStringData* QString::makeSharedNull()
{
QString::shared_null = new QStringData;
-#if defined( Q_OS_MAC ) || defined(Q_OS_SOLARIS) || defined(Q_OS_HPUX) || defined(Q_OS_AIX)
+#if defined( Q_OS_MAC ) || defined(Q_OS_SOLARIS) || defined(Q_OS_HPUX) || defined(Q_OS_AIX) || defined(Q_OS_NETBSD)
QString *that = const_cast<QString *>(&QString::null);
that->d = QString::shared_null;
#endif
@@ -5805,6 +5805,7 @@ QString QString::fromUtf8( const char* u
result.setLength( len ); // worst case
QChar *qch = (QChar *)result.unicode();
uint uc = 0;
+ uint min_uc = 0;
int need = 0;
int error = -1;
uchar ch;
@@ -5822,6 +5823,12 @@ QString QString::fromUtf8( const char* u
unsigned short low = uc%0x400 + 0xdc00;
*qch++ = QChar(high);
*qch++ = QChar(low);
+ } else if (uc < min_uc || (uc >= 0xd800 && uc <= 0xdfff) || (uc >= 0xfffe)) {
+ // overlong seqence, UTF16 surrogate or BOM
+ i = error;
+ qch = addOne(qch, result);
+ *qch++ = QChar(0xdbff);
+ *qch++ = QChar(0xde00+((uchar)utf8[i]));
} else {
*qch++ = uc;
}
@@ -5844,14 +5851,17 @@ QString QString::fromUtf8( const char* u
uc = ch & 0x1f;
need = 1;
error = i;
+ min_uc = 0x80;
} else if ((ch & 0xf0) == 0xe0) {
uc = ch & 0x0f;
need = 2;
error = i;
+ min_uc = 0x800;
} else if ((ch&0xf8) == 0xf0) {
uc = ch & 0x07;
need = 3;
error = i;
+ min_uc = 0x10000;
} else {
// Error
qch = addOne(qch, result);