0004-Fix-compilation-with-ICU-59.patch 4.6 KB

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