diff options
Diffstat (limited to 'Source/JavaScriptCore')
-rw-r--r-- | Source/JavaScriptCore/jsc.cpp | 8 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/DateConversion.cpp | 3 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/JSArrayBufferView.h | 2 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/JSTypedArrayViewConstructor.cpp | 1 |
4 files changed, 7 insertions, 7 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 diff --git a/Source/JavaScriptCore/runtime/DateConversion.cpp b/Source/JavaScriptCore/runtime/DateConversion.cpp index 05e27338b..8a87cc62a 100644 --- a/Source/JavaScriptCore/runtime/DateConversion.cpp +++ b/Source/JavaScriptCore/runtime/DateConversion.cpp @@ -32,6 +32,7 @@ #if OS(WINDOWS) #include <windows.h> +#include <wtf/text/win/WCharStringExtras.h> #endif using namespace WTF; @@ -108,7 +109,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(reinterpret_cast<const UChar*>(winTimeZoneName)); + String timeZoneName = nullTerminatedWCharToString(winTimeZoneName); #else struct tm gtm = t; char timeZoneName[70]; diff --git a/Source/JavaScriptCore/runtime/JSArrayBufferView.h b/Source/JavaScriptCore/runtime/JSArrayBufferView.h index 769150b36..a5afdb9ef 100644 --- a/Source/JavaScriptCore/runtime/JSArrayBufferView.h +++ b/Source/JavaScriptCore/runtime/JSArrayBufferView.h @@ -162,7 +162,7 @@ public: bool isNeutered() { return hasArrayBuffer() && !vector(); } void neuter(); - void* vector() + void* vector() const { return m_vector.getPredicated( this, diff --git a/Source/JavaScriptCore/runtime/JSTypedArrayViewConstructor.cpp b/Source/JavaScriptCore/runtime/JSTypedArrayViewConstructor.cpp index bf99dbc87..5c038c502 100644 --- a/Source/JavaScriptCore/runtime/JSTypedArrayViewConstructor.cpp +++ b/Source/JavaScriptCore/runtime/JSTypedArrayViewConstructor.cpp @@ -35,6 +35,7 @@ #include "JSObject.h" #include "JSTypedArrayViewPrototype.h" #include "JSTypedArrays.h" +#include "TypedArrayInlines.h" namespace JSC { |