File fix-build-icu59.patch of Package libqt5-qtwebkit
From 868adfcb9efa4ad5cf4d0ddd5a772e5bdb2f3f35 Mon Sep 17 00:00:00 2001
From: "annulen@yandex.ru"
<annulen@yandex.ru@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu, 4 May 2017 15:33:41 +0000
Subject: [PATCH] Fix compilation with ICU 59.1
https://bugs.webkit.org/show_bug.cgi?id=171612
Reviewed by Mark Lam.
ICU 59.1 has broken source compatibility. Now it defines UChar as
char16_t, which does not allow automatic type conversion from unsigned
short in C++ code.
Source/JavaScriptCore:
* API/JSStringRef.cpp:
(JSStringCreateWithCharacters):
(JSStringCreateWithCharactersNoCopy):
(JSStringGetCharactersPtr):
* runtime/DateConversion.cpp:
(JSC::formatDateTime):
Source/WebKit2:
* Shared/API/c/WKString.cpp:
(WKStringGetCharacters):
Tools:
* TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
(UIScriptContext::tryToCompleteUIScriptForCurrentParentCallback):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@216187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
---
Source/JavaScriptCore/API/JSStringRef.cpp | 6 +++---
Source/JavaScriptCore/runtime/DateConversion.cpp | 3 ++-
Source/WTF/wtf/TypeTraits.h | 1 +
Source/WebKit2/Shared/API/c/WKString.cpp | 2 +-
4 files changed, 7 insertions(+), 5 deletions(-)
--- a/Source/JavaScriptCore/API/JSStringRef.cpp
+++ b/Source/JavaScriptCore/API/JSStringRef.cpp
@@ -37,7 +37,7 @@ using namespace WTF::Unicode;
JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars)
{
initializeThreading();
- return OpaqueJSString::create(chars, numChars).leakRef();
+ return OpaqueJSString::create(reinterpret_cast<const UChar*>(chars), numChars).leakRef();
}
JSStringRef JSStringCreateWithUTF8CString(const char* string)
@@ -62,7 +62,7 @@ JSStringRef JSStringCreateWithUTF8CStrin
JSStringRef JSStringCreateWithCharactersNoCopy(const JSChar* chars, size_t numChars)
{
initializeThreading();
- return OpaqueJSString::create(StringImpl::createWithoutCopying(chars, numChars, WTF::DoesNotHaveTerminatingNullCharacter)).leakRef();
+ return OpaqueJSString::create(StringImpl::createWithoutCopying(reinterpret_cast<const UChar*>(chars), numChars, WTF::DoesNotHaveTerminatingNullCharacter)).leakRef();
}
JSStringRef JSStringRetain(JSStringRef string)
@@ -83,7 +83,7 @@ size_t JSStringGetLength(JSStringRef str
const JSChar* JSStringGetCharactersPtr(JSStringRef string)
{
- return string->characters();
+ return reinterpret_cast<const JSChar*>(string->characters());
}
size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string)
--- a/Source/JavaScriptCore/runtime/DateConversion.cpp
+++ b/Source/JavaScriptCore/runtime/DateConversion.cpp
@@ -107,7 +107,8 @@ String formatDateTime(const GregorianDat
#if OS(WINDOWS)
TIME_ZONE_INFORMATION timeZoneInformation;
GetTimeZoneInformation(&timeZoneInformation);
- const WCHAR* timeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
+ const WCHAR* winTimeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
+ String timeZoneName(reinterpret_cast<const UChar*>(winTimeZoneName));
#else
struct tm gtm = t;
char timeZoneName[70];
--- a/Source/WebKit2/Shared/API/c/WKString.cpp
+++ b/Source/WebKit2/Shared/API/c/WKString.cpp
@@ -55,7 +55,7 @@ size_t WKStringGetLength(WKStringRef str
size_t WKStringGetCharacters(WKStringRef stringRef, WKChar* buffer, size_t bufferLength)
{
COMPILE_ASSERT(sizeof(WKChar) == sizeof(UChar), WKStringGetCharacters_sizeof_WKChar_matches_UChar);
- return (toImpl(stringRef)->getCharacters(static_cast<UChar*>(buffer), bufferLength));
+ return (toImpl(stringRef)->getCharacters(reinterpret_cast<UChar*>(buffer), bufferLength));
}
size_t WKStringGetMaximumUTF8CStringSize(WKStringRef stringRef)
--- a/Source/WTF/wtf/TypeTraits.h
+++ b/Source/WTF/wtf/TypeTraits.h
@@ -72,6 +72,7 @@ namespace WTF {
template<> struct IsInteger<unsigned long> { static const bool value = true; };
template<> struct IsInteger<long long> { static const bool value = true; };
template<> struct IsInteger<unsigned long long> { static const bool value = true; };
+ template<> struct IsInteger<char16_t> { static const bool value = true; };
#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
template<> struct IsInteger<wchar_t> { static const bool value = true; };
#endif