Index: WebCore/html/FormDataList.cpp |
diff --git a/WebCore/html/FormDataList.cpp b/WebCore/html/FormDataList.cpp |
index 281c9fe418e1c4833bb87f82f74f1cc4d722d57c..0f62595ed41c2319bdb79b57bbd7ca94622b82aa 100644 |
--- a/WebCore/html/FormDataList.cpp |
+++ b/WebCore/html/FormDataList.cpp |
@@ -28,64 +28,22 @@ FormDataList::FormDataList(const TextEncoding& c) |
{ |
} |
-void FormDataList::appendString(const CString& s) |
+void FormDataList::appendString(const String& s) |
{ |
- m_list.append(s); |
+ m_items.append(StringBlobItem::create(s, EndingCRLF, m_encoding)); |
} |
-// Change plain CR and plain LF to CRLF pairs. |
-static CString fixLineBreaks(const CString& s) |
+void FormDataList::appendString(const CString& 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(); |
- char* q; |
- CString result = CString::newUninitialized(newLen, q); |
- 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; |
+ m_items.append(StringBlobItem::create(s)); |
} |
-void FormDataList::appendString(const String& s) |
+void FormDataList::appendBlob(const String& key, PassRefPtr<Blob> blob) |
{ |
- CString cstr = fixLineBreaks(m_encoding.encode(s.characters(), s.length(), EntitiesForUnencodables)); |
- m_list.append(cstr); |
+ appendString(key); |
+ const BlobItemList& items = blob->items(); |
+ for (size_t i = 0; i < items.size(); ++i) |
+ m_items.append(items.at(i)); |
} |
} // namespace |