aboutsummaryrefslogtreecommitdiff
path: root/x11-toolkits/qt33
diff options
context:
space:
mode:
authorMichael Nottebrock <lofi@FreeBSD.org>2007-03-30 18:15:08 +0000
committerMichael Nottebrock <lofi@FreeBSD.org>2007-03-30 18:15:08 +0000
commitbf4e60e8bfb5be3d1939f2f2b41973b3faf5f67b (patch)
treeb682bea2b50d3c979b9eb2c0bfdcb65256d774a0 /x11-toolkits/qt33
parent200db6b63d7f18b12f00132977c84f2cc862e489 (diff)
downloadports-bf4e60e8bfb5be3d1939f2f2b41973b3faf5f67b.tar.gz
ports-bf4e60e8bfb5be3d1939f2f2b41973b3faf5f67b.zip
Notes
Diffstat (limited to 'x11-toolkits/qt33')
-rw-r--r--x11-toolkits/qt33/Makefile1
-rw-r--r--x11-toolkits/qt33/files/patch-utf8-bug-qt3101
2 files changed, 102 insertions, 0 deletions
diff --git a/x11-toolkits/qt33/Makefile b/x11-toolkits/qt33/Makefile
index 0066629e1cbf..c4bab954fb4d 100644
--- a/x11-toolkits/qt33/Makefile
+++ b/x11-toolkits/qt33/Makefile
@@ -8,6 +8,7 @@
PORTNAME= qt
PORTVERSION= 3.3.8
+PORTREVISION= 1
CATEGORIES?= x11-toolkits ipv6
MASTER_SITES= ${MASTER_SITE_QT}
DISTNAME= qt-x11-free-${PORTVERSION}
diff --git a/x11-toolkits/qt33/files/patch-utf8-bug-qt3 b/x11-toolkits/qt33/files/patch-utf8-bug-qt3
new file mode 100644
index 000000000000..43e84a99f1e9
--- /dev/null
+++ b/x11-toolkits/qt33/files/patch-utf8-bug-qt3
@@ -0,0 +1,101 @@
+--- src/codecs/qutfcodec.cpp
++++ src/codecs/qutfcodec.cpp
+@@ -154,6 +154,7 @@
+
+ class QUtf8Decoder : public QTextDecoder {
+ uint uc;
++ uint min_uc;
+ int need;
+ bool headerDone;
+ public:
+@@ -167,8 +168,9 @@
+ result.setLength( len ); // worst case
+ QChar *qch = (QChar *)result.unicode();
+ uchar ch;
++ int error = -1;
+ for (int i=0; i<len; i++) {
+- ch = *chars++;
++ ch = chars[i];
+ if (need) {
+ if ( (ch&0xc0) == 0x80 ) {
+ uc = (uc << 6) | (ch & 0x3f);
+@@ -182,6 +184,8 @@
+ *qch++ = QChar(high);
+ *qch++ = QChar(low);
+ headerDone = TRUE;
++ } else if ((uc < min_uc) || (uc >= 0xd800 && uc <= 0xdfff) || (uc >= 0xfffe)) {
++ *qch++ = QChar::replacement;
+ } else {
+ if (headerDone || QChar(uc) != QChar::byteOrderMark)
+ *qch++ = uc;
+@@ -190,6 +194,7 @@
+ }
+ } else {
+ // error
++ i = error;
+ *qch++ = QChar::replacement;
+ need = 0;
+ }
+@@ -200,12 +205,21 @@
+ } else if ((ch & 0xe0) == 0xc0) {
+ 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++ = QChar::replacement;
+ }
+ }
+ }
+--- src/tools/qstring.cpp
++++ src/tools/qstring.cpp
+@@ -5805,6 +5805,7 @@
+ 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 @@
+ 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 @@
+ 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);