mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed some warnings with -Wconversion enabled
This commit is contained in:
parent
adbf5fc219
commit
4a5dda489f
18 changed files with 39 additions and 30 deletions
|
|
@ -75,7 +75,7 @@ void MidiKeyboardState::noteOnInternal (const int midiChannel, const int midiNo
|
|||
{
|
||||
if (isPositiveAndBelow (midiNoteNumber, 128))
|
||||
{
|
||||
noteStates [midiNoteNumber] |= (1 << (midiChannel - 1));
|
||||
noteStates[midiNoteNumber] = static_cast<uint16> (noteStates[midiNoteNumber] | (1 << (midiChannel - 1)));
|
||||
|
||||
for (int i = listeners.size(); --i >= 0;)
|
||||
listeners.getUnchecked(i)->handleNoteOn (this, midiChannel, midiNoteNumber, velocity);
|
||||
|
|
@ -100,7 +100,7 @@ void MidiKeyboardState::noteOffInternal (const int midiChannel, const int midiN
|
|||
{
|
||||
if (isNoteOn (midiChannel, midiNoteNumber))
|
||||
{
|
||||
noteStates [midiNoteNumber] &= ~(1 << (midiChannel - 1));
|
||||
noteStates[midiNoteNumber] = static_cast<uint16> (noteStates[midiNoteNumber] & ~(1 << (midiChannel - 1)));
|
||||
|
||||
for (int i = listeners.size(); --i >= 0;)
|
||||
listeners.getUnchecked(i)->handleNoteOff (this, midiChannel, midiNoteNumber, velocity);
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ public:
|
|||
private:
|
||||
//==============================================================================
|
||||
CriticalSection lock;
|
||||
uint16 noteStates [128];
|
||||
uint16 noteStates[128];
|
||||
MidiBuffer eventsToAdd;
|
||||
Array <MidiKeyboardStateListener*> listeners;
|
||||
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ namespace AiffFileHelpers
|
|||
out.writeIntBigEndian (offset);
|
||||
|
||||
auto labelLength = jmin ((size_t) 254, label.getNumBytesAsUTF8()); // seems to need null terminator even though it's a pstring
|
||||
out.writeByte ((char) labelLength + 1);
|
||||
out.writeByte (static_cast<char> (labelLength + 1));
|
||||
out.write (label.toUTF8(), labelLength);
|
||||
out.writeByte (0);
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ namespace AiffFileHelpers
|
|||
auto comment = values.getValue (prefix + "Text", String());
|
||||
auto commentLength = jmin (comment.getNumBytesAsUTF8(), (size_t) 65534);
|
||||
|
||||
out.writeShortBigEndian ((short) commentLength + 1);
|
||||
out.writeShortBigEndian (static_cast<short> (commentLength + 1));
|
||||
out.write (comment.toUTF8(), commentLength);
|
||||
out.writeByte (0);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ namespace OggVorbisNamespace
|
|||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wconversion"
|
||||
#pragma clang diagnostic ignored "-Wshadow"
|
||||
#pragma clang diagnostic ignored "-Wfloat-conversion"
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-register"
|
||||
#pragma clang diagnostic ignored "-Wswitch-enum"
|
||||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
|
|
@ -53,6 +54,7 @@ namespace OggVorbisNamespace
|
|||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#pragma GCC diagnostic ignored "-Wfloat-conversion"
|
||||
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#pragma GCC diagnostic ignored "-Wswitch-enum"
|
||||
#pragma GCC diagnostic ignored "-Wswitch-default"
|
||||
|
|
@ -212,7 +214,7 @@ public:
|
|||
while (numToRead > 0)
|
||||
{
|
||||
float** dataIn = nullptr;
|
||||
auto samps = ov_read_float (&ovFile, &dataIn, numToRead, &bitStream);
|
||||
auto samps = static_cast<int> (ov_read_float (&ovFile, &dataIn, numToRead, &bitStream));
|
||||
|
||||
if (samps <= 0)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ struct Program
|
|||
auto n = (uint16) size;
|
||||
|
||||
for (uint32 i = 2; i < size; ++i)
|
||||
n += (n * 2) + programStart[i];
|
||||
n = static_cast<uint16> (n + (n * 2) + programStart[i]);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ static uint8 calculatePacketChecksum (const uint8* data, uint32 size) noexcept
|
|||
uint8 checksum = (uint8) size;
|
||||
|
||||
for (uint32 i = 0; i < size; ++i)
|
||||
checksum += checksum * 2 + data[i];
|
||||
checksum = static_cast<uint8> (checksum + (checksum * 2 + data[i]));
|
||||
|
||||
return checksum & 0x7f;
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ struct Packed7BitArrayBuilder
|
|||
{
|
||||
const int bitsToDo = jmin (7 - bitsInCurrentByte, numBits);
|
||||
|
||||
data[bytesWritten] |= ((value & (uint32) ((1 << bitsToDo) - 1)) << bitsInCurrentByte);
|
||||
data[bytesWritten] = static_cast<uint8> (data[bytesWritten] | ((value & (uint32) ((1 << bitsToDo) - 1)) << bitsInCurrentByte));
|
||||
value >>= bitsToDo;
|
||||
numBits -= bitsToDo;
|
||||
bitsInCurrentByte += bitsToDo;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#if defined JUCE_CLANG
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wconversion"
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
#pragma clang diagnostic ignored "-Wfloat-conversion"
|
||||
#pragma clang diagnostic ignored "-Wcast-align"
|
||||
|
|
@ -46,7 +47,9 @@
|
|||
#endif
|
||||
#elif defined JUCE_GCC
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#pragma GCC diagnostic ignored "-Wfloat-conversion"
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#pragma GCC diagnostic ignored "-Wswitch-enum"
|
||||
|
|
|
|||
|
|
@ -551,7 +551,7 @@ BigInteger& BigInteger::operator*= (const BigInteger& other)
|
|||
{
|
||||
auto uv = (uint64) totalValues[i + j] + (uint64) values[j] * (uint64) mValues[i] + (uint64) c;
|
||||
totalValues[i + j] = (uint32) uv;
|
||||
c = uv >> 32;
|
||||
c = static_cast<uint32> (uv >> 32);
|
||||
}
|
||||
|
||||
totalValues[i + n + 1] = c;
|
||||
|
|
|
|||
|
|
@ -90,10 +90,10 @@ IPAddress::IPAddress (uint16 a1, uint16 a2, uint16 a3, uint16 a4,
|
|||
|
||||
IPAddress::IPAddress (uint32 n) noexcept : isIPv6 (false)
|
||||
{
|
||||
address[0] = (n >> 24);
|
||||
address[1] = (n >> 16) & 255;
|
||||
address[2] = (n >> 8) & 255;
|
||||
address[3] = (n & 255);
|
||||
address[0] = static_cast<uint8> (n >> 24);
|
||||
address[1] = static_cast<uint8> ((n >> 16) & 255);
|
||||
address[2] = static_cast<uint8> ((n >> 8) & 255);
|
||||
address[3] = static_cast<uint8> ((n & 255));
|
||||
|
||||
zeroUnusedBytes (address);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ namespace SocketHelpers
|
|||
break;
|
||||
}
|
||||
|
||||
bytesRead += bytesThisTime;
|
||||
bytesRead = static_cast<int> (bytesRead + bytesThisTime);
|
||||
|
||||
if (! blockUntilSpecifiedAmountHasArrived)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public:
|
|||
while ((static_cast<uint8> (n) & bit) != 0 && bit > 0x8)
|
||||
{
|
||||
++data;
|
||||
bit >>= 1;
|
||||
bit = static_cast<uint8> (bit >> 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ namespace NumberToStringConverters
|
|||
|
||||
do
|
||||
{
|
||||
*--t = '0' + (char) (v % 10);
|
||||
*--t = static_cast<char> ('0' + (char) (v % 10));
|
||||
v /= 10;
|
||||
|
||||
} while (v > 0);
|
||||
|
|
@ -1912,7 +1912,7 @@ static String hexToString (Type v)
|
|||
do
|
||||
{
|
||||
*--t = hexDigits [(int) (v & 15)];
|
||||
v >>= 4;
|
||||
v = static_cast<Type> (v >> 4);
|
||||
|
||||
} while (v != 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ private:
|
|||
target.writeInt ((int) checksum);
|
||||
target.writeInt ((int) (uint32) compressedSize);
|
||||
target.writeInt ((int) (uint32) uncompressedSize);
|
||||
target.writeShort ((short) storedPathname.toUTF8().sizeInBytes() - 1);
|
||||
target.writeShort (static_cast<short> (storedPathname.toUTF8().sizeInBytes() - 1));
|
||||
target.writeShort (0); // extra field length
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ bool BlowFish::apply (void* data, size_t size, void (BlowFish::*op) (uint32&, ui
|
|||
int BlowFish::pad (void* data, size_t size, size_t bufferSize) noexcept
|
||||
{
|
||||
// add padding according to https://tools.ietf.org/html/rfc2898#section-6.1.1
|
||||
const uint8 paddingSize = 8u - (size % 8u);
|
||||
const uint8 paddingSize = static_cast<uint8> (8u - (size % 8u));
|
||||
auto n = size + paddingSize;
|
||||
|
||||
if (n > bufferSize)
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ private:
|
|||
bufferBits = bufferPos = 0;
|
||||
}
|
||||
|
||||
buffer[bufferPos] = (uint8_t) (b << (8 - bufferRem));
|
||||
buffer[bufferPos] = static_cast<uint8_t> (b << (8 - bufferRem));
|
||||
bufferBits += bufferRem;
|
||||
|
||||
numBits -= 8;
|
||||
|
|
@ -103,7 +103,7 @@ private:
|
|||
if (numBits > 0)
|
||||
{
|
||||
b = (source[sourcePos] << sourceGap) & 0xff;
|
||||
buffer[bufferPos] |= (b >> bufferRem);
|
||||
buffer[bufferPos] = static_cast<uint8_t> (buffer[bufferPos] | (b >> bufferRem));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -126,7 +126,7 @@ private:
|
|||
bufferBits = bufferPos = 0;
|
||||
}
|
||||
|
||||
buffer[bufferPos] = (uint8_t) (b << (8 - bufferRem));
|
||||
buffer[bufferPos] = static_cast<uint8_t> (b << (8 - bufferRem));
|
||||
bufferBits += numBits;
|
||||
}
|
||||
}
|
||||
|
|
@ -134,7 +134,8 @@ private:
|
|||
void finalize (uint8_t* result) noexcept
|
||||
{
|
||||
// append a '1'-bit
|
||||
buffer[bufferPos++] |= 0x80u >> (bufferBits & 7);
|
||||
buffer[bufferPos] = static_cast<uint8_t> (buffer[bufferPos] | (0x80u >> (bufferBits & 7)));
|
||||
bufferPos++;
|
||||
|
||||
// pad with zero bits to complete (N*(64*8) - (32*8)) bits
|
||||
if (bufferPos > 32)
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ struct SIMDFallbackOps
|
|||
auto retval = static_cast<ScalarType> (0);
|
||||
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
retval += a.s[i];
|
||||
retval = static_cast<ScalarType> (retval + a.s[i]);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,10 @@ bool Colour::operator!= (const Colour& other) const noexcept { return argb.ge
|
|||
|
||||
//==============================================================================
|
||||
Colour::Colour (const uint32 col) noexcept
|
||||
: argb ((col >> 24) & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff, col & 0xff)
|
||||
: argb (static_cast<uint8> ((col >> 24) & 0xff),
|
||||
static_cast<uint8> ((col >> 16) & 0xff),
|
||||
static_cast<uint8> ((col >> 8) & 0xff),
|
||||
static_cast<uint8> (col & 0xff))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1757,7 +1757,7 @@ public:
|
|||
case XK_Delete:
|
||||
case XK_Insert:
|
||||
keyPressed = true;
|
||||
keyCode = (keyCode & 0xff) | Keys::extendedKeyModifier;
|
||||
keyCode = static_cast<int> ((keyCode & 0xff) | Keys::extendedKeyModifier);
|
||||
break;
|
||||
|
||||
case XK_Tab:
|
||||
|
|
@ -1777,7 +1777,7 @@ public:
|
|||
if (sym >= XK_F1 && sym <= XK_F35)
|
||||
{
|
||||
keyPressed = true;
|
||||
keyCode = (sym & 0xff) | Keys::extendedKeyModifier;
|
||||
keyCode = static_cast<int> ((sym & 0xff) | Keys::extendedKeyModifier);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -2436,9 +2436,9 @@ private:
|
|||
const int keybit = (1 << (keycode & 7));
|
||||
|
||||
if (press)
|
||||
Keys::keyStates [keybyte] |= keybit;
|
||||
Keys::keyStates[keybyte] = static_cast<char> (Keys::keyStates[keybyte] | keybit);
|
||||
else
|
||||
Keys::keyStates [keybyte] &= ~keybit;
|
||||
Keys::keyStates[keybyte] = static_cast<char> (Keys::keyStates[keybyte] & ~keybit);
|
||||
}
|
||||
|
||||
static void updateKeyModifiers (int status) noexcept
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue