Title: [264582] trunk/Source/WebCore
- Revision
- 264582
- Author
- [email protected]
- Date
- 2020-07-19 12:13:34 -0700 (Sun, 19 Jul 2020)
Log Message
Remove findCharsetInMediaType
https://bugs.webkit.org/show_bug.cgi?id=214523
Patch by Rob Buis <[email protected]> on 2020-07-19
Reviewed by Darin Adler.
Remove findCharsetInMediaType (by moving its code
into extractCharsetFromMediaType) since there are
no users for findCharsetInMediaType anymore.
* platform/network/HTTPParsers.cpp:
(WebCore::extractCharsetFromMediaType):
(WebCore::findCharsetInMediaType): Deleted.
* platform/network/HTTPParsers.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (264581 => 264582)
--- trunk/Source/WebCore/ChangeLog 2020-07-19 19:06:23 UTC (rev 264581)
+++ trunk/Source/WebCore/ChangeLog 2020-07-19 19:13:34 UTC (rev 264582)
@@ -1,3 +1,19 @@
+2020-07-19 Rob Buis <[email protected]>
+
+ Remove findCharsetInMediaType
+ https://bugs.webkit.org/show_bug.cgi?id=214523
+
+ Reviewed by Darin Adler.
+
+ Remove findCharsetInMediaType (by moving its code
+ into extractCharsetFromMediaType) since there are
+ no users for findCharsetInMediaType anymore.
+
+ * platform/network/HTTPParsers.cpp:
+ (WebCore::extractCharsetFromMediaType):
+ (WebCore::findCharsetInMediaType): Deleted.
+ * platform/network/HTTPParsers.h:
+
2020-07-19 Sam Weinig <[email protected]>
Additional Color related cleanups
Modified: trunk/Source/WebCore/platform/network/HTTPParsers.cpp (264581 => 264582)
--- trunk/Source/WebCore/platform/network/HTTPParsers.cpp 2020-07-19 19:06:23 UTC (rev 264581)
+++ trunk/Source/WebCore/platform/network/HTTPParsers.cpp 2020-07-19 19:13:34 UTC (rev 264582)
@@ -37,13 +37,10 @@
#include "HTTPHeaderNames.h"
#include "ParsedContentType.h"
#include <wtf/DateMath.h>
-#include <wtf/Language.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/Optional.h>
-#include <wtf/text/StringBuilder.h>
#include <wtf/unicode/CharacterNames.h>
-
namespace WebCore {
// True if characters which satisfy the predicate are present, incrementing
@@ -396,38 +393,29 @@
String extractCharsetFromMediaType(const String& mediaType)
{
- unsigned int pos, len;
- findCharsetInMediaType(mediaType, pos, len);
- return mediaType.substring(pos, len);
-}
+ unsigned charsetPos = 0, charsetLen = 0;
+ size_t pos = 0;
+ unsigned length = mediaType.length();
-void findCharsetInMediaType(const String& mediaType, unsigned int& charsetPos, unsigned int& charsetLen, unsigned int start)
-{
- charsetPos = start;
- charsetLen = 0;
-
- size_t pos = start;
- unsigned length = mediaType.length();
-
while (pos < length) {
pos = mediaType.findIgnoringASCIICase("charset", pos);
if (pos == notFound || pos == 0) {
charsetLen = 0;
- return;
+ break;
}
-
+
// is what we found a beginning of a word?
if (mediaType[pos-1] > ' ' && mediaType[pos-1] != ';') {
pos += 7;
continue;
}
-
+
pos += 7;
// skip whitespace
while (pos != length && mediaType[pos] <= ' ')
++pos;
-
+
if (mediaType[pos++] != '=') // this "charset" substring wasn't a parameter name, but there may be others
continue;
@@ -441,8 +429,9 @@
charsetPos = pos;
charsetLen = endpos - pos;
- return;
+ break;
}
+ return mediaType.substring(charsetPos, charsetLen);
}
XSSProtectionDisposition parseXSSProtectionHeader(const String& header, String& failureReason, unsigned& failurePosition, String& reportURL)
Modified: trunk/Source/WebCore/platform/network/HTTPParsers.h (264581 => 264582)
--- trunk/Source/WebCore/platform/network/HTTPParsers.h 2020-07-19 19:06:23 UTC (rev 264581)
+++ trunk/Source/WebCore/platform/network/HTTPParsers.h 2020-07-19 19:13:34 UTC (rev 264582)
@@ -80,7 +80,6 @@
String filenameFromHTTPContentDisposition(const String&);
String extractMIMETypeFromMediaType(const String&);
String extractCharsetFromMediaType(const String&);
-void findCharsetInMediaType(const String& mediaType, unsigned int& charsetPos, unsigned int& charsetLen, unsigned int start = 0);
XSSProtectionDisposition parseXSSProtectionHeader(const String& header, String& failureReason, unsigned& failurePosition, String& reportURL);
AtomString extractReasonPhraseFromHTTPStatusLine(const String&);
WEBCORE_EXPORT XFrameOptionsDisposition parseXFrameOptionsHeader(const String&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes