Ignore:
Timestamp:
Jun 4, 2017, 9:38:39 AM (8 years ago)
Author:
Konstantin Tokarev
Message:

Fix build of Windows-specific code with ICU 59.1
https://bugs.webkit.org/show_bug.cgi?id=172729

Reviewed by Darin Adler.

Source/JavaScriptCore:

Fix conversions from WTF::String to wchar_t* and vice versa.

  • jsc.cpp:

(currentWorkingDirectory):
(fetchModuleFromLocalFileSystem):

  • runtime/DateConversion.cpp:

(JSC::formatDateTime):

Source/WebCore:

Fix conversions from WTF::String to wchar_t* and vice versa.
No new tests needed.

  • platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:

(WebCore::mimeTypeCache):
(WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):

Source/WebKit/win:

Fix conversions from WTF::String to wchar_t* and vice versa.

  • Plugins/PluginDatabaseWin.cpp:

(WebCore::addPluginPathsFromRegistry):
(WebCore::PluginDatabase::getPluginPathsInDirectories):
(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):

Source/WTF:

  • wtf/text/win/WCharStringExtras.h: Added new header file wuth helper

functions for conversion between WTF::String and wchart_t*.
(WTF::stringToNullTerminatedWChar):
(WTF::wcharToString):
(WTF::nullTerminatedWCharToString):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r217523 r217771  
    9797#if OS(WINDOWS)
    9898#include <direct.h>
     99#include <wtf/text/win/WCharStringExtras.h>
    99100#else
    100101#include <unistd.h>
     
    15681569    auto buffer = std::make_unique<wchar_t[]>(bufferLength);
    15691570    DWORD lengthNotIncludingNull = ::GetCurrentDirectoryW(bufferLength, buffer.get());
    1570     static_assert(sizeof(wchar_t) == sizeof(UChar), "In Windows, both are UTF-16LE");
    1571     String directoryString = String(reinterpret_cast<UChar*>(buffer.get()));
     1571    String directoryString = nullTerminatedWCharToString(buffer.get());
    15721572    // We don't support network path like \\host\share\<path name>.
    15731573    if (directoryString.startsWith("\\\\"))
     
    17461746    // Use long UNC to pass the long path name to the Windows APIs.
    17471747    String longUNCPathName = WTF::makeString("\\\\?\\", fileName);
    1748     static_assert(sizeof(wchar_t) == sizeof(UChar), "In Windows, both are UTF-16LE");
    1749     auto utf16Vector = longUNCPathName.charactersWithNullTermination();
    1750     FILE* f = _wfopen(reinterpret_cast<wchar_t*>(utf16Vector.data()), L"rb");
     1748    FILE* f = _wfopen(stringToNullTerminatedWChar(longUNCPathName).data(), L"rb");
    17511749#else
    17521750    FILE* f = fopen(fileName.utf8().data(), "r");
Note: See TracChangeset for help on using the changeset viewer.