diff --git a/x11/qt4/Makefile b/x11/qt4/Makefile index 603cda05e3b..1c04d511a51 100644 --- a/x11/qt4/Makefile +++ b/x11/qt4/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.34 2007/03/26 21:22:13 espie Exp $ +# $OpenBSD: Makefile,v 1.35 2007/03/31 23:10:18 espie Exp $ COMMENT-main= "C++ X11 GUI toolkit" COMMENT-examples= "examples for qt4" @@ -8,13 +8,13 @@ COMMENT-mysql= "MySQL plugin for qt4" COMMENT-sqlite2= "sqlite2 plugin for qt4" COMMENT-sqlite= "sqlite plugin for qt4" -PKGNAME= qt4-${VERSION}p0 +PKGNAME= qt4-${VERSION} PKGNAME-mysql= qt4-mysql-${VERSION} PKGNAME-postgresql= qt4-postgresql-${VERSION} PKGNAME-examples= qt4-examples-${VERSION} PKGNAME-sqlite2= qt4-sqlite2-${VERSION} PKGNAME-sqlite= qt4-sqlite-${VERSION} -PKGNAME-main= qt4-${VERSION} +PKGNAME-main= qt4-${VERSION}p0 FULLPKGNAME-html= qt4-html-${VERSION} SHARED_LIBS= Qt3Support 7.0 \ QtCore 6.2 \ diff --git a/x11/qt4/patches/patch-src_corelib_codecs_qutfcodec_cpp b/x11/qt4/patches/patch-src_corelib_codecs_qutfcodec_cpp new file mode 100644 index 00000000000..9eeb9841f55 --- /dev/null +++ b/x11/qt4/patches/patch-src_corelib_codecs_qutfcodec_cpp @@ -0,0 +1,92 @@ +$OpenBSD: patch-src_corelib_codecs_qutfcodec_cpp,v 1.1 2007/03/31 23:10:18 espie Exp $ +--- src/corelib/codecs/qutfcodec.cpp.orig Wed Feb 21 10:58:41 2007 ++++ src/corelib/codecs/qutfcodec.cpp Sat Mar 31 15:01:10 2007 +@@ -127,15 +127,19 @@ QString QUtf8Codec::convertToUnicode(const char *chars + bool headerdone = false; + QChar replacement = QChar::ReplacementCharacter; + int need = 0; ++ int error = -1; + uint uc = 0; ++ uint min_uc = 0; + if (state) { + if (state->flags & IgnoreHeader) + headerdone = true; + if (state->flags & ConvertInvalidToNull) + replacement = QChar::Null; + need = state->remainingChars; +- if (need) ++ if (need) { + uc = state->state_data[0]; ++ min_uc = state->state_data[1]; ++ } + } + if (!headerdone && len > 3 + && (uchar)chars[0] == 0xef && (uchar)chars[1] == 0xbb && (uchar)chars[2] == 0xbf) { +@@ -152,7 +156,7 @@ QString QUtf8Codec::convertToUnicode(const char *chars + int invalid = 0; + + for (int i=0; i= result.size()) { ++ result.resize(where + 2); ++ qch = result.data() + where; ++ } ++ + *qch++ = QChar(high); + *qch++ = QChar(low); ++ } else if ((uc < min_uc) || (uc >= 0xd800 && uc <= 0xdfff) || (uc >= 0xfffe)) { ++ // error ++ *qch++ = QChar::ReplacementCharacter; ++ ++invalid; + } else { + *qch++ = uc; + } + } + } else { + // error ++ i = error; + *qch++ = QChar::ReplacementCharacter; + ++invalid; + need = 0; +@@ -181,12 +198,22 @@ QString QUtf8Codec::convertToUnicode(const char *chars + } 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::ReplacementCharacter; ++ ++invalid; + } + } + } +@@ -197,6 +224,7 @@ QString QUtf8Codec::convertToUnicode(const char *chars + if (headerdone) + state->flags |= IgnoreHeader; + state->state_data[0] = need ? uc : 0; ++ state->state_data[1] = need ? min_uc : 0; + } + return result; + } diff --git a/x11/qt4/patches/patch-src_corelib_tools_qstring_cpp b/x11/qt4/patches/patch-src_corelib_tools_qstring_cpp new file mode 100644 index 00000000000..9624afe1b64 --- /dev/null +++ b/x11/qt4/patches/patch-src_corelib_tools_qstring_cpp @@ -0,0 +1,42 @@ +$OpenBSD: patch-src_corelib_tools_qstring_cpp,v 1.1 2007/03/31 23:10:18 espie Exp $ +--- src/corelib/tools/qstring.cpp.orig Wed Feb 21 10:58:43 2007 ++++ src/corelib/tools/qstring.cpp Sat Mar 31 15:01:10 2007 +@@ -3352,6 +3352,7 @@ QString QString::fromUtf8(const char *str, int size) + result.resize(size); // worst case + ushort *qch = result.d->data; + uint uc = 0; ++ uint min_uc = 0; + int need = 0; + int error = -1; + uchar ch; +@@ -3369,6 +3370,12 @@ QString QString::fromUtf8(const char *str, int size) + ushort low = uc%0x400 + 0xdc00; + *qch++ = high; + *qch++ = 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++ = 0xdbff; ++ *qch++ = 0xde00 + ((uchar)str[i]); + } else { + *qch++ = uc; + } +@@ -3391,14 +3398,17 @@ QString QString::fromUtf8(const char *str, int size) + 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);