Skip to content

Commit

Permalink
Fixed type_conversion error compiling for rocko with gcc7
Browse files Browse the repository at this point in the history
* Fixed JSStringRef_type_conversion error
* Fixed WKString_type_conversion error
* Fixed JSStringRef type_conversion references
* Fixed WebEventFactory no matching conversion for functional-style cast

Signed-off-by: Pablo Saavedra <[email protected]>
  • Loading branch information
psaavedra authored and clopez committed Feb 27, 2018
1 parent 267ce67 commit b4162a4
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff -ruN git/Source/JavaScriptCore/API/JSStringRef.cpp git.patched/Source/JavaScriptCore/API/JSStringRef.cpp
--- git/Source/JavaScriptCore/API/JSStringRef.cpp 2018-02-27 16:47:25.182835822 +0100
+++ git.patched/Source/JavaScriptCore/API/JSStringRef.cpp 2018-02-27 16:58:07.649218536 +0100
@@ -37,7 +37,7 @@
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 JSStringCreateWithCharactersNoCopy(const JSChar* chars, size_t numChars)
{
initializeThreading();
- return OpaqueJSString::create(StringImpl::createWithoutCopying(chars, numChars)).leakRef();
+ return OpaqueJSString::create(StringImpl::createWithoutCopying(reinterpret_cast<const UChar*>(chars), numChars)).leakRef();
}

JSStringRef JSStringRetain(JSStringRef string)
@@ -87,7 +87,7 @@
{
if (!string)
return nullptr;
- return string->characters();
+ return reinterpret_cast<const JSChar*>(string->characters());
}

size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string)
diff -ruN git/Source/JavaScriptCore/runtime/DateConversion.cpp git.patched/Source/JavaScriptCore/runtime/DateConversion.cpp
--- git/Source/JavaScriptCore/runtime/DateConversion.cpp 2018-02-27 16:47:25.182835822 +0100
+++ git.patched/Source/JavaScriptCore/runtime/DateConversion.cpp 2018-02-27 16:59:22.741504563 +0100
@@ -107,7 +107,8 @@
#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];
diff -ruN git/Source/WebKit2/Shared/API/c/WKString.cpp git.patched/Source/WebKit2/Shared/API/c/WKString.cpp
--- git/Source/WebKit2/Shared/API/c/WKString.cpp 2018-02-27 16:47:25.182835822 +0100
+++ git.patched/Source/WebKit2/Shared/API/c/WKString.cpp 2018-02-27 17:01:07.673903932 +0100
@@ -61,7 +61,7 @@
unsigned unsignedBufferLength = std::min<size_t>(bufferLength, std::numeric_limits<unsigned>::max());
auto substring = toImpl(stringRef)->stringView().substring(0, unsignedBufferLength);

- substring.getCharactersWithUpconvert(static_cast<UChar*>(buffer));
+ substring.getCharactersWithUpconvert(reinterpret_cast<UChar*>(buffer));
return substring.length();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- wpewebkit-1.20170926-r0.orig/Source/JavaScriptCore/API/JSStringRef.h 2016-02-27 11:14:00.000000000 +0100
+++ wpewebkit-1.20170926-r0/Source/JavaScriptCore/API/JSStringRef.h 2017-02-27 11:14:05.000000000 +0100
@@ -27,6 +27,7 @@
#define JSStringRef_h

#include <JavaScriptCore/JSValueRef.h>
+#include <uchar.h>

#ifndef __cplusplus
#include <stdbool.h>
@@ -46,7 +47,7 @@
character. As with all scalar types, endianness depends on the underlying
architecture.
*/
- typedef unsigned short JSChar;
+ typedef char16_t JSChar;
#else
typedef wchar_t JSChar;
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- webkitgtk-2.4.11.orig/Source/WebKit2/Shared/API/c/WKString.h.orig 2017-12-17 20:37:47.918238974 +0100
+++ webkitgtk-2.4.11.orig/Source/WebKit2/Shared/API/c/WKString.h 2017-12-17 20:39:10.970532449 +0100
@@ -28,6 +28,7 @@

#include <WebKit2/WKBase.h>
#include <stddef.h>
+#include <uchar.h>

#ifndef __cplusplus
#include <stdbool.h>
@@ -39,7 +40,7 @@

#if !defined(WIN32) && !defined(_WIN32) \
&& !((defined(__CC_ARM) || defined(__ARMCC__)) && !defined(__linux__)) /* RVCT */
- typedef unsigned short WKChar;
+ typedef char16_t WKChar;
#else
typedef wchar_t WKChar;
#endif
20 changes: 20 additions & 0 deletions recipes-browser/wpewebkit/wpewebkit/fix_WebEventFactory.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[WPE] Build failure with Clang 4.0.1: no matching conversion for functional-style cast from 'pointer' (aka 'unsigned short *') to 'WTF::String'
https://bugs.webkit.org/show_bug.cgi?id=175477

Reviewed by Žan Doberšek.

* Shared/wpe/WebEventFactory.cpp:
(WebKit::singleCharacterStringForKeyEvent): Cast to UChar* to make
compiler choose the correct WTF::String constructor.

(revision 223544)

--- webkitgtk/Source/WebKit2/Shared/wpe/WebEventFactory.cpp.orig 2017-12-17 20:37:47.918238974 +0100
+++ webkitgtk/Source/WebKit2/Shared/wpe/WebEventFactory.cpp 2017-12-17 20:39:10.970532449 +0100
@@ -60,5 +60,5 @@
GUniquePtr<gunichar2> uchar16(g_ucs4_to_utf16(&event->unicode, 1, 0, &length, nullptr));
if (uchar16)
- return String(uchar16.get());
+ return String(reinterpret_cast<UChar*>(uchar16.get()), length);
return String();
}
4 changes: 4 additions & 0 deletions recipes-browser/wpewebkit/wpewebkit_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ SRC_URI = " git://github.com/WebPlatformForEmbedded/WPEWebKit.git;protocol=https
file://0001-WebKitMacros-Append-to-I-and-not-to-isystem.patch \
file://0001-WPE-Some-event-handlers-not-working.patch \
file://revert_image_decoders-198781.patch \
file://fix_JSStringRef_type_conversion.patch \
file://fix_WKString_type_conversion.patch \
file://fix_API_JSStringRef_type_conversion.patch \
file://fix_WebEventFactory.patch \
"

S = "${WORKDIR}/git"
Expand Down

0 comments on commit b4162a4

Please sign in to comment.