diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp index b5ddcf6152..8f76de968f 100644 --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp @@ -117,7 +117,7 @@ namespace juce extern void initialiseMac(); extern void* attachComponentToWindowRef (Component* component, void* windowRef); extern void detachComponentFromWindowRef (Component* component, void* nsWindow); - extern void setNativeHostWindowSize (void* nsWindow, Component* editorComp, int newWidth, int newHeight, const PluginHostType& host); + extern void setNativeHostWindowSize (void* nsWindow, Component* editorComp, int newWidth, int newHeight); extern void checkWindowVisibility (void* nsWindow, Component* component); extern bool forwardCurrentKeyEventToHost (Component* component); #endif @@ -1252,7 +1252,7 @@ public: { // some hosts don't support the sizeWindow call, so do it manually.. #if JUCE_MAC - setNativeHostWindowSize (hostWindow, editorComp, newWidth, newHeight, getHostType()); + setNativeHostWindowSize (hostWindow, editorComp, newWidth, newHeight); #elif JUCE_LINUX // (Currently, all linux hosts support sizeWindow, so this should never need to happen) diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm index 79e2182077..3b00d0a87d 100644 --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm @@ -208,8 +208,8 @@ void detachComponentFromWindowRef (Component* comp, void* nsWindow) } } -void setNativeHostWindowSize (void* nsWindow, Component* component, int newWidth, int newHeight, const PluginHostType& host); -void setNativeHostWindowSize (void* nsWindow, Component* component, int newWidth, int newHeight, const PluginHostType& host) +void setNativeHostWindowSize (void* nsWindow, Component* component, int newWidth, int newHeight); +void setNativeHostWindowSize (void* nsWindow, Component* component, int newWidth, int newHeight) { JUCE_AUTORELEASEPOOL { diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp index 0105d8a122..9b6aa01bb9 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp @@ -114,6 +114,8 @@ void AudioProcessor::setLatencySamples (const int newLatency) void AudioProcessor::setParameterNotifyingHost (const int parameterIndex, const float newValue) { + jassert (MessageManager::getInstance()->isThisTheMessageThread()); + setParameter (parameterIndex, newValue); sendParamChangeMessageToListeners (parameterIndex, newValue); } diff --git a/modules/juce_browser_plugin/wrapper/juce_ActiveX_GlueCode.cpp b/modules/juce_browser_plugin/wrapper/juce_ActiveX_GlueCode.cpp index f9a7ddd3aa..9fa365d2f7 100644 --- a/modules/juce_browser_plugin/wrapper/juce_ActiveX_GlueCode.cpp +++ b/modules/juce_browser_plugin/wrapper/juce_ActiveX_GlueCode.cpp @@ -147,7 +147,7 @@ public: private: StringPool identifierPool; - static DISPID getHashFromString (const String::CharPointerType& s) noexcept + static DISPID getHashFromString (const String::CharPointerType s) noexcept { return (DISPID) (pointer_sized_int) s.getAddress(); } diff --git a/modules/juce_core/memory/juce_Atomic.h b/modules/juce_core/memory/juce_Atomic.h index 1c846f0556..b7d364a9d0 100644 --- a/modules/juce_core/memory/juce_Atomic.h +++ b/modules/juce_core/memory/juce_Atomic.h @@ -153,10 +153,13 @@ public: volatile Type value; private: - static inline Type castFrom32Bit (int32 value) noexcept { return *(Type*) &value; } - static inline Type castFrom64Bit (int64 value) noexcept { return *(Type*) &value; } - static inline int32 castTo32Bit (Type value) noexcept { return *(int32*) &value; } - static inline int64 castTo64Bit (Type value) noexcept { return *(int64*) &value; } + template + static inline Dest castTo (Source value) noexcept { union { Dest d; Source s; } u; u.s = value; return u.d; } + + static inline Type castFrom32Bit (int32 value) noexcept { return castTo (value); } + static inline Type castFrom64Bit (int64 value) noexcept { return castTo (value); } + static inline int32 castTo32Bit (Type value) noexcept { return castTo (value); } + static inline int64 castTo64Bit (Type value) noexcept { return castTo (value); } Type operator++ (int); // better to just use pre-increment with atomics.. Type operator-- (int); diff --git a/modules/juce_core/native/juce_linux_SystemStats.cpp b/modules/juce_core/native/juce_linux_SystemStats.cpp index ccbb307c9a..40e917c66b 100644 --- a/modules/juce_core/native/juce_linux_SystemStats.cpp +++ b/modules/juce_core/native/juce_linux_SystemStats.cpp @@ -83,7 +83,7 @@ int SystemStats::getMemorySizeInMegabytes() struct sysinfo sysi; if (sysinfo (&sysi) == 0) - return (sysi.totalram * sysi.mem_unit / (1024 * 1024)); + return sysi.totalram * sysi.mem_unit / (1024 * 1024); return 0; } @@ -99,11 +99,8 @@ String SystemStats::getLogonName() const char* user = getenv ("USER"); if (user == nullptr) - { - struct passwd* const pw = getpwuid (getuid()); - if (pw != nullptr) + if (passwd* const pw = getpwuid (getuid())) user = pw->pw_name; - } return CharPointer_UTF8 (user); } @@ -122,11 +119,12 @@ String SystemStats::getComputerName() return String::empty; } -String getLocaleValue (nl_item key) +static String getLocaleValue (nl_item key) { const char* oldLocale = ::setlocale (LC_ALL, ""); - return String (const_cast (nl_langinfo (key))); + String result (String::fromUTF8 (nl_langinfo (key))); ::setlocale (LC_ALL, oldLocale); + return result; } String SystemStats::getUserLanguage() { return getLocaleValue (_NL_IDENTIFICATION_LANGUAGE); } diff --git a/modules/juce_core/native/juce_linux_Threads.cpp b/modules/juce_core/native/juce_linux_Threads.cpp index 36bbf0aaa9..bbf01c8034 100644 --- a/modules/juce_core/native/juce_linux_Threads.cpp +++ b/modules/juce_core/native/juce_linux_Threads.cpp @@ -59,6 +59,9 @@ void Process::terminate() JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() { + #if JUCE_BSD + return false; + #else static char testResult = 0; if (testResult == 0) @@ -73,6 +76,7 @@ JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() } return testResult < 0; + #endif } JUCE_API bool JUCE_CALLTYPE Process::isRunningUnderDebugger() diff --git a/modules/juce_core/system/juce_TargetPlatform.h b/modules/juce_core/system/juce_TargetPlatform.h index 3aec45245c..79d9fe1be6 100644 --- a/modules/juce_core/system/juce_TargetPlatform.h +++ b/modules/juce_core/system/juce_TargetPlatform.h @@ -64,6 +64,8 @@ #else #define JUCE_MAC 1 #endif +#elif defined (__FreeBSD__) + #define JUCE_BSD 1 #else #error "Unknown platform!" #endif diff --git a/modules/juce_core/text/juce_String.cpp b/modules/juce_core/text/juce_String.cpp index 92d4c43fc4..11fb5b7c03 100644 --- a/modules/juce_core/text/juce_String.cpp +++ b/modules/juce_core/text/juce_String.cpp @@ -1205,8 +1205,8 @@ public: dest = result.getCharPointer(); } - StringCreationHelper (const String::CharPointerType& source_) - : source (source_), dest (nullptr), allocatedBytes (StringHolder::getAllocatedNumBytes (source)), bytesWritten (0) + StringCreationHelper (const String::CharPointerType s) + : source (s), dest (nullptr), allocatedBytes (StringHolder::getAllocatedNumBytes (s)), bytesWritten (0) { result.preallocateBytes (allocatedBytes); dest = result.getCharPointer(); @@ -1536,7 +1536,8 @@ String String::quoted (const juce_wchar quoteCharacter) const } //============================================================================== -static String::CharPointerType findTrimmedEnd (const String::CharPointerType& start, String::CharPointerType end) +static String::CharPointerType findTrimmedEnd (const String::CharPointerType start, + String::CharPointerType end) { while (end > start) { diff --git a/modules/juce_core/text/juce_TextDiff.cpp b/modules/juce_core/text/juce_TextDiff.cpp index a5a7d7d058..177cd130d0 100644 --- a/modules/juce_core/text/juce_TextDiff.cpp +++ b/modules/juce_core/text/juce_TextDiff.cpp @@ -35,14 +35,14 @@ struct TextDiffHelpers StringRegion (const String& s) noexcept : text (s.getCharPointer()), start (0), length (s.length()) {} - StringRegion (const String::CharPointerType& t, int s, int len) noexcept + StringRegion (const String::CharPointerType t, int s, int len) noexcept : text (t), start (s), length (len) {} String::CharPointerType text; int start, length; }; - static void addInsertion (TextDiff& td, const String::CharPointerType& text, int index, int length) + static void addInsertion (TextDiff& td, const String::CharPointerType text, int index, int length) { TextDiff::Change c; c.insertedText = String (text, (size_t) length); @@ -104,7 +104,7 @@ struct TextDiffHelpers } static int findLongestCommonSubstring (String::CharPointerType a, const int lenA, - const String::CharPointerType& b, const int lenB, + const String::CharPointerType b, const int lenB, int& indexInA, int& indexInB) { if (lenA == 0 || lenB == 0) diff --git a/modules/juce_gui_extra/code_editor/juce_CPlusPlusCodeTokeniserFunctions.h b/modules/juce_gui_extra/code_editor/juce_CPlusPlusCodeTokeniserFunctions.h index 86c0fcfc20..796042d0af 100644 --- a/modules/juce_gui_extra/code_editor/juce_CPlusPlusCodeTokeniserFunctions.h +++ b/modules/juce_gui_extra/code_editor/juce_CPlusPlusCodeTokeniserFunctions.h @@ -541,8 +541,8 @@ struct CppTokeniserFunctions */ struct StringIterator { - StringIterator (const String& s) noexcept : t (s.getCharPointer()), numChars (0) {} - StringIterator (const String::CharPointerType& s) noexcept : t (s), numChars (0) {} + StringIterator (const String& s) noexcept : t (s.getCharPointer()), numChars (0) {} + StringIterator (String::CharPointerType s) noexcept : t (s), numChars (0) {} juce_wchar nextChar() noexcept { if (isEOF()) return 0; ++numChars; return t.getAndAdvance(); } juce_wchar peekNextChar()noexcept { return *t; } diff --git a/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp b/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp index 678c0eca21..63523143ae 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp @@ -25,7 +25,7 @@ class CodeDocumentLine { public: - CodeDocumentLine (const String::CharPointerType& l, + CodeDocumentLine (const String::CharPointerType l, const int lineLen, const int numNewLineChars, const int startInFile)