From 2fbae920b9004602ad6dd05e374f40330f73450e Mon Sep 17 00:00:00 2001 From: Axel Date: Mon, 23 Nov 2020 09:34:50 +0100 Subject: [PATCH] Fixed conversion of std::string to FString. --- LibCarla/source/carla/rpc/String.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/LibCarla/source/carla/rpc/String.h b/LibCarla/source/carla/rpc/String.h index 7bfe3e835..92effa85e 100644 --- a/LibCarla/source/carla/rpc/String.h +++ b/LibCarla/source/carla/rpc/String.h @@ -48,16 +48,10 @@ namespace rpc { // Slower conversion to fstring for long text static inline FString ToLongFString(const std::string &str) { FString result = ""; - size_t i = 0; - while(i + MaxStringLength < str.size()) { - auto substr = str.substr(i, MaxStringLength); - FString temp_string(substr.size(), UTF8_TO_TCHAR(substr.c_str())); - result += temp_string; - i += MaxStringLength; + for (size_t i = 0; i < str.size(); i++) + { + result += str[i]; } - auto substr = str.substr(i); - FString temp_string(substr.size(), UTF8_TO_TCHAR(substr.c_str())); - result += temp_string; return result; }