diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2017-06-15 12:13:20 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-06-17 10:46:54 +0000 |
commit | aab669a05f943c587f6acccd94d53a8544170c1c (patch) | |
tree | 2c22545100b500eb80d23f75b8e3180ed9b5f3b7 /Source/JavaScriptCore/jsc.cpp | |
parent | c119ecc79e19c630a8b1ef10fe01cc567901033f (diff) | |
download | qtwebkit-aab669a05f943c587f6acccd94d53a8544170c1c.tar.gz |
Import WebKit commit 6d0ad27b6bc4209fb8d8cee2692dc0c6a5462051v5.212.0-alpha2
Change-Id: Ifdedb7bc3162434686201813dc1d994cf5ae7e70
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/JavaScriptCore/jsc.cpp')
-rw-r--r-- | Source/JavaScriptCore/jsc.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp index d9f888fb1..c0a84fc5f 100644 --- a/Source/JavaScriptCore/jsc.cpp +++ b/Source/JavaScriptCore/jsc.cpp @@ -68,6 +68,7 @@ #if OS(WINDOWS) #include <direct.h> +#include <wtf/text/win/WCharStringExtras.h> #else #include <unistd.h> #endif @@ -868,8 +869,7 @@ static bool currentWorkingDirectory(DirectoryName& directoryName) // https://msdn.microsoft.com/en-us/library/windows/desktop/ff381407.aspx auto buffer = std::make_unique<wchar_t[]>(bufferLength); DWORD lengthNotIncludingNull = ::GetCurrentDirectoryW(bufferLength, buffer.get()); - static_assert(sizeof(wchar_t) == sizeof(UChar), "In Windows, both are UTF-16LE"); - String directoryString = String(reinterpret_cast<UChar*>(buffer.get())); + String directoryString = wcharToString(buffer.get(), lengthNotIncludingNull); // We don't support network path like \\host\share\<path name>. if (directoryString.startsWith("\\\\")) return false; @@ -999,9 +999,7 @@ static bool fetchModuleFromLocalFileSystem(const String& fileName, Vector<char>& // 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); - static_assert(sizeof(wchar_t) == sizeof(UChar), "In Windows, both are UTF-16LE"); - auto utf16Vector = longUNCPathName.charactersWithNullTermination(); - FILE* f = _wfopen(reinterpret_cast<wchar_t*>(utf16Vector.data()), L"rb"); + FILE* f = _wfopen(stringToNullTerminatedWChar(longUNCPathName).data(), L"rb"); #else FILE* f = fopen(fileName.utf8().data(), "r"); #endif |