Commit Graph

8 Commits

Author SHA1 Message Date
Zousar Shaker
ab3554e509 Finding and addressing codepaths that check property type by explicitly checking equality with FObjectProperty::StaticClass() or FClassProperty::StaticClass(). Changing them to instead use CastField<FObjectProperty> (which will generically handle both FObjectProperty, FClassProperty, and any of their derivatives). Could be further genericized in the future to use FObjectPropertyBase, but don't want to add more risk by introducing that at this point.
Confirmed that now System.Core.Serialization.StructElementSerializer and System.Core.Serialization.StructSerializer unit tests are passing.

#rb francis.hurteau

[CL 15294198 by Zousar Shaker in ue5-main branch]
2021-02-03 12:08:22 -04:00
ryan durand
0f0464a30e Updating copyright for Engine Runtime.
#rnx
#rb none


#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870549 by ryan durand in Main branch]
2019-12-26 14:45:42 -05:00
Robert Manuszewski
7b6f840f7f Copying //UE4/Dev-Core @ 10708550 to Dev-Main (//UE4/Dev-Main)
#rb none

[CL 10708666 by Robert Manuszewski in Main branch]
2019-12-13 11:07:03 -05:00
jamie dale
a287480c36 Allow FString instances containing code units outside of the basic multilingual plane to be losslessly processed regardless of whether TCHAR is 2 or 4 bytes.
Most UE4 platforms use a 2-byte TCHAR, however some still use a 4-byte TCHAR. The platforms that use a 4-byte TCHAR expect their string data to be UTF-32, however there are parts of UE4 that serialize FString data as a series of UCS2CHAR, simply narrowing or widening each TCHAR in turn. This can result in invalid or corrupted UTF-32 strings (either UTF-32 strings containing UTF-16 surrogates, or UTF-32 code points that have been truncated to 2-bytes), which leads to either odd behavior or crashes.

This change updates the parts of UE4 that process FString data as a series of 2-byte values to do so on the correct UTF-16 interpretation of the data, converting to/from UTF-32 as required on platforms that use a 4-byte TCHAR. This conversion is a no-op on platforms that use a 2-byte TCHAR as the string is already assumed to be valid UTF-16 data. It should also be noted that while FString may contain UTF-16 code units on platforms using a 2-byte TCHAR, this change doesn't do anything to make FString represent a Unicode string on those platforms (ie, a string that understands and works on code points), but is rather just a bag of code units.

Two new variable-width string converters have be added to facilitate the conversion (modelled after the TCHAR<->UTF-8 converters), TUTF16ToUTF32_Convert and TUTF32ToUTF16_Convert. These are used for both TCHAR<->UTF16CHAR conversion when needed, but also for TCHAR<->wchar_t conversion on platforms that use char16_t for TCHAR along with having a 4-byte wchar_t (as defined by the new PLATFORM_WCHAR_IS_4_BYTES option).

These conversion routines are accessed either via the conversion macros (TCHAR_TO_UTF16, UTF16_TO_TCHAR, TCHAR_TO_WCHAR, and WCHAR_TO_TCHAR), or by using a conversion struct (FTCHARToUTF16, FUTF16ToTCHAR, FTCHARToWChar, and FWCharToTCHAR), which is the same pattern as the existing TCHAR<->UTF-8 conversion. Both the macros and the structs are defined as no-ops when the conversion isn't needed, but always exist so that code can be written in a portable way.

Very little code actually needed updating to use UTF-16, as the vast majority makes no assumptions about the size of TCHAR, nor how FString should be serialized. The main places were the FString archive serialization and the JSON reader/writer, along with some minor fixes to the UTF-8 conversion logic for platforms using a 4-byte TCHAR.

Tests have been added to verify that an FString representing a UTF-32 code point can be losslessly converted to/from UTF-8 and UTF-16, and serialized to/from an archive.

#jira
#rb Steve.Robb, Josh.Adams


#ROBOMERGE-SOURCE: CL 8676728 via CL 8687863
#ROBOMERGE-BOT: (v421-8677696)

[CL 8688048 by jamie dale in Main branch]
2019-09-16 05:44:11 -04:00
Francis Hurteau
57c677da93 Copying //UE4/Dev-Enterprise@4705006 to Dev-Main (//UE4/Dev-Main)
#rb none
#lockdown Nick.Penwarden

[CL 4705151 by Francis Hurteau in Main branch]
2019-01-10 17:26:53 -05:00
Ben Marsh
7598af0532 Update copyright notices to 2019.
#rb none
#lockdown Nick.Penwarden

[CL 4662404 by Ben Marsh in Main branch]
2018-12-14 13:41:00 -05:00
Jack Porter
2a6f9fd726 Fix CIS issues in IOSPlatformWebBrowser
#jira UE-63809
#rb None

[CL 4348580 by Jack Porter in Dev-Mobile branch]
2018-09-06 14:36:13 -04:00
Sorin Gradinaru
1d89a48b13 UEMOB-185 Implement the equivalent of FAndroidJSScripting for iOS
UE-59488 FWebBrowserWindow::UnbindUObject of IOSPlatformWebBrowser.cpp is not implemented yet

#jira UEMOB-185
#jira UE-59488
#4.21
#iOS
#rb Jack.Porter

New methods (using WebKit, matching the Android implementation):
- Go back/forward
- HandlePageLoading (loading/didCommitNavigation, loaded/didFinishNavigation)
- HandleReceivedError (didFailNavigation)
- execute JS code
- controlling the client using JS commands (WKWebViewConfiguration & WKUserContentController):
	- in Android we using shouldInterceptRequest to intercept a custom resource URL (JS: XMLHttpRequest.send, document.location)
	- iOS will register handlers (JS: window.webkit.messageHandlers.<FMobileJSScripting::JSMessageHandler>.postMessage)

[CL 4343824 by Sorin Gradinaru in Dev-Mobile branch]
2018-09-05 04:55:55 -04:00