[Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
authorross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Mar 2019 07:31:57 +0000 (07:31 +0000)
committerross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Mar 2019 07:31:57 +0000 (07:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195346

Reviewed by Fujii Hironori.

.:

* Source/cmake/OptionsJSCOnly.cmake:
* Source/cmake/OptionsWin.cmake:
Stop compiling with -DUCHAR_TYPE=wchar_t.

Source/JavaScriptCore:

* jsc.cpp:
(currentWorkingDirectory):
(fetchModuleFromLocalFileSystem):
* runtime/DateConversion.cpp:
(JSC::formatDateTime):
Use wchar helpers as needed.

Source/WebCore:

* platform/graphics/win/FontCacheWin.cpp:
(WebCore::appendLinkedFonts):
(WebCore::getLinkedFonts):
(WebCore::FontCache::systemFallbackForCharacters):
(WebCore::FontCache::fontFromDescriptionAndLogFont):
(WebCore::createGDIFont):
(WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
* platform/graphics/win/FontCustomPlatformDataCairo.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp:
(WebCore::GlyphPage::fill):
* platform/graphics/win/IconWin.cpp:
(WebCore::Icon::createIconForFiles):
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::mimeTypeCache):
(WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):
* platform/graphics/win/UniscribeController.cpp:
(WebCore::UniscribeController::itemizeShapeAndPlace):
(WebCore::UniscribeController::shape):
* platform/network/win/DownloadBundleWin.cpp:
(WebCore::DownloadBundle::appendResumeData):
(WebCore::DownloadBundle::extractResumeData):
* platform/text/win/LocaleWin.cpp:
(WebCore::LCIDFromLocaleInternal):
(WebCore::LCIDFromLocale):
(WebCore::LocaleWin::getLocaleInfoString):
* platform/win/BString.cpp:
(WebCore::BString::BString):
* platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::getWebLocData):
(WebCore::createGlobalData):
(WebCore::getFileDescriptorData):
(WebCore::getURL):
(WebCore::getCFData):
(WebCore::setCFData):
* platform/win/DragDataWin.cpp:
(WebCore::DragData::asFilenames const):
* platform/win/DragImageWin.cpp:
(WebCore::createDragImageIconForCachedImageFilename):
(WebCore::dragLabelFont):
* platform/win/MIMETypeRegistryWin.cpp:
(WebCore::mimeTypeForExtension):
(WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::read):
(WebCore::filesystemPathFromUrlOrTitle):
(WebCore::Pasteboard::writeURLToDataObject):
(WebCore::createGlobalImageFileDescriptor):
(WebCore::createGlobalHDropContent):
* platform/win/SSLKeyGeneratorWin.cpp:
(WebCore::signedPublicKeyAndChallengeString):
* platform/win/SharedBufferWin.cpp:
(WebCore::SharedBuffer::createFromReadingFile):
* rendering/RenderThemeWin.cpp:
(WebCore::fillFontDescription):
Use wchar helpers as needed.

Source/WebKit:

* Platform/IPC/win/ConnectionWin.cpp:
(IPC::Connection::createServerAndClientIdentifiers):
* Platform/win/ModuleWin.cpp:
(WebKit::Module::load):
* UIProcess/Launcher/win/ProcessLauncherWin.cpp:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/win/WebContextMenuProxyWin.cpp:
(WebKit::createMenuItem):
* UIProcess/win/WebView.cpp:
(WebKit::WebView::setToolTip):
* WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
(WebKit::InjectedBundle::initialize):
Use wchar helpers as needed.

Source/WebKitLegacy/win:

* COMPropertyBag.h:
(HashType>::GetPropertyInfo):
(HashType>::LoadObject):
* DOMCoreClasses.cpp:
(DOMNode::addEventListener):
(DOMNode::removeEventListener):
(DOMWindow::addEventListener):
(DOMWindow::removeEventListener):
(DOMElement::font):
* DOMHTMLClasses.cpp:
(DOMHTMLInputElement::setValueForUser):
(DOMHTMLInputElement::replaceCharactersInRange):
* Plugins/PluginDatabaseWin.cpp:
(WebCore::addPluginPathsFromRegistry):
(WebCore::PluginDatabase::getPluginPathsInDirectories const):
(WebCore::addMozillaPluginDirectories):
(WebCore::addWindowsMediaPlayerPluginDirectory):
(WebCore::addAdobeAcrobatPluginDirectory):
(WebCore::addJavaPluginDirectory):
(WebCore::safariPluginsDirectory):
(WebCore::addMacromediaPluginDirectories):
* Plugins/PluginPackageWin.cpp:
(WebCore::getVersionInfo):
(WebCore::PluginPackage::fetchInfo):
(WebCore::PluginPackage::load):
* Plugins/PluginViewWin.cpp:
(WebCore::PluginView::handlePostReadFile):
* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::runOpenPanel):
* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::checkSpellingOfString):
(WebEditorClient::checkGrammarOfString):
* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorFrontendClient::updateWindowTitle):
* WebLocalizableStrings.cpp:
(LocalizedString::operator LPCTSTR const):
* WebView.cpp:
(createContextMenuFromItems):
(WebView::setToolTip):
Use wchar helpers as needed.

Source/WTF:

* wtf/PlatformWin.cmake:
* wtf/text/AtomicString.h:
(WTF::AtomicString::AtomicString):
* wtf/text/WTFString.h:
(WTF::String::String):
* wtf/text/win/StringWin.cpp: Added.
(WTF::String::wideCharacters const): Renamed from WTF::stringToNullTerminatedWChar.
* wtf/text/win/WCharStringExtras.h:
(WTF::ucharFrom):
(WTF::wcharFrom):
(WTF::stringToNullTerminatedWChar): Deleted.
(WTF::wcharToString): Deleted.
(WTF::nullTerminatedWCharToString): Deleted.
Add static_assert-guarded reinterpret_cast wrappers for going between UChar* and wchar_t*.
Move existing to/from-String helpers into the String (and AtomicString) class(es).

* wtf/win/FileSystemWin.cpp:
(WTF::FileSystemImpl::getFindData):
(WTF::FileSystemImpl::getFinalPathName):
(WTF::FileSystemImpl::createSymbolicLink):
(WTF::FileSystemImpl::deleteFile):
(WTF::FileSystemImpl::deleteEmptyDirectory):
(WTF::FileSystemImpl::moveFile):
(WTF::FileSystemImpl::pathByAppendingComponent):
(WTF::FileSystemImpl::fileSystemRepresentation):
(WTF::FileSystemImpl::makeAllDirectories):
(WTF::FileSystemImpl::pathGetFileName):
(WTF::FileSystemImpl::storageDirectory):
(WTF::FileSystemImpl::generateTemporaryPath):
(WTF::FileSystemImpl::openTemporaryFile):
(WTF::FileSystemImpl::openFile):
(WTF::FileSystemImpl::hardLinkOrCopyFile):
(WTF::FileSystemImpl::deleteNonEmptyDirectory):
* wtf/win/LanguageWin.cpp:
(WTF::localeInfo):
* wtf/win/PathWalker.cpp:
(WTF::PathWalker::PathWalker):
Use wchar helpers as needed.

Tools:

* TestWebKitAPI/Tests/WTF/StringOperators.cpp:
(TestWebKitAPI::TEST):
Delete wchar tests -- these are MSVC-only and we won't be using String::operator+ going forward anyway.

* DumpRenderTree/win/DumpRenderTree.cpp:
(findFontFallback):
(addFontFallbackIfPresent):
(removeFontFallbackIfPresent):
(main):
* TestWebKitAPI/win/PlatformUtilitiesWin.cpp:
(TestWebKitAPI::Util::moduleDirectory):
(TestWebKitAPI::Util::createInjectedBundlePath):
Use wchar helpers as needed.

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

56 files changed:
ChangeLog
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/runtime/DateConversion.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/PlatformWin.cmake
Source/WTF/wtf/text/AtomicString.h
Source/WTF/wtf/text/WTFString.h
Source/WTF/wtf/text/win/StringWin.cpp [new file with mode: 0644]
Source/WTF/wtf/text/win/WCharStringExtras.h
Source/WTF/wtf/win/FileSystemWin.cpp
Source/WTF/wtf/win/LanguageWin.cpp
Source/WTF/wtf/win/PathWalker.cpp
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/win/FontCacheWin.cpp
Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp
Source/WebCore/platform/graphics/win/IconWin.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
Source/WebCore/platform/graphics/win/UniscribeController.cpp
Source/WebCore/platform/network/win/DownloadBundleWin.cpp
Source/WebCore/platform/text/win/LocaleWin.cpp
Source/WebCore/platform/win/BString.cpp
Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp
Source/WebCore/platform/win/DragDataWin.cpp
Source/WebCore/platform/win/DragImageWin.cpp
Source/WebCore/platform/win/MIMETypeRegistryWin.cpp
Source/WebCore/platform/win/PasteboardWin.cpp
Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp
Source/WebCore/platform/win/SharedBufferWin.cpp
Source/WebCore/rendering/RenderThemeWin.cpp
Source/WebKit/ChangeLog
Source/WebKit/Platform/IPC/win/ConnectionWin.cpp
Source/WebKit/Platform/win/ModuleWin.cpp
Source/WebKit/UIProcess/Launcher/win/ProcessLauncherWin.cpp
Source/WebKit/UIProcess/win/WebContextMenuProxyWin.cpp
Source/WebKit/UIProcess/win/WebView.cpp
Source/WebKit/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp
Source/WebKitLegacy/win/COMPropertyBag.h
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/DOMCoreClasses.cpp
Source/WebKitLegacy/win/DOMHTMLClasses.cpp
Source/WebKitLegacy/win/Plugins/PluginDatabaseWin.cpp
Source/WebKitLegacy/win/Plugins/PluginPackageWin.cpp
Source/WebKitLegacy/win/Plugins/PluginViewWin.cpp
Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.cpp
Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp
Source/WebKitLegacy/win/WebCoreSupport/WebInspectorClient.cpp
Source/WebKitLegacy/win/WebLocalizableStrings.cpp
Source/WebKitLegacy/win/WebView.cpp
Source/cmake/OptionsJSCOnly.cmake
Source/cmake/OptionsWin.cmake
Tools/ChangeLog
Tools/DumpRenderTree/win/DumpRenderTree.cpp
Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp
Tools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp

index d2f19d7..9e79ff9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
+        https://bugs.webkit.org/show_bug.cgi?id=195346
+
+        Reviewed by Fujii Hironori.
+
+        * Source/cmake/OptionsJSCOnly.cmake:
+        * Source/cmake/OptionsWin.cmake:
+        Stop compiling with -DUCHAR_TYPE=wchar_t.
+
 2019-03-06  Don Olmstead  <don.olmstead@sony.com>
 
         [WinCairo] Enable additional experimental features
index f76d109..b001b6f 100644 (file)
@@ -1,3 +1,17 @@
+2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
+        https://bugs.webkit.org/show_bug.cgi?id=195346
+
+        Reviewed by Fujii Hironori.
+
+        * jsc.cpp:
+        (currentWorkingDirectory):
+        (fetchModuleFromLocalFileSystem):
+        * runtime/DateConversion.cpp:
+        (JSC::formatDateTime):
+        Use wchar helpers as needed.
+
 2019-03-06  Mark Lam  <mark.lam@apple.com>
 
         Fix incorrect handling of try-finally completion values.
index e550a72..7ef1ae1 100644 (file)
@@ -98,7 +98,6 @@
 #include <direct.h>
 #include <fcntl.h>
 #include <io.h>
-#include <wtf/text/win/WCharStringExtras.h>
 #else
 #include <unistd.h>
 #endif
@@ -748,7 +747,7 @@ static Optional<DirectoryName> currentWorkingDirectory()
     // https://msdn.microsoft.com/en-us/library/windows/desktop/ff381407.aspx
     Vector<wchar_t> buffer(bufferLength);
     DWORD lengthNotIncludingNull = ::GetCurrentDirectoryW(bufferLength, buffer.data());
-    String directoryString = wcharToString(buffer.data(), lengthNotIncludingNull);
+    String directoryString(buffer.data(), lengthNotIncludingNull);
     // We don't support network path like \\host\share\<path name>.
     if (directoryString.startsWith("\\\\"))
         return WTF::nullopt;
@@ -1062,8 +1061,7 @@ static bool fetchModuleFromLocalFileSystem(const String& fileName, Vector& buffe
 #if OS(WINDOWS)
     // https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx#maxpath
     // Use long UNC to pass the long path name to the Windows APIs.
-    String longUNCPathName = WTF::makeString("\\\\?\\", fileName);
-    auto pathName = stringToNullTerminatedWChar(longUNCPathName);
+    auto pathName = makeString("\\\\?\\", fileName).wideCharacters();
     struct _stat status { };
     if (_wstat(pathName.data(), &status))
         return false;
index fa0fb42..73eea31 100644 (file)
@@ -32,7 +32,6 @@
 
 #if OS(WINDOWS)
 #include <windows.h>
-#include <wtf/text/win/WCharStringExtras.h>
 #endif
 
 namespace JSC {
@@ -109,7 +108,7 @@ String formatDateTime(const GregorianDateTime& t, DateTimeFormat format, bool as
             TIME_ZONE_INFORMATION timeZoneInformation;
             GetTimeZoneInformation(&timeZoneInformation);
             const WCHAR* winTimeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
-            String timeZoneName = nullTerminatedWCharToString(winTimeZoneName);
+            String timeZoneName(winTimeZoneName);
 #else
             struct tm gtm = t;
             char timeZoneName[70];
index 1a9b19d..0d9c9a4 100644 (file)
@@ -1,3 +1,49 @@
+2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
+        https://bugs.webkit.org/show_bug.cgi?id=195346
+
+        Reviewed by Fujii Hironori.
+
+        * wtf/PlatformWin.cmake:
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::AtomicString):
+        * wtf/text/WTFString.h:
+        (WTF::String::String):
+        * wtf/text/win/StringWin.cpp: Added.
+        (WTF::String::wideCharacters const): Renamed from WTF::stringToNullTerminatedWChar.
+        * wtf/text/win/WCharStringExtras.h:
+        (WTF::ucharFrom):
+        (WTF::wcharFrom):
+        (WTF::stringToNullTerminatedWChar): Deleted.
+        (WTF::wcharToString): Deleted.
+        (WTF::nullTerminatedWCharToString): Deleted.
+        Add static_assert-guarded reinterpret_cast wrappers for going between UChar* and wchar_t*.
+        Move existing to/from-String helpers into the String (and AtomicString) class(es).
+
+        * wtf/win/FileSystemWin.cpp:
+        (WTF::FileSystemImpl::getFindData):
+        (WTF::FileSystemImpl::getFinalPathName):
+        (WTF::FileSystemImpl::createSymbolicLink):
+        (WTF::FileSystemImpl::deleteFile):
+        (WTF::FileSystemImpl::deleteEmptyDirectory):
+        (WTF::FileSystemImpl::moveFile):
+        (WTF::FileSystemImpl::pathByAppendingComponent):
+        (WTF::FileSystemImpl::fileSystemRepresentation):
+        (WTF::FileSystemImpl::makeAllDirectories):
+        (WTF::FileSystemImpl::pathGetFileName):
+        (WTF::FileSystemImpl::storageDirectory):
+        (WTF::FileSystemImpl::generateTemporaryPath):
+        (WTF::FileSystemImpl::openTemporaryFile):
+        (WTF::FileSystemImpl::openFile):
+        (WTF::FileSystemImpl::hardLinkOrCopyFile):
+        (WTF::FileSystemImpl::deleteNonEmptyDirectory):
+        * wtf/win/LanguageWin.cpp:
+        (WTF::localeInfo):
+        * wtf/win/PathWalker.cpp:
+        (WTF::PathWalker::PathWalker):
+        Use wchar helpers as needed.
+
 2019-02-28  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add WeakHashSet
index 2c34022..c5979d8 100644 (file)
@@ -8,6 +8,7 @@ list(APPEND WTF_PUBLIC_HEADERS
 )
 
 list(APPEND WTF_SOURCES
+    text/win/StringWin.cpp
     text/win/TextBreakIteratorInternalICUWin.cpp
 
     win/CPUTimeWin.cpp
index 7d74502..12d0f6f 100644 (file)
 #include <wtf/text/IntegerToStringConversion.h>
 #include <wtf/text/WTFString.h>
 
+#if OS(WINDOWS)
+#include <wtf/text/win/WCharStringExtras.h>
+#endif
+
 // Define 'NO_IMPLICIT_ATOMICSTRING' before including this header,
 // to disallow (expensive) implicit String-->AtomicString conversions.
 #ifdef NO_IMPLICIT_ATOMICSTRING
@@ -153,6 +157,14 @@ public:
     operator NSString*() const { return m_string; }
 #endif
 
+#if OS(WINDOWS) && U_ICU_VERSION_MAJOR_NUM >= 59
+    AtomicString(const wchar_t* characters, unsigned length)
+        : AtomicString(ucharFrom(characters), length) { }
+
+    AtomicString(const wchar_t* characters)
+        : AtomicString(ucharFrom(characters)) { }
+#endif
+
     // AtomicString::fromUTF8 will return a null string if the input data contains invalid UTF-8 sequences.
     static AtomicString fromUTF8(const char*, size_t);
     static AtomicString fromUTF8(const char*);
index aa5c9fc..1d9f0db 100644 (file)
 #include <objc/objc.h>
 #endif
 
+#if OS(WINDOWS)
+#include <wtf/text/win/WCharStringExtras.h>
+#endif
+
 namespace WTF {
 
 // Declarations of string operations
@@ -330,6 +334,18 @@ public:
     operator NSString *() const;
 #endif
 
+#if OS(WINDOWS)
+#if U_ICU_VERSION_MAJOR_NUM >= 59
+    String(const wchar_t* characters, unsigned length)
+        : String(ucharFrom(characters), length) { }
+
+    String(const wchar_t* characters)
+        : String(ucharFrom(characters)) { }
+#endif
+
+    WTF_EXPORT_PRIVATE Vector<wchar_t> wideCharacters() const;
+#endif
+
     WTF_EXPORT_PRIVATE static String make8BitFrom16BitSource(const UChar*, size_t);
     template<size_t inlineCapacity> static String make8BitFrom16BitSource(const Vector<UChar, inlineCapacity>&);
 
diff --git a/Source/WTF/wtf/text/win/StringWin.cpp b/Source/WTF/wtf/text/win/StringWin.cpp
new file mode 100644 (file)
index 0000000..8833cd2
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2019 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+Vector<wchar_t> String::wideCharacters() const
+{
+    Vector<wchar_t> result;
+
+    if (m_impl) {
+        result.reserveInitialCapacity(length() + 1);
+
+        if (is8Bit()) {
+            const LChar* characters8 = m_impl->characters8();
+            for (size_t i = 0; i < length(); ++i)
+                result.uncheckedAppend(characters8[i]);
+        } else {
+            const UChar* characters16 = m_impl->characters16();
+            result.append(characters16, m_impl->length());
+        }
+
+        result.append(0);
+    }
+
+    return result;
+}
+
+}
index d41f462..fc7f9e2 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 Konstantin Tokarev <annulen@yandex.ru>
+ * Copyright (C) 2019 Sony Interactive Entertainment Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #pragma once
 
-#include <wchar.h>
-#include <wtf/text/WTFString.h>
-
 namespace WTF {
 
-inline Vector<wchar_t> stringToNullTerminatedWChar(const String& string)
+inline const UChar* ucharFrom(const wchar_t* characters)
 {
-    Vector<wchar_t> result;
-
-    if (!string.isNull()) {
-        result.reserveInitialCapacity(string.impl()->length() + 1);
-
-        if (string.is8Bit()) {
-            const LChar* characters8 = string.impl()->characters8();
-            for (size_t i = 0; i < string.impl()->length(); ++i)
-                result.uncheckedAppend(characters8[i]);
-        } else {
-            const UChar* characters16 = string.impl()->characters16();
-            result.append(characters16, string.impl()->length());
-        }
-
-        result.append(0);
-    }
+    static_assert(sizeof(wchar_t) == sizeof(UChar), "We assume wchar_t and UChar have the same size");
+    return reinterpret_cast<const UChar*>(characters);
+}
 
-    return result;
+inline UChar* ucharFrom(wchar_t* characters)
+{
+    static_assert(sizeof(wchar_t) == sizeof(UChar), "We assume wchar_t and UChar have the same size");
+    return reinterpret_cast<UChar*>(characters);
 }
 
-inline String wcharToString(const wchar_t* characters, unsigned length)
+inline const wchar_t* wcharFrom(const UChar* characters)
 {
     static_assert(sizeof(wchar_t) == sizeof(UChar), "We assume wchar_t and UChar have the same size");
-    return String(reinterpret_cast<const UChar*>(characters), length);
+    return reinterpret_cast<const wchar_t*>(characters);
 }
 
-inline String nullTerminatedWCharToString(const wchar_t* characters)
+inline wchar_t* wcharFrom(UChar* characters)
 {
-    return wcharToString(characters, wcslen(characters));
+    static_assert(sizeof(wchar_t) == sizeof(UChar), "We assume wchar_t and UChar have the same size");
+    return reinterpret_cast<wchar_t*>(characters);
 }
 
 } // namespace WTF
 
-using WTF::stringToNullTerminatedWChar;
-using WTF::wcharToString;
-using WTF::nullTerminatedWCharToString;
+using WTF::ucharFrom;
+using WTF::wcharFrom;
index d672af6..cf46a50 100644 (file)
@@ -51,7 +51,7 @@ static const ULONGLONG kSecondsFromFileTimeToTimet = 11644473600;
 
 static bool getFindData(String path, WIN32_FIND_DATAW& findData)
 {
-    HANDLE handle = FindFirstFileW(stringToNullTerminatedWChar(path).data(), &findData);
+    HANDLE handle = FindFirstFileW(path.wideCharacters().data(), &findData);
     if (handle == INVALID_HANDLE_VALUE)
         return false;
     FindClose(handle);
@@ -152,13 +152,13 @@ static String getFinalPathName(const String& path)
         return String();
 
     Vector<UChar> buffer(MAX_PATH);
-    if (::GetFinalPathNameByHandleW(handle, buffer.data(), buffer.size(), VOLUME_NAME_NT) >= MAX_PATH) {
+    if (::GetFinalPathNameByHandleW(handle, wcharFrom(buffer.data()), buffer.size(), VOLUME_NAME_NT) >= MAX_PATH) {
         closeFile(handle);
         return String();
     }
     closeFile(handle);
 
-    buffer.shrink(wcslen(buffer.data()));
+    buffer.shrink(wcslen(wcharFrom(buffer.data())));
     return String::adopt(WTFMove(buffer));
 }
 
@@ -221,7 +221,7 @@ Optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path)
 
 bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath)
 {
-    return !::CreateSymbolicLinkW(stringToNullTerminatedWChar(symbolicLinkPath).data(), stringToNullTerminatedWChar(targetPath).data(), 0);
+    return !::CreateSymbolicLinkW(symbolicLinkPath.wideCharacters().data(), targetPath.wideCharacters().data(), 0);
 }
 
 bool fileExists(const String& path)
@@ -233,37 +233,35 @@ bool fileExists(const String& path)
 bool deleteFile(const String& path)
 {
     String filename = path;
-    return !!DeleteFileW(stringToNullTerminatedWChar(filename).data());
+    return !!DeleteFileW(filename.wideCharacters().data());
 }
 
 bool deleteEmptyDirectory(const String& path)
 {
     String filename = path;
-    return !!RemoveDirectoryW(stringToNullTerminatedWChar(filename).data());
+    return !!RemoveDirectoryW(filename.wideCharacters().data());
 }
 
 bool moveFile(const String& oldPath, const String& newPath)
 {
     String oldFilename = oldPath;
     String newFilename = newPath;
-    return !!::MoveFileEx(stringToNullTerminatedWChar(oldFilename).data(), stringToNullTerminatedWChar(newFilename).data(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
+    return !!::MoveFileEx(oldFilename.wideCharacters().data(), newFilename.wideCharacters().data(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
 }
 
 String pathByAppendingComponent(const String& path, const String& component)
 {
     Vector<UChar> buffer(MAX_PATH);
-
     if (path.length() + 1 > buffer.size())
         return String();
 
     StringView(path).getCharactersWithUpconvert(buffer.data());
     buffer[path.length()] = '\0';
 
-    if (!PathAppendW(buffer.data(), stringToNullTerminatedWChar(component).data()))
+    if (!PathAppendW(wcharFrom(buffer.data()), component.wideCharacters().data()))
         return String();
 
-    buffer.shrink(wcslen(buffer.data()));
-
+    buffer.shrink(wcslen(wcharFrom(buffer.data())));
     return String::adopt(WTFMove(buffer));
 }
 
@@ -279,9 +277,7 @@ String pathByAppendingComponents(StringView path, const Vector<StringView>& comp
 
 CString fileSystemRepresentation(const String& path)
 {
-    auto upconvertedCharacters = StringView(path).upconvertedCharacters();
-
-    const UChar* characters = upconvertedCharacters;
+    auto characters = wcharFrom(StringView(path).upconvertedCharacters());
     int size = WideCharToMultiByte(CP_ACP, 0, characters, path.length(), 0, 0, 0, 0) - 1;
 
     char* buffer;
@@ -297,7 +293,7 @@ CString fileSystemRepresentation(const String& path)
 bool makeAllDirectories(const String& path)
 {
     String fullPath = path;
-    if (SHCreateDirectoryEx(0, stringToNullTerminatedWChar(fullPath).data(), 0) != ERROR_SUCCESS) {
+    if (SHCreateDirectoryEx(0, fullPath.wideCharacters().data(), 0) != ERROR_SUCCESS) {
         DWORD error = GetLastError();
         if (error != ERROR_FILE_EXISTS && error != ERROR_ALREADY_EXISTS) {
             LOG_ERROR("Failed to create path %s", path.ascii().data());
@@ -314,7 +310,7 @@ String homeDirectoryPath()
 
 String pathGetFileName(const String& path)
 {
-    return nullTerminatedWCharToString(::PathFindFileName(stringToNullTerminatedWChar(path).data()));
+    return String(::PathFindFileName(path.wideCharacters().data()));
 }
 
 String directoryName(const String& path)
@@ -350,9 +346,10 @@ static String bundleName()
 static String storageDirectory(DWORD pathIdentifier)
 {
     Vector<UChar> buffer(MAX_PATH);
-    if (FAILED(SHGetFolderPathW(0, pathIdentifier | CSIDL_FLAG_CREATE, 0, 0, buffer.data())))
+    if (FAILED(SHGetFolderPathW(0, pathIdentifier | CSIDL_FLAG_CREATE, 0, 0, wcharFrom(buffer.data()))))
         return String();
-    buffer.resize(wcslen(buffer.data()));
+
+    buffer.shrink(wcslen(wcharFrom(buffer.data())));
     String directory = String::adopt(WTFMove(buffer));
 
     directory = pathByAppendingComponent(directory, "Apple Computer\\" + bundleName());
@@ -397,7 +394,7 @@ static String generateTemporaryPath(const Function<bool(const String&)>& action)
 
         ASSERT(wcslen(tempFile) == WTF_ARRAY_LENGTH(tempFile) - 1);
 
-        proposedPath = pathByAppendingComponent(nullTerminatedWCharToString(tempPath), nullTerminatedWCharToString(tempFile));
+        proposedPath = pathByAppendingComponent(tempPath, tempFile);
         if (proposedPath.isEmpty())
             break;
     } while (!action(proposedPath));
@@ -411,7 +408,7 @@ String openTemporaryFile(const String&, PlatformFileHandle& handle)
 
     String proposedPath = generateTemporaryPath([&handle](const String& proposedPath) {
         // use CREATE_NEW to avoid overwriting an existing file with the same name
-        handle = ::CreateFileW(stringToNullTerminatedWChar(proposedPath).data(), GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
+        handle = ::CreateFileW(proposedPath.wideCharacters().data(), GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
 
         return isHandleValid(handle) || GetLastError() == ERROR_ALREADY_EXISTS;
     });
@@ -442,7 +439,7 @@ PlatformFileHandle openFile(const String& path, FileOpenMode mode)
     }
 
     String destination = path;
-    return CreateFile(stringToNullTerminatedWChar(destination).data(), desiredAccess, shareMode, 0, creationDisposition, FILE_ATTRIBUTE_NORMAL, 0);
+    return CreateFile(destination.wideCharacters().data(), desiredAccess, shareMode, 0, creationDisposition, FILE_ATTRIBUTE_NORMAL, 0);
 }
 
 void closeFile(PlatformFileHandle& handle)
@@ -501,7 +498,7 @@ int readFromFile(PlatformFileHandle handle, char* data, int length)
 
 bool hardLinkOrCopyFile(const String& source, const String& destination)
 {
-    return !!::CopyFile(stringToNullTerminatedWChar(source).data(), stringToNullTerminatedWChar(destination).data(), TRUE);
+    return !!::CopyFile(source.wideCharacters().data(), destination.wideCharacters().data(), TRUE);
 }
 
 String localUserSpecificStorageDirectory()
@@ -572,7 +569,7 @@ bool deleteNonEmptyDirectory(const String& directoryPath)
     SHFILEOPSTRUCT deleteOperation = {
         nullptr,
         FO_DELETE,
-        stringToNullTerminatedWChar(directoryPath).data(),
+        directoryPath.wideCharacters().data(),
         L"",
         FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT,
         false,
index 309ca66..fc1fc52 100644 (file)
@@ -31,6 +31,7 @@
 #include <wtf/Lock.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
+#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WTF {
 
@@ -44,7 +45,7 @@ static String localeInfo(LCTYPE localeType, const String& fallback)
         return fallback;
     UChar* localeNameBuf;
     String localeName = String::createUninitialized(localeChars, localeNameBuf);
-    localeChars = GetLocaleInfo(langID, localeType, localeNameBuf, localeChars);
+    localeChars = GetLocaleInfo(langID, localeType, wcharFrom(localeNameBuf), localeChars);
     if (!localeChars)
         return fallback;
     if (localeName.isEmpty())
index c6d3f97..8d7d7ac 100644 (file)
 #include <wtf/win/PathWalker.h>
 
 #include <wtf/text/WTFString.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WTF {
 
 PathWalker::PathWalker(const String& directory, const String& pattern)
 {
     String path = directory + "\\" + pattern;
-    m_handle = ::FindFirstFileW(stringToNullTerminatedWChar(path).data(), &m_data);
+    m_handle = ::FindFirstFileW(path.wideCharacters().data(), &m_data);
 }
 
 PathWalker::~PathWalker()
index a3bde4a..2d51777 100644 (file)
@@ -1,3 +1,67 @@
+2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
+        https://bugs.webkit.org/show_bug.cgi?id=195346
+
+        Reviewed by Fujii Hironori.
+
+        * platform/graphics/win/FontCacheWin.cpp:
+        (WebCore::appendLinkedFonts):
+        (WebCore::getLinkedFonts):
+        (WebCore::FontCache::systemFallbackForCharacters):
+        (WebCore::FontCache::fontFromDescriptionAndLogFont):
+        (WebCore::createGDIFont):
+        (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
+        * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
+        (WebCore::FontCustomPlatformData::fontPlatformData):
+        * platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp:
+        (WebCore::GlyphPage::fill):
+        * platform/graphics/win/IconWin.cpp:
+        (WebCore::Icon::createIconForFiles):
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::mimeTypeCache):
+        (WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):
+        * platform/graphics/win/UniscribeController.cpp:
+        (WebCore::UniscribeController::itemizeShapeAndPlace):
+        (WebCore::UniscribeController::shape):
+        * platform/network/win/DownloadBundleWin.cpp:
+        (WebCore::DownloadBundle::appendResumeData):
+        (WebCore::DownloadBundle::extractResumeData):
+        * platform/text/win/LocaleWin.cpp:
+        (WebCore::LCIDFromLocaleInternal):
+        (WebCore::LCIDFromLocale):
+        (WebCore::LocaleWin::getLocaleInfoString):
+        * platform/win/BString.cpp:
+        (WebCore::BString::BString):
+        * platform/win/ClipboardUtilitiesWin.cpp:
+        (WebCore::getWebLocData):
+        (WebCore::createGlobalData):
+        (WebCore::getFileDescriptorData):
+        (WebCore::getURL):
+        (WebCore::getCFData):
+        (WebCore::setCFData):
+        * platform/win/DragDataWin.cpp:
+        (WebCore::DragData::asFilenames const):
+        * platform/win/DragImageWin.cpp:
+        (WebCore::createDragImageIconForCachedImageFilename):
+        (WebCore::dragLabelFont):
+        * platform/win/MIMETypeRegistryWin.cpp:
+        (WebCore::mimeTypeForExtension):
+        (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
+        * platform/win/PasteboardWin.cpp:
+        (WebCore::Pasteboard::read):
+        (WebCore::filesystemPathFromUrlOrTitle):
+        (WebCore::Pasteboard::writeURLToDataObject):
+        (WebCore::createGlobalImageFileDescriptor):
+        (WebCore::createGlobalHDropContent):
+        * platform/win/SSLKeyGeneratorWin.cpp:
+        (WebCore::signedPublicKeyAndChallengeString):
+        * platform/win/SharedBufferWin.cpp:
+        (WebCore::SharedBuffer::createFromReadingFile):
+        * rendering/RenderThemeWin.cpp:
+        (WebCore::fillFontDescription):
+        Use wchar helpers as needed.
+
 2019-03-06  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: DOM Debugger: event breakpoints still fire when breakpoints are disabled
index 0794881..9a85640 100644 (file)
@@ -112,7 +112,7 @@ WEBCORE_EXPORT void appendLinkedFonts(WCHAR* linkedFonts, unsigned length, Vecto
         unsigned j = i;
         while (j < length && linkedFonts[j])
             j++;
-        result->append(wcharToString(linkedFonts + i, j - i));
+        result->append(String(linkedFonts + i, j - i));
         i = j + 1;
     }
 }
@@ -131,14 +131,14 @@ static const Vector<String>* getLinkedFonts(String& family)
         return result;
 
     DWORD linkedFontsBufferSize = 0;
-    if (::RegQueryValueEx(fontLinkKey, stringToNullTerminatedWChar(family).data(), 0, nullptr, nullptr, &linkedFontsBufferSize) == ERROR_FILE_NOT_FOUND) {
+    if (::RegQueryValueEx(fontLinkKey, family.wideCharacters().data(), 0, nullptr, nullptr, &linkedFontsBufferSize) == ERROR_FILE_NOT_FOUND) {
         WTFLogAlways("The font link key %s does not exist in the registry.", family.utf8().data());
         return result;
     }
 
     static const constexpr unsigned InitialBufferSize { 256 / sizeof(WCHAR) };
     Vector<WCHAR, InitialBufferSize> linkedFonts(roundUpToMultipleOf<sizeof(WCHAR)>(linkedFontsBufferSize) / sizeof(WCHAR));
-    if (::RegQueryValueEx(fontLinkKey, stringToNullTerminatedWChar(family).data(), 0, nullptr, reinterpret_cast<BYTE*>(linkedFonts.data()), &linkedFontsBufferSize) == ERROR_SUCCESS) {
+    if (::RegQueryValueEx(fontLinkKey, family.wideCharacters().data(), 0, nullptr, reinterpret_cast<BYTE*>(linkedFonts.data()), &linkedFontsBufferSize) == ERROR_SUCCESS) {
         unsigned length = linkedFontsBufferSize / sizeof(WCHAR);
         appendLinkedFonts(linkedFonts.data(), length, result);
     }
@@ -285,7 +285,7 @@ RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& descr
         SelectObject(hdc, hfont);
         WCHAR name[LF_FACESIZE];
         GetTextFace(hdc, LF_FACESIZE, name);
-        familyName = nullTerminatedWCharToString(name);
+        familyName = String(name);
 
         if (containsCharacter || currentFontContainsCharacter(hdc, character))
             break;
@@ -301,7 +301,7 @@ RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& descr
 
         LOGFONT logFont;
         logFont.lfCharSet = DEFAULT_CHARSET;
-        StringView(linkedFonts->at(linkedFontIndex)).getCharactersWithUpconvert(logFont.lfFaceName);
+        StringView(linkedFonts->at(linkedFontIndex)).getCharactersWithUpconvert(ucharFrom(logFont.lfFaceName));
         logFont.lfFaceName[linkedFonts->at(linkedFontIndex).length()] = 0;
         EnumFontFamiliesEx(hdc, &logFont, linkedFontEnumProc, reinterpret_cast<LPARAM>(&hfont), 0);
         linkedFontIndex++;
@@ -330,7 +330,7 @@ Vector<String> FontCache::systemFontFamilies()
 
 RefPtr<Font> FontCache::fontFromDescriptionAndLogFont(const FontDescription& fontDescription, const LOGFONT& font, AtomicString& outFontFamilyName)
 {
-    AtomicString familyName = wcharToString(font.lfFaceName, wcsnlen(font.lfFaceName, LF_FACESIZE));
+    AtomicString familyName(font.lfFaceName, wcsnlen(font.lfFaceName, LF_FACESIZE));
     RefPtr<Font> fontData = fontForFamily(fontDescription, familyName);
     if (fontData)
         outFontFamilyName = familyName;
@@ -484,7 +484,7 @@ static GDIObject<HFONT> createGDIFont(const AtomicString& family, LONG desiredWe
     LOGFONT logFont;
     logFont.lfCharSet = DEFAULT_CHARSET;
     StringView truncatedFamily = StringView(family).substring(0, static_cast<unsigned>(LF_FACESIZE - 1));
-    truncatedFamily.getCharactersWithUpconvert(logFont.lfFaceName);
+    truncatedFamily.getCharactersWithUpconvert(ucharFrom(logFont.lfFaceName));
     logFont.lfFaceName[truncatedFamily.length()] = 0;
     logFont.lfPitchAndFamily = 0;
 
@@ -598,7 +598,7 @@ Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamil
     LOGFONT logFont;
     logFont.lfCharSet = DEFAULT_CHARSET;
     StringView truncatedFamily = StringView(familyName).substring(0, static_cast<unsigned>(LF_FACESIZE - 1));
-    truncatedFamily.getCharactersWithUpconvert(logFont.lfFaceName);
+    truncatedFamily.getCharactersWithUpconvert(ucharFrom(logFont.lfFaceName));
     logFont.lfFaceName[truncatedFamily.length()] = 0;
     logFont.lfPitchAndFamily = 0;
 
index a57e69b..ab7c790 100644 (file)
 #include "FontPlatformData.h"
 #include "OpenTypeUtilities.h"
 #include "SharedBuffer.h"
-
 #include <cairo-win32.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/text/Base64.h>
-#include <wtf/text/win/WCharStringExtras.h>
 #include <wtf/win/GDIObject.h>
 
 namespace WebCore {
@@ -47,7 +45,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription&
 
     LOGFONT logFont;
     memset(&logFont, 0, sizeof(LOGFONT));
-    wcsncpy(logFont.lfFaceName, stringToNullTerminatedWChar(m_name).data(), LF_FACESIZE - 1);
+    wcsncpy(logFont.lfFaceName, m_name.wideCharacters().data(), LF_FACESIZE - 1);
 
     logFont.lfHeight = -size;
     if (renderingMode == FontRenderingMode::Normal)
index 4a59e1b..38caa8b 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "Font.h"
 #include "HWndDC.h"
+#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebCore {
 
@@ -49,7 +50,7 @@ bool GlyphPage::fill(UChar* buffer, unsigned bufferLength)
     SelectObject(dc, font.platformData().hfont());
 
     WORD localGlyphBuffer[GlyphPage::size * 2];
-    DWORD result = GetGlyphIndices(dc, buffer, bufferLength, localGlyphBuffer, GGI_MARK_NONEXISTING_GLYPHS);
+    DWORD result = GetGlyphIndices(dc, wcharFrom(buffer), bufferLength, localGlyphBuffer, GGI_MARK_NONEXISTING_GLYPHS);
     bool success = result != GDI_ERROR && static_cast<unsigned>(result) == bufferLength;
     if (success) {
         for (unsigned i = 0; i < GlyphPage::size; i++) {
index 799e347..852cba2 100644 (file)
@@ -26,7 +26,6 @@
 #include "LocalWindowsContext.h"
 #include <windows.h>
 #include <wtf/text/WTFString.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebCore {
 
@@ -54,7 +53,7 @@ RefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames)
         memset(&sfi, 0, sizeof(sfi));
 
         String tmpFilename = filenames[0];
-        if (!SHGetFileInfo(stringToNullTerminatedWChar(tmpFilename).data(), 0, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SHELLICONSIZE | SHGFI_SMALLICON))
+        if (!SHGetFileInfo(tmpFilename.wideCharacters().data(), 0, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SHELLICONSIZE | SHGFI_SMALLICON))
             return 0;
 
         return adoptRef(new Icon(sfi.hIcon));
index c848b61..efb155f 100644 (file)
@@ -44,7 +44,6 @@
 
 #include <wtf/MainThread.h>
 #include <wtf/NeverDestroyed.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 SOFT_LINK_LIBRARY(Mf);
 SOFT_LINK_OPTIONAL(Mf, MFCreateSourceResolver, HRESULT, STDAPICALLTYPE, (IMFSourceResolver**));
@@ -142,7 +141,7 @@ static const HashSet<String, ASCIICaseInsensitiveHash>& mimeTypeCache()
     if (SUCCEEDED(hr)) {
         CALPWSTR mimeTypeArray = propVarMimeTypeArray.calpwstr;
         for (unsigned i = 0; i < mimeTypeArray.cElems; i++)
-            cachedTypes.get().add(nullTerminatedWCharToString(mimeTypeArray.pElems[i]));
+            cachedTypes.get().add(mimeTypeArray.pElems[i]);
     }
 
     PropVariantClear(&propVarMimeTypeArray);
@@ -470,7 +469,7 @@ bool MediaPlayerPrivateMediaFoundation::startCreateMediaSource(const String& url
         return false;
 
     COMPtr<IUnknown> cancelCookie;
-    Vector<wchar_t> urlSource = stringToNullTerminatedWChar(url);
+    Vector<wchar_t> urlSource = url.wideCharacters();
 
     AsyncCallback* callback = new AsyncCallback(this, false);
 
index 1104547..474c486 100644 (file)
@@ -31,7 +31,7 @@
 #include "HWndDC.h"
 #include "TextRun.h"
 #include <wtf/MathExtras.h>
-
+#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebCore {
 using namespace WTF::Unicode;
@@ -196,7 +196,7 @@ void UniscribeController::itemizeShapeAndPlace(const UChar* cp, unsigned stringO
     m_items.resize(6);
     int numItems = 0;
     HRESULT rc = S_OK;
-    while (rc = ::ScriptItemize(cp, length, m_items.size() - 1, &m_control, &m_state, m_items.data(), &numItems) == E_OUTOFMEMORY) {
+    while (rc = ::ScriptItemize(wcharFrom(cp), length, m_items.size() - 1, &m_control, &m_state, m_items.data(), &numItems) == E_OUTOFMEMORY) {
         m_items.resize(m_items.size() * 2);
         resetControlAndState();
     }
@@ -428,7 +428,7 @@ bool UniscribeController::shape(const UChar* str, int len, SCRIPT_ITEM item, con
         return false;
 
     do {
-        shapeResult = ScriptShape(hdc, fontData->scriptCache(), str, len, glyphs.size(), &item.a,
+        shapeResult = ScriptShape(hdc, fontData->scriptCache(), wcharFrom(str), len, glyphs.size(), &item.a,
                                   glyphs.data(), clusters.data(), visualAttributes.data(), &glyphCount);
         if (shapeResult == E_PENDING) {
             // The script cache isn't primed with enough info yet.  We need to select our HFONT into
index 38fd60b..901b2b7 100644 (file)
@@ -31,7 +31,6 @@
 #include <sys/types.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebCore {
 
@@ -59,9 +58,9 @@ bool appendResumeData(const char* resumeBytes, uint32_t resumeLength, const Stri
         return false;
     }
 
-    String nullifiedPath = bundlePath;
+    auto nullifiedPath = bundlePath.wideCharacters();
     FILE* bundle = 0;
-    if (_wfopen_s(&bundle, stringToNullTerminatedWChar(nullifiedPath).data(), TEXT("ab")) || !bundle) {
+    if (_wfopen_s(&bundle, nullifiedPath.data(), TEXT("ab")) || !bundle) {
         LOG_ERROR("Failed to open file %s to append resume data", bundlePath.ascii().data());
         return false;
     }
@@ -98,9 +97,9 @@ bool extractResumeData(const String& bundlePath, Vector<char>& resumeData)
     }
 
     // Open a handle to the bundle file
-    String nullifiedPath = bundlePath;
+    auto nullifiedPath = bundlePath.wideCharacters();
     FILE* bundle = 0;
-    if (_wfopen_s(&bundle, stringToNullTerminatedWChar(nullifiedPath).data(), TEXT("r+b")) || !bundle) {
+    if (_wfopen_s(&bundle, nullifiedPath.data(), TEXT("r+b")) || !bundle) {
         LOG_ERROR("Failed to open file %s to get resume data", bundlePath.ascii().data());
         return false;
     }
index 15315ca..a61aa8c 100644 (file)
@@ -59,7 +59,7 @@ static LCID LCIDFromLocaleInternal(LCID userDefaultLCID, const String& userDefau
 {
     if (equalIgnoringASCIICase(extractLanguageCode(locale), userDefaultLanguageCode))
         return userDefaultLCID;
-    return LocaleNameToLCID(stringToNullTerminatedWChar(locale).data(), 0);
+    return LocaleNameToLCID(locale.wideCharacters().data(), 0);
 }
 
 static LCID LCIDFromLocale(const AtomicString& locale)
@@ -68,7 +68,7 @@ static LCID LCIDFromLocale(const AtomicString& locale)
     const size_t languageCodeBufferSize = 9;
     WCHAR lowercaseLanguageCode[languageCodeBufferSize];
     ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, lowercaseLanguageCode, languageCodeBufferSize);
-    String userDefaultLanguageCode = nullTerminatedWCharToString(lowercaseLanguageCode);
+    String userDefaultLanguageCode(lowercaseLanguageCode);
 
     LCID lcid = LCIDFromLocaleInternal(LOCALE_USER_DEFAULT, userDefaultLanguageCode, String(locale));
     if (!lcid)
@@ -95,7 +95,7 @@ String LocaleWin::getLocaleInfoString(LCTYPE type)
     if (bufferSizeWithNUL <= 0)
         return String();
     Vector<UChar> buffer(bufferSizeWithNUL);
-    ::GetLocaleInfo(m_lcid, type, buffer.data(), bufferSizeWithNUL);
+    ::GetLocaleInfo(m_lcid, type, wcharFrom(buffer.data()), bufferSizeWithNUL);
     buffer.shrink(bufferSizeWithNUL - 1);
     return String::adopt(WTFMove(buffer));
 }
index 0f46c5d..027cddd 100644 (file)
@@ -30,6 +30,7 @@
 #include <wtf/URL.h>
 #include <wtf/text/AtomicString.h>
 #include <wtf/text/StringView.h>
+#include <wtf/text/win/WCharStringExtras.h>
 
 #if USE(CF)
 #include <CoreFoundation/CoreFoundation.h>
@@ -65,7 +66,7 @@ BString::BString(const String& s)
     if (s.isNull())
         m_bstr = 0;
     else
-        m_bstr = SysAllocStringLen(StringView(s).upconvertedCharacters(), s.length());
+        m_bstr = SysAllocStringLen(wcharFrom(StringView(s).upconvertedCharacters()), s.length());
 }
 
 BString::BString(const URL& url)
@@ -73,7 +74,7 @@ BString::BString(const URL& url)
     if (url.isNull())
         m_bstr = 0;
     else
-        m_bstr = SysAllocStringLen(StringView(url.string()).upconvertedCharacters(), url.string().length());
+        m_bstr = SysAllocStringLen(wcharFrom(StringView(url.string()).upconvertedCharacters()), url.string().length());
 }
 
 BString::BString(const AtomicString& s)
@@ -81,7 +82,7 @@ BString::BString(const AtomicString& s)
     if (s.isNull())
         m_bstr = 0;
     else
-        m_bstr = SysAllocStringLen(StringView(s.string()).upconvertedCharacters(), s.length());
+        m_bstr = SysAllocStringLen(wcharFrom(StringView(s.string()).upconvertedCharacters()), s.length());
 }
 
 #if USE(CF)
index 0e4080b..953d4bd 100644 (file)
@@ -131,7 +131,7 @@ static bool getWebLocData(const DragDataMap* dataObject, String& url, String* ti
     if (!dataObject->contains(cfHDropFormat()->cfFormat))
         return false;
 
-    wcscpy(filename, stringToNullTerminatedWChar(dataObject->get(cfHDropFormat()->cfFormat)[0]).data());
+    wcscpy(filename, dataObject->get(cfHDropFormat()->cfFormat)[0].wideCharacters().data());
     if (_wcsicmp(PathFindExtensionW(filename), L".url"))
         return false;    
 
@@ -140,10 +140,10 @@ static bool getWebLocData(const DragDataMap* dataObject, String& url, String* ti
 
     if (title) {
         PathRemoveExtension(filename);
-        *title = nullTerminatedWCharToString(filename);
+        *title = String(filename);
     }
     
-    url = nullTerminatedWCharToString(urlBuffer);
+    url = String(urlBuffer);
     return true;
 #else
     return false;
@@ -185,7 +185,7 @@ HGLOBAL createGlobalData(const URL& url, const String& title)
 
     if (cbData) {
         PWSTR buffer = static_cast<PWSTR>(GlobalLock(cbData));
-        _snwprintf(buffer, size, L"%s\n%s", stringToNullTerminatedWChar(mutableURL).data(), stringToNullTerminatedWChar(mutableTitle).data());
+        _snwprintf(buffer, size, L"%s\n%s", mutableURL.wideCharacters().data(), mutableTitle.wideCharacters().data());
         GlobalUnlock(cbData);
     }
     return cbData;
@@ -402,7 +402,7 @@ void getFileDescriptorData(IDataObject* dataObject, int& size, String& pathname)
 
     FILEGROUPDESCRIPTOR* fgd = static_cast<FILEGROUPDESCRIPTOR*>(GlobalLock(store.hGlobal));
     size = fgd->fgd[0].nFileSizeLow;
-    pathname = nullTerminatedWCharToString(fgd->fgd[0].cFileName);
+    pathname = String(fgd->fgd[0].cFileName);
 
     GlobalUnlock(store.hGlobal);
     ::ReleaseStgMedium(&store);
@@ -525,9 +525,10 @@ String getURL(const DragDataMap* data, DragData::FilenameConversionPolicy filena
     if (!getDataMapItem(data, filenameWFormat(), stringData))
         getDataMapItem(data, filenameFormat(), stringData);
 
-    if (stringData.isEmpty() || (!PathFileExists(stringToNullTerminatedWChar(stringData).data()) && !PathIsUNC(stringToNullTerminatedWChar(stringData).data())))
+    auto wcharData = stringData.wideCharacters().data();
+    if (stringData.isEmpty() || (!PathFileExists(wcharData) && !PathIsUNC(wcharData)))
         return url;
-    RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar *)stringToNullTerminatedWChar(stringData).data(), wcslen(stringToNullTerminatedWChar(stringData).data())));
+    RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar *)wcharData, wcslen(wcharData)));
     if (urlFromPath(pathAsCFString.get(), url) && title)
         *title = url;
 #endif
@@ -742,7 +743,7 @@ void getCFData(IDataObject* data, FORMATETC* format, Vector<String>& dataStrings
     for (UINT i = 0; i < fileCount; i++) {
         if (!DragQueryFileW(hdrop, i, filename, WTF_ARRAY_LENGTH(filename)))
             continue;
-        dataStrings.append(nullTerminatedWCharToString(filename));
+        dataStrings.append(filename);
     }
 
     GlobalUnlock(store.hGlobal);
@@ -797,7 +798,7 @@ void setCFData(IDataObject* data, FORMATETC* format, const Vector<String>& dataS
     dropFiles->pFiles = sizeof(DROPFILES);
     dropFiles->fWide = TRUE;
     String filename = dataStrings.first();
-    wcscpy(reinterpret_cast<LPWSTR>(dropFiles + 1), stringToNullTerminatedWChar(filename).data());
+    wcscpy(reinterpret_cast<LPWSTR>(dropFiles + 1), filename.wideCharacters().data());
     GlobalUnlock(medium.hGlobal);
     data->SetData(format, &medium, FALSE);
     ::GlobalFree(medium.hGlobal);
index 479e0ca..ee0d8b2 100644 (file)
@@ -37,7 +37,6 @@
 #include <wtf/HashMap.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebCore {
 
@@ -158,7 +157,7 @@ Vector<String> DragData::asFilenames() const
         for (unsigned i = 0; i < numFiles; i++) {
             if (!DragQueryFileW(hdrop, i, filename, WTF_ARRAY_LENGTH(filename)))
                 continue;
-            result.append(nullTerminatedWCharToString(filename));
+            result.append(filename);
         }
 
         // Free up memory from drag
index 1255480..e81c801 100644 (file)
@@ -40,7 +40,6 @@
 #include "WebCoreTextRenderer.h"
 #include <wtf/RetainPtr.h>
 #include <wtf/URL.h>
-#include <wtf/text/win/WCharStringExtras.h>
 #include <wtf/win/GDIObject.h>
 
 #include <windows.h>
@@ -74,8 +73,8 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float)
 DragImageRef createDragImageIconForCachedImageFilename(const String& filename)
 {
     SHFILEINFO shfi { };
-    String fname = filename;
-    if (FAILED(SHGetFileInfo(stringToNullTerminatedWChar(fname).data(), FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES)))
+    auto fname = filename.wideCharacters();
+    if (FAILED(SHGetFileInfo(fname.data(), FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES)))
         return 0;
 
     ICONINFO iconInfo;
@@ -111,7 +110,7 @@ static FontCascade dragLabelFont(int size, bool bold, FontRenderingMode renderin
 
     FontCascadeDescription description;
     description.setWeight(bold ? boldWeightValue() : normalWeightValue());
-    description.setOneFamily(nullTerminatedWCharToString(metrics.lfSmCaptionFont.lfFaceName));
+    description.setOneFamily(metrics.lfSmCaptionFont.lfFaceName);
     description.setSpecifiedSize((float)size);
     description.setComputedSize((float)size);
     description.setRenderingMode(renderingMode);
index b350f1c..a044982 100644 (file)
@@ -30,7 +30,6 @@
 #include <wtf/HashMap.h>
 #include <wtf/MainThread.h>
 #include <wtf/WindowsExtras.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebCore {
 
@@ -41,10 +40,10 @@ static String mimeTypeForExtension(const String& extension)
     DWORD contentTypeStrLen = sizeof(contentTypeStr);
     DWORD keyType;
 
-    HRESULT result = getRegistryValue(HKEY_CLASSES_ROOT, stringToNullTerminatedWChar(ext).data(), L"Content Type", &keyType, contentTypeStr, &contentTypeStrLen);
+    HRESULT result = getRegistryValue(HKEY_CLASSES_ROOT, ext.wideCharacters().data(), L"Content Type", &keyType, contentTypeStr, &contentTypeStrLen);
 
     if (result == ERROR_SUCCESS && keyType == REG_SZ)
-        return wcharToString(contentTypeStr, contentTypeStrLen / sizeof(contentTypeStr[0]) - 1);
+        return String(contentTypeStr, contentTypeStrLen / sizeof(contentTypeStr[0]) - 1);
 
     return String();
 }
@@ -56,10 +55,10 @@ String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type)
     DWORD extStrLen = sizeof(extStr);
     DWORD keyType;
 
-    HRESULT result = getRegistryValue(HKEY_CLASSES_ROOT, stringToNullTerminatedWChar(path).data(), L"Extension", &keyType, extStr, &extStrLen);
+    HRESULT result = getRegistryValue(HKEY_CLASSES_ROOT, path.wideCharacters().data(), L"Extension", &keyType, extStr, &extStrLen);
 
     if (result == ERROR_SUCCESS && keyType == REG_SZ)
-        return wcharToString(extStr + 1, extStrLen / sizeof(extStr[0]) - 2);
+        return String(extStr + 1, extStrLen / sizeof(extStr[0]) - 2);
 
     return String();
 }
index a5fd930..efcc6b6 100644 (file)
@@ -341,7 +341,7 @@ void Pasteboard::read(PasteboardFileReader& reader)
         for (UINT i = 0; i < fileCount; i++) {
             if (!DragQueryFileW(hdrop, i, filename, WTF_ARRAY_LENGTH(filename)))
                 continue;
-            reader.readFilename(nullTerminatedWCharToString(filename));
+            reader.readFilename(filename);
         }
 
         GlobalUnlock(medium.hGlobal);
@@ -555,23 +555,22 @@ static inline void pathRemoveBadFSCharacters(PWSTR psz, size_t length)
     psz[writeTo] = 0;
 }
 
-static String filesystemPathFromUrlOrTitle(const String& url, const String& title, const UChar* extension, bool isLink)
+static String filesystemPathFromUrlOrTitle(const String& url, const String& title, const String& extension, bool isLink)
 {
     static const size_t fsPathMaxLengthExcludingNullTerminator = MAX_PATH - 1;
     bool usedURL = false;
-    WCHAR fsPathBuffer[MAX_PATH];
+    UChar fsPathBuffer[MAX_PATH];
     fsPathBuffer[0] = 0;
-    int extensionLen = extension ? lstrlen(extension) : 0;
-    int fsPathMaxLengthExcludingExtension = fsPathMaxLengthExcludingNullTerminator - extensionLen;
+    int fsPathMaxLengthExcludingExtension = fsPathMaxLengthExcludingNullTerminator - extension.length();
 
     if (!title.isEmpty()) {
         size_t len = std::min<size_t>(title.length(), fsPathMaxLengthExcludingExtension);
         StringView(title).substring(0, len).getCharactersWithUpconvert(fsPathBuffer);
         fsPathBuffer[len] = 0;
-        pathRemoveBadFSCharacters(fsPathBuffer, len);
+        pathRemoveBadFSCharacters(wcharFrom(fsPathBuffer), len);
     }
 
-    if (!lstrlen(fsPathBuffer)) {
+    if (!wcslen(wcharFrom(fsPathBuffer))) {
         URL kurl(URL(), url);
         usedURL = true;
         // The filename for any content based drag or file url should be the last element of 
@@ -587,18 +586,18 @@ static String filesystemPathFromUrlOrTitle(const String& url, const String& titl
             StringView(url).substring(0, len).getCharactersWithUpconvert(fsPathBuffer);
         }
         fsPathBuffer[len] = 0;
-        pathRemoveBadFSCharacters(fsPathBuffer, len);
+        pathRemoveBadFSCharacters(wcharFrom(fsPathBuffer), len);
     }
 
-    if (!extension)
-        return String(static_cast<UChar*>(fsPathBuffer));
+    if (extension.isEmpty())
+        return String(fsPathBuffer);
 
     if (!isLink && usedURL) {
-        PathRenameExtension(fsPathBuffer, extension);
-        return String(static_cast<UChar*>(fsPathBuffer));
+        PathRenameExtension(wcharFrom(fsPathBuffer), extension.wideCharacters().data());
+        return String(fsPathBuffer);
     }
 
-    return makeString(static_cast<const UChar*>(fsPathBuffer), extension);
+    return makeString(const_cast<const UChar*>(fsPathBuffer), extension);
 }
 
 // writeFileToDataObject takes ownership of fileDescriptor and fileContent
@@ -655,7 +654,7 @@ void Pasteboard::writeURLToDataObject(const URL& kurl, const String& titleStr)
     String url = kurl.string();
     ASSERT(url.isAllASCII()); // URL::string() is URL encoded.
 
-    String fsPath = filesystemPathFromUrlOrTitle(url, titleStr, L".URL", true);
+    String fsPath = filesystemPathFromUrlOrTitle(url, titleStr, ".URL", true);
     String contentString("[InternetShortcut]\r\nURL=" + url + "\r\n");
     CString content = contentString.latin1();
 
@@ -684,7 +683,7 @@ void Pasteboard::writeURLToDataObject(const URL& kurl, const String& titleStr)
     fgd->fgd[0].nFileSizeLow = content.length();
 
     unsigned maxSize = std::min<unsigned>(fsPath.length(), WTF_ARRAY_LENGTH(fgd->fgd[0].cFileName));
-    StringView(fsPath).substring(0, maxSize).getCharactersWithUpconvert(fgd->fgd[0].cFileName);
+    StringView(fsPath).substring(0, maxSize).getCharactersWithUpconvert(ucharFrom(fgd->fgd[0].cFileName));
     GlobalUnlock(urlFileDescriptor);
 
     char* fileContents = static_cast<char*>(GlobalLock(urlFileContent));
@@ -914,7 +913,7 @@ static HGLOBAL createGlobalImageFileDescriptor(const String& url, const String&
         return 0;
     }
     extension.insert(".", 0);
-    fsPath = filesystemPathFromUrlOrTitle(url, preferredTitle, extension.charactersWithNullTermination().data(), false);
+    fsPath = filesystemPathFromUrlOrTitle(url, preferredTitle, extension, false);
 
     if (fsPath.length() <= 0) {
         GlobalUnlock(memObj);
@@ -923,7 +922,7 @@ static HGLOBAL createGlobalImageFileDescriptor(const String& url, const String&
     }
 
     int maxSize = std::min<int>(fsPath.length(), WTF_ARRAY_LENGTH(fgd->fgd[0].cFileName));
-    StringView(fsPath).substring(0, maxSize).getCharactersWithUpconvert(fgd->fgd[0].cFileName);
+    StringView(fsPath).substring(0, maxSize).getCharactersWithUpconvert(ucharFrom(fgd->fgd[0].cFileName));
     GlobalUnlock(memObj);
 
     return memObj;
@@ -961,8 +960,7 @@ static HGLOBAL createGlobalHDropContent(const URL& url, String& fileName, Shared
         // windows does not enjoy a leading slash on paths
         if (localPath[0] == '/')
             localPath = localPath.substring(1);
-        auto localPathWide = stringToNullTerminatedWChar(localPath);
-        LPCWSTR localPathStr = localPathWide.data();
+        LPCWSTR localPathStr = localPath.wideCharacters().data();
         if (localPathStr && wcslen(localPathStr) + 1 < MAX_PATH)
             wcscpy_s(filePath, MAX_PATH, localPathStr);
         else
@@ -972,7 +970,7 @@ static HGLOBAL createGlobalHDropContent(const URL& url, String& fileName, Shared
         WCHAR extension[MAX_PATH];
         if (!::GetTempPath(WTF_ARRAY_LENGTH(tempPath), tempPath))
             return 0;
-        if (!::PathAppend(tempPath, stringToNullTerminatedWChar(fileName).data()))
+        if (!::PathAppend(tempPath, fileName.wideCharacters().data()))
             return 0;
         LPCWSTR foundExtension = ::PathFindExtension(tempPath);
         if (foundExtension) {
index fd6806e..6b72984 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <wtf/text/Base64.h>
 #include <wtf/text/CString.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 #include <windows.h>
 #include <wincrypt.h>
@@ -67,7 +66,7 @@ String signedPublicKeyAndChallengeString(unsigned index, const String& challenge
         String localChallenge = challenge;
 
         // Windows API won't write to our buffer, although it's not declared with const.
-        auto localChallengeWide = stringToNullTerminatedWChar(localChallenge);
+        auto localChallengeWide = localChallenge.wideCharacters();
         requestInfo.pwszChallengeString = const_cast<wchar_t*>(localChallengeWide.data());
 
         CRYPT_ALGORITHM_IDENTIFIER signAlgo { };
index 5bdabb6..6291b64 100644 (file)
@@ -30,7 +30,6 @@
 #include "config.h"
 #include "SharedBuffer.h"
 #include <wtf/text/CString.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebCore {
 
@@ -40,7 +39,7 @@ RefPtr<SharedBuffer> SharedBuffer::createFromReadingFile(const String& filePath)
         return nullptr;
 
     String nullifiedPath = filePath;
-    HANDLE fileHandle = CreateFileW(stringToNullTerminatedWChar(nullifiedPath).data(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+    HANDLE fileHandle = CreateFileW(nullifiedPath.wideCharacters().data(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
     if (fileHandle == INVALID_HANDLE_VALUE) {
         LOG_ERROR("Failed to open file %s to create shared buffer, GetLastError() = %u", filePath.ascii().data(), GetLastError());
         return nullptr;
index 6e41381..7eb703a 100644 (file)
@@ -40,7 +40,6 @@
 #include <wtf/FileSystem.h>
 #include <wtf/SoftLinking.h>
 #include <wtf/text/StringBuilder.h>
-#include <wtf/text/win/WCharStringExtras.h>
 #include <wtf/win/GDIObject.h>
 
 #if ENABLE(VIDEO)
@@ -318,7 +317,7 @@ Color RenderThemeWin::platformInactiveSelectionForegroundColor(OptionSet<StyleCo
 static void fillFontDescription(FontCascadeDescription& fontDescription, LOGFONT& logFont, float fontSize)
 {    
     fontDescription.setIsAbsoluteSize(true);
-    fontDescription.setOneFamily(nullTerminatedWCharToString(logFont.lfFaceName));
+    fontDescription.setOneFamily(logFont.lfFaceName);
     fontDescription.setSpecifiedSize(fontSize);
     fontDescription.setWeight(logFont.lfWeight >= 700 ? boldWeightValue() : normalWeightValue()); // FIXME: Use real weight.
     fontDescription.setIsItalic(logFont.lfItalic);
index df04689..84628d6 100644 (file)
@@ -1,3 +1,24 @@
+2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
+        https://bugs.webkit.org/show_bug.cgi?id=195346
+
+        Reviewed by Fujii Hironori.
+
+        * Platform/IPC/win/ConnectionWin.cpp:
+        (IPC::Connection::createServerAndClientIdentifiers):
+        * Platform/win/ModuleWin.cpp:
+        (WebKit::Module::load):
+        * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
+        (WebKit::ProcessLauncher::launchProcess):
+        * UIProcess/win/WebContextMenuProxyWin.cpp:
+        (WebKit::createMenuItem):
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::setToolTip):
+        * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
+        (WebKit::InjectedBundle::initialize):
+        Use wchar helpers as needed.
+
 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Crash when attempting to change input type while dismissing datalist suggestions
index ebb3738..e26a7e2 100644 (file)
@@ -43,7 +43,7 @@ bool Connection::createServerAndClientIdentifiers(HANDLE& serverIdentifier, HAND
         unsigned uniqueID = randomNumber() * std::numeric_limits<unsigned>::max();
         pipeName = makeString("\\\\.\\pipe\\com.apple.WebKit.", hex(uniqueID));
 
-        serverIdentifier = ::CreateNamedPipe(pipeName.charactersWithNullTermination().data(),
+        serverIdentifier = ::CreateNamedPipe(pipeName.wideCharacters().data(),
             PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED,
             PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, 1, inlineMessageMaxSize, inlineMessageMaxSize,
             0, 0);
@@ -52,7 +52,7 @@ bool Connection::createServerAndClientIdentifiers(HANDLE& serverIdentifier, HAND
     if (!serverIdentifier)
         return false;
 
-    clientIdentifier = ::CreateFileW(pipeName.charactersWithNullTermination().data(), GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
+    clientIdentifier = ::CreateFileW(pipeName.wideCharacters().data(), GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
     if (!clientIdentifier) {
         ::CloseHandle(serverIdentifier);
         return false;
index 7b65d77..33b709e 100644 (file)
@@ -34,8 +34,8 @@ namespace WebKit {
 
 bool Module::load()
 {
-    ASSERT(!::PathIsRelativeW(m_path.charactersWithNullTermination().data()));
-    m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination().data(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
+    ASSERT(!::PathIsRelativeW(m_path.wideCharacters().data()));
+    m_module = ::LoadLibraryExW(m_path.wideCharacters().data(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
     return m_module;
 }
 
index 577e469..d3d171d 100644 (file)
@@ -31,7 +31,6 @@
 #include <WTF/RunLoop.h>
 #include <shlwapi.h>
 #include <wtf/text/StringBuilder.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebKit {
 
@@ -85,7 +84,7 @@ void ProcessLauncher::launchProcess()
     commandLineBuilder.append(String::number(reinterpret_cast<uintptr_t>(clientIdentifier)));
     commandLineBuilder.append('\0');
 
-    auto commandLine = stringToNullTerminatedWChar(commandLineBuilder.toString());
+    auto commandLine = commandLineBuilder.toString().wideCharacters();
 
     STARTUPINFO startupInfo { };
     startupInfo.cb = sizeof(startupInfo);
index af435c1..aa171f4 100644 (file)
@@ -71,7 +71,7 @@ static void createMenuItem(const ContextMenuContextData &context, HMENU menu, co
     switch (data.type()) {
     case ActionType:
     case CheckableActionType:
-        ::AppendMenu(menu, flags | MF_STRING, data.action(), data.title().charactersWithNullTermination().data());
+        ::AppendMenu(menu, flags | MF_STRING, data.action(), data.title().wideCharacters().data());
         break;
     case SeparatorType:
         ::AppendMenu(menu, flags | MF_SEPARATOR, data.action(), nullptr);
@@ -79,7 +79,7 @@ static void createMenuItem(const ContextMenuContextData &context, HMENU menu, co
     case SubmenuType:
         HMENU submenu = createMenu(context);
         populate(context, submenu, data.submenu());
-        ::AppendMenu(menu, flags | MF_POPUP, (UINT_PTR)submenu, data.title().charactersWithNullTermination().data());
+        ::AppendMenu(menu, flags | MF_POPUP, (UINT_PTR)submenu, data.title().wideCharacters().data());
         break;
     }
 }
index 14b1d9f..450a06d 100644 (file)
@@ -874,8 +874,8 @@ void WebView::setToolTip(const String& toolTip)
         info.cbSize = sizeof(info);
         info.uFlags = TTF_IDISHWND;
         info.uId = reinterpret_cast<UINT_PTR>(nativeWindow());
-        Vector<UChar> toolTipCharacters = toolTip.charactersWithNullTermination(); // Retain buffer long enough to make the SendMessage call
-        info.lpszText = const_cast<UChar*>(toolTipCharacters.data());
+        Vector<wchar_t> toolTipCharacters = toolTip.wideCharacters(); // Retain buffer long enough to make the SendMessage call
+        info.lpszText = const_cast<wchar_t*>(toolTipCharacters.data());
         ::SendMessage(m_toolTipWindow, TTM_UPDATETIPTEXT, 0, reinterpret_cast<LPARAM>(&info));
     }
 
index f987eb7..f75c2aa 100644 (file)
 
 #include "WKBundleAPICast.h"
 #include "WKBundleInitialize.h"
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebKit {
 
 bool InjectedBundle::initialize(const WebProcessCreationParameters&, API::Object* initializationUserData)
 {
-    HMODULE lib = ::LoadLibrary(stringToNullTerminatedWChar(m_path).data());
+    HMODULE lib = ::LoadLibrary(m_path.wideCharacters().data());
     if (!lib)
         return false;
 
index 2165a23..cc3d8d5 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef COMPropertyBag_h
-#define COMPropertyBag_h
+#pragma once
 
+#include "COMVariantSetter.h"
 #include <ocidl.h>
 #include <unknwn.h>
-
 #include <wtf/Noncopyable.h>
 #include <wtf/HashMap.h>
 
-#include "COMVariantSetter.h"
-
 template<typename ValueType, typename KeyType = typename WTF::String, typename HashType = typename WTF::StringHash>
 class COMPropertyBag final : public IPropertyBag, public IPropertyBag2 {
     WTF_MAKE_NONCOPYABLE(COMPropertyBag);
@@ -220,7 +217,7 @@ HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::GetPrope
         pPropBag[j].pstrName = (LPOLESTR)CoTaskMemAlloc(sizeof(wchar_t)*(current->key.length()+1));
         if (!pPropBag[j].pstrName)
             return E_OUTOFMEMORY;
-        wcscpy_s(pPropBag[j].pstrName, current->key.length()+1, static_cast<String>(current->key).charactersWithNullTermination().data());
+        wcscpy_s(pPropBag[j].pstrName, current->key.length()+1, current->key.wideCharacters().data());
         ++*pcProperties;
     }
     return S_OK;
@@ -231,5 +228,3 @@ HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::LoadObje
 {
     return E_NOTIMPL;
 }
-
-#endif // COMPropertyBag_h
index 7e827b5..3f23ba1 100644 (file)
@@ -1,3 +1,51 @@
+2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
+        https://bugs.webkit.org/show_bug.cgi?id=195346
+
+        Reviewed by Fujii Hironori.
+
+        * COMPropertyBag.h:
+        (HashType>::GetPropertyInfo):
+        (HashType>::LoadObject):
+        * DOMCoreClasses.cpp:
+        (DOMNode::addEventListener):
+        (DOMNode::removeEventListener):
+        (DOMWindow::addEventListener):
+        (DOMWindow::removeEventListener):
+        (DOMElement::font):
+        * DOMHTMLClasses.cpp:
+        (DOMHTMLInputElement::setValueForUser):
+        (DOMHTMLInputElement::replaceCharactersInRange):
+        * Plugins/PluginDatabaseWin.cpp:
+        (WebCore::addPluginPathsFromRegistry):
+        (WebCore::PluginDatabase::getPluginPathsInDirectories const):
+        (WebCore::addMozillaPluginDirectories):
+        (WebCore::addWindowsMediaPlayerPluginDirectory):
+        (WebCore::addAdobeAcrobatPluginDirectory):
+        (WebCore::addJavaPluginDirectory):
+        (WebCore::safariPluginsDirectory):
+        (WebCore::addMacromediaPluginDirectories):
+        * Plugins/PluginPackageWin.cpp:
+        (WebCore::getVersionInfo):
+        (WebCore::PluginPackage::fetchInfo):
+        (WebCore::PluginPackage::load):
+        * Plugins/PluginViewWin.cpp:
+        (WebCore::PluginView::handlePostReadFile):
+        * WebCoreSupport/WebChromeClient.cpp:
+        (WebChromeClient::runOpenPanel):
+        * WebCoreSupport/WebEditorClient.cpp:
+        (WebEditorClient::checkSpellingOfString):
+        (WebEditorClient::checkGrammarOfString):
+        * WebCoreSupport/WebInspectorClient.cpp:
+        (WebInspectorFrontendClient::updateWindowTitle):
+        * WebLocalizableStrings.cpp:
+        (LocalizedString::operator LPCTSTR const):
+        * WebView.cpp:
+        (createContextMenuFromItems):
+        (WebView::setToolTip):
+        Use wchar helpers as needed.
+
 2019-03-02  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] Programmatic paste access should be granted when copying and pasting within the same origin
index c5880ea..eada3e6 100644 (file)
@@ -30,7 +30,6 @@
 #include "DOMEventsClasses.h"
 #include "DOMHTMLClasses.h"
 #include "WebKitGraphics.h"
-
 #include <WebCore/Attr.h>
 #include <WebCore/BString.h>
 #include <WebCore/COMPtr.h>
@@ -56,8 +55,9 @@
 #include <WebCore/RenderTreeAsText.h>
 #include <WebCore/ScrollIntoViewOptions.h>
 #include <WebCore/StyledElement.h>
-
 #include <initguid.h>
+#include <wtf/text/win/WCharStringExtras.h>
+
 // {3B0C0EFF-478B-4b0b-8290-D2321E08E23E}
 DEFINE_GUID(IID_DOMElement, 0x3b0c0eff, 0x478b, 0x4b0b, 0x82, 0x90, 0xd2, 0x32, 0x1e, 0x8, 0xe2, 0x3e);
 
@@ -414,7 +414,7 @@ HRESULT DOMNode::setTextContent(_In_ BSTR /*text*/)
 HRESULT DOMNode::addEventListener(_In_ BSTR type, _In_opt_ IDOMEventListener* listener, BOOL useCapture)
 {
     auto webListener = WebEventListener::create(listener);
-    m_node->addEventListener(type, WTFMove(webListener), useCapture);
+    m_node->addEventListener(ucharFrom(type), WTFMove(webListener), useCapture);
 
     return S_OK;
 }
@@ -426,7 +426,7 @@ HRESULT DOMNode::removeEventListener(_In_ BSTR type, _In_opt_ IDOMEventListener*
     if (!m_node)
         return E_FAIL;
     auto webListener = WebEventListener::create(listener);
-    m_node->removeEventListener(type, webListener, useCapture);
+    m_node->removeEventListener(ucharFrom(type), webListener, useCapture);
     return S_OK;
 }
 
@@ -924,7 +924,7 @@ HRESULT DOMWindow::addEventListener(_In_ BSTR type, _In_opt_ IDOMEventListener*
     if (!m_window)
         return E_FAIL;
     auto webListener = WebEventListener::create(listener);
-    m_window->addEventListener(type, WTFMove(webListener), useCapture);
+    m_window->addEventListener(ucharFrom(type), WTFMove(webListener), useCapture);
     return S_OK;
 }
 
@@ -935,7 +935,7 @@ HRESULT DOMWindow::removeEventListener(_In_ BSTR type, _In_opt_ IDOMEventListene
     if (!m_window)
         return E_FAIL;
     auto webListener = WebEventListener::create(listener);
-    m_window->removeEventListener(type, webListener, useCapture);
+    m_window->removeEventListener(ucharFrom(type), webListener, useCapture);
     return S_OK;
 }
 
@@ -1292,7 +1292,7 @@ HRESULT DOMElement::font(_Out_ WebFontDescription* webFontDescription)
     UChar* familyCharactersBuffer = new UChar[family.length()];
     StringView(family.string()).getCharactersWithUpconvert(familyCharactersBuffer);
 
-    webFontDescription->family = familyCharactersBuffer;
+    webFontDescription->family = wcharFrom(familyCharactersBuffer);
     webFontDescription->familyLength = family.length();
     webFontDescription->size = fontDescription.computedSize();
     webFontDescription->bold = isFontWeightBold(fontDescription.weight());
index 3cf38b4..4c1ff63 100644 (file)
@@ -1228,7 +1228,7 @@ HRESULT DOMHTMLInputElement::setValueForUser(_In_ BSTR value)
 {
     ASSERT(is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
-    inputElement.setValueForUser(String(static_cast<UChar*>(value), SysStringLen(value)));
+    inputElement.setValueForUser(String(value, SysStringLen(value)));
     return S_OK;
 }
 
@@ -1326,7 +1326,7 @@ HRESULT DOMHTMLInputElement::replaceCharactersInRange(int startTarget, int endTa
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
 
     String newValue = inputElement.value();
-    String webCoreReplacementString(static_cast<UChar*>(replacementString), SysStringLen(replacementString));
+    String webCoreReplacementString(replacementString, SysStringLen(replacementString));
     newValue.replace(startTarget, endTarget - startTarget, webCoreReplacementString);
     inputElement.setValue(newValue);
     inputElement.setSelectionRange(index, newValue.length());
index 814e2bb..807a9c1 100644 (file)
@@ -31,7 +31,6 @@
 #include <WebCore/Frame.h>
 #include <wtf/URL.h>
 #include <wtf/WindowsExtras.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebCore {
 
@@ -62,7 +61,7 @@ static inline void addPluginPathsFromRegistry(HKEY rootKey, HashSet<String>& pat
         if (result != ERROR_SUCCESS || type != REG_SZ)
             continue;
 
-        paths.add(wcharToString(pathStr, pathStrSize / sizeof(WCHAR) - 1));
+        paths.add(String(pathStr, pathStrSize / sizeof(WCHAR) - 1));
     }
 
     RegCloseKey(key);
@@ -83,7 +82,7 @@ void PluginDatabase::getPluginPathsInDirectories(HashSet<String>& paths) const
     for (auto& directory : m_pluginDirectories) {
         String pattern = directory + "\\*";
 
-        hFind = FindFirstFileW(stringToNullTerminatedWChar(pattern).data(), &findFileData);
+        hFind = FindFirstFileW(pattern.wideCharacters().data(), &findFileData);
 
         if (hFind == INVALID_HANDLE_VALUE)
             continue;
@@ -92,7 +91,7 @@ void PluginDatabase::getPluginPathsInDirectories(HashSet<String>& paths) const
             if (findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                 continue;
 
-            String filename = wcharToString(findFileData.cFileName, wcslen(findFileData.cFileName));
+            String filename(findFileData.cFileName, wcslen(findFileData.cFileName));
             if (!(startsWithLettersIgnoringASCIICase(filename, "np") && filename.endsWithIgnoringASCIICase("dll"))
                 && !(equalLettersIgnoringASCIICase(filename, "plugin.dll") && directory.endsWithIgnoringASCIICase("shockwave 10")))
                 continue;
@@ -180,11 +179,11 @@ static inline void addMozillaPluginDirectories(Vector<String>& directories)
             if (result != ERROR_SUCCESS)
                 break;
 
-            String extensionsPath = wcharToString(name, nameLen) + "\\Extensions";
+            String extensionsPath = String(name, nameLen) + "\\Extensions";
             HKEY extensionsKey;
 
             // Try opening the key
-            result = RegOpenKeyEx(key, stringToNullTerminatedWChar(extensionsPath).data(), 0, KEY_READ, &extensionsKey);
+            result = RegOpenKeyEx(key, extensionsPath.wideCharacters().data(), 0, KEY_READ, &extensionsKey);
 
             if (result == ERROR_SUCCESS) {
                 // Now get the plugins directory
@@ -195,7 +194,7 @@ static inline void addMozillaPluginDirectories(Vector<String>& directories)
                 result = RegQueryValueEx(extensionsKey, TEXT("Plugins"), 0, &type, (LPBYTE)&pluginsDirectoryStr, &pluginsDirectorySize);
 
                 if (result == ERROR_SUCCESS && type == REG_SZ)
-                    directories.append(wcharToString(pluginsDirectoryStr, pluginsDirectorySize / sizeof(WCHAR) - 1));
+                    directories.append(String(pluginsDirectoryStr, pluginsDirectorySize / sizeof(WCHAR) - 1));
 
                 RegCloseKey(extensionsKey);
             }
@@ -212,7 +211,7 @@ static inline void addWindowsMediaPlayerPluginDirectory(Vector<String>& director
     DWORD pluginDirectorySize = ::ExpandEnvironmentStringsW(TEXT("%SYSTEMDRIVE%\\PFiles\\Plugins"), pluginDirectoryStr, WTF_ARRAY_LENGTH(pluginDirectoryStr));
 
     if (pluginDirectorySize > 0 && pluginDirectorySize <= WTF_ARRAY_LENGTH(pluginDirectoryStr))
-        directories.append(wcharToString(pluginDirectoryStr, pluginDirectorySize - 1));
+        directories.append(String(pluginDirectoryStr, pluginDirectorySize - 1));
 
     DWORD type;
     WCHAR installationDirectoryStr[_MAX_PATH];
@@ -221,7 +220,7 @@ static inline void addWindowsMediaPlayerPluginDirectory(Vector<String>& director
     HRESULT result = getRegistryValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MediaPlayer", L"Installation Directory", &type, &installationDirectoryStr, &installationDirectorySize);
 
     if (result == ERROR_SUCCESS && type == REG_SZ)
-        directories.append(wcharToString(installationDirectoryStr, installationDirectorySize / sizeof(WCHAR) - 1));
+        directories.append(String(installationDirectoryStr, installationDirectorySize / sizeof(WCHAR) - 1));
 }
 
 static inline void addAdobeAcrobatPluginDirectory(Vector<String>& directories)
@@ -245,10 +244,10 @@ static inline void addAdobeAcrobatPluginDirectory(Vector<String>& directories)
         if (result != ERROR_SUCCESS)
             break;
 
-        Vector<int> acrobatVersion = parseVersionString(wcharToString(name, nameLen));
+        Vector<int> acrobatVersion = parseVersionString(String(name, nameLen));
         if (compareVersions(acrobatVersion, latestAcrobatVersion)) {
             latestAcrobatVersion = acrobatVersion;
-            latestAcrobatVersionString = wcharToString(name, nameLen);
+            latestAcrobatVersionString = String(name, nameLen);
         }
     }
 
@@ -258,10 +257,10 @@ static inline void addAdobeAcrobatPluginDirectory(Vector<String>& directories)
         DWORD acrobatInstallPathSize = sizeof(acrobatInstallPathStr);
 
         String acrobatPluginKeyPath = "Software\\Adobe\\Acrobat Reader\\" + latestAcrobatVersionString + "\\InstallPath";
-        result = getRegistryValue(HKEY_LOCAL_MACHINE, stringToNullTerminatedWChar(acrobatPluginKeyPath).data(), 0, &type, acrobatInstallPathStr, &acrobatInstallPathSize);
+        result = getRegistryValue(HKEY_LOCAL_MACHINE, acrobatPluginKeyPath.wideCharacters().data(), 0, &type, acrobatInstallPathStr, &acrobatInstallPathSize);
 
         if (result == ERROR_SUCCESS) {
-            String acrobatPluginDirectory = wcharToString(acrobatInstallPathStr, acrobatInstallPathSize / sizeof(WCHAR) - 1) + "\\browser";
+            String acrobatPluginDirectory = String(acrobatInstallPathStr, acrobatInstallPathSize / sizeof(WCHAR) - 1) + "\\browser";
             directories.append(acrobatPluginDirectory);
         }
     }
@@ -290,10 +289,10 @@ static inline void addJavaPluginDirectory(Vector<String>& directories)
         if (result != ERROR_SUCCESS)
             break;
 
-        Vector<int> javaVersion = parseVersionString(wcharToString(name, nameLen));
+        Vector<int> javaVersion = parseVersionString(String(name, nameLen));
         if (compareVersions(javaVersion, latestJavaVersion)) {
             latestJavaVersion = javaVersion;
-            latestJavaVersionString = wcharToString(name, nameLen);
+            latestJavaVersionString = String(name, nameLen);
         }
     }
 
@@ -305,12 +304,12 @@ static inline void addJavaPluginDirectory(Vector<String>& directories)
         DWORD useNewPluginSize;
 
         String javaPluginKeyPath = "Software\\JavaSoft\\Java Plug-in\\" + latestJavaVersionString;
-        result = getRegistryValue(HKEY_LOCAL_MACHINE, stringToNullTerminatedWChar(javaPluginKeyPath).data(), L"UseNewJavaPlugin", &type, &useNewPluginValue, &useNewPluginSize);
+        result = getRegistryValue(HKEY_LOCAL_MACHINE, javaPluginKeyPath.wideCharacters().data(), L"UseNewJavaPlugin", &type, &useNewPluginValue, &useNewPluginSize);
 
         if (result == ERROR_SUCCESS && useNewPluginValue == 1) {
-            result = getRegistryValue(HKEY_LOCAL_MACHINE, stringToNullTerminatedWChar(javaPluginKeyPath).data(), L"JavaHome", &type, javaInstallPathStr, &javaInstallPathSize);
+            result = getRegistryValue(HKEY_LOCAL_MACHINE, javaPluginKeyPath.wideCharacters().data(), L"JavaHome", &type, javaInstallPathStr, &javaInstallPathSize);
             if (result == ERROR_SUCCESS) {
-                String javaPluginDirectory = wcharToString(javaInstallPathStr, javaInstallPathSize / sizeof(WCHAR) - 1) + "\\bin\\new_plugin";
+                String javaPluginDirectory = String(javaInstallPathStr, javaInstallPathSize / sizeof(WCHAR) - 1) + "\\bin\\new_plugin";
                 directories.append(javaPluginDirectory);
             }
         }
@@ -336,7 +335,7 @@ static inline String safariPluginsDirectory()
         if (!PathRemoveFileSpec(moduleFileNameStr))
             goto exit;
 
-        pluginsDirectory = nullTerminatedWCharToString(moduleFileNameStr) + "\\Plugins";
+        pluginsDirectory = String(moduleFileNameStr) + "\\Plugins";
     }
 exit:
     return pluginsDirectory;
@@ -352,10 +351,10 @@ static inline void addMacromediaPluginDirectories(Vector<String>& directories)
     WCHAR macromediaDirectoryStr[MAX_PATH];
 
     PathCombine(macromediaDirectoryStr, systemDirectoryStr, TEXT("macromed\\Flash"));
-    directories.append(nullTerminatedWCharToString(macromediaDirectoryStr));
+    directories.append(macromediaDirectoryStr);
 
     PathCombine(macromediaDirectoryStr, systemDirectoryStr, TEXT("macromed\\Shockwave 10"));
-    directories.append(nullTerminatedWCharToString(macromediaDirectoryStr));
+    directories.append(macromediaDirectoryStr);
 }
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
index 94bba6a..ff27415 100644 (file)
@@ -36,7 +36,6 @@
 #include <string.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace WebCore {
 
@@ -46,7 +45,7 @@ static String getVersionInfo(const LPVOID versionInfoData, const String& info)
     UINT bufferLength;
     String subInfo = "\\StringfileInfo\\040904E4\\" + info;
     bool retval = VerQueryValueW(versionInfoData,
-        stringToNullTerminatedWChar(subInfo).data(),
+        subInfo.wideCharacters().data(),
         &buffer, &bufferLength);
     if (!retval || bufferLength == 0)
         return String();
@@ -166,13 +165,13 @@ void PluginPackage::determineQuirks(const String& mimeType)
 bool PluginPackage::fetchInfo()
 {
     DWORD versionInfoSize, zeroHandle;
-    versionInfoSize = GetFileVersionInfoSizeW(stringToNullTerminatedWChar(m_path).data(), &zeroHandle);
+    versionInfoSize = GetFileVersionInfoSizeW(m_path.wideCharacters().data(), &zeroHandle);
     if (versionInfoSize == 0)
         return false;
 
     Vector<char> versionInfoData(versionInfoSize);
 
-    if (!GetFileVersionInfoW(stringToNullTerminatedWChar(m_path).data(), 0, versionInfoSize, versionInfoData.data()))
+    if (!GetFileVersionInfoW(m_path.wideCharacters().data(), 0, versionInfoSize, versionInfoData.data()))
         return false;
 
     m_name = getVersionInfo(versionInfoData.data(), "ProductName");
@@ -238,11 +237,11 @@ bool PluginPackage::load()
 
         String path = m_path.substring(0, m_path.reverseFind('\\'));
 
-        if (!::SetCurrentDirectoryW(stringToNullTerminatedWChar(path).data()))
+        if (!::SetCurrentDirectoryW(path.wideCharacters().data()))
             return false;
 
         // Load the library
-        m_module = ::LoadLibraryExW(stringToNullTerminatedWChar(m_path).data(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
+        m_module = ::LoadLibraryExW(m_path.wideCharacters().data(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
 
         if (!::SetCurrentDirectoryW(currentPath)) {
             if (m_module)
index 4a663e0..05728f3 100644 (file)
@@ -71,7 +71,6 @@
 #include <WebCore/runtime_root.h>
 #include <wtf/ASCIICType.h>
 #include <wtf/text/WTFString.h>
-#include <wtf/text/win/WCharStringExtras.h>
 #include <wtf/win/GDIObject.h>
 
 #if USE(CAIRO)
@@ -755,13 +754,13 @@ NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const
 
     // Get file info
     WIN32_FILE_ATTRIBUTE_DATA attrs;
-    if (!GetFileAttributesExW(stringToNullTerminatedWChar(filename).data(), GetFileExInfoStandard, &attrs))
+    if (!GetFileAttributesExW(filename.wideCharacters().data(), GetFileExInfoStandard, &attrs))
         return NPERR_FILE_NOT_FOUND;
 
     if (attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
         return NPERR_FILE_NOT_FOUND;
 
-    HANDLE fileHandle = CreateFileW(stringToNullTerminatedWChar(filename).data(), FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
+    HANDLE fileHandle = CreateFileW(filename.wideCharacters().data(), FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
     
     if (fileHandle == INVALID_HANDLE_VALUE)
         return NPERR_FILE_NOT_FOUND;
index 8331ca9..8f67a11 100644 (file)
@@ -646,16 +646,15 @@ void WebChromeClient::runOpenPanel(Frame&, FileChooser& fileChooser)
 
     ofn.lStructSize = sizeof(ofn);
     ofn.hwndOwner = viewWindow;
-    String allFiles = allFilesText();
-    allFiles.append(L"\0*.*\0\0", 6);
+    String allFiles = makeString(allFilesText(), String("\0*.*\0\0", 6));
 
-    Vector<UChar> filterCharacters = allFiles.charactersWithNullTermination(); // Retain buffer long enough to make the GetOpenFileName call
+    Vector<wchar_t> filterCharacters = allFiles.wideCharacters(); // Retain buffer long enough to make the GetOpenFileName call
     ofn.lpstrFilter = filterCharacters.data();
 
     ofn.lpstrFile = fileBuf.data();
     ofn.nMaxFile = fileBuf.size();
     String dialogTitle = uploadFileText();
-    Vector<UChar> dialogTitleCharacters = dialogTitle.charactersWithNullTermination(); // Retain buffer long enough to make the GetOpenFileName call
+    Vector<wchar_t> dialogTitleCharacters = dialogTitle.wideCharacters(); // Retain buffer long enough to make the GetOpenFileName call
     ofn.lpstrTitle = dialogTitleCharacters.data();
     ofn.Flags = OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;
     if (multiFile)
index aae1e00..910be87 100644 (file)
 #include "WebKitDLL.h"
 #include "WebEditorClient.h"
 
+#include "DOMCoreClasses.h"
 #include "WebKit.h"
 #include "WebNotification.h"
 #include "WebNotificationCenter.h"
 #include "WebView.h"
-#include "DOMCoreClasses.h"
 #include <comutil.h>
 #include <WebCore/BString.h>
 #include <WebCore/Document.h>
@@ -48,6 +48,7 @@
 #include <WebCore/UserTypingGestureIndicator.h>
 #include <WebCore/VisibleSelection.h>
 #include <wtf/text/StringView.h>
+#include <wtf/text/win/WCharStringExtras.h>
 
 using namespace WebCore;
 using namespace HTMLNames;
@@ -758,7 +759,7 @@ void WebEditorClient::checkSpellingOfString(StringView text, int* misspellingLoc
         return;
 
     initViewSpecificSpelling(m_webView);
-    ed->checkSpellingOfString(m_webView, text.upconvertedCharacters(), text.length(), misspellingLocation, misspellingLength);
+    ed->checkSpellingOfString(m_webView, wcharFrom(text.upconvertedCharacters()), text.length(), misspellingLocation, misspellingLength);
 }
 
 String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String& inputWord)
@@ -780,7 +781,7 @@ void WebEditorClient::checkGrammarOfString(StringView text, Vector<GrammarDetail
 
     initViewSpecificSpelling(m_webView);
     COMPtr<IEnumWebGrammarDetails> enumDetailsObj;
-    if (FAILED(ed->checkGrammarOfString(m_webView, text.upconvertedCharacters(), text.length(), &enumDetailsObj, badGrammarLocation, badGrammarLength)))
+    if (FAILED(ed->checkGrammarOfString(m_webView, wcharFrom(text.upconvertedCharacters()), text.length(), &enumDetailsObj, badGrammarLocation, badGrammarLength)))
         return;
 
     while (true) {
index 221e22f..06ac11c 100644 (file)
@@ -450,7 +450,7 @@ void WebInspectorFrontendClient::destroyInspectorView()
 void WebInspectorFrontendClient::updateWindowTitle()
 {
     String title = makeString("Web Inspector ", static_cast<UChar>(0x2014), ' ', m_inspectedURL);
-    ::SetWindowText(m_frontendHwnd, title.charactersWithNullTermination().data());
+    ::SetWindowText(m_frontendHwnd, title.wideCharacters().data());
 }
 
 LRESULT WebInspectorFrontendClient::onGetMinMaxInfo(WPARAM, LPARAM lParam)
index de0221f..4c257cf 100644 (file)
@@ -81,7 +81,7 @@ private:
 LocalizedString::operator LPCTSTR() const
 {
     if (!m_string.isEmpty())
-        return m_string.charactersWithNullTermination().data();
+        return m_string.wideCharacters().data();
 
     m_string = m_cfString;
 
@@ -89,7 +89,7 @@ LocalizedString::operator LPCTSTR() const
         if (m_string[i] == '@' && (m_string[i - 1] == '%' || (i > 2 && m_string[i - 1] == '$' && m_string[i - 2] >= '1' && m_string[i - 2] <= '9' && m_string[i - 3] == '%')))
             m_string.replace(i, 1, "s");
 
-    return m_string.charactersWithNullTermination().data();
+    return m_string.wideCharacters().data();
 }
 
 static CFBundleRef createWebKitBundle()
index 3ff81cf..b4d228f 100644 (file)
@@ -1598,13 +1598,13 @@ static HMENU createContextMenuFromItems(const Vector<ContextMenuItem>& items)
         switch (item.type()) {
         case ActionType:
         case CheckableActionType:
-            ::AppendMenu(menu, flags | MF_STRING, item.action(), item.title().charactersWithNullTermination().data());
+            ::AppendMenu(menu, flags | MF_STRING, item.action(), item.title().wideCharacters().data());
             break;
         case SeparatorType:
             ::AppendMenu(menu, flags | MF_SEPARATOR, item.action(), nullptr);
             break;
         case SubmenuType:
-            ::AppendMenu(menu, flags | MF_POPUP, (UINT_PTR)createContextMenuFromItems(item.subMenuItems()), item.title().charactersWithNullTermination().data());
+            ::AppendMenu(menu, flags | MF_POPUP, (UINT_PTR)createContextMenuFromItems(item.subMenuItems()), item.title().wideCharacters().data());
             break;
         }
     }
@@ -3234,8 +3234,8 @@ void WebView::setToolTip(const String& toolTip)
         info.cbSize = sizeof(info);
         info.uFlags = TTF_IDISHWND;
         info.uId = reinterpret_cast<UINT_PTR>(m_viewWindow);
-        Vector<UChar> toolTipCharacters = m_toolTip.charactersWithNullTermination(); // Retain buffer long enough to make the SendMessage call
-        info.lpszText = const_cast<UChar*>(toolTipCharacters.data());
+        Vector<wchar_t> toolTipCharacters = m_toolTip.wideCharacters(); // Retain buffer long enough to make the SendMessage call
+        info.lpszText = const_cast<wchar_t*>(toolTipCharacters.data());
         ::SendMessage(m_toolTipHwnd, TTM_UPDATETIPTEXT, 0, reinterpret_cast<LPARAM>(&info));
     }
 
index 50df03e..9476adc 100644 (file)
@@ -97,9 +97,6 @@ endif ()
 
 if (NOT APPLE)
     find_package(ICU REQUIRED)
-    if (WIN32)
-        add_definitions(-DUCHAR_TYPE=wchar_t)
-    endif ()
 else ()
     add_definitions(-DU_DISABLE_RENAMING=1 -DU_SHOW_CPLUSPLUS_API=0)
     set(ICU_LIBRARIES libicucore.dylib)
index ae3a9ef..61fa485 100644 (file)
@@ -158,7 +158,6 @@ set(PAL_LIBRARY_TYPE STATIC)
 set(WebKitLegacy_LIBRARY_TYPE SHARED)
 
 find_package(ICU REQUIRED)
-add_definitions(-DUCHAR_TYPE=wchar_t)
 
 # If <winsock2.h> is not included before <windows.h> redefinition errors occur
 # unless _WINSOCKAPI_ is defined before <windows.h> is included
index ca155e8..9365027 100644 (file)
@@ -1,3 +1,24 @@
+2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
+        https://bugs.webkit.org/show_bug.cgi?id=195346
+
+        Reviewed by Fujii Hironori.
+
+        * TestWebKitAPI/Tests/WTF/StringOperators.cpp:
+        (TestWebKitAPI::TEST):
+        Delete wchar tests -- these are MSVC-only and we won't be using String::operator+ going forward anyway.
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (findFontFallback):
+        (addFontFallbackIfPresent):
+        (removeFontFallbackIfPresent):
+        (main):
+        * TestWebKitAPI/win/PlatformUtilitiesWin.cpp:
+        (TestWebKitAPI::Util::moduleDirectory):
+        (TestWebKitAPI::Util::createInjectedBundlePath):
+        Use wchar helpers as needed.
+
 2019-03-06  Rob Buis  <rbuis@igalia.com>
 
         Consider supporting the `referrerpolicy` attribute.
index dae5de7..2c4e50c 100644 (file)
@@ -1038,7 +1038,7 @@ static String findFontFallback(const char* pathOrUrl)
     String pathToFontFallback = FileSystem::directoryName(pathOrUrl);
 
     wchar_t fullPath[_MAX_PATH];
-    if (!_wfullpath(fullPath, pathToFontFallback.charactersWithNullTermination().data(), _MAX_PATH))
+    if (!_wfullpath(fullPath, pathToFontFallback.wideCharacters().data(), _MAX_PATH))
         return emptyString();
 
     if (!::PathIsDirectoryW(fullPath))
@@ -1069,7 +1069,7 @@ static String findFontFallback(const char* pathOrUrl)
     for (Vector<String>::iterator pos = possiblePaths.begin(); pos != possiblePaths.end(); ++pos) {
         pathToFontFallback = FileSystem::pathByAppendingComponent(*pos, "resources\\");
 
-        if (::PathIsDirectoryW(pathToFontFallback.charactersWithNullTermination().data()))
+        if (::PathIsDirectoryW(pathToFontFallback.wideCharacters().data()))
             return pathToFontFallback;
     }
 
@@ -1083,7 +1083,7 @@ static void addFontFallbackIfPresent(const String& fontFallbackPath)
 
     String fontFallback = FileSystem::pathByAppendingComponent(fontFallbackPath, "Mac-compatible-font-fallback.css");
 
-    if (!::PathFileExistsW(fontFallback.charactersWithNullTermination().data()))
+    if (!::PathFileExistsW(fontFallback.wideCharacters().data()))
         return;
 
     ::setPersistentUserStyleSheetLocation(fontFallback.createCFString().get());
@@ -1096,7 +1096,7 @@ static void removeFontFallbackIfPresent(const String& fontFallbackPath)
 
     String fontFallback = FileSystem::pathByAppendingComponent(fontFallbackPath, "Mac-compatible-font-fallback.css");
 
-    if (!::PathFileExistsW(fontFallback.charactersWithNullTermination().data()))
+    if (!::PathFileExistsW(fontFallback.wideCharacters().data()))
         return;
 
     ::setPersistentUserStyleSheetLocation(nullptr);
@@ -1541,12 +1541,12 @@ int main(int argc, const char* argv[])
     String desktopName = makeString("desktop", processId);
     HDESK desktop = nullptr;
 
-    auto windowsStation = ::CreateWindowStation(windowStationName.charactersWithNullTermination().data(), CWF_CREATE_ONLY, WINSTA_ALL_ACCESS, nullptr);
+    auto windowsStation = ::CreateWindowStation(windowStationName.wideCharacters().data(), CWF_CREATE_ONLY, WINSTA_ALL_ACCESS, nullptr);
     if (windowsStation) {
         if (!::SetProcessWindowStation(windowsStation))
             fprintf(stderr, "SetProcessWindowStation failed with error %lu\n", ::GetLastError());
 
-        desktop = ::CreateDesktop(desktopName.charactersWithNullTermination().data(), nullptr, nullptr, 0, GENERIC_ALL, nullptr);
+        desktop = ::CreateDesktop(desktopName.wideCharacters().data(), nullptr, nullptr, 0, GENERIC_ALL, nullptr);
         if (!desktop)
             fprintf(stderr, "Failed to create desktop with error %lu\n", ::GetLastError());
     } else {
index 9abcbb3..0e3bf98 100644 (file)
@@ -250,78 +250,6 @@ TEST(WTF, StringOperators)
     EXPECT_N_WTF_STRING_COPIES(2, stringView + literal + string + literal + atomicString + literal);
     EXPECT_N_WTF_STRING_COPIES(2, stringView + (literal + string + literal + atomicString + literal));
     EXPECT_N_WTF_STRING_COPIES(2, (stringView + literal) + (string + literal) + (atomicString + literal));
-
-#if COMPILER(MSVC)
-    EXPECT_N_WTF_STRING_COPIES(1, L"wide string" + string);
-    EXPECT_N_WTF_STRING_COPIES(1, string + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(1, L"wide string" + atomicString);
-    EXPECT_N_WTF_STRING_COPIES(1, atomicString + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(0, L"wide string" + stringView);
-    EXPECT_N_WTF_STRING_COPIES(0, stringView + L"wide string");
-
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + string + L"wide string" + string);
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + (string + L"wide string" + string));
-    EXPECT_N_WTF_STRING_COPIES(2, (L"wide string" + string) + (L"wide string" + string));
-    EXPECT_N_WTF_STRING_COPIES(2, string + L"wide string" + string + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(2, string + (L"wide string" + string + L"wide string"));
-    EXPECT_N_WTF_STRING_COPIES(2, (string + L"wide string") + (string + L"wide string"));
-
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + atomicString + L"wide string" + atomicString);
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + (atomicString + L"wide string" + atomicString));
-    EXPECT_N_WTF_STRING_COPIES(2, (L"wide string" + atomicString) + (L"wide string" + atomicString));
-    EXPECT_N_WTF_STRING_COPIES(2, atomicString + L"wide string" + atomicString + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(2, atomicString + (L"wide string" + atomicString + L"wide string"));
-    EXPECT_N_WTF_STRING_COPIES(2, (atomicString + L"wide string") + (atomicString + L"wide string"));
-
-    EXPECT_N_WTF_STRING_COPIES(0, L"wide string" + stringView + L"wide string" + stringView);
-    EXPECT_N_WTF_STRING_COPIES(0, L"wide string" + (stringView + L"wide string" + stringView));
-    EXPECT_N_WTF_STRING_COPIES(0, (L"wide string" + stringView) + (L"wide string" + stringView));
-    EXPECT_N_WTF_STRING_COPIES(0, stringView + L"wide string" + stringView + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(0, stringView + (L"wide string" + stringView + L"wide string"));
-    EXPECT_N_WTF_STRING_COPIES(0, (stringView + L"wide string") + (stringView + L"wide string"));
-
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + string + L"wide string" + atomicString + L"wide string" + stringView);
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + (string + L"wide string" + atomicString + L"wide string" + stringView));
-    EXPECT_N_WTF_STRING_COPIES(2, (L"wide string" + string) + (L"wide string" + atomicString) + (L"wide string" + stringView));
-    EXPECT_N_WTF_STRING_COPIES(2, string + L"wide string" + atomicString + L"wide string" + stringView + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(2, string + (L"wide string" + atomicString + L"wide string" + stringView + L"wide string"));
-    EXPECT_N_WTF_STRING_COPIES(2, (string + L"wide string") + (atomicString + L"wide string") + (stringView + L"wide string"));
-
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + string + L"wide string" + stringView + L"wide string" + atomicString);
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + (string + L"wide string" + stringView + L"wide string" + atomicString));
-    EXPECT_N_WTF_STRING_COPIES(2, (L"wide string" + string) + (L"wide string" + stringView) + (L"wide string" + atomicString));
-    EXPECT_N_WTF_STRING_COPIES(2, string + L"wide string" + stringView + L"wide string" + atomicString + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(2, string + (L"wide string" + stringView + L"wide string" + atomicString + L"wide string"));
-    EXPECT_N_WTF_STRING_COPIES(2, (string + L"wide string") + (stringView + L"wide string") + (atomicString + L"wide string"));
-
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + atomicString + L"wide string" + string + L"wide string" + stringView);
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + (atomicString + L"wide string" + string + L"wide string" + stringView));
-    EXPECT_N_WTF_STRING_COPIES(2, (L"wide string" + atomicString) + (L"wide string" + string) + (L"wide string" + stringView));
-    EXPECT_N_WTF_STRING_COPIES(2, atomicString + L"wide string" + string + L"wide string" + stringView + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(2, atomicString + (L"wide string" + string + L"wide string" + stringView + L"wide string"));
-    EXPECT_N_WTF_STRING_COPIES(2, (atomicString + L"wide string") + (string + L"wide string") + (stringView + L"wide string"));
-
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + atomicString + L"wide string" + stringView + L"wide string" + string);
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + (atomicString + L"wide string" + stringView + L"wide string" + string));
-    EXPECT_N_WTF_STRING_COPIES(2, (L"wide string" + atomicString) + (L"wide string" + stringView) + (L"wide string" + string));
-    EXPECT_N_WTF_STRING_COPIES(2, atomicString + L"wide string" + stringView + L"wide string" + string + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(2, atomicString + (L"wide string" + stringView + L"wide string" + string + L"wide string"));
-    EXPECT_N_WTF_STRING_COPIES(2, (atomicString + L"wide string") + (stringView + L"wide string") + (string + L"wide string"));
-
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + stringView + L"wide string" + atomicString + L"wide string" + string);
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + (stringView + L"wide string" + atomicString + L"wide string" + string));
-    EXPECT_N_WTF_STRING_COPIES(2, (L"wide string" + stringView) + (L"wide string" + atomicString) + (L"wide string" + string));
-    EXPECT_N_WTF_STRING_COPIES(2, stringView + L"wide string" + atomicString + L"wide string" + string + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(2, stringView + (L"wide string" + atomicString + L"wide string" + string + L"wide string"));
-    EXPECT_N_WTF_STRING_COPIES(2, (stringView + L"wide string") + (atomicString + L"wide string") + (string + L"wide string"));
-
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + stringView + L"wide string" + string + L"wide string" + atomicString);
-    EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + (stringView + L"wide string" + string + L"wide string" + atomicString));
-    EXPECT_N_WTF_STRING_COPIES(2, (L"wide string" + stringView) + (L"wide string" + string) + (L"wide string" + atomicString));
-    EXPECT_N_WTF_STRING_COPIES(2, stringView + L"wide string" + string + L"wide string" + atomicString + L"wide string");
-    EXPECT_N_WTF_STRING_COPIES(2, stringView + (L"wide string" + string + L"wide string" + atomicString + L"wide string"));
-    EXPECT_N_WTF_STRING_COPIES(2, (stringView + L"wide string") + (string + L"wide string") + (atomicString + L"wide string"));
-#endif
 }
 
 TEST(WTF, ConcatenateCharacterArrayAndEmptyString)
index 2e54308..3d59d25 100644 (file)
@@ -29,7 +29,6 @@
 #include <Shlwapi.h>
 #include <wtf/FileSystem.h>
 #include <wtf/URL.h>
-#include <wtf/text/win/WCharStringExtras.h>
 
 namespace TestWebKitAPI {
 namespace Util {
@@ -40,12 +39,12 @@ static String moduleDirectory()
     wchar_t filename[bufferLength];
     auto len = GetModuleFileName(nullptr, filename, bufferLength);
     ASSERT(len > 0);
-    return FileSystem::directoryName(wcharToString(filename, len));
+    return FileSystem::directoryName(String(filename, len));
 }
 
 WKStringRef createInjectedBundlePath()
 {
-    auto path = FileSystem::pathByAppendingComponent(moduleDirectory(), String(L"TestWebKitAPIInjectedBundle.dll"));
+    auto path = FileSystem::pathByAppendingComponent(moduleDirectory(), "TestWebKitAPIInjectedBundle.dll");
     return WKStringCreateWithUTF8CString(path.utf8().data());
 }