mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Misc minor clean-ups.
This commit is contained in:
parent
282cf3dac4
commit
516bddabcc
12 changed files with 35 additions and 25 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <typename Dest, typename Source>
|
||||
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 <Type, int32> (value); }
|
||||
static inline Type castFrom64Bit (int64 value) noexcept { return castTo <Type, int64> (value); }
|
||||
static inline int32 castTo32Bit (Type value) noexcept { return castTo <int32, Type> (value); }
|
||||
static inline int64 castTo64Bit (Type value) noexcept { return castTo <int64, Type> (value); }
|
||||
|
||||
Type operator++ (int); // better to just use pre-increment with atomics..
|
||||
Type operator-- (int);
|
||||
|
|
|
|||
|
|
@ -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 <const char*> (nl_langinfo (key)));
|
||||
String result (String::fromUTF8 (nl_langinfo (key)));
|
||||
::setlocale (LC_ALL, oldLocale);
|
||||
return result;
|
||||
}
|
||||
|
||||
String SystemStats::getUserLanguage() { return getLocaleValue (_NL_IDENTIFICATION_LANGUAGE); }
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@
|
|||
#else
|
||||
#define JUCE_MAC 1
|
||||
#endif
|
||||
#elif defined (__FreeBSD__)
|
||||
#define JUCE_BSD 1
|
||||
#else
|
||||
#error "Unknown platform!"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue