1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-06 04:00:08 +00:00

Minor fixes to avoid compiler warnings

This commit is contained in:
Julian Storer 2010-01-15 15:06:24 +00:00
parent e61e8f6775
commit 55306275b1
8 changed files with 22 additions and 19 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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));
}

View file

@ -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;

View file

@ -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() {}
};