[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:24:06 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit c8f4ebe0629dc1b32eca690da60465a498672c67
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Feb 7 06:50:57 2003 +0000
Reviewed by Maciej.
- fixed 3140738 -- textarea contents are LF delimited instead of CRLF
* khtml/html/html_formimpl.cpp:
(encodeCString): Turn CR followed by something other than LF into CRLF.
(fixLineBreaks): Added. Turns stray CRs and LFs into CRLF.
(HTMLFormElementImpl::formData): Call fixLineBreaks on form data.
- fixed 3167235 -- REGRESSION: assert after clicking on a link on radioslack.com
* kwq/KWQTextCodec.mm: (KWQTextDecoder::toUnicode): Return the null string
if the passed in string pointer is NULL, rather than asserting.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 7fd0bf1..f73c81b 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,19 @@
+2003-02-06 Darin Adler <darin at apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3140738 -- textarea contents are LF delimited instead of CRLF
+
+ * khtml/html/html_formimpl.cpp:
+ (encodeCString): Turn CR followed by something other than LF into CRLF.
+ (fixLineBreaks): Added. Turns stray CRs and LFs into CRLF.
+ (HTMLFormElementImpl::formData): Call fixLineBreaks on form data.
+
+ - fixed 3167235 -- REGRESSION: assert after clicking on a link on radioslack.com
+
+ * kwq/KWQTextCodec.mm: (KWQTextDecoder::toUnicode): Return the null string
+ if the passed in string pointer is NULL, rather than asserting.
+
2003-02-06 David Hyatt <hyatt at apple.com>
Fix rollingstone regression.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 7fd0bf1..f73c81b 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,19 @@
+2003-02-06 Darin Adler <darin at apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3140738 -- textarea contents are LF delimited instead of CRLF
+
+ * khtml/html/html_formimpl.cpp:
+ (encodeCString): Turn CR followed by something other than LF into CRLF.
+ (fixLineBreaks): Added. Turns stray CRs and LFs into CRLF.
+ (HTMLFormElementImpl::formData): Call fixLineBreaks on form data.
+
+ - fixed 3167235 -- REGRESSION: assert after clicking on a link on radioslack.com
+
+ * kwq/KWQTextCodec.mm: (KWQTextDecoder::toUnicode): Return the null string
+ if the passed in string pointer is NULL, rather than asserting.
+
2003-02-06 David Hyatt <hyatt at apple.com>
Fix rollingstone regression.
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index 3ade820..37eddd8 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -163,7 +163,7 @@ static QCString encodeCString(const QCString& e)
encoded[enclen++] = c;
else if ( c == ' ' )
encoded[enclen++] = '+';
- else if ( c == '\n' )
+ else if ( c == '\n' || ( c == '\r' && e[pos+1] != '\n' ) )
{
encoded[enclen++] = '%';
encoded[enclen++] = '0';
@@ -197,6 +197,55 @@ inline static QCString fixUpfromUnicode(const QTextCodec* codec, const QString&
return str;
}
+// Change plain CR and plain LF to CRLF pairs.
+static QCString fixLineBreaks(const QCString &s)
+{
+ // Compute the length.
+ unsigned newLen = 0;
+ const char *p = s.data();
+ while (char c = *p++) {
+ if (c == '\r') {
+ // Safe to look ahead because of trailing '\0'.
+ if (*p != '\n') {
+ // Turn CR into CRLF.
+ newLen += 2;
+ }
+ } else if (c == '\n') {
+ // Turn LF into CRLF.
+ newLen += 2;
+ } else {
+ // Leave other characters alone.
+ newLen += 1;
+ }
+ }
+ if (newLen == s.length()) {
+ return s;
+ }
+
+ // Make a copy of the string.
+ p = s.data();
+ QCString result(newLen + 1);
+ char *q = result.data();
+ while (char c = *p++) {
+ if (c == '\r') {
+ // Safe to look ahead because of trailing '\0'.
+ if (*p != '\n') {
+ // Turn CR into CRLF.
+ *q++ = '\r';
+ *q++ = '\n';
+ }
+ } else if (c == '\n') {
+ // Turn LF into CRLF.
+ *q++ = '\r';
+ *q++ = '\n';
+ } else {
+ // Leave other characters alone.
+ *q++ = c;
+ }
+ }
+ return result;
+}
+
#if !APPLE_CHANGES
void HTMLFormElementImpl::i18nData()
@@ -348,9 +397,10 @@ QByteArray HTMLFormElementImpl::formData(bool& ok)
// append body
unsigned int old_size = form_data.size();
- form_data.resize( old_size + hstr.length() + (*it).size() + 1);
+ QCString data = fixLineBreaks(*it);
+ form_data.resize( old_size + hstr.length() + data.size() + 1);
memcpy(form_data.data() + old_size, hstr.data(), hstr.length());
- memcpy(form_data.data() + old_size + hstr.length(), *it, (*it).size());
+ memcpy(form_data.data() + old_size + hstr.length(), data, data.size());
form_data[form_data.size()-2] = '\r';
form_data[form_data.size()-1] = '\n';
}
diff --git a/WebCore/kwq/KWQTextCodec.mm b/WebCore/kwq/KWQTextCodec.mm
index 9b5a462..2bf2a72 100644
--- a/WebCore/kwq/KWQTextCodec.mm
+++ b/WebCore/kwq/KWQTextCodec.mm
@@ -277,10 +277,9 @@ QString KWQTextDecoder::convertUsingTEC(const UInt8 *chs, int len)
QString KWQTextDecoder::toUnicode(const char *chs, int len)
{
- ASSERT_ARG(chs, chs);
ASSERT_ARG(len, len >= 0);
- if (len <= 0) {
+ if (!chs || len <= 0) {
return QString::null;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list