From aabd65b0fd7e69f5c4f41ee95253caf7fbe125cd Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 14 Oct 2021 12:29:55 +0100 Subject: [PATCH] Text: Fix some build issues when JUCE_STRING_UTF_TYPE != 8 --- modules/juce_core/native/juce_linux_Files.cpp | 2 +- modules/juce_core/native/juce_mac_Files.mm | 2 +- modules/juce_core/text/juce_String.cpp | 4 ++-- .../native/accessibility/juce_win32_WindowsUIAWrapper.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/juce_core/native/juce_linux_Files.cpp b/modules/juce_core/native/juce_linux_Files.cpp index 953d81f4b9..22f989acfa 100644 --- a/modules/juce_core/native/juce_linux_Files.cpp +++ b/modules/juce_core/native/juce_linux_Files.cpp @@ -139,7 +139,7 @@ File File::getSpecialLocation (const SpecialLocationType type) case invokedExecutableFile: if (juce_argv != nullptr && juce_argc > 0) - return File (CharPointer_UTF8 (juce_argv[0])); + return File (String (CharPointer_UTF8 (juce_argv[0]))); // Falls through JUCE_FALLTHROUGH diff --git a/modules/juce_core/native/juce_mac_Files.mm b/modules/juce_core/native/juce_mac_Files.mm index 7b6d6daaee..15c9da26f8 100644 --- a/modules/juce_core/native/juce_mac_Files.mm +++ b/modules/juce_core/native/juce_mac_Files.mm @@ -201,7 +201,7 @@ File File::getSpecialLocation (const SpecialLocationType type) case invokedExecutableFile: if (juce_argv != nullptr && juce_argc > 0) - return File::getCurrentWorkingDirectory().getChildFile (CharPointer_UTF8 (juce_argv[0])); + return File::getCurrentWorkingDirectory().getChildFile (String (CharPointer_UTF8 (juce_argv[0]))); // deliberate fall-through... JUCE_FALLTHROUGH diff --git a/modules/juce_core/text/juce_String.cpp b/modules/juce_core/text/juce_String.cpp index b98ae31dce..68f15ee2a1 100644 --- a/modules/juce_core/text/juce_String.cpp +++ b/modules/juce_core/text/juce_String.cpp @@ -1278,7 +1278,7 @@ String String::replaceSection (int index, int numCharsToReplace, StringRef strin dest += newStringBytes; memcpy (dest, startOfRemainder.getAddress(), remainderBytes); dest += remainderBytes; - CharPointerType ((CharPointerType::CharType*) dest).writeNull(); + CharPointerType (unalignedPointerCast (dest)).writeNull(); return result; } @@ -2149,7 +2149,7 @@ String String::fromUTF8 (const char* const buffer, int bufferSizeBytes) JUCE_END_IGNORE_WARNINGS_MSVC //============================================================================== -StringRef::StringRef() noexcept : text ((const String::CharPointerType::CharType*) "\0\0\0") +StringRef::StringRef() noexcept : text (unalignedPointerCast ("\0\0\0")) { } diff --git a/modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h b/modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h index c540d315f3..19c8a5d772 100644 --- a/modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h +++ b/modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h @@ -125,7 +125,7 @@ private: //============================================================================== template - static FuncType getUiaFunction (HMODULE module, StringRef funcName) + static FuncType getUiaFunction (HMODULE module, LPCSTR funcName) { return (FuncType) GetProcAddress (module, funcName); }