diff --git a/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm b/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm index c06e945bff..93c9031e0b 100644 --- a/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm +++ b/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm @@ -53,7 +53,7 @@ static VoidArray activePlugins, activeUIs; static const short channelConfigs[][2] = { JucePlugin_PreferredChannelConfigurations }; -static const int numChannelConfigs = numElementsInArray (channelConfigs); +static const int numChannelConfigs = sizeof (channelConfigs) / sizeof (*channelConfigs); #if JucePlugin_IsSynth #define JuceAUBaseClass MusicDeviceBase diff --git a/src/containers/juce_MemoryBlock.cpp b/src/containers/juce_MemoryBlock.cpp index 11182f6c96..5a41dfa95c 100644 --- a/src/containers/juce_MemoryBlock.cpp +++ b/src/containers/juce_MemoryBlock.cpp @@ -243,12 +243,12 @@ int MemoryBlock::getBitRange (const size_t bitRangeStart, size_t numBits) const int res = 0; size_t byte = bitRangeStart >> 3; - size_t offsetInByte = bitRangeStart & 7; + int offsetInByte = bitRangeStart & 7; size_t bitsSoFar = 0; while (numBits > 0 && (size_t) byte < size) { - const size_t bitsThisTime = jmin (numBits, 8 - offsetInByte); + const int bitsThisTime = jmin ((int) numBits, 8 - offsetInByte); const int mask = (0xff >> (8 - bitsThisTime)) << offsetInByte; res |= (((data[byte] & mask) >> offsetInByte) << bitsSoFar); @@ -265,12 +265,12 @@ int MemoryBlock::getBitRange (const size_t bitRangeStart, size_t numBits) const void MemoryBlock::setBitRange (const size_t bitRangeStart, size_t numBits, int bitsToSet) throw() { size_t byte = bitRangeStart >> 3; - size_t offsetInByte = bitRangeStart & 7; + int offsetInByte = bitRangeStart & 7; unsigned int mask = ~((((unsigned int)0xffffffff) << (32 - numBits)) >> (32 - numBits)); while (numBits > 0 && (size_t) byte < size) { - const size_t bitsThisTime = jmin (numBits, 8 - offsetInByte); + const int bitsThisTime = jmin ((int) numBits, 8 - offsetInByte); const unsigned int tempMask = (mask << offsetInByte) | ~((((unsigned int)0xffffffff) >> offsetInByte) << offsetInByte); const unsigned int tempBits = bitsToSet << offsetInByte; diff --git a/src/core/juce_SystemStats.cpp b/src/core/juce_SystemStats.cpp index 85b51b91b8..b92370262d 100644 --- a/src/core/juce_SystemStats.cpp +++ b/src/core/juce_SystemStats.cpp @@ -60,13 +60,16 @@ void JUCE_PUBLIC_FUNCTION initialiseJuce_NonGUI() #ifdef JUCE_DEBUG { + // Some simple test code to keep an eye on things and make sure these functions + // work ok on all platforms. Let me know if any of these assertions fail! + + jassert (sizeof (pointer_sized_int) == sizeof (void*)); + char a1[7]; jassert (numElementsInArray(a1) == 7); int a2[3]; jassert (numElementsInArray(a2) == 3); - // Some simple test code to keep an eye on things and make sure these functions - // work ok on all platforms. Let me know if any of these assertions fail! int n = 1; Atomic::increment (n); jassert (Atomic::incrementAndReturn (n) == 3); diff --git a/src/cryptography/juce_MD5.cpp b/src/cryptography/juce_MD5.cpp index b722300a51..db0a35b4b4 100644 --- a/src/cryptography/juce_MD5.cpp +++ b/src/cryptography/juce_MD5.cpp @@ -96,7 +96,7 @@ void MD5::processStream (InputStream& input, int64 numBytesToRead) while (numBytesToRead > 0) { char tempBuffer [512]; - const int bytesRead = input.read (tempBuffer, (int) jmin ((size_t) numBytesToRead, sizeof (tempBuffer))); + const int bytesRead = input.read (tempBuffer, (int) jmin (numBytesToRead, (int64) sizeof (tempBuffer))); if (bytesRead <= 0) break; diff --git a/src/gui/components/buttons/juce_Button.cpp b/src/gui/components/buttons/juce_Button.cpp index 89de492769..22e3718063 100644 --- a/src/gui/components/buttons/juce_Button.cpp +++ b/src/gui/components/buttons/juce_Button.cpp @@ -137,7 +137,7 @@ void Button::setToggleState (const bool shouldBeOn, if (sendChangeNotification) sendClickMessage (ModifierKeys()); - if ((! deletionWatcher.hasBeenDeleted()) && getToggleState()) + if ((! deletionWatcher.hasBeenDeleted()) && lastToggleState) turnOffOtherButtonsInGroup (sendChangeNotification); } } @@ -170,7 +170,7 @@ void Button::setRadioGroupId (const int newGroupId) { radioGroupId = newGroupId; - if (getToggleState()) + if (lastToggleState) turnOffOtherButtonsInGroup (true); } } @@ -304,7 +304,7 @@ void Button::triggerClick() void Button::internalClickCallback (const ModifierKeys& modifiers) { if (clickTogglesState) - setToggleState ((radioGroupId != 0) || ! getToggleState(), false); + setToggleState ((radioGroupId != 0) || ! lastToggleState, false); sendClickMessage (modifiers); } @@ -679,8 +679,7 @@ void Button::repeatTimerCallback() throw() getRepeatTimer().startTimer (repeatSpeed); const uint32 now = Time::getApproximateMillisecondCounter(); - const int numTimesToCallback - = (now > lastTimeCallbackTime) ? jmax ((uint32) 1, (now - lastTimeCallbackTime) / repeatSpeed) : 1; + const int numTimesToCallback = (now > lastTimeCallbackTime) ? jmax (1, (int) (now - lastTimeCallbackTime) / repeatSpeed) : 1; lastTimeCallbackTime = now; diff --git a/src/gui/graphics/colour/juce_Colour.cpp b/src/gui/graphics/colour/juce_Colour.cpp index 42d95b6d1a..18bd7fbb35 100644 --- a/src/gui/graphics/colour/juce_Colour.cpp +++ b/src/gui/graphics/colour/juce_Colour.cpp @@ -31,7 +31,7 @@ BEGIN_JUCE_NAMESPACE //============================================================================== -static forcedinline uint8 floatAlphaToInt (const float alpha) +static uint8 floatAlphaToInt (const float alpha) { return (uint8) jlimit (0, 0xff, roundToInt (alpha * 255.0f)); } diff --git a/src/io/streams/juce_MemoryInputStream.cpp b/src/io/streams/juce_MemoryInputStream.cpp index ae6ada14c4..5e85a54c21 100644 --- a/src/io/streams/juce_MemoryInputStream.cpp +++ b/src/io/streams/juce_MemoryInputStream.cpp @@ -57,7 +57,8 @@ int64 MemoryInputStream::getTotalLength() int MemoryInputStream::read (void* buffer, int howMany) { - const size_t num = jmin ((size_t) howMany, dataSize - position); + jassert (howMany >= 0); + const int num = jmin (howMany, (int) (dataSize - position)); memcpy (buffer, data + position, num); position += num; return (int) num; diff --git a/src/threads/juce_CriticalSection.h b/src/threads/juce_CriticalSection.h index 1c33dd7270..3d312d71a4 100644 --- a/src/threads/juce_CriticalSection.h +++ b/src/threads/juce_CriticalSection.h @@ -119,11 +119,11 @@ private: class JUCE_API DummyCriticalSection { public: - forcedinline DummyCriticalSection() throw() {} - forcedinline ~DummyCriticalSection() throw() {} + inline DummyCriticalSection() throw() {} + inline ~DummyCriticalSection() throw() {} - forcedinline void enter() const throw() {} - forcedinline void exit() const throw() {} + inline void enter() const throw() {} + inline void exit() const throw() {} };