[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:41:31 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit bcf08b3f4c4ca6a92de87088fe8f4a47062fc7d9
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat May 10 05:46:59 2003 +0000
Reviewed by Maciej.
- fixed 3131026 -- half-width yen character (x5C) shows up as a backslash
To fix this, I had to reverse our previous decoding approach for the characters
that are different in Shift-JIS and ASCII. Before, we would decode them as
ASCII, and so they would be wrong in web pages, but right in URLs. Now, I decode
them as Shift-JIS, so they are right for web pages. This does not break URLs,
though, because back in February we added code to re-encode characters for URLs
to fix bug 3124596. But there is a TEC bug we have to work around to make this
work right for the tilde character.
* kwq/KWQTextCodec.mm:
(QTextCodec::fromUnicode): Work around the TEC bug that prevents the tilde
character from surviving the round trip through the decoding process by explicitly
changing decoded tildes back to ASCII tildes.
(KWQTextDecoder::convertUsingTEC): Do not set kUnicodeForceASCIIRangeMask.
* kwq/KWQCString.h: Added replace call for use by new code. Some other
small improvements.
* kwq/KWQCString.mm:
(QCString::contains): Make this faster by not doing the case-insensitive
and case-sensitive cases both in the same loop.
(QCString::append): Changed the += calls to this name, and made the
+= operator override call these.
(QCString::replace): Added.
* WebCore-tests.exp: Changed to export append calls.
* WebCore-combined.exp: Regenerated.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4340 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index a940d98..b4deae7 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,35 @@
+2003-05-09 Darin Adler <darin at apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3131026 -- half-width yen character (x5C) shows up as a backslash
+
+ To fix this, I had to reverse our previous decoding approach for the characters
+ that are different in Shift-JIS and ASCII. Before, we would decode them as
+ ASCII, and so they would be wrong in web pages, but right in URLs. Now, I decode
+ them as Shift-JIS, so they are right for web pages. This does not break URLs,
+ though, because back in February we added code to re-encode characters for URLs
+ to fix bug 3124596. But there is a TEC bug we have to work around to make this
+ work right for the tilde character.
+
+ * kwq/KWQTextCodec.mm:
+ (QTextCodec::fromUnicode): Work around the TEC bug that prevents the tilde
+ character from surviving the round trip through the decoding process by explicitly
+ changing decoded tildes back to ASCII tildes.
+ (KWQTextDecoder::convertUsingTEC): Do not set kUnicodeForceASCIIRangeMask.
+
+ * kwq/KWQCString.h: Added replace call for use by new code. Some other
+ small improvements.
+ * kwq/KWQCString.mm:
+ (QCString::contains): Make this faster by not doing the case-insensitive
+ and case-sensitive cases both in the same loop.
+ (QCString::append): Changed the += calls to this name, and made the
+ += operator override call these.
+ (QCString::replace): Added.
+
+ * WebCore-tests.exp: Changed to export append calls.
+ * WebCore-combined.exp: Regenerated.
+
2003-05-09 David Hyatt <hyatt at apple.com>
Finally get tables cutting the right properties off and letting
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index a940d98..b4deae7 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,35 @@
+2003-05-09 Darin Adler <darin at apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3131026 -- half-width yen character (x5C) shows up as a backslash
+
+ To fix this, I had to reverse our previous decoding approach for the characters
+ that are different in Shift-JIS and ASCII. Before, we would decode them as
+ ASCII, and so they would be wrong in web pages, but right in URLs. Now, I decode
+ them as Shift-JIS, so they are right for web pages. This does not break URLs,
+ though, because back in February we added code to re-encode characters for URLs
+ to fix bug 3124596. But there is a TEC bug we have to work around to make this
+ work right for the tilde character.
+
+ * kwq/KWQTextCodec.mm:
+ (QTextCodec::fromUnicode): Work around the TEC bug that prevents the tilde
+ character from surviving the round trip through the decoding process by explicitly
+ changing decoded tildes back to ASCII tildes.
+ (KWQTextDecoder::convertUsingTEC): Do not set kUnicodeForceASCIIRangeMask.
+
+ * kwq/KWQCString.h: Added replace call for use by new code. Some other
+ small improvements.
+ * kwq/KWQCString.mm:
+ (QCString::contains): Make this faster by not doing the case-insensitive
+ and case-sensitive cases both in the same loop.
+ (QCString::append): Changed the += calls to this name, and made the
+ += operator override call these.
+ (QCString::replace): Added.
+
+ * WebCore-tests.exp: Changed to export append calls.
+ * WebCore-combined.exp: Regenerated.
+
2003-05-09 David Hyatt <hyatt at apple.com>
Finally get tables cutting the right properties off and letting
diff --git a/WebCore/WebCore-combined.exp b/WebCore/WebCore-combined.exp
index 2986d1c..5aad1f1 100644
--- a/WebCore/WebCore-combined.exp
+++ b/WebCore/WebCore-combined.exp
@@ -184,6 +184,8 @@ __ZN7QStringD1Ev
__ZN7QStringpLE5QChar
__ZN7QStringpLERKS_
__ZN7QStringpLEc
+__ZN8QCString6appendEPKc
+__ZN8QCString6appendEc
__ZN8QCString8truncateEj
__ZN8QCStringC1EPKc
__ZN8QCStringC1EPKcj
diff --git a/WebCore/WebCore-tests.exp b/WebCore/WebCore-tests.exp
index ccc2f4f..7d18549 100644
--- a/WebCore/WebCore-tests.exp
+++ b/WebCore/WebCore-tests.exp
@@ -161,6 +161,8 @@ __ZN7QStringD1Ev
__ZN7QStringpLE5QChar
__ZN7QStringpLERKS_
__ZN7QStringpLEc
+__ZN8QCString6appendEPKc
+__ZN8QCString6appendEc
__ZN8QCString8truncateEj
__ZN8QCStringC1EPKc
__ZN8QCStringC1EPKcj
diff --git a/WebCore/kwq/KWQCString.h b/WebCore/kwq/KWQCString.h
index 90c7863..fff26bc 100644
--- a/WebCore/kwq/KWQCString.h
+++ b/WebCore/kwq/KWQCString.h
@@ -38,6 +38,8 @@ public:
QCString(const char *);
QCString(const char *, uint);
+ QCString &operator=(const char *);
+
bool isEmpty() const;
bool isNull() const { return data() == 0; }
int find(const char *, int index=0, bool cs=true) const;
@@ -50,10 +52,13 @@ public:
QCString right(uint) const;
QCString mid(uint, uint len=0xffffffff) const;
+ QCString &append(char);
+ QCString &append(const char *);
+ QCString &replace(char, char);
+
operator const char *() const { return data(); }
- QCString &operator=(const char *);
- QCString &operator+=(const char *);
- QCString &operator+=(char);
+ QCString &operator+=(const char *s) { return append(s); }
+ QCString &operator+=(char c) { return append(c); }
#ifdef _KWQ_IOSTREAM_
friend std::ostream &operator<<(std::ostream &, const QCString &);
diff --git a/WebCore/kwq/KWQCString.mm b/WebCore/kwq/KWQCString.mm
index 1eea723..af126b8 100644
--- a/WebCore/kwq/KWQCString.mm
+++ b/WebCore/kwq/KWQCString.mm
@@ -199,24 +199,24 @@ int QCString::find(const char *sub, int index, bool cs) const
int QCString::contains(char c, bool cs) const
{
- const char* str = data();
uint found = 0;
uint len = length();
- if( str && len )
- {
- // drop char if we're insensitive
- if( !cs )
+ if (len) {
+ const char *str = data();
+
+ if (cs) {
+ for (unsigned i = 0; i != len; ++i) {
+ found += str[i] == c;
+ }
+ } else {
c = tolower(c);
- for( unsigned i=0; i<len; i++ )
- {
- char chr = str[i];
- if( !cs )
+ for (unsigned i = 0; i != len; ++i) {
+ char chr = str[i];
chr = tolower(chr);
-
- if( chr == c )
- found ++;
+ found += chr == c;
+ }
}
}
@@ -229,26 +229,26 @@ QCString &QCString::operator=(const char *assignFrom)
return *this;
}
-QCString& QCString::operator+=(const char *s)
+QCString& QCString::append(const char *s)
{
if (s) {
- detach();
- uint len1 = length();
uint len2 = strlen(s);
- if (QByteArray::resize(len1 + len2 + 1)) {
- memcpy(data() + len1, s, len2 + 1);
+ if (len2) {
+ detach();
+ uint len1 = length();
+ if (QByteArray::resize(len1 + len2 + 1)) {
+ memcpy(data() + len1, s, len2 + 1);
+ }
}
}
return *this;
}
-QCString &QCString::operator+=(char c)
+QCString &QCString::append(char c)
{
- uint len;
-
detach();
- len = length();
+ uint len = length();
if (QByteArray::resize(len + 2)) {
*(data() + len) = c;
@@ -258,6 +258,40 @@ QCString &QCString::operator+=(char c)
return *this;
}
+QCString &QCString::replace(char c1, char c2)
+{
+ uint len = length();
+
+ if (len) {
+ // Search for the first instance of c1 before detaching,
+ // just in case there is nothing to replace. In that case
+ // we don't want to detach this from other shared instances
+ // since we have no need to modify it.
+ unsigned i;
+ {
+ const char *s = data();
+ for (i = 0; i != len; ++i) {
+ if (s[i] == c1) {
+ break;
+ }
+ }
+ }
+
+ if (i != len) {
+ detach();
+ char *s = data();
+ // Start at the first instance of c1; no need to rescan earlier chars.
+ for (; i != len; ++i) {
+ if (s[i] == c1) {
+ s[i] = c2;
+ }
+ }
+ }
+ }
+
+ return *this;
+}
+
bool operator==(const QCString &s1, const char *s2)
{
if (s1.size() == 0 && !s2) {
diff --git a/WebCore/kwq/KWQTextCodec.mm b/WebCore/kwq/KWQTextCodec.mm
index d829692..e3c2645 100644
--- a/WebCore/kwq/KWQTextCodec.mm
+++ b/WebCore/kwq/KWQTextCodec.mm
@@ -30,13 +30,6 @@
const UniChar BOM = 0xFEFF;
-struct TECObjectPeek {
- UInt32 skip1;
- UInt32 skip2;
- UInt32 skip3;
- OptionBits optionsControlFlags;
-};
-
class KWQTextDecoder : public QTextDecoder {
public:
KWQTextDecoder(CFStringEncoding, KWQEncodingFlags);
@@ -140,13 +133,38 @@ QCString QTextCodec::fromUnicode(const QString &qcs) const
CFStringEncoding encoding = effectiveEncoding(_encoding);
- CFStringRef cfs = qcs.getCFString();
+ QString copy;
+ bool doingTildeWorkaround = false;
+
+ // This is a hack to work around bug 3254512 -- tilde does not make the round trip when encoding/decoding Shift-JIS.
+ // We change decoded tilde characters into U+0001 because that will survive the decoding process (turn into ASCII 0x01)
+ // and we don't care about preserving U+0001 characters; they should never occur.
+ switch (encoding) {
+ case kCFStringEncodingShiftJIS_X0213_00:
+ case kCFStringEncodingEUC_JP: {
+ const QChar decodedTilde(0x203E);
+ if (qcs.find(decodedTilde) != -1) {
+ doingTildeWorkaround = true;
+ copy = qcs;
+ copy.replace(decodedTilde, 0x0001);
+ }
+ }
+ }
+
+ CFStringRef cfs = doingTildeWorkaround ? copy.getCFString() : qcs.getCFString();
+
CFRange range = CFRangeMake(0, CFStringGetLength(cfs));
CFIndex bufferLength;
- CFStringGetBytes(cfs, range, encoding, '?', false, NULL, 0x7FFFFFFF, &bufferLength);
+ CFStringGetBytes(cfs, range, encoding, '?', FALSE, NULL, 0x7FFFFFFF, &bufferLength);
QCString result(bufferLength + 1);
- CFStringGetBytes(cfs, range, encoding, '?', false, (UInt8 *)result.data(), bufferLength, &bufferLength);
+ CFStringGetBytes(cfs, range, encoding, '?', FALSE, reinterpret_cast<UInt8 *>(result.data()), bufferLength, &bufferLength);
result[bufferLength] = 0;
+
+ // Change the decoded U+0001 characters (now 0x01) into tilde.
+ if (doingTildeWorkaround) {
+ result.replace(0x01, '~');
+ }
+
return result;
}
@@ -293,9 +311,6 @@ QString KWQTextDecoder::convertUsingTEC(const UInt8 *chs, int len, bool flush)
ERROR("the Text Encoding Converter won't convert from text encoding 0x%X, error %d", encoding, status);
return QString();
}
-
- // Workaround for missing TECSetBasicOptions call.
- reinterpret_cast<TECObjectPeek **>(_converter)[0]->optionsControlFlags |= kUnicodeForceASCIIRangeMask;
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list