Move LineEnding.{h,cpp} from WebCore/platform/text to wtf/text
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Oct 2017 06:42:22 +0000 (06:42 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Oct 2017 06:42:22 +0000 (06:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=176575

Reviewed by Alex Christensen.

Source/WebCore:

No new tests because there is no behavior change.

* WebCore.xcodeproj/project.pbxproj:
* fileapi/BlobBuilder.cpp:
* html/FormDataList.cpp:

Source/WTF:

As part of the PAL effort, we're trying to move everything out of WebCore/platform, one-by-one.
These LineEnding files belong in WTF.

* WTF.xcodeproj/project.pbxproj:
* wtf/text/LineEnding.cpp: Renamed from Source/WebCore/platform/text/LineEnding.cpp.
(WTF::normalizeLineEndingsToCRLF):
* wtf/text/LineEnding.h: Renamed from Source/WebCore/platform/text/LineEnding.h.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@222771 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/text/LineEnding.cpp [moved from Source/WebCore/platform/text/LineEnding.cpp with 95% similarity]
Source/WTF/wtf/text/LineEnding.h [moved from Source/WebCore/platform/text/LineEnding.h with 82% similarity]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/fileapi/BlobBuilder.cpp
Source/WebCore/platform/network/FormData.cpp

index 1fdedc0..cc4348e 100644 (file)
@@ -1,3 +1,18 @@
+2017-10-02  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Move LineEnding.{h,cpp} from WebCore/platform/text to wtf/text
+        https://bugs.webkit.org/show_bug.cgi?id=176575
+
+        Reviewed by Alex Christensen.
+
+        As part of the PAL effort, we're trying to move everything out of WebCore/platform, one-by-one.
+        These LineEnding files belong in WTF.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/text/LineEnding.cpp: Renamed from Source/WebCore/platform/text/LineEnding.cpp.
+        (WTF::normalizeLineEndingsToCRLF):
+        * wtf/text/LineEnding.h: Renamed from Source/WebCore/platform/text/LineEnding.h.
+
 2017-10-02  Geoffrey Garen  <ggaren@apple.com>
 
         WeakPtr should have a move constructor
index 9b8b728..b484d61 100644 (file)
                ADF2CE671E39F106006889DB /* MemoryFootprintCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADF2CE651E39F106006889DB /* MemoryFootprintCocoa.cpp */; };
                C2BCFC401F61D13000C9222C /* Language.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2BCFC3E1F61D13000C9222C /* Language.cpp */; };
                C2BCFC421F61D61600C9222C /* LanguageCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2BCFC411F61D61600C9222C /* LanguageCF.cpp */; };
+               C2BCFC551F621F3F00C9222C /* LineEnding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2BCFC531F621F3F00C9222C /* LineEnding.cpp */; };
                CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497AA15857D0300B5BC30 /* MediaTime.cpp */; };
                DCEE22011CEA7551000C2396 /* BlockObjCExceptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = DCEE21FD1CEA7551000C2396 /* BlockObjCExceptions.mm */; };
                E15556F518A0CC18006F48FB /* CryptographicUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E15556F318A0CC18006F48FB /* CryptographicUtilities.cpp */; };
                C2BCFC3E1F61D13000C9222C /* Language.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Language.cpp; sourceTree = "<group>"; };
                C2BCFC3F1F61D13000C9222C /* Language.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Language.h; sourceTree = "<group>"; };
                C2BCFC411F61D61600C9222C /* LanguageCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LanguageCF.cpp; sourceTree = "<group>"; };
+               C2BCFC531F621F3F00C9222C /* LineEnding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LineEnding.cpp; sourceTree = "<group>"; };
+               C2BCFC541F621F3F00C9222C /* LineEnding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineEnding.h; sourceTree = "<group>"; };
                C4F8A93619C65EB400B2B15D /* Stopwatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stopwatch.h; sourceTree = "<group>"; };
                C8F597CA2A57417FBAB92FD6 /* RandomDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomDevice.cpp; sourceTree = "<group>"; };
                CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; };
                                26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */,
                                93AC91A718942FC400244939 /* LChar.h */,
                                1C181C811D30797C00F5FA16 /* LineBreakIteratorPoolICU.h */,
+                               C2BCFC531F621F3F00C9222C /* LineEnding.cpp */,
+                               C2BCFC541F621F3F00C9222C /* LineEnding.h */,
                                14E785E71DFB330100209BD1 /* OrdinalNumber.h */,
                                A8A47323151A825B004123FF /* StringBuffer.h */,
                                A8A47324151A825B004123FF /* StringBuilder.cpp */,
                                A8A473D8151A825B004123FF /* HashTable.cpp in Sources */,
                                C2BCFC401F61D13000C9222C /* Language.cpp in Sources */,
                                C2BCFC421F61D61600C9222C /* LanguageCF.cpp in Sources */,
+                               C2BCFC551F621F3F00C9222C /* LineEnding.cpp in Sources */,
                                0FE1646A1B6FFC9600400E7C /* Lock.cpp in Sources */,
                                0F60F32F1DFCBD1B00416D6C /* LockedPrintStream.cpp in Sources */,
                                53534F2A1EC0E10E00141B2F /* MachExceptions.defs in Sources */,
index c2d1bf1..a8b8624 100644 (file)
@@ -178,6 +178,7 @@ set(WTF_HEADERS
     text/CString.h
     text/IntegerToStringConversion.h
     text/LChar.h
+    text/LineEnding.h
     text/LineBreakIteratorPoolICU.h
     text/StringBuffer.h
     text/StringCommon.h
@@ -287,6 +288,7 @@ set(WTF_SOURCES
     text/AtomicStringTable.cpp
     text/Base64.cpp
     text/CString.cpp
+    text/LineEnding.cpp
     text/StringBuilder.cpp
     text/StringBuilderJSON.cpp
     text/StringImpl.cpp
similarity index 95%
rename from Source/WebCore/platform/text/LineEnding.cpp
rename to Source/WTF/wtf/text/LineEnding.cpp
index 3e0ea4d..e819aef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2008, 2017 Apple Inc. All rights reserved.
  * Copyright (C) 2010 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@ namespace {
 
 class OutputBuffer {
 public:
-    virtual uint8_t* allocate(size_t size) = 0;
+    virtual uint8_t* allocate(size_t) = 0;
     virtual void copy(const CString&) = 0;
     virtual ~OutputBuffer() { }
 };
@@ -153,7 +153,7 @@ void internalNormalizeLineEndingsToCRLF(const CString& from, OutputBuffer& buffe
 
 };
 
-namespace WebCore {
+namespace WTF {
 
 // Normalize all line-endings to CR or LF.
 static void normalizeToCROrLF(const CString& from, Vector<uint8_t>& result, bool toCR)
@@ -209,12 +209,12 @@ static void normalizeToCROrLF(const CString& from, Vector<uint8_t>& result, bool
 CString normalizeLineEndingsToCRLF(const CString& from)
 {
     CString result;
-    CStringBuffer buffer(result);
+    ::CStringBuffer buffer(result);
     internalNormalizeLineEndingsToCRLF(from, buffer);
     return buffer.buffer();
 }
 
-void normalizeLineEndingsToNative(const CString& from, Vector<uint8_t>& result)
+void normalizeAndAppendLineEndingsToNative(const CString& from, Vector<uint8_t>& result)
 {
 #if OS(WINDOWS)
     VectorCharAppendBuffer buffer(result);
@@ -224,4 +224,4 @@ void normalizeLineEndingsToNative(const CString& from, Vector<uint8_t>& result)
 #endif
 }
 
-} // namespace WebCore
+} // namespace WTF
similarity index 82%
rename from Source/WebCore/platform/text/LineEnding.h
rename to Source/WTF/wtf/text/LineEnding.h
index ea44362..51af045 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2008, 2017 Apple Inc. All rights reserved.
  * Copyright (C) 2010 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef LineEnding_h
-#define LineEnding_h
+#pragma once
 
 #include <wtf/Forward.h>
+#include <wtf/Vector.h>
 
-namespace WebCore {
+namespace WTF {
 
 // Normalize all line-endings in the given string to CRLF.
-CString normalizeLineEndingsToCRLF(const CString& from);
+WTF_EXPORT CString normalizeLineEndingsToCRLF(const CString& from);
 
 // Normalize all line-endings in the given string to the native line-endings and append the result to the given buffer.
 // (Normalize to CRLF on Windows and normalize to LF on all other platforms.)
-void normalizeLineEndingsToNative(const CString& from, Vector<uint8_t>& result);
+WTF_EXPORT void normalizeAndAppendLineEndingsToNative(const CString& from, Vector<uint8_t>& result);
 
-} // namespace WebCore
+} // namespace WTF
 
-#endif // LineEnding_h
+using WTF::normalizeLineEndingsToCRLF;
+using WTF::normalizeAndAppendLineEndingsToNative;
index 0053aef..d5708e9 100644 (file)
@@ -2612,7 +2612,6 @@ set(WebCore_SOURCES
 
     platform/text/BidiContext.cpp
     platform/text/DateTimeFormat.cpp
-    platform/text/LineEnding.cpp
     platform/text/LocaleToScriptMappingDefault.cpp
     platform/text/PlatformLocale.cpp
     platform/text/QuotedPrintable.cpp
index e7bbbce..7ca954d 100644 (file)
@@ -1,3 +1,16 @@
+2017-10-02  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Move LineEnding.{h,cpp} from WebCore/platform/text to wtf/text
+        https://bugs.webkit.org/show_bug.cgi?id=176575
+
+        Reviewed by Alex Christensen.
+
+        No new tests because there is no behavior change.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * fileapi/BlobBuilder.cpp:
+        * html/FormDataList.cpp:
+
 2017-10-02  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Rename methods ending in *Json() as *JSON()
index 9505c9b..a6c656b 100644 (file)
                8931DE5B14C44C44000DC9D2 /* JSBlobCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8931DE5A14C44C44000DC9D2 /* JSBlobCustom.cpp */; };
                898785F4122E1EAC003AABDA /* JSFileReaderSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 898785F2122E1EAC003AABDA /* JSFileReaderSync.cpp */; };
                898785F5122E1EAC003AABDA /* JSFileReaderSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 898785F3122E1EAC003AABDA /* JSFileReaderSync.h */; };
-               89B5EAA111E8003D00F2367E /* LineEnding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89B5EA9F11E8003D00F2367E /* LineEnding.cpp */; };
-               89B5EAA211E8003D00F2367E /* LineEnding.h in Headers */ = {isa = PBXBuildFile; fileRef = 89B5EAA011E8003D00F2367E /* LineEnding.h */; settings = {ATTRIBUTES = (Private, ); }; };
                89F60B11157F686E0075E157 /* DOMWindowQuota.h in Headers */ = {isa = PBXBuildFile; fileRef = 89F60B0A157F686D0075E157 /* DOMWindowQuota.h */; };
                89F60CDA15809D760075E157 /* JSStorageInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 89F60CD215809D760075E157 /* JSStorageInfo.h */; };
                8A12E35D11FA33280025836A /* LoadTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A12E35C11FA33280025836A /* LoadTiming.h */; settings = {ATTRIBUTES = (Private, ); }; };
                8931DE5A14C44C44000DC9D2 /* JSBlobCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBlobCustom.cpp; sourceTree = "<group>"; };
                898785F2122E1EAC003AABDA /* JSFileReaderSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileReaderSync.cpp; sourceTree = "<group>"; };
                898785F3122E1EAC003AABDA /* JSFileReaderSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileReaderSync.h; sourceTree = "<group>"; };
-               89B5EA9F11E8003D00F2367E /* LineEnding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LineEnding.cpp; sourceTree = "<group>"; };
-               89B5EAA011E8003D00F2367E /* LineEnding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineEnding.h; sourceTree = "<group>"; };
                89F60B0A157F686D0075E157 /* DOMWindowQuota.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowQuota.h; sourceTree = "<group>"; };
                89F60CD215809D760075E157 /* JSStorageInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStorageInfo.h; sourceTree = "<group>"; };
                89FD58D816EEDBD400E183F0 /* NavigatorStorageQuota.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorStorageQuota.h; sourceTree = "<group>"; };
                                CECCFC3A141973D5002A0AC1 /* DecodeEscapeSequences.h */,
                                7CCB11D81F81B22000849AFD /* FontRenderingMode.h */,
                                375CD231119D43C800A2A859 /* Hyphenation.h */,
-                               89B5EA9F11E8003D00F2367E /* LineEnding.cpp */,
-                               89B5EAA011E8003D00F2367E /* LineEnding.h */,
                                7633A72413D8B33A008501B6 /* LocaleToScriptMapping.h */,
                                7633A72513D8B33A008501B6 /* LocaleToScriptMappingDefault.cpp */,
                                F544F78615CFB2A800AF33A8 /* PlatformLocale.cpp */,
                                84730D911248F0B300D3A9C9 /* LightSource.h in Headers */,
                                B22279650D00BF220071B782 /* LinearGradientAttributes.h in Headers */,
                                AB31C91E10AE1B8E000C7B92 /* LineClampValue.h in Headers */,
-                               89B5EAA211E8003D00F2367E /* LineEnding.h in Headers */,
                                FFEFAB2A18380DA000514534 /* LineLayoutState.h in Headers */,
                                FFDBC047183D27B700407109 /* LineWidth.h in Headers */,
                                CBA9DC0B1DF44DF40005675C /* LinkHeader.h in Headers */,
                                417612B11E3A994000C3D81D /* LibWebRTCPeerConnectionBackend.cpp in Sources */,
                                41A1B00E1E526579007F3769 /* LibWebRTCProvider.cpp in Sources */,
                                FFB698CC1833EE0D00158A31 /* LineBreaker.cpp in Sources */,
-                               89B5EAA111E8003D00F2367E /* LineEnding.cpp in Sources */,
                                FFB698CF183402BB00158A31 /* LineInfo.cpp in Sources */,
                                FFDBC048183D27B700407109 /* LineWidth.cpp in Sources */,
                                CBA9DC0A1DF44DF10005675C /* LinkHeader.cpp in Sources */,
index d66dc9f..af6d1e6 100644 (file)
 #include "BlobBuilder.h"
 
 #include "Blob.h"
-#include "LineEnding.h"
 #include "TextEncoding.h"
 #include <runtime/ArrayBuffer.h>
 #include <runtime/ArrayBufferView.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/LineEnding.h>
 
 namespace WebCore {
 
@@ -73,7 +73,7 @@ void BlobBuilder::append(const String& text)
     CString utf8Text = UTF8Encoding().encode(text, EntitiesForUnencodables);
 
     if (m_endings == BlobLineEndings::Native)
-        normalizeLineEndingsToNative(utf8Text, m_appendableData);
+        normalizeAndAppendLineEndingsToNative(utf8Text, m_appendableData);
     else {
         ASSERT(m_endings == BlobLineEndings::Transparent);
         m_appendableData.append(utf8Text.data(), utf8Text.length());
index 672d0a9..c575fda 100644 (file)
 #include "File.h"
 #include "FileSystem.h"
 #include "FormDataBuilder.h"
-#include "LineEnding.h"
 #include "Page.h"
 #include "TextEncoding.h"
 #include "ThreadableBlobRegistry.h"
+#include <wtf/text/LineEnding.h>
 
 namespace WebCore {