1 From bf172ae289a1348842005a9421797970f9b72060 Mon Sep 17 00:00:00 2001
2 From: Konstantin Tokarev <annulen@yandex.ru>
3 Date: Thu, 4 May 2017 15:12:37 +0300
4 Subject: [PATCH] Fix compilation with ICU 59
6 Upstream fix: https://bugs.webkit.org/show_bug.cgi?id=171612
8 Task-number: QTBUG-60532
9 Change-Id: I6014feea213aa70ebe40b09d9d1a03fd1ed3c843
10 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
11 Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
13 Source/JavaScriptCore/API/JSStringRef.cpp | 6 +++---
14 Source/JavaScriptCore/runtime/DateConversion.cpp | 3 ++-
15 Source/WTF/wtf/TypeTraits.h | 3 +++
16 Source/WebKit2/Shared/API/c/WKString.cpp | 2 +-
17 4 files changed, 9 insertions(+), 5 deletions(-)
19 diff --git a/Source/JavaScriptCore/API/JSStringRef.cpp b/Source/JavaScriptCore/API/JSStringRef.cpp
20 index 812f3d413..77a3fd0f4 100644
21 --- a/Source/JavaScriptCore/API/JSStringRef.cpp
22 +++ b/Source/JavaScriptCore/API/JSStringRef.cpp
23 @@ -37,7 +37,7 @@ using namespace WTF::Unicode;
24 JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars)
26 initializeThreading();
27 - return OpaqueJSString::create(chars, numChars).leakRef();
28 + return OpaqueJSString::create(reinterpret_cast<const UChar*>(chars), numChars).leakRef();
31 JSStringRef JSStringCreateWithUTF8CString(const char* string)
32 @@ -62,7 +62,7 @@ JSStringRef JSStringCreateWithUTF8CString(const char* string)
33 JSStringRef JSStringCreateWithCharactersNoCopy(const JSChar* chars, size_t numChars)
35 initializeThreading();
36 - return OpaqueJSString::create(StringImpl::createWithoutCopying(chars, numChars, WTF::DoesNotHaveTerminatingNullCharacter)).leakRef();
37 + return OpaqueJSString::create(StringImpl::createWithoutCopying(reinterpret_cast<const UChar*>(chars), numChars, WTF::DoesNotHaveTerminatingNullCharacter)).leakRef();
40 JSStringRef JSStringRetain(JSStringRef string)
41 @@ -83,7 +83,7 @@ size_t JSStringGetLength(JSStringRef string)
43 const JSChar* JSStringGetCharactersPtr(JSStringRef string)
45 - return string->characters();
46 + return reinterpret_cast<const JSChar*>(string->characters());
49 size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string)
50 diff --git a/Source/JavaScriptCore/runtime/DateConversion.cpp b/Source/JavaScriptCore/runtime/DateConversion.cpp
51 index 0b57f012d..05e27338b 100644
52 --- a/Source/JavaScriptCore/runtime/DateConversion.cpp
53 +++ b/Source/JavaScriptCore/runtime/DateConversion.cpp
54 @@ -107,7 +107,8 @@ String formatDateTime(const GregorianDateTime& t, DateTimeFormat format, bool as
56 TIME_ZONE_INFORMATION timeZoneInformation;
57 GetTimeZoneInformation(&timeZoneInformation);
58 - const WCHAR* timeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
59 + const WCHAR* winTimeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
60 + String timeZoneName(reinterpret_cast<const UChar*>(winTimeZoneName));
63 char timeZoneName[70];
64 diff --git a/Source/WTF/wtf/TypeTraits.h b/Source/WTF/wtf/TypeTraits.h
65 index 9df2c95cf..f5d6121fd 100644
66 --- a/Source/WTF/wtf/TypeTraits.h
67 +++ b/Source/WTF/wtf/TypeTraits.h
68 @@ -72,6 +72,9 @@ namespace WTF {
69 template<> struct IsInteger<unsigned long> { static const bool value = true; };
70 template<> struct IsInteger<long long> { static const bool value = true; };
71 template<> struct IsInteger<unsigned long long> { static const bool value = true; };
72 +#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT)
73 + template<> struct IsInteger<char16_t> { static const bool value = true; };
75 #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
76 template<> struct IsInteger<wchar_t> { static const bool value = true; };
78 diff --git a/Source/WebKit2/Shared/API/c/WKString.cpp b/Source/WebKit2/Shared/API/c/WKString.cpp
79 index cbac67dd8..23400a64e 100644
80 --- a/Source/WebKit2/Shared/API/c/WKString.cpp
81 +++ b/Source/WebKit2/Shared/API/c/WKString.cpp
82 @@ -55,7 +55,7 @@ size_t WKStringGetLength(WKStringRef stringRef)
83 size_t WKStringGetCharacters(WKStringRef stringRef, WKChar* buffer, size_t bufferLength)
85 COMPILE_ASSERT(sizeof(WKChar) == sizeof(UChar), WKStringGetCharacters_sizeof_WKChar_matches_UChar);
86 - return (toImpl(stringRef)->getCharacters(static_cast<UChar*>(buffer), bufferLength));
87 + return (toImpl(stringRef)->getCharacters(reinterpret_cast<UChar*>(buffer), bufferLength));
90 size_t WKStringGetMaximumUTF8CStringSize(WKStringRef stringRef)