1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed some warnings on the latest compilers

This commit is contained in:
Tom Poole 2019-07-26 12:58:04 +01:00
parent 70429ade14
commit a12bc32979
10 changed files with 58 additions and 58 deletions

View file

@ -163,7 +163,7 @@ public:
for (auto y = 1; y < imageHeight; ++y)
{
auto skewedProportionY = 1.0f - std::exp (std::log (y / (float) imageHeight) * 0.2f);
auto fftDataIndex = jlimit (0, fftSize / 2, (int) (skewedProportionY * fftSize / 2));
auto fftDataIndex = jlimit (0, fftSize / 2, (int) (skewedProportionY * (int) fftSize / 2));
auto level = jmap (fftData[fftDataIndex], 0.0f, jmax (maxLevel.getEnd(), 1e-5f), 0.0f, 1.0f);
spectrogramImage.setPixelAt (rightHandEdge, y, Colour::fromHSV (level, 1.0f, level, 1.0f));

View file

@ -217,7 +217,7 @@ public:
for (auto i = 0; i < steps; ++i)
{
auto p = start + ((finish - start) * i) / steps;
auto p = start + ((finish - start) * i) / (int) steps;
auto index = (bufferIndex + i) % wavetableSize;
waveValues[1][index] = yToAmplitude (p.y);

View file

@ -102,9 +102,9 @@ public:
inline void advance() noexcept { ++data; }
inline void skip (int numSamples) noexcept { data += numSamples; }
inline float getAsFloatLE() const noexcept { return (float) (*data * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatLE() const noexcept { return (float) (*data * (1.0 / (1.0 + (double) maxValue))); }
inline float getAsFloatBE() const noexcept { return getAsFloatLE(); }
inline void setAsFloatLE (float newValue) noexcept { *data = (int8) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))); }
inline void setAsFloatLE (float newValue) noexcept { *data = (int8) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + (double) maxValue))); }
inline void setAsFloatBE (float newValue) noexcept { setAsFloatLE (newValue); }
inline int32 getAsInt32LE() const noexcept { return (int) (*((uint8*) data) << 24); }
inline int32 getAsInt32BE() const noexcept { return getAsInt32LE(); }
@ -127,9 +127,9 @@ public:
inline void advance() noexcept { ++data; }
inline void skip (int numSamples) noexcept { data += numSamples; }
inline float getAsFloatLE() const noexcept { return (float) ((*data - 128) * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatLE() const noexcept { return (float) ((*data - 128) * (1.0 / (1.0 + (double) maxValue))); }
inline float getAsFloatBE() const noexcept { return getAsFloatLE(); }
inline void setAsFloatLE (float newValue) noexcept { *data = (uint8) jlimit (0, 255, 128 + roundToInt (newValue * (1.0 + maxValue))); }
inline void setAsFloatLE (float newValue) noexcept { *data = (uint8) jlimit (0, 255, 128 + roundToInt (newValue * (1.0 + (double) maxValue))); }
inline void setAsFloatBE (float newValue) noexcept { setAsFloatLE (newValue); }
inline int32 getAsInt32LE() const noexcept { return (int) (((uint8) (*data - 128)) << 24); }
inline int32 getAsInt32BE() const noexcept { return getAsInt32LE(); }
@ -152,10 +152,10 @@ public:
inline void advance() noexcept { ++data; }
inline void skip (int numSamples) noexcept { data += numSamples; }
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint16) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint16) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int16) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int16) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint16) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + (double) maxValue)))); }
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint16) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + (double) maxValue)))); }
inline int32 getAsInt32LE() const noexcept { return (int32) (ByteOrder::swapIfBigEndian ((uint16) *data) << 16); }
inline int32 getAsInt32BE() const noexcept { return (int32) (ByteOrder::swapIfLittleEndian ((uint16) *data) << 16); }
inline void setAsInt32LE (int32 newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint16) (newValue >> 16)); }
@ -177,10 +177,10 @@ public:
inline void advance() noexcept { data += 3; }
inline void skip (int numSamples) noexcept { data += 3 * numSamples; }
inline float getAsFloatLE() const noexcept { return (float) (ByteOrder::littleEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
inline float getAsFloatBE() const noexcept { return (float) (ByteOrder::bigEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
inline void setAsFloatLE (float newValue) noexcept { ByteOrder::littleEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
inline void setAsFloatBE (float newValue) noexcept { ByteOrder::bigEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
inline float getAsFloatLE() const noexcept { return (float) (ByteOrder::littleEndian24Bit (data) * (1.0 / (1.0 + (double) maxValue))); }
inline float getAsFloatBE() const noexcept { return (float) (ByteOrder::bigEndian24Bit (data) * (1.0 / (1.0 + (double) maxValue))); }
inline void setAsFloatLE (float newValue) noexcept { ByteOrder::littleEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + (double) maxValue))), data); }
inline void setAsFloatBE (float newValue) noexcept { ByteOrder::bigEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + (double) maxValue))), data); }
inline int32 getAsInt32LE() const noexcept { return (int32) (((unsigned int) ByteOrder::littleEndian24Bit (data)) << 8); }
inline int32 getAsInt32BE() const noexcept { return (int32) (((unsigned int) ByteOrder::bigEndian24Bit (data)) << 8); }
inline void setAsInt32LE (int32 newValue) noexcept { ByteOrder::littleEndian24BitToChars (newValue >> 8, data); }
@ -202,10 +202,10 @@ public:
inline void advance() noexcept { ++data; }
inline void skip (int numSamples) noexcept { data += numSamples; }
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) (int32) (maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) (int32) (maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) (int32) ((double) maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) (int32) ((double) maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
inline int32 getAsInt32LE() const noexcept { return (int32) ByteOrder::swapIfBigEndian (*data); }
inline int32 getAsInt32BE() const noexcept { return (int32) ByteOrder::swapIfLittleEndian (*data); }
inline void setAsInt32LE (int32 newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); }
@ -226,10 +226,10 @@ public:
public:
inline Int24in32 (void* d) noexcept : Int32 (d) {}
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) (maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) (maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) ((double) maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) ((double) maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
inline int32 getAsInt32LE() const noexcept { return (int32) ByteOrder::swapIfBigEndian (*data) << 8; }
inline int32 getAsInt32BE() const noexcept { return (int32) ByteOrder::swapIfLittleEndian (*data) << 8; }
inline void setAsInt32LE (int32 newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) newValue >> 8); }
@ -261,8 +261,8 @@ public:
#endif
inline int32 getAsInt32LE() const noexcept { return (int32) roundToInt (jlimit (-1.0, 1.0, (double) getAsFloatLE()) * (double) maxValue); }
inline int32 getAsInt32BE() const noexcept { return (int32) roundToInt (jlimit (-1.0, 1.0, (double) getAsFloatBE()) * (double) maxValue); }
inline void setAsInt32LE (int32 newValue) noexcept { setAsFloatLE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void setAsInt32BE (int32 newValue) noexcept { setAsFloatBE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
inline void setAsInt32LE (int32 newValue) noexcept { setAsFloatLE ((float) (newValue * (1.0 / (1.0 + (double) maxValue)))); }
inline void setAsInt32BE (int32 newValue) noexcept { setAsFloatBE ((float) (newValue * (1.0 / (1.0 + (double) maxValue)))); }
inline void clear() noexcept { *data = 0; }
inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;}
template <class SourceType> inline void copyFromLE (SourceType& source) noexcept { setAsFloatLE (source.getAsFloat()); }
@ -528,8 +528,8 @@ public:
if (v < mn) mn = v;
}
return Range<float> (mn * (float) (1.0 / (1.0 + Int32::maxValue)),
mx * (float) (1.0 / (1.0 + Int32::maxValue)));
return Range<float> (mn * (float) (1.0 / (1.0 + (double) Int32::maxValue)),
mx * (float) (1.0 / (1.0 + (double) Int32::maxValue)));
}
/** Scans a block of data, returning the lowest and highest levels as floats */

View file

@ -928,7 +928,7 @@ private:
enum { numMIDIChannels = 16 };
Vst::ParamID parameterToMidiControllerOffset;
MidiController parameterToMidiController[numMIDIChannels * Vst::kCountCtrlNumber];
MidiController parameterToMidiController[(int) numMIDIChannels * (int) Vst::kCountCtrlNumber];
Vst::ParamID midiControllerToParameter[numMIDIChannels][Vst::kCountCtrlNumber];
//==============================================================================

View file

@ -16,6 +16,7 @@
//----------------------------------------------------------------------------------------------
#if SMTG_OS_MACOS
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-warning-option"
#pragma GCC diagnostic ignored "-Wpragma-pack"
#if SMTG_PLATFORM_64
@ -23,8 +24,7 @@
#else
#pragma pack(push, 1)
#endif
#pragma GCC diagnostic default "-Wpragma-pack"
#pragma GCC diagnostic default "-Wunknown-warning-option"
#pragma GCC diagnostic pop
#elif defined __BORLANDC__
#pragma -a8
#elif SMTG_OS_WINDOWS

View file

@ -471,25 +471,25 @@ static constexpr uint32 controlBlockStackSize = 800;
/** Contains the number of bits required to encode various items in the packets */
enum BitSizes
{
topologyMessageHeader = MessageType::bits + ProtocolVersion::bits + DeviceCount::bits + ConnectionCount::bits,
topologyDeviceInfo = BlockSerialNumber::maxLength * 7 + BatteryLevel::bits + BatteryCharging::bits,
topologyConnectionInfo = topologyIndexBits + ConnectorPort::bits + topologyIndexBits + ConnectorPort::bits,
topologyMessageHeader = (int) MessageType::bits + (int) ProtocolVersion::bits + (int) DeviceCount::bits + (int) ConnectionCount::bits,
topologyDeviceInfo = (int) BlockSerialNumber::maxLength * 7 + (int) BatteryLevel::bits + (int) BatteryCharging::bits,
topologyConnectionInfo = topologyIndexBits + (int) ConnectorPort::bits + topologyIndexBits + (int) ConnectorPort::bits,
typeDeviceAndTime = MessageType::bits + PacketTimestampOffset::bits,
typeDeviceAndTime = (int) MessageType::bits + (int) PacketTimestampOffset::bits,
touchMessage = typeDeviceAndTime + TouchIndex::bits + TouchPosition::bits,
touchMessageWithVelocity = touchMessage + TouchVelocity::bits,
touchMessage = (int) typeDeviceAndTime + (int) TouchIndex::bits + (int) TouchPosition::bits,
touchMessageWithVelocity = (int) touchMessage + (int) TouchVelocity::bits,
programEventMessage = MessageType::bits + 32 * numProgramMessageInts,
packetACK = MessageType::bits + PacketCounter::bits,
programEventMessage = (int) MessageType::bits + 32 * numProgramMessageInts,
packetACK = (int) MessageType::bits + (int) PacketCounter::bits,
firmwareUpdateACK = MessageType::bits + FirmwareUpdateACKCode::bits + FirmwareUpdateACKDetail::bits,
firmwareUpdateACK = (int) MessageType::bits + (int) FirmwareUpdateACKCode::bits + (int) FirmwareUpdateACKDetail::bits,
controlButtonMessage = typeDeviceAndTime + ControlButtonID::bits,
controlButtonMessage = (int) typeDeviceAndTime + (int) ControlButtonID::bits,
configSetMessage = MessageType::bits + ConfigCommand::bits + ConfigItemIndex::bits + ConfigItemValue::bits,
configRespMessage = MessageType::bits + ConfigCommand::bits + ConfigItemIndex::bits + (ConfigItemValue::bits * 3),
configSyncEndMessage = MessageType::bits + ConfigCommand::bits,
configSetMessage = (int) MessageType::bits + (int) ConfigCommand::bits + (int) ConfigItemIndex::bits + (int) ConfigItemValue::bits,
configRespMessage = (int) MessageType::bits + (int) ConfigCommand::bits + (int) ConfigItemIndex::bits + ((int) ConfigItemValue::bits * 3),
configSyncEndMessage = (int) MessageType::bits + (int) ConfigCommand::bits,
};
//==============================================================================

View file

@ -58,7 +58,7 @@ struct HostPacketBuilder
//==============================================================================
bool deviceControlMessage (DeviceCommand command) noexcept
{
if (! data.hasCapacity (MessageType::bits + DeviceCommand::bits))
if (! data.hasCapacity ((int) MessageType::bits + (int) DeviceCommand::bits))
return false;
writeMessageType (MessageFromHost::deviceCommandMessage);
@ -69,7 +69,7 @@ struct HostPacketBuilder
//==============================================================================
bool beginDataChanges (PacketIndex packetIndex) noexcept
{
if (! data.hasCapacity (MessageType::bits + PacketIndex::bits + DataChangeCommand::bits))
if (! data.hasCapacity ((int) MessageType::bits + (int) PacketIndex::bits + (int) DataChangeCommand::bits))
return false;
writeMessageType (MessageFromHost::sharedDataChange);
@ -255,7 +255,7 @@ struct HostPacketBuilder
bool addRequestFactorySyncMessage()
{
if (! data.hasCapacity (MessageType::bits + ConfigCommand::bits))
if (! data.hasCapacity ((int) MessageType::bits + (int) ConfigCommand::bits))
return false;
writeMessageType (MessageFromHost::configMessage);
@ -266,7 +266,7 @@ struct HostPacketBuilder
bool addRequestUserSyncMessage()
{
if (! data.hasCapacity (MessageType::bits + ConfigCommand::bits))
if (! data.hasCapacity ((int) MessageType::bits + (int) ConfigCommand::bits))
return false;
writeMessageType (MessageFromHost::configMessage);

View file

@ -104,7 +104,7 @@ struct HostPacketDecoder
static bool handleTopology (Handler& handler, Packed7BitArrayReader& reader, bool newTopology)
{
if (reader.getRemainingBits() < DeviceCount::bits + ConnectionCount::bits)
if (reader.getRemainingBits() < (int) DeviceCount::bits + (int) ConnectionCount::bits)
{
jassertfalse; // not enough data available for this message type!
return false;
@ -220,7 +220,7 @@ struct HostPacketDecoder
static bool handleTouch (Handler& handler, Packed7BitArrayReader& reader, TopologyIndex deviceIndex,
PacketTimestamp packetTimestamp, bool isStart, bool isEnd)
{
if (reader.getRemainingBits() < BitSizes::touchMessage - MessageType::bits)
if (reader.getRemainingBits() < (int) BitSizes::touchMessage - (int) MessageType::bits)
{
jassertfalse; // not enough data available for this message type!
return false;
@ -240,7 +240,7 @@ struct HostPacketDecoder
static bool handleTouchWithVelocity (Handler& handler, Packed7BitArrayReader& reader, TopologyIndex deviceIndex,
PacketTimestamp packetTimestamp, bool isStart, bool isEnd)
{
if (reader.getRemainingBits() < BitSizes::touchMessageWithVelocity - MessageType::bits)
if (reader.getRemainingBits() < (int) BitSizes::touchMessageWithVelocity - (int) MessageType::bits)
{
jassertfalse; // not enough data available for this message type!
return false;
@ -269,7 +269,7 @@ struct HostPacketDecoder
static bool handleButtonDownOrUp (Handler& handler, Packed7BitArrayReader& reader, TopologyIndex deviceIndex,
PacketTimestamp packetTimestamp, bool isDown)
{
if (reader.getRemainingBits() < BitSizes::controlButtonMessage - MessageType::bits)
if (reader.getRemainingBits() < (int) BitSizes::controlButtonMessage - (int) MessageType::bits)
{
jassertfalse; // not enough data available for this message type!
return false;
@ -285,7 +285,7 @@ struct HostPacketDecoder
static bool handleCustomMessage (Handler& handler, Packed7BitArrayReader& reader,
TopologyIndex deviceIndex, PacketTimestamp packetTimestamp)
{
if (reader.getRemainingBits() < BitSizes::programEventMessage - MessageType::bits)
if (reader.getRemainingBits() < BitSizes::programEventMessage - (int) MessageType::bits)
{
jassertfalse; // not enough data available for this message type!
return false;
@ -302,7 +302,7 @@ struct HostPacketDecoder
static bool handlePacketACK (Handler& handler, Packed7BitArrayReader& reader, TopologyIndex deviceIndex)
{
if (reader.getRemainingBits() < BitSizes::packetACK - MessageType::bits)
if (reader.getRemainingBits() < BitSizes::packetACK - (int) MessageType::bits)
{
jassertfalse; // not enough data available for this message type!
return false;

View file

@ -188,10 +188,10 @@ namespace XmlOutputFunctions
template <int tableIndex>
struct Byte
{
enum { v = Bit<tableIndex * 8 + 0>::v | Bit<tableIndex * 8 + 1>::v
| Bit<tableIndex * 8 + 2>::v | Bit<tableIndex * 8 + 3>::v
| Bit<tableIndex * 8 + 4>::v | Bit<tableIndex * 8 + 5>::v
| Bit<tableIndex * 8 + 6>::v | Bit<tableIndex * 8 + 7>::v };
enum { v = (int) Bit<tableIndex * 8 + 0>::v | (int) Bit<tableIndex * 8 + 1>::v
| (int) Bit<tableIndex * 8 + 2>::v | (int) Bit<tableIndex * 8 + 3>::v
| (int) Bit<tableIndex * 8 + 4>::v | (int) Bit<tableIndex * 8 + 5>::v
| (int) Bit<tableIndex * 8 + 6>::v | (int) Bit<tableIndex * 8 + 7>::v };
};
static bool isLegal (uint32 c) noexcept

View file

@ -918,10 +918,10 @@ struct Grid::BoxAlignment
// align and justify
auto r = area;
if (item.width != GridItem::notAssigned)
if (item.width != (float) GridItem::notAssigned)
r.setWidth (item.width);
if (item.height != GridItem::notAssigned)
if (item.height != (float) GridItem::notAssigned)
r.setHeight (item.height);
if (alignType == Grid::AlignItems::start && justifyType == Grid::JustifyItems::start)