Browse Source

Fixed some GCC compiler warnings and removed deprecated functions

tags/2021-05-28
Tom Poole 6 years ago
parent
commit
16dd26649a
100 changed files with 363 additions and 258 deletions
  1. +1
    -1
      examples/Assets/AudioLiveScrollingDisplay.h
  2. +1
    -1
      examples/Audio/AudioLatencyDemo.h
  3. +2
    -0
      examples/Audio/AudioSynthesiserDemo.h
  4. +2
    -0
      examples/Audio/MPEDemo.h
  5. +1
    -1
      examples/BLOCKS/BlocksMonitorDemo.h
  6. +2
    -0
      examples/BLOCKS/BlocksSynthDemo.h
  7. +2
    -0
      examples/DemoRunner/Source/UI/SettingsContent.h
  8. +2
    -0
      examples/GUI/WidgetsDemo.h
  9. +2
    -0
      examples/Plugins/AudioPluginDemo.h
  10. +6
    -0
      extras/AudioPluginHost/Source/Filters/InternalFilters.cpp
  11. +2
    -0
      extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h
  12. +2
    -0
      extras/Projucer/Source/LiveBuildEngine/UI/jucer_ComponentListComponent.h
  13. +2
    -0
      extras/Projucer/Source/Project/UI/jucer_ContentViewComponents.h
  14. +2
    -0
      extras/Projucer/Source/Utility/UI/jucer_SlidingPanelComponent.cpp
  15. +0
    -1
      extras/Projucer/Source/Utility/UI/jucer_SlidingPanelComponent.h
  16. +2
    -0
      extras/Projucer/Source/Wizards/jucer_TemplateThumbnailsComponent.h
  17. +3
    -1
      modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp
  18. +2
    -2
      modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h
  19. +0
    -5
      modules/juce_audio_basics/synthesisers/juce_Synthesiser.h
  20. +1
    -1
      modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp
  21. +1
    -1
      modules/juce_audio_devices/native/juce_android_Oboe.cpp
  22. +2
    -2
      modules/juce_audio_devices/native/juce_linux_ALSA.cpp
  23. +5
    -5
      modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp
  24. +3
    -1
      modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp
  25. +1
    -0
      modules/juce_audio_formats/codecs/juce_AiffAudioFormat.h
  26. +1
    -1
      modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp
  27. +1
    -0
      modules/juce_audio_formats/codecs/juce_CoreAudioFormat.h
  28. +13
    -2
      modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp
  29. +2
    -0
      modules/juce_audio_formats/codecs/juce_FlacAudioFormat.h
  30. +1
    -0
      modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.h
  31. +22
    -21
      modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp
  32. +1
    -0
      modules/juce_audio_formats/codecs/juce_MP3AudioFormat.h
  33. +6
    -3
      modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp
  34. +1
    -0
      modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.h
  35. +4
    -2
      modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp
  36. +1
    -0
      modules/juce_audio_formats/codecs/juce_WavAudioFormat.h
  37. +1
    -0
      modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.h
  38. +2
    -2
      modules/juce_audio_formats/format/juce_AudioFormatReader.cpp
  39. +1
    -1
      modules/juce_audio_formats/format/juce_AudioFormatReader.h
  40. +1
    -0
      modules/juce_audio_formats/format/juce_AudioSubsectionReader.h
  41. +1
    -0
      modules/juce_audio_formats/sampler/juce_Sampler.h
  42. +1
    -1
      modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm
  43. +23
    -13
      modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  44. +1
    -1
      modules/juce_audio_processors/format_types/juce_AU_Shared.h
  45. +1
    -1
      modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
  46. +29
    -27
      modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp
  47. +2
    -2
      modules/juce_audio_processors/format_types/juce_VSTCommon.h
  48. +2
    -2
      modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h
  49. +29
    -13
      modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  50. +1
    -1
      modules/juce_audio_processors/processors/juce_AudioPluginInstance.h
  51. +3
    -3
      modules/juce_audio_processors/processors/juce_AudioProcessor.h
  52. +1
    -0
      modules/juce_audio_processors/processors/juce_AudioProcessorParameterGroup.cpp
  53. +1
    -0
      modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp
  54. +2
    -0
      modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp
  55. +4
    -4
      modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp
  56. +1
    -1
      modules/juce_blocks_basics/littlefoot/juce_LittleFootRunner.h
  57. +4
    -4
      modules/juce_blocks_basics/protocol/juce_BitPackingUtilities.h
  58. +3
    -3
      modules/juce_blocks_basics/topology/internal/juce_BlockImplementation.cpp
  59. +3
    -3
      modules/juce_blocks_basics/visualisers/juce_BitmapLEDProgram.cpp
  60. +3
    -3
      modules/juce_blocks_basics/visualisers/juce_DrumPadLEDProgram.cpp
  61. +8
    -7
      modules/juce_box2d/juce_box2d.cpp
  62. +16
    -8
      modules/juce_box2d/juce_box2d.h
  63. +2
    -2
      modules/juce_core/containers/juce_ArrayBase.h
  64. +3
    -3
      modules/juce_core/maths/juce_BigInteger.cpp
  65. +1
    -1
      modules/juce_core/maths/juce_MathsFunctions.h
  66. +1
    -1
      modules/juce_core/memory/juce_MemoryBlock.cpp
  67. +1
    -1
      modules/juce_core/native/juce_linux_Files.cpp
  68. +1
    -1
      modules/juce_core/native/juce_linux_SystemStats.cpp
  69. +2
    -2
      modules/juce_core/native/juce_posix_SharedCode.h
  70. +1
    -1
      modules/juce_core/system/juce_TargetPlatform.h
  71. +3
    -3
      modules/juce_core/text/juce_CharacterFunctions.h
  72. +2
    -2
      modules/juce_core/text/juce_String.cpp
  73. +1
    -1
      modules/juce_core/text/juce_StringArray.cpp
  74. +1
    -1
      modules/juce_core/xml/juce_XmlDocument.cpp
  75. +12
    -0
      modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp
  76. +10
    -10
      modules/juce_core/zip/juce_ZipFile.cpp
  77. +1
    -1
      modules/juce_cryptography/hashing/juce_SHA256.cpp
  78. +2
    -2
      modules/juce_cryptography/hashing/juce_Whirlpool.cpp
  79. +1
    -1
      modules/juce_dsp/containers/juce_SIMDRegister_Impl.h
  80. +1
    -1
      modules/juce_dsp/containers/juce_SIMDRegister_test.cpp
  81. +4
    -4
      modules/juce_dsp/frequency/juce_FFT.cpp
  82. +1
    -1
      modules/juce_dsp/maths/juce_Matrix.h
  83. +0
    -7
      modules/juce_events/broadcasters/juce_ChangeListener.h
  84. +1
    -1
      modules/juce_events/native/juce_linux_Messaging.cpp
  85. +8
    -3
      modules/juce_graphics/image_formats/juce_JPEGLoader.cpp
  86. +15
    -4
      modules/juce_graphics/image_formats/juce_PNGLoader.cpp
  87. +3
    -3
      modules/juce_graphics/native/juce_freetype_Fonts.cpp
  88. +0
    -7
      modules/juce_gui_basics/buttons/juce_Button.h
  89. +4
    -2
      modules/juce_gui_basics/buttons/juce_HyperlinkButton.h
  90. +4
    -0
      modules/juce_gui_basics/components/juce_ModalComponentManager.cpp
  91. +2
    -0
      modules/juce_gui_basics/layout/juce_ScrollBar.cpp
  92. +1
    -0
      modules/juce_gui_basics/layout/juce_TabbedButtonBar.h
  93. +0
    -5
      modules/juce_gui_basics/layout/juce_Viewport.h
  94. +0
    -2
      modules/juce_gui_basics/mouse/juce_DragAndDropContainer.h
  95. +0
    -12
      modules/juce_gui_basics/mouse/juce_DragAndDropTarget.h
  96. +0
    -8
      modules/juce_gui_basics/mouse/juce_MouseListener.h
  97. +4
    -0
      modules/juce_gui_basics/native/juce_android_Windowing.cpp
  98. +2
    -0
      modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm
  99. +18
    -14
      modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp
  100. +4
    -0
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm

+ 1
- 1
examples/Assets/AudioLiveScrollingDisplay.h View File

@@ -65,7 +65,7 @@ public:
// We need to clear the output buffers before returning, in case they're full of junk.. // We need to clear the output buffers before returning, in case they're full of junk..
for (int j = 0; j < numOutputChannels; ++j) for (int j = 0; j < numOutputChannels; ++j)
if (float* outputChannel = outputChannelData[j]) if (float* outputChannel = outputChannelData[j])
zeromem (outputChannel, sizeof (float) * (size_t) numberOfSamples);
zeromem (outputChannel, (size_t) numberOfSamples * sizeof (float));
} }
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LiveScrollingAudioDisplay) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LiveScrollingAudioDisplay)


+ 1
- 1
examples/Audio/AudioLatencyDemo.h View File

@@ -175,7 +175,7 @@ public:
// We need to clear the output buffers, in case they're full of junk.. // We need to clear the output buffers, in case they're full of junk..
for (int i = 0; i < numOutputChannels; ++i) for (int i = 0; i < numOutputChannels; ++i)
if (outputChannelData[i] != nullptr) if (outputChannelData[i] != nullptr)
zeromem (outputChannelData[i], sizeof (float) * (size_t) numSamples);
zeromem (outputChannelData[i], (size_t) numSamples * sizeof (float));
} }
} }


+ 2
- 0
examples/Audio/AudioSynthesiserDemo.h View File

@@ -149,6 +149,8 @@ struct SineWaveVoice : public SynthesiserVoice
} }
} }
using SynthesiserVoice::renderNextBlock;
private: private:
double currentAngle = 0.0, angleDelta = 0.0, level = 0.0, tailOff = 0.0; double currentAngle = 0.0, angleDelta = 0.0, level = 0.0, tailOff = 0.0;
}; };


+ 2
- 0
examples/Audio/MPEDemo.h View File

@@ -828,6 +828,8 @@ public:
} }
} }
using MPESynthesiserVoice::renderNextBlock;
private: private:
//============================================================================== //==============================================================================
float getNextSample() noexcept float getNextSample() noexcept


+ 1
- 1
examples/BLOCKS/BlocksMonitorDemo.h View File

@@ -150,7 +150,7 @@ public:
{ CB::down } { CB::down }
}; };
for (auto i = 0; i < numElementsInArray (map); ++i)
for (int i = 0; i < numElementsInArray (map); ++i)
if (map[i].contains (f)) if (map[i].contains (f))
return i; return i;


+ 2
- 0
examples/BLOCKS/BlocksSynthDemo.h View File

@@ -108,6 +108,8 @@ public:
} }
} }
using SynthesiserVoice::renderNextBlock;
/** Returns the next sample */ /** Returns the next sample */
double getSample() double getSample()
{ {


+ 2
- 0
examples/DemoRunner/Source/UI/SettingsContent.h View File

@@ -173,7 +173,9 @@ private:
//============================================================================== //==============================================================================
void componentMovedOrResized (bool, bool) override {} void componentMovedOrResized (bool, bool) override {}
using ComponentListener::componentMovedOrResized;
void componentVisibilityChanged() override {} void componentVisibilityChanged() override {}
using ComponentListener::componentVisibilityChanged;
void componentPeerChanged() override void componentPeerChanged() override
{ {
auto* newPeer = getPeer(); auto* newPeer = getPeer();


+ 2
- 0
examples/GUI/WidgetsDemo.h View File

@@ -97,6 +97,8 @@ public:
CallOutBox::launchAsynchronously (colourSelector, getScreenBounds(), nullptr); CallOutBox::launchAsynchronously (colourSelector, getScreenBounds(), nullptr);
} }
using TextButton::clicked;
void changeListenerCallback (ChangeBroadcaster* source) override void changeListenerCallback (ChangeBroadcaster* source) override
{ {
if (auto* cs = dynamic_cast<ColourSelector*> (source)) if (auto* cs = dynamic_cast<ColourSelector*> (source))


+ 2
- 0
examples/Plugins/AudioPluginDemo.h View File

@@ -160,6 +160,8 @@ public:
} }
} }
using SynthesiserVoice::renderNextBlock;
private: private:
double currentAngle = 0.0; double currentAngle = 0.0;
double angleDelta = 0.0; double angleDelta = 0.0;


+ 6
- 0
extras/AudioPluginHost/Source/Filters/InternalFilters.cpp View File

@@ -170,6 +170,8 @@ public:
buffer.applyGain (0.8f); buffer.applyGain (0.8f);
} }
using InternalPlugin::processBlock;
private: private:
//============================================================================== //==============================================================================
class SineWaveSound : public SynthesiserSound class SineWaveSound : public SynthesiserSound
@@ -282,6 +284,8 @@ private:
} }
} }
using SynthesiserVoice::renderNextBlock;
private: private:
double currentAngle, angleDelta, level, tailOff; double currentAngle, angleDelta, level, tailOff;
}; };
@@ -337,6 +341,8 @@ public:
buffer.clear (ch, 0, buffer.getNumSamples()); buffer.clear (ch, 0, buffer.getNumSamples());
} }
using InternalPlugin::processBlock;
private: private:
Reverb reverb; Reverb reverb;
}; };


+ 2
- 0
extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h View File

@@ -201,6 +201,8 @@ private:
if (auto* l = findParentComponentOfClass<LaunchClassOverlayComponent>()) if (auto* l = findParentComponentOfClass<LaunchClassOverlayComponent>())
l->launch(); l->launch();
} }
using Button::clicked;
}; };
void launch() void launch()


+ 2
- 0
extras/Projucer/Source/LiveBuildEngine/UI/jucer_ComponentListComponent.h View File

@@ -242,6 +242,8 @@ private:
classItem.launchEditor(); classItem.launchEditor();
} }
using Button::clicked;
const ClassItem& classItem; const ClassItem& classItem;
bool isShowCode; bool isShowCode;
}; };


+ 2
- 0
extras/Projucer/Source/Project/UI/jucer_ContentViewComponents.h View File

@@ -185,6 +185,8 @@ public:
CallOutBox::launchAsynchronously (w, getScreenBounds(), nullptr); CallOutBox::launchAsynchronously (w, getScreenBounds(), nullptr);
} }
using Button::clicked;
void setInfoToDisplay (const String& infoToDisplay) void setInfoToDisplay (const String& infoToDisplay)
{ {
if (infoToDisplay.isNotEmpty()) if (infoToDisplay.isNotEmpty())


+ 2
- 0
extras/Projucer/Source/Utility/UI/jucer_SlidingPanelComponent.cpp View File

@@ -49,6 +49,8 @@ struct SlidingPanelComponent::DotButton : public Button
owner.goToTab (index); owner.goToTab (index);
} }
using Button::clicked;
SlidingPanelComponent& owner; SlidingPanelComponent& owner;
int index; int index;
}; };


+ 0
- 1
extras/Projucer/Source/Utility/UI/jucer_SlidingPanelComponent.h View File

@@ -53,7 +53,6 @@ public:
/** Animates the window to the desired tab. */ /** Animates the window to the desired tab. */
void goToTab (int targetTabIndex); void goToTab (int targetTabIndex);
//============================================================================== //==============================================================================
/** @internal */ /** @internal */
void resized() override; void resized() override;


+ 2
- 0
extras/Projucer/Source/Wizards/jucer_TemplateThumbnailsComponent.h View File

@@ -127,6 +127,8 @@ private:
Analytics::getInstance()->logEvent ("Start Page Button", data, ProjucerAnalyticsEvent::startPageEvent); Analytics::getInstance()->logEvent ("Start Page Button", data, ProjucerAnalyticsEvent::startPageEvent);
} }
using DrawableButton::clicked;
std::unique_ptr<Drawable> thumb, hoverBackground; std::unique_ptr<Drawable> thumb, hoverBackground;
String name, description; String name, description;


+ 3
- 1
modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp View File

@@ -483,7 +483,9 @@ public:
static void test (UnitTest& unitTest, bool inPlace, Random& r) static void test (UnitTest& unitTest, bool inPlace, Random& r)
{ {
const int numSamples = 2048; const int numSamples = 2048;
int32 original[numSamples], converted[numSamples], reversed[numSamples];
int32 original [(size_t) numSamples],
converted[(size_t) numSamples],
reversed [(size_t) numSamples];
{ {
AudioData::Pointer<F1, E1, AudioData::NonInterleaved, AudioData::NonConst> d (original); AudioData::Pointer<F1, E1, AudioData::NonInterleaved, AudioData::NonConst> d (original);


+ 2
- 2
modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h View File

@@ -340,7 +340,7 @@ public:
if (newNumSamples != size || newNumChannels != numChannels) if (newNumSamples != size || newNumChannels != numChannels)
{ {
auto allocatedSamplesPerChannel = ((size_t) newNumSamples + 3) & ~3u; auto allocatedSamplesPerChannel = ((size_t) newNumSamples + 3) & ~3u;
auto channelListSize = ((sizeof (Type*) * (size_t) (newNumChannels + 1)) + 15) & ~15u;
auto channelListSize = ((static_cast<size_t> (1 + newNumChannels) * sizeof (Type*)) + 15) & ~15u;
auto newTotalBytes = ((size_t) newNumChannels * (size_t) allocatedSamplesPerChannel * sizeof (Type)) auto newTotalBytes = ((size_t) newNumChannels * (size_t) allocatedSamplesPerChannel * sizeof (Type))
+ channelListSize + 32; + channelListSize + 32;
@@ -1076,7 +1076,7 @@ private:
void allocateData() void allocateData()
{ {
jassert (size >= 0); jassert (size >= 0);
auto channelListSize = sizeof (Type*) * (size_t) (numChannels + 1);
auto channelListSize = (size_t) (numChannels + 1) * sizeof (Type*);
allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (Type) + channelListSize + 32; allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (Type) + channelListSize + 32;
allocatedData.malloc (allocatedBytes); allocatedData.malloc (allocatedBytes);
channels = reinterpret_cast<Type**> (allocatedData.get()); channels = reinterpret_cast<Type**> (allocatedData.get());


+ 0
- 5
modules/juce_audio_basics/synthesisers/juce_Synthesiser.h View File

@@ -274,11 +274,6 @@ private:
AudioBuffer<float> tempBuffer; AudioBuffer<float> tempBuffer;
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE
// Note the new parameters for this method.
virtual int stopNote (bool) { return 0; }
#endif
JUCE_LEAK_DETECTOR (SynthesiserVoice) JUCE_LEAK_DETECTOR (SynthesiserVoice)
}; };


+ 1
- 1
modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp View File

@@ -814,7 +814,7 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat
else else
{ {
for (int i = 0; i < numOutputChannels; ++i) for (int i = 0; i < numOutputChannels; ++i)
zeromem (outputChannelData[i], sizeof (float) * (size_t) numSamples);
zeromem (outputChannelData[i], (size_t) numSamples * sizeof (float));
} }
if (testSound != nullptr) if (testSound != nullptr)


+ 1
- 1
modules/juce_audio_devices/native/juce_android_Oboe.cpp View File

@@ -424,7 +424,7 @@ private:
else else
{ {
for (int i = 0; i < numOutputChannels; ++i) for (int i = 0; i < numOutputChannels; ++i)
zeromem (outputChannelData[i], sizeof (float) * static_cast<size_t> (numFrames));
zeromem (outputChannelData[i], (size_t) (numFrames) * sizeof (float));
} }
} }


+ 2
- 2
modules/juce_audio_devices/native/juce_linux_ALSA.cpp View File

@@ -261,7 +261,7 @@ public:
unsigned int periods = 4; unsigned int periods = 4;
snd_pcm_uframes_t samplesPerPeriod = (snd_pcm_uframes_t) bufferSize; snd_pcm_uframes_t samplesPerPeriod = (snd_pcm_uframes_t) bufferSize;
if (JUCE_ALSA_FAILED (snd_pcm_hw_params_set_rate_near (handle, hwParams, &sampleRate, 0))
if (JUCE_ALSA_FAILED (snd_pcm_hw_params_set_rate_near (handle, hwParams, &sampleRate, nullptr))
|| JUCE_ALSA_FAILED (snd_pcm_hw_params_set_channels (handle, hwParams, (unsigned int ) numChannels)) || JUCE_ALSA_FAILED (snd_pcm_hw_params_set_channels (handle, hwParams, (unsigned int ) numChannels))
|| JUCE_ALSA_FAILED (snd_pcm_hw_params_set_periods_near (handle, hwParams, &periods, &dir)) || JUCE_ALSA_FAILED (snd_pcm_hw_params_set_periods_near (handle, hwParams, &periods, &dir))
|| JUCE_ALSA_FAILED (snd_pcm_hw_params_set_period_size_near (handle, hwParams, &samplesPerPeriod, &dir)) || JUCE_ALSA_FAILED (snd_pcm_hw_params_set_period_size_near (handle, hwParams, &samplesPerPeriod, &dir))
@@ -722,7 +722,7 @@ public:
else else
{ {
for (int i = 0; i < outputChannelDataForCallback.size(); ++i) for (int i = 0; i < outputChannelDataForCallback.size(); ++i)
zeromem (outputChannelDataForCallback[i], sizeof (float) * (size_t) bufferSize);
zeromem (outputChannelDataForCallback[i], (size_t) bufferSize * sizeof (float));
} }
} }


+ 5
- 5
modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp View File

@@ -104,14 +104,14 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData,
for (int i = 0; i < numOutputs; ++i) for (int i = 0; i < numOutputs; ++i)
{ {
channels[numActiveChans] = outputChans[i]; channels[numActiveChans] = outputChans[i];
memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * (size_t) numSamples);
memcpy (channels[numActiveChans], inputChans[i], (size_t) numSamples * sizeof (float));
++numActiveChans; ++numActiveChans;
} }
for (int i = numOutputs; i < numInputs; ++i) for (int i = numOutputs; i < numInputs; ++i)
{ {
channels[numActiveChans] = tempBuffer.getWritePointer (i - numOutputs); channels[numActiveChans] = tempBuffer.getWritePointer (i - numOutputs);
memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * (size_t) numSamples);
memcpy (channels[numActiveChans], inputChans[i], (size_t) numSamples * sizeof (float));
++numActiveChans; ++numActiveChans;
} }
} }
@@ -120,14 +120,14 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData,
for (int i = 0; i < numInputs; ++i) for (int i = 0; i < numInputs; ++i)
{ {
channels[numActiveChans] = outputChans[i]; channels[numActiveChans] = outputChans[i];
memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * (size_t) numSamples);
memcpy (channels[numActiveChans], inputChans[i], (size_t) numSamples * sizeof (float));
++numActiveChans; ++numActiveChans;
} }
for (int i = numInputs; i < numOutputs; ++i) for (int i = numInputs; i < numOutputs; ++i)
{ {
channels[numActiveChans] = outputChans[i]; channels[numActiveChans] = outputChans[i];
zeromem (channels[numActiveChans], sizeof (float) * (size_t) numSamples);
zeromem (channels[numActiveChans], (size_t) numSamples * sizeof (float));
++numActiveChans; ++numActiveChans;
} }
} }
@@ -146,7 +146,7 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData,
{ {
for (int i = 0; i < totalNumOutputChannels; ++i) for (int i = 0; i < totalNumOutputChannels; ++i)
if (outputChannelData[i] != nullptr) if (outputChannelData[i] != nullptr)
zeromem (outputChannelData[i], sizeof (float) * (size_t) numSamples);
zeromem (outputChannelData[i], (size_t) numSamples * sizeof (float));
} }
} }


+ 3
- 1
modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp View File

@@ -846,7 +846,7 @@ public:
{ {
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read. jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read.
zeromem (result, sizeof (float) * (size_t) num);
zeromem (result, (size_t) num * sizeof (float));
return; return;
} }
@@ -907,6 +907,8 @@ public:
} }
} }
using AudioFormatReader::readMaxLevels;
private: private:
const bool littleEndian; const bool littleEndian;


+ 1
- 0
modules/juce_audio_formats/codecs/juce_AiffAudioFormat.h View File

@@ -86,6 +86,7 @@ public:
int bitsPerSample, int bitsPerSample,
const StringPairArray& metadataValues, const StringPairArray& metadataValues,
int qualityOptionIndex) override; int qualityOptionIndex) override;
using AudioFormat::createWriterFor;
private: private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AiffAudioFormat) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AiffAudioFormat)


+ 1
- 1
modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp View File

@@ -475,7 +475,7 @@ public:
while (numSamples > 0) while (numSamples > 0)
{ {
auto numThisTime = jmin (8192, numSamples); auto numThisTime = jmin (8192, numSamples);
auto numBytes = sizeof (float) * (size_t) numThisTime;
auto numBytes = (size_t) numThisTime * sizeof (float);
audioDataBlock.ensureSize (numBytes * numChannels, false); audioDataBlock.ensureSize (numBytes * numChannels, false);
auto* data = static_cast<float*> (audioDataBlock.getData()); auto* data = static_cast<float*> (audioDataBlock.getData());


+ 1
- 0
modules/juce_audio_formats/codecs/juce_CoreAudioFormat.h View File

@@ -76,6 +76,7 @@ public:
int bitsPerSample, int bitsPerSample,
const StringPairArray& metadataValues, const StringPairArray& metadataValues,
int qualityOptionIndex) override; int qualityOptionIndex) override;
using AudioFormat::createWriterFor;
private: private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CoreAudioFormat) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CoreAudioFormat)


+ 13
- 2
modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp View File

@@ -122,6 +122,13 @@ namespace FlacNamespace
#endif #endif
#endif #endif
#if JUCE_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
#if JUCE_INTEL #if JUCE_INTEL
#if JUCE_32BIT #if JUCE_32BIT
#define FLAC__CPU_IA32 1 #define FLAC__CPU_IA32 1
@@ -161,6 +168,10 @@ namespace FlacNamespace
#if JUCE_CLANG #if JUCE_CLANG
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif
#if JUCE_GCC
#pragma GCC diagnostic pop
#endif
} }
#undef max #undef max
@@ -240,7 +251,7 @@ public:
if (destSamples[i] != nullptr) if (destSamples[i] != nullptr)
memcpy (destSamples[i] + startOffsetInDestBuffer, memcpy (destSamples[i] + startOffsetInDestBuffer,
reservoir.getReadPointer (i, (int) (startSampleInFile - reservoirStart)), reservoir.getReadPointer (i, (int) (startSampleInFile - reservoirStart)),
sizeof (int) * (size_t) num);
(size_t) num * sizeof (int));
startOffsetInDestBuffer += num; startOffsetInDestBuffer += num;
startSampleInFile += num; startSampleInFile += num;
@@ -277,7 +288,7 @@ public:
{ {
for (int i = numDestChannels; --i >= 0;) for (int i = numDestChannels; --i >= 0;)
if (destSamples[i] != nullptr) if (destSamples[i] != nullptr)
zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * (size_t) numSamples);
zeromem (destSamples[i] + startOffsetInDestBuffer, (size_t) numSamples * sizeof (int));
} }
return true; return true;


+ 2
- 0
modules/juce_audio_formats/codecs/juce_FlacAudioFormat.h View File

@@ -64,6 +64,8 @@ public:
int bitsPerSample, int bitsPerSample,
const StringPairArray& metadataValues, const StringPairArray& metadataValues,
int qualityOptionIndex) override; int qualityOptionIndex) override;
using AudioFormat::createWriterFor;
private: private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FlacAudioFormat) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FlacAudioFormat)
}; };


+ 1
- 0
modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.h View File

@@ -67,6 +67,7 @@ public:
AudioFormatWriter* createWriterFor (OutputStream*, double sampleRateToUse, AudioFormatWriter* createWriterFor (OutputStream*, double sampleRateToUse,
unsigned int numberOfChannels, int bitsPerSample, unsigned int numberOfChannels, int bitsPerSample,
const StringPairArray& metadataValues, int qualityOptionIndex); const StringPairArray& metadataValues, int qualityOptionIndex);
using AudioFormat::createWriterFor;
private: private:
File lameApp; File lameApp;


+ 22
- 21
modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp View File

@@ -496,8 +496,8 @@ struct MP3Frame
mpeg25 = (header & (1 << 20)) == 0; mpeg25 = (header & (1 << 20)) == 0;
lsf = mpeg25 ? 1 : ((header & (1 << 19)) ? 0 : 1); lsf = mpeg25 ? 1 : ((header & (1 << 19)) ? 0 : 1);
layer = 4 - ((header >> 17) & 3);
sampleRateIndex = mpeg25 ? (6 + ((header >> 10) & 3)) : ((int) ((header >> 10) & 3) + (lsf * 3));
layer = (int) (4 - ((header >> 17) & 3));
sampleRateIndex = (int) ((header >> 10) & 3) + (mpeg25 ? 6 : (lsf * 3));
crc16FollowsHeader = ((header >> 16) & 1) == 0; crc16FollowsHeader = ((header >> 16) & 1) == 0;
bitrateIndex = (header >> 12) & 15; bitrateIndex = (header >> 12) & 15;
padding = (header >> 9) & 1; padding = (header >> 9) & 1;
@@ -1625,7 +1625,7 @@ private:
static bool isValidHeader (uint32 header, int oldLayer) noexcept static bool isValidHeader (uint32 header, int oldLayer) noexcept
{ {
int newLayer = 4 - ((header >> 17) & 3);
auto newLayer = (int) (4 - ((header >> 17) & 3));
return (header & 0xffe00000) == 0xffe00000 return (header & 0xffe00000) == 0xffe00000
&& newLayer != 4 && newLayer != 4
@@ -1655,8 +1655,8 @@ private:
if (numBits <= 0 || bufferPointer == nullptr) if (numBits <= 0 || bufferPointer == nullptr)
return 0; return 0;
const uint32 result = ((((((bufferPointer[0] << 8) | bufferPointer[1]) << 8)
| bufferPointer[2]) << bitIndex) & 0xffffff) >> (24 - numBits);
const auto result = (uint32) (((((((bufferPointer[0] << 8) | bufferPointer[1]) << 8)
| bufferPointer[2]) << bitIndex) & 0xffffff) >> (24 - numBits));
bitIndex += numBits; bitIndex += numBits;
bufferPointer += (bitIndex >> 3); bufferPointer += (bitIndex >> 3);
bitIndex &= 7; bitIndex &= 7;
@@ -1669,12 +1669,12 @@ private:
++bitIndex; ++bitIndex;
bufferPointer += (bitIndex >> 3); bufferPointer += (bitIndex >> 3);
bitIndex &= 7; bitIndex &= 7;
return result >> 7;
return (uint32) (result >> 7);
} }
uint32 getBitsUnchecked (int numBits) noexcept uint32 getBitsUnchecked (int numBits) noexcept
{ {
const uint32 result = ((((bufferPointer[0] << 8) | bufferPointer[1]) << bitIndex) & 0xffff) >> (16 - numBits);
const auto result = (uint32) (((((bufferPointer[0] << 8) | bufferPointer[1]) << bitIndex) & 0xffff) >> (16 - numBits));
bitIndex += numBits; bitIndex += numBits;
bufferPointer += (bitIndex >> 3); bufferPointer += (bitIndex >> 3);
bitIndex &= 7; bitIndex &= 7;
@@ -1912,9 +1912,10 @@ private:
getLayer3SideInfo2 (numChannels, msStereo, sampleRate, single); getLayer3SideInfo2 (numChannels, msStereo, sampleRate, single);
int databits = 0; int databits = 0;
for (int gr = 0; gr < granules; ++gr) for (int gr = 0; gr < granules; ++gr)
for (int ch = 0; ch < numChannels; ++ch) for (int ch = 0; ch < numChannels; ++ch)
databits += sideinfo.ch[ch].gr[gr].part2_3Length;
databits += (int) sideinfo.ch[ch].gr[gr].part2_3Length;
return databits - 8 * (int) sideinfo.mainDataStart; return databits - 8 * (int) sideinfo.mainDataStart;
} }
@@ -2452,7 +2453,7 @@ private:
auto* xrpnt = (float*) xr; auto* xrpnt = (float*) xr;
auto part2remain = (int) granule.part2_3Length - part2bits; auto part2remain = (int) granule.part2_3Length - part2bits;
zeromem (xrpnt, sizeof (float) * (size_t) (&xr[32][0] - xrpnt));
zeromem (xrpnt, (size_t) (&xr[32][0] - xrpnt) * sizeof (float));
auto bv = (int) granule.bigValues; auto bv = (int) granule.bigValues;
auto region1 = (int) granule.region1Start; auto region1 = (int) granule.region1Start;
@@ -2549,8 +2550,8 @@ private:
if (x == 15) if (x == 15)
{ {
max[lwin] = cb; max[lwin] = cb;
part2remain -= h->bits + 1;
x += getBits ((int) h->bits);
part2remain -= (int) (h->bits + 1);
x += (int) getBits ((int) h->bits);
*xrpnt = constants.nToThe4Over3[x] * (getOneBit() ? -v : v); *xrpnt = constants.nToThe4Over3[x] * (getOneBit() ? -v : v);
} }
else if (x) else if (x)
@@ -2567,8 +2568,8 @@ private:
if (y == 15) if (y == 15)
{ {
max[lwin] = cb; max[lwin] = cb;
part2remain -= h->bits + 1;
y += getBits ((int) h->bits);
part2remain -= (int) (h->bits + 1);
y += (int) getBits ((int) h->bits);
*xrpnt = constants.nToThe4Over3[y] * (getOneBit() ? -v : v); *xrpnt = constants.nToThe4Over3[y] * (getOneBit() ? -v : v);
} }
else if (y) else if (y)
@@ -2709,8 +2710,8 @@ private:
if (x == 15) if (x == 15)
{ {
max = cb; max = cb;
part2remain -= h->bits + 1;
x += getBits ((int) h->bits);
part2remain -= (int) (h->bits + 1);
x += (int) getBits ((int) h->bits);
*xrpnt++ = constants.nToThe4Over3[x] * (getOneBit() ? -v : v); *xrpnt++ = constants.nToThe4Over3[x] * (getOneBit() ? -v : v);
} }
else if (x) else if (x)
@@ -2725,8 +2726,8 @@ private:
if (y == 15) if (y == 15)
{ {
max = cb; max = cb;
part2remain -= h->bits + 1;
y += getBits ((int) h->bits);
part2remain -= (int) (h->bits + 1);
y += (int) getBits ((int) h->bits);
*xrpnt++ = constants.nToThe4Over3[y] * (getOneBit() ? -v : v); *xrpnt++ = constants.nToThe4Over3[y] * (getOneBit() ? -v : v);
} }
else if (y) else if (y)
@@ -2788,7 +2789,7 @@ private:
} }
} }
zeromem (xrpnt, sizeof (float) * (size_t) (&xr[32][0] - xrpnt));
zeromem (xrpnt, (size_t) (&xr[32][0] - xrpnt) * sizeof (float));
granule.maxBandl = (uint32) (max + 1); granule.maxBandl = (uint32) (max + 1);
granule.maxb = (uint32) constants.longLimit[sampleRate][granule.maxBandl]; granule.maxb = (uint32) constants.longLimit[sampleRate][granule.maxBandl];
@@ -3006,17 +3007,17 @@ public:
{ {
for (int i = numDestChannels; --i >= 0;) for (int i = numDestChannels; --i >= 0;)
if (destSamples[i] != nullptr) if (destSamples[i] != nullptr)
zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (float) * (size_t) numSamples);
zeromem (destSamples[i] + startOffsetInDestBuffer, (size_t) numSamples * sizeof (float));
return false; return false;
} }
const int numToCopy = jmin (decodedEnd - decodedStart, numSamples); const int numToCopy = jmin (decodedEnd - decodedStart, numSamples);
float* const* const dst = reinterpret_cast<float**> (destSamples); float* const* const dst = reinterpret_cast<float**> (destSamples);
memcpy (dst[0] + startOffsetInDestBuffer, decoded0 + decodedStart, sizeof (float) * (size_t) numToCopy);
memcpy (dst[0] + startOffsetInDestBuffer, decoded0 + decodedStart, (size_t) numToCopy * sizeof (float));
if (numDestChannels > 1 && dst[1] != nullptr) if (numDestChannels > 1 && dst[1] != nullptr)
memcpy (dst[1] + startOffsetInDestBuffer, (numChannels < 2 ? decoded0 : decoded1) + decodedStart, sizeof (float) * (size_t) numToCopy);
memcpy (dst[1] + startOffsetInDestBuffer, (numChannels < 2 ? decoded0 : decoded1) + decodedStart, (size_t) numToCopy * sizeof (float));
startOffsetInDestBuffer += numToCopy; startOffsetInDestBuffer += numToCopy;
decodedStart += numToCopy; decodedStart += numToCopy;


+ 1
- 0
modules/juce_audio_formats/codecs/juce_MP3AudioFormat.h View File

@@ -66,6 +66,7 @@ public:
AudioFormatWriter* createWriterFor (OutputStream*, double sampleRateToUse, AudioFormatWriter* createWriterFor (OutputStream*, double sampleRateToUse,
unsigned int numberOfChannels, int bitsPerSample, unsigned int numberOfChannels, int bitsPerSample,
const StringPairArray& metadataValues, int qualityOptionIndex) override; const StringPairArray& metadataValues, int qualityOptionIndex) override;
using AudioFormat::createWriterFor;
}; };
#endif #endif


+ 6
- 3
modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp View File

@@ -49,7 +49,10 @@ namespace OggVorbisNamespace
#endif #endif
#elif JUCE_GCC #elif JUCE_GCC
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif #endif
#include "oggvorbis/vorbisenc.h" #include "oggvorbis/vorbisenc.h"
@@ -178,7 +181,7 @@ public:
if (destSamples[i] != nullptr) if (destSamples[i] != nullptr)
memcpy (destSamples[i] + startOffsetInDestBuffer, memcpy (destSamples[i] + startOffsetInDestBuffer,
reservoir.getReadPointer (i, (int) (startSampleInFile - reservoirStart)), reservoir.getReadPointer (i, (int) (startSampleInFile - reservoirStart)),
sizeof (float) * (size_t) numToUse);
(size_t) numToUse * sizeof (float));
startSampleInFile += numToUse; startSampleInFile += numToUse;
numSamples -= numToUse; numSamples -= numToUse;
@@ -213,7 +216,7 @@ public:
jassert (samps <= numToRead); jassert (samps <= numToRead);
for (int i = jmin ((int) numChannels, reservoir.getNumChannels()); --i >= 0;) for (int i = jmin ((int) numChannels, reservoir.getNumChannels()); --i >= 0;)
memcpy (reservoir.getWritePointer (i, offset), dataIn[i], sizeof (float) * (size_t) samps);
memcpy (reservoir.getWritePointer (i, offset), dataIn[i], (size_t) samps * sizeof (float));
numToRead -= samps; numToRead -= samps;
offset += samps; offset += samps;
@@ -228,7 +231,7 @@ public:
{ {
for (int i = numDestChannels; --i >= 0;) for (int i = numDestChannels; --i >= 0;)
if (destSamples[i] != nullptr) if (destSamples[i] != nullptr)
zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * (size_t) numSamples);
zeromem (destSamples[i] + startOffsetInDestBuffer, (size_t) numSamples * sizeof (int));
} }
return true; return true;


+ 1
- 0
modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.h View File

@@ -91,6 +91,7 @@ public:
int bitsPerSample, int bitsPerSample,
const StringPairArray& metadataValues, const StringPairArray& metadataValues,
int qualityOptionIndex) override; int qualityOptionIndex) override;
using AudioFormat::createWriterFor;
private: private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OggVorbisAudioFormat) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OggVorbisAudioFormat)


+ 4
- 2
modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp View File

@@ -1001,7 +1001,7 @@ public:
} }
else else
{ {
bytesPerFrame = numChannels * bitsPerSample / 8;
bytesPerFrame = (int) (numChannels * bitsPerSample / 8);
} }
if (format == 3) if (format == 3)
@@ -1581,7 +1581,7 @@ public:
{ {
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read. jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read.
zeromem (result, sizeof (float) * (size_t) num);
zeromem (result, (size_t) num * sizeof (float));
return; return;
} }
@@ -1626,6 +1626,8 @@ public:
} }
} }
using AudioFormatReader::readMaxLevels;
private: private:
template <typename SampleType> template <typename SampleType>
void scanMinAndMax (int64 startSampleInFile, int64 numSamples, Range<float>* results, int numChannelsToRead) const noexcept void scanMinAndMax (int64 startSampleInFile, int64 numSamples, Range<float>* results, int numChannelsToRead) const noexcept


+ 1
- 0
modules/juce_audio_formats/codecs/juce_WavAudioFormat.h View File

@@ -210,6 +210,7 @@ public:
int bitsPerSample, int bitsPerSample,
const StringPairArray& metadataValues, const StringPairArray& metadataValues,
int qualityOptionIndex) override; int qualityOptionIndex) override;
using AudioFormat::createWriterFor;
//============================================================================== //==============================================================================
/** Utility function to replace the metadata in a wav file with a new set of values. /** Utility function to replace the metadata in a wav file with a new set of values.


+ 1
- 0
modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.h View File

@@ -55,6 +55,7 @@ public:
AudioFormatWriter* createWriterFor (OutputStream*, double sampleRateToUse, AudioFormatWriter* createWriterFor (OutputStream*, double sampleRateToUse,
unsigned int numberOfChannels, int bitsPerSample, unsigned int numberOfChannels, int bitsPerSample,
const StringPairArray& metadataValues, int qualityOptionIndex) override; const StringPairArray& metadataValues, int qualityOptionIndex) override;
using AudioFormat::createWriterFor;
}; };
#endif #endif


+ 2
- 2
modules/juce_audio_formats/format/juce_AudioFormatReader.cpp View File

@@ -75,7 +75,7 @@ bool AudioFormatReader::read (int* const* destChannels,
for (int i = numDestChannels; --i >= 0;) for (int i = numDestChannels; --i >= 0;)
if (auto d = destChannels[i]) if (auto d = destChannels[i])
zeromem (d, sizeof (int) * (size_t) silence);
zeromem (d, (size_t) silence * sizeof (int));
startOffsetInDestBuffer += silence; startOffsetInDestBuffer += silence;
numSamplesToRead -= silence; numSamplesToRead -= silence;
@@ -175,7 +175,7 @@ void AudioFormatReader::read (AudioBuffer<float>* buffer,
// if the target's stereo and the source is mono, dupe the first channel.. // if the target's stereo and the source is mono, dupe the first channel..
if (numTargetChannels > 1 && (chans[0] == nullptr || chans[1] == nullptr)) if (numTargetChannels > 1 && (chans[0] == nullptr || chans[1] == nullptr))
memcpy (dests[1], dests[0], sizeof (float) * (size_t) numSamples);
memcpy (dests[1], dests[0], (size_t) numSamples * sizeof (float));
if (! usesFloatingPointData) if (! usesFloatingPointData)
convertFixedToFloat (dests, 2, numSamples); convertFixedToFloat (dests, 2, numSamples);


+ 1
- 1
modules/juce_audio_formats/format/juce_AudioFormatReader.h View File

@@ -314,7 +314,7 @@ protected:
{ {
for (int i = numDestChannels; --i >= 0;) for (int i = numDestChannels; --i >= 0;)
if (destChannels[i] != nullptr) if (destChannels[i] != nullptr)
zeromem (destChannels[i] + startOffsetInDestBuffer, sizeof (int) * (size_t) numSamples);
zeromem (destChannels[i] + startOffsetInDestBuffer, (size_t) numSamples * sizeof (int));
numSamples = (int) samplesAvailable; numSamples = (int) samplesAvailable;
} }


+ 1
- 0
modules/juce_audio_formats/format/juce_AudioSubsectionReader.h View File

@@ -73,6 +73,7 @@ public:
void readMaxLevels (int64 startSample, int64 numSamples, void readMaxLevels (int64 startSample, int64 numSamples,
Range<float>* results, int numChannelsToRead) override; Range<float>* results, int numChannelsToRead) override;
using AudioFormatReader::readMaxLevels;
private: private:
//============================================================================== //==============================================================================


+ 1
- 0
modules/juce_audio_formats/sampler/juce_Sampler.h View File

@@ -138,6 +138,7 @@ public:
void controllerMoved (int controllerNumber, int newValue) override; void controllerMoved (int controllerNumber, int newValue) override;
void renderNextBlock (AudioBuffer<float>&, int startSample, int numSamples) override; void renderNextBlock (AudioBuffer<float>&, int startSample, int numSamples) override;
using SynthesiserVoice::renderNextBlock;
private: private:
//============================================================================== //==============================================================================


+ 1
- 1
modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm View File

@@ -917,7 +917,7 @@ public:
} }
// Is this a meter? // Is this a meter?
if (((param->getCategory() & 0xffff0000) >> 16) == 2)
if ((((unsigned int) param->getCategory() & 0xffff0000) >> 16) == 2)
{ {
outParameterInfo.flags &= ~kAudioUnitParameterFlag_IsWritable; outParameterInfo.flags &= ~kAudioUnitParameterFlag_IsWritable;
outParameterInfo.flags |= kAudioUnitParameterFlag_MeterReadOnly | kAudioUnitParameterFlag_DisplayLogarithmic; outParameterInfo.flags |= kAudioUnitParameterFlag_MeterReadOnly | kAudioUnitParameterFlag_DisplayLogarithmic;


+ 23
- 13
modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp View File

@@ -77,6 +77,12 @@
#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
#endif #endif
#if JUCE_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning (push) #pragma warning (push)
#pragma warning (disable : 4458) #pragma warning (disable : 4458)
@@ -106,6 +112,10 @@ using namespace juce;
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif
#if JUCE_GCC
#pragma GCC diagnostic pop
#endif
//============================================================================== //==============================================================================
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma pack (push, 8) #pragma pack (push, 8)
@@ -498,7 +508,7 @@ public:
if (i < numIn) if (i < numIn)
{ {
if (chan != inputs[i]) if (chan != inputs[i])
memcpy (chan, inputs[i], sizeof (FloatType) * (size_t) numSamples);
memcpy (chan, inputs[i], (size_t) numSamples * sizeof (FloatType));
} }
else else
{ {
@@ -525,7 +535,7 @@ public:
for (i = 0; i < numOut; ++i) for (i = 0; i < numOut; ++i)
if (auto* chan = tmpBuffers.tempChannels.getUnchecked(i)) if (auto* chan = tmpBuffers.tempChannels.getUnchecked(i))
if (auto* dest = outputs[i]) if (auto* dest = outputs[i])
memcpy (dest, chan, sizeof (FloatType) * (size_t) numSamples);
memcpy (dest, chan, (size_t) numSamples * sizeof (FloatType));
} }
} }
@@ -630,7 +640,7 @@ public:
if (vstEffect.flags & Vst2::effFlagsIsSynth || JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect) if (vstEffect.flags & Vst2::effFlagsIsSynth || JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect)
{ {
if (hostCallback != nullptr) if (hostCallback != nullptr)
hostCallback (&vstEffect, Vst2::audioMasterWantMidi, 0, 1, 0, 0);
hostCallback (&vstEffect, Vst2::audioMasterWantMidi, 0, 1, nullptr, 0);
} }
if (getHostType().isAbletonLive() if (getHostType().isAbletonLive()
@@ -680,7 +690,7 @@ public:
| Vst2::kVstTimeSigValid | Vst2::kVstSmpteValid | Vst2::kVstTimeSigValid | Vst2::kVstSmpteValid
| Vst2::kVstClockValid; | Vst2::kVstClockValid;
auto result = hostCallback (&vstEffect, Vst2::audioMasterGetTime, 0, flags, 0, 0);
auto result = hostCallback (&vstEffect, Vst2::audioMasterGetTime, 0, flags, nullptr, 0);
ti = reinterpret_cast<Vst2::VstTimeInfo*> (result); ti = reinterpret_cast<Vst2::VstTimeInfo*> (result);
} }
@@ -796,19 +806,19 @@ public:
} }
if (hostCallback != nullptr) if (hostCallback != nullptr)
hostCallback (&vstEffect, Vst2::audioMasterAutomate, index, 0, 0, newValue);
hostCallback (&vstEffect, Vst2::audioMasterAutomate, index, 0, nullptr, newValue);
} }
void audioProcessorParameterChangeGestureBegin (AudioProcessor*, int index) override void audioProcessorParameterChangeGestureBegin (AudioProcessor*, int index) override
{ {
if (hostCallback != nullptr) if (hostCallback != nullptr)
hostCallback (&vstEffect, Vst2::audioMasterBeginEdit, index, 0, 0, 0);
hostCallback (&vstEffect, Vst2::audioMasterBeginEdit, index, 0, nullptr, 0);
} }
void audioProcessorParameterChangeGestureEnd (AudioProcessor*, int index) override void audioProcessorParameterChangeGestureEnd (AudioProcessor*, int index) override
{ {
if (hostCallback != nullptr) if (hostCallback != nullptr)
hostCallback (&vstEffect, Vst2::audioMasterEndEdit, index, 0, 0, 0);
hostCallback (&vstEffect, Vst2::audioMasterEndEdit, index, 0, nullptr, 0);
} }
void parameterValueChanged (int, float newValue) override void parameterValueChanged (int, float newValue) override
@@ -824,7 +834,7 @@ public:
vstEffect.initialDelay = processor->getLatencySamples(); vstEffect.initialDelay = processor->getLatencySamples();
if (hostCallback != nullptr) if (hostCallback != nullptr)
hostCallback (&vstEffect, Vst2::audioMasterUpdateDisplay, 0, 0, 0, 0);
hostCallback (&vstEffect, Vst2::audioMasterUpdateDisplay, 0, 0, nullptr, 0);
triggerAsyncUpdate(); triggerAsyncUpdate();
} }
@@ -832,7 +842,7 @@ public:
void handleAsyncUpdate() override void handleAsyncUpdate() override
{ {
if (hostCallback != nullptr) if (hostCallback != nullptr)
hostCallback (&vstEffect, Vst2::audioMasterIOChanged, 0, 0, 0, 0);
hostCallback (&vstEffect, Vst2::audioMasterIOChanged, 0, 0, nullptr, 0);
} }
bool getPinProperties (Vst2::VstPinProperties& properties, bool direction, int index) const bool getPinProperties (Vst2::VstPinProperties& properties, bool direction, int index) const
@@ -1446,7 +1456,7 @@ public:
const ScopedValueSetter<bool> inSizeWindowSetter (isInSizeWindow, true); const ScopedValueSetter<bool> inSizeWindowSetter (isInSizeWindow, true);
sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::audioMasterSizeWindow, sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::audioMasterSizeWindow,
newWidth, newHeight, 0, 0) != 0);
newWidth, newHeight, nullptr, 0) != 0);
} }
} }
@@ -1569,7 +1579,7 @@ private:
bool isProcessLevelOffline() bool isProcessLevelOffline()
{ {
return hostCallback != nullptr return hostCallback != nullptr
&& (int32) hostCallback (&vstEffect, Vst2::audioMasterGetCurrentProcessLevel, 0, 0, 0, 0) == 4;
&& (int32) hostCallback (&vstEffect, Vst2::audioMasterGetCurrentProcessLevel, 0, 0, nullptr, 0) == 4;
} }
static inline int32 convertHexVersionToDecimal (const unsigned int hexVersion) static inline int32 convertHexVersionToDecimal (const unsigned int hexVersion)
@@ -1897,7 +1907,7 @@ private:
{ {
if (auto* param = juceParameters.getParamForIndex (args.index)) if (auto* param = juceParameters.getParamForIndex (args.index))
{ {
const bool isMeter = (((param->getCategory() & 0xffff0000) >> 16) == 2);
const bool isMeter = ((((unsigned int) param->getCategory() & 0xffff0000) >> 16) == 2);
return (param->isAutomatable() && (! isMeter) ? 1 : 0); return (param->isAutomatable() && (! isMeter) ? 1 : 0);
} }
@@ -2305,7 +2315,7 @@ namespace
try try
{ {
if (audioMaster (0, Vst2::audioMasterVersion, 0, 0, 0, 0) != 0)
if (audioMaster (nullptr, Vst2::audioMasterVersion, 0, 0, nullptr, 0) != 0)
{ {
#if JUCE_LINUX #if JUCE_LINUX
MessageManagerLock mmLock; MessageManagerLock mmLock;


+ 1
- 1
modules/juce_audio_processors/format_types/juce_AU_Shared.h View File

@@ -308,7 +308,7 @@ struct AudioUnitHelpers
static bool isLayoutSupported (const AudioProcessor& processor, static bool isLayoutSupported (const AudioProcessor& processor,
bool isInput, int busIdx, bool isInput, int busIdx,
int numChannels, int numChannels,
const short (&channelLayoutList) [numLayouts][2],
const short (&channelLayoutList) [(size_t) numLayouts][2],
bool hasLayoutMap = true) bool hasLayoutMap = true)
{ {
if (const AudioProcessor::Bus* bus = processor.getBus (isInput, busIdx)) if (const AudioProcessor::Bus* bus = processor.getBus (isInput, busIdx))


+ 1
- 1
modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm View File

@@ -1052,7 +1052,7 @@ public:
for (AudioUnitElement j = 0; j < abl.mNumberBuffers; ++j) for (AudioUnitElement j = 0; j < abl.mNumberBuffers; ++j)
{ {
abl.mBuffers[j].mNumberChannels = 1; abl.mBuffers[j].mNumberChannels = 1;
abl.mBuffers[j].mDataByteSize = (UInt32) (sizeof (float) * (size_t) numSamples);
abl.mBuffers[j].mDataByteSize = (UInt32) ((size_t) numSamples * sizeof (float));
abl.mBuffers[j].mData = buffer.getWritePointer (chIdx++); abl.mBuffers[j].mData = buffer.getWritePointer (chIdx++);
} }
} }


+ 29
- 27
modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp View File

@@ -217,7 +217,7 @@ public:
//============================================================================== //==============================================================================
// AudioPluginInstance methods: // AudioPluginInstance methods:
void fillInPluginDescription (PluginDescription& desc) const
void fillInPluginDescription (PluginDescription& desc) const override
{ {
desc.name = getName(); desc.name = getName();
desc.fileOrIdentifier = module->file.getFullPathName(); desc.fileOrIdentifier = module->file.getFullPathName();
@@ -233,7 +233,7 @@ public:
desc.isInstrument = false; desc.isInstrument = false;
} }
const String getName() const
const String getName() const override
{ {
if (plugin != nullptr && plugin->Label != nullptr) if (plugin != nullptr && plugin->Label != nullptr)
return plugin->Label; return plugin->Label;
@@ -249,16 +249,16 @@ public:
return module->file.hashCode(); return module->file.hashCode();
} }
String getVersion() const { return LADSPA_VERSION; }
String getCategory() const { return "Effect"; }
String getVersion() const { return LADSPA_VERSION; }
String getCategory() const { return "Effect"; }
bool acceptsMidi() const { return false; }
bool producesMidi() const { return false; }
bool acceptsMidi() const override { return false; }
bool producesMidi() const override { return false; }
double getTailLengthSeconds() const { return 0.0; }
double getTailLengthSeconds() const override { return 0.0; }
//============================================================================== //==============================================================================
void prepareToPlay (double newSampleRate, int samplesPerBlockExpected)
void prepareToPlay (double newSampleRate, int samplesPerBlockExpected) override
{ {
setLatencySamples (0); setLatencySamples (0);
@@ -281,7 +281,7 @@ public:
} }
} }
void releaseResources()
void releaseResources() override
{ {
if (handle != nullptr && plugin->deactivate != nullptr) if (handle != nullptr && plugin->deactivate != nullptr)
plugin->deactivate (handle); plugin->deactivate (handle);
@@ -289,7 +289,7 @@ public:
tempBuffer.setSize (1, 1); tempBuffer.setSize (1, 1);
} }
void processBlock (AudioBuffer<float>& buffer, MidiBuffer&)
void processBlock (AudioBuffer<float>& buffer, MidiBuffer&) override
{ {
auto numSamples = buffer.getNumSamples(); auto numSamples = buffer.getNumSamples();
@@ -333,10 +333,12 @@ public:
buffer.clear (i, 0, numSamples); buffer.clear (i, 0, numSamples);
} }
bool isInputChannelStereoPair (int index) const { return isPositiveAndBelow (index, getTotalNumInputChannels()); }
bool isOutputChannelStereoPair (int index) const { return isPositiveAndBelow (index, getTotalNumOutputChannels()); }
using AudioPluginInstance::processBlock;
const String getInputChannelName (const int index) const
bool isInputChannelStereoPair (int index) const override { return isPositiveAndBelow (index, getTotalNumInputChannels()); }
bool isOutputChannelStereoPair (int index) const override { return isPositiveAndBelow (index, getTotalNumOutputChannels()); }
const String getInputChannelName (const int index) const override
{ {
if (isPositiveAndBelow (index, getTotalNumInputChannels())) if (isPositiveAndBelow (index, getTotalNumInputChannels()))
return String (plugin->PortNames [inputs [index]]).trim(); return String (plugin->PortNames [inputs [index]]).trim();
@@ -344,7 +346,7 @@ public:
return {}; return {};
} }
const String getOutputChannelName (const int index) const
const String getOutputChannelName (const int index) const override
{ {
if (isPositiveAndBelow (index, getTotalNumInputChannels())) if (isPositiveAndBelow (index, getTotalNumInputChannels()))
return String (plugin->PortNames [outputs [index]]).trim(); return String (plugin->PortNames [outputs [index]]).trim();
@@ -353,24 +355,24 @@ public:
} }
//============================================================================== //==============================================================================
int getNumPrograms() { return 0; }
int getCurrentProgram() { return 0; }
int getNumPrograms() override { return 0; }
int getCurrentProgram() override { return 0; }
void setCurrentProgram (int)
void setCurrentProgram (int) override
{ {
for (auto* param : getParameters()) for (auto* param : getParameters())
if (auto* ladspaParam = dynamic_cast<LADSPAParameter*> (param)) if (auto* ladspaParam = dynamic_cast<LADSPAParameter*> (param))
ladspaParam->reset(); ladspaParam->reset();
} }
const String getProgramName (int) { return {}; }
void changeProgramName (int, const String&) {}
const String getProgramName (int) override { return {}; }
void changeProgramName (int, const String&) override {}
//============================================================================== //==============================================================================
void getStateInformation (MemoryBlock& destData)
void getStateInformation (MemoryBlock& destData) override
{ {
auto numParameters = getParameters().size(); auto numParameters = getParameters().size();
destData.setSize (sizeof (float) * (size_t) numParameters);
destData.setSize ((size_t) numParameters * sizeof (float));
destData.fillWith (0); destData.fillWith (0);
auto* p = (float*) ((char*) destData.getData()); auto* p = (float*) ((char*) destData.getData());
@@ -380,10 +382,10 @@ public:
p[i] = param->getValue(); p[i] = param->getValue();
} }
void getCurrentProgramStateInformation (MemoryBlock& destData) { getStateInformation (destData); }
void setCurrentProgramStateInformation (const void* data, int sizeInBytes) { setStateInformation (data, sizeInBytes); }
void getCurrentProgramStateInformation (MemoryBlock& destData) override { getStateInformation (destData); }
void setCurrentProgramStateInformation (const void* data, int sizeInBytes) override { setStateInformation (data, sizeInBytes); }
void setStateInformation (const void* data, int sizeInBytes)
void setStateInformation (const void* data, int sizeInBytes) override
{ {
ignoreUnused (sizeInBytes); ignoreUnused (sizeInBytes);
@@ -394,10 +396,10 @@ public:
param->setValue (p[i]); param->setValue (p[i]);
} }
bool hasEditor() const { return false; }
AudioProcessorEditor* createEditor() { return nullptr; }
bool hasEditor() const override { return false; }
AudioProcessorEditor* createEditor() override { return nullptr; }
bool isValid() const { return handle != nullptr; }
bool isValid() const { return handle != nullptr; }
//============================================================================== //==============================================================================
LADSPAModuleHandle::Ptr module; LADSPAModuleHandle::Ptr module;


+ 2
- 2
modules/juce_audio_processors/format_types/juce_VSTCommon.h View File

@@ -195,8 +195,8 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
Vst2::VstSpeakerArrangement* allocate (int numChannels) Vst2::VstSpeakerArrangement* allocate (int numChannels)
{ {
auto arrangementSize = sizeof (Vst2::VstSpeakerArrangement)
+ sizeof (Vst2::VstSpeakerProperties) * static_cast<size_t> (jmax (8, numChannels) - 8);
auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstSpeakerProperties)
+ sizeof (Vst2::VstSpeakerArrangement);
storage.malloc (1, arrangementSize); storage.malloc (1, arrangementSize);
return storage.get(); return storage.get();


+ 2
- 2
modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h View File

@@ -61,7 +61,7 @@ public:
events->numEvents = 0; events->numEvents = 0;
} }
void addEvent (const void* const midiData, const int numBytes, const int frameOffset)
void addEvent (const void* const midiData, int numBytes, int frameOffset)
{ {
ensureSize (numEventsUsed + 1); ensureSize (numEventsUsed + 1);
@@ -137,7 +137,7 @@ public:
{ {
numEventsNeeded = (numEventsNeeded + 32) & ~31; numEventsNeeded = (numEventsNeeded + 32) & ~31;
const size_t size = 20 + sizeof (Vst2::VstEvent*) * (size_t) numEventsNeeded;
const size_t size = 20 + (size_t) numEventsNeeded * sizeof (Vst2::VstEvent*);
if (events == nullptr) if (events == nullptr)
events.calloc (size, 1); events.calloc (size, 1);


+ 29
- 13
modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp View File

@@ -36,10 +36,14 @@
#define __cdecl #define __cdecl
#endif #endif
#if JUCE_CLANG
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#if JUCE_CLANG && __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#if JUCE_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif #endif
#define VST_FORCE_DEPRECATED 0 #define VST_FORCE_DEPRECATED 0
@@ -63,6 +67,14 @@ namespace Vst2
#pragma warning (disable: 4355) // ("this" used in initialiser list warning) #pragma warning (disable: 4355) // ("this" used in initialiser list warning)
#endif #endif
#if JUCE_CLANG && __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic pop
#endif
#if JUCE_GCC
#pragma GCC diagnostic pop
#endif
#include "juce_VSTMidiEventList.h" #include "juce_VSTMidiEventList.h"
#if JUCE_MINGW #if JUCE_MINGW
@@ -180,7 +192,7 @@ namespace
return timeGetTime() * 1000000.0; return timeGetTime() * 1000000.0;
#elif JUCE_LINUX || JUCE_IOS || JUCE_ANDROID #elif JUCE_LINUX || JUCE_IOS || JUCE_ANDROID
timeval micro; timeval micro;
gettimeofday (&micro, 0);
gettimeofday (&micro, nullptr);
return micro.tv_usec * 1000.0; return micro.tv_usec * 1000.0;
#elif JUCE_MAC #elif JUCE_MAC
UnsignedWide micro; UnsignedWide micro;
@@ -692,7 +704,7 @@ struct ModuleHandle : public ReferenceCountedObject
void closeEffect (Vst2::AEffect* eff) void closeEffect (Vst2::AEffect* eff)
{ {
eff->dispatcher (eff, Vst2::effClose, 0, 0, 0, 0);
eff->dispatcher (eff, Vst2::effClose, 0, 0, nullptr, 0);
} }
#if JUCE_WINDOWS #if JUCE_WINDOWS
@@ -1131,7 +1143,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
#endif #endif
// Must delete any editors before deleting the plugin instance! // Must delete any editors before deleting the plugin instance!
jassert (getActiveEditor() == 0);
jassert (getActiveEditor() == nullptr);
_fpreset(); // some dodgy plug-ins mess around with this _fpreset(); // some dodgy plug-ins mess around with this
@@ -1894,7 +1906,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
if (isFXB) if (isFXB)
{ {
auto progLen = (int) sizeof (fxProgram) + (numParams - 1) * (int) sizeof (float); auto progLen = (int) sizeof (fxProgram) + (numParams - 1) * (int) sizeof (float);
auto len = (sizeof (fxSet) - sizeof (fxProgram)) + (size_t) (progLen * jmax (1, numPrograms));
auto len = (size_t) (progLen * jmax (1, numPrograms)) + (sizeof (fxSet) - sizeof (fxProgram));
dest.setSize (len, true); dest.setSize (len, true);
auto set = (fxSet*) dest.getData(); auto set = (fxSet*) dest.getData();
@@ -1930,7 +1942,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
} }
else else
{ {
dest.setSize (sizeof (fxProgram) + (size_t) ((numParams - 1) * (int) sizeof (float)), true);
dest.setSize ((size_t) ((numParams - 1) * (int) sizeof (float)) + sizeof (fxProgram), true);
setParamsInProgramBlock ((fxProgram*) dest.getData()); setParamsInProgramBlock ((fxProgram*) dest.getData());
} }
} }
@@ -2162,7 +2174,7 @@ private:
if (effect != nullptr && effect->magic == 0x56737450 /* 'VstP' */) if (effect != nullptr && effect->magic == 0x56737450 /* 'VstP' */)
{ {
jassert (effect->resvd2 == 0); jassert (effect->resvd2 == 0);
jassert (effect->object != 0);
jassert (effect->object != nullptr);
_fpreset(); // some dodgy plugs mess around with this _fpreset(); // some dodgy plugs mess around with this
} }
@@ -2891,6 +2903,8 @@ public:
} }
} }
using ComponentMovementWatcher::componentMovedOrResized;
void componentVisibilityChanged() override void componentVisibilityChanged() override
{ {
if (isShowing()) if (isShowing())
@@ -2904,6 +2918,8 @@ public:
componentMovedOrResized (true, true); componentMovedOrResized (true, true);
} }
using ComponentMovementWatcher::componentVisibilityChanged;
void componentPeerChanged() override void componentPeerChanged() override
{ {
closePluginWindow(); closePluginWindow();
@@ -3086,7 +3102,7 @@ private:
#else #else
void openPluginWindow() void openPluginWindow()
{ {
if (isOpen || getWindowHandle() == 0)
if (isOpen || getWindowHandle() == nullptr)
return; return;
JUCE_VST_LOG ("Opening VST UI: " + plugin.getName()); JUCE_VST_LOG ("Opening VST UI: " + plugin.getName());
@@ -3121,10 +3137,10 @@ private:
// do this before and after like in the steinberg example // do this before and after like in the steinberg example
dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
dispatch (Vst2::effGetProgram, 0, 0, 0, 0); // also in steinberg code
dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); // also in steinberg code
// Install keyboard hooks // Install keyboard hooks
pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, 0, 0) == 0);
pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0);
#if JUCE_WINDOWS #if JUCE_WINDOWS
originalWndProc = 0; originalWndProc = 0;


+ 1
- 1
modules/juce_audio_processors/processors/juce_AudioPluginInstance.h View File

@@ -116,7 +116,7 @@ protected:
AudioPluginInstance() = default; AudioPluginInstance() = default;
AudioPluginInstance (const BusesProperties& ioLayouts) : AudioProcessor (ioLayouts) {} AudioPluginInstance (const BusesProperties& ioLayouts) : AudioProcessor (ioLayouts) {}
template <int numLayouts> template <int numLayouts>
AudioPluginInstance (const short channelLayoutList[numLayouts][2]) : AudioProcessor (channelLayoutList) {}
AudioPluginInstance (const short channelLayoutList[(size_t) numLayouts][2]) : AudioProcessor (channelLayoutList) {}
private: private:
void assertOnceOnDeprecatedMethodUse() const noexcept; void assertOnceOnDeprecatedMethodUse() const noexcept;


+ 3
- 3
modules/juce_audio_processors/processors/juce_AudioProcessor.h View File

@@ -764,7 +764,7 @@ public:
} }
template <int numLayouts> template <int numLayouts>
static bool containsLayout (const BusesLayout& layouts, const short (&channelLayoutList) [numLayouts][2])
static bool containsLayout (const BusesLayout& layouts, const short (&channelLayoutList) [(size_t) numLayouts][2])
{ {
return containsLayout (layouts, layoutListToArray (channelLayoutList)); return containsLayout (layouts, layoutListToArray (channelLayoutList));
} }
@@ -782,7 +782,7 @@ public:
*/ */
template <int numLayouts> template <int numLayouts>
BusesLayout getNextBestLayoutInLayoutList (const BusesLayout& layouts, BusesLayout getNextBestLayoutInLayoutList (const BusesLayout& layouts,
const short (&channelLayoutList) [numLayouts][2])
const short (&channelLayoutList) [(size_t) numLayouts][2])
{ {
return getNextBestLayoutInList (layouts, layoutListToArray (channelLayoutList)); return getNextBestLayoutInList (layouts, layoutListToArray (channelLayoutList));
} }
@@ -1422,7 +1422,7 @@ private:
}; };
template <int numLayouts> template <int numLayouts>
static Array<InOutChannelPair> layoutListToArray (const short (&configuration) [numLayouts][2])
static Array<InOutChannelPair> layoutListToArray (const short (&configuration) [(size_t) numLayouts][2])
{ {
Array<InOutChannelPair> layouts; Array<InOutChannelPair> layouts;


+ 1
- 0
modules/juce_audio_processors/processors/juce_AudioProcessorParameterGroup.cpp View File

@@ -297,6 +297,7 @@ private:
void prepareToPlay (double, int) override {} void prepareToPlay (double, int) override {}
void releaseResources() override {} void releaseResources() override {}
void processBlock (AudioBuffer<float>&, MidiBuffer&) override {} void processBlock (AudioBuffer<float>&, MidiBuffer&) override {}
using AudioProcessor::processBlock;
double getTailLengthSeconds() const override { return 0.0; } double getTailLengthSeconds() const override { return 0.0; }
bool acceptsMidi() const override { return false; } bool acceptsMidi() const override { return false; }
bool producesMidi() const override { return false; } bool producesMidi() const override { return false; }


+ 1
- 0
modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp View File

@@ -857,6 +857,7 @@ private:
void prepareToPlay (double, int) override {} void prepareToPlay (double, int) override {}
void releaseResources() override {} void releaseResources() override {}
void processBlock (AudioBuffer<float>&, MidiBuffer&) override {} void processBlock (AudioBuffer<float>&, MidiBuffer&) override {}
using AudioProcessor::processBlock;
double getTailLengthSeconds() const override { return {}; } double getTailLengthSeconds() const override { return {}; }
bool acceptsMidi() const override { return {}; } bool acceptsMidi() const override { return {}; }
bool producesMidi() const override { return {}; } bool producesMidi() const override { return {}; }


+ 2
- 0
modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp View File

@@ -50,6 +50,8 @@ struct MidiKeyboardComponent::UpDownButton : public Button
owner.setLowestVisibleKey (note * 12); owner.setLowestVisibleKey (note * 12);
} }
using Button::clicked;
void paintButton (Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override void paintButton (Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
{ {
owner.drawUpDownButton (g, getWidth(), getHeight(), owner.drawUpDownButton (g, getWidth(), getHeight(),


+ 4
- 4
modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp View File

@@ -122,14 +122,14 @@ void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChann
for (int i = 0; i < numOutputChannels; ++i) for (int i = 0; i < numOutputChannels; ++i)
{ {
channels[totalNumChans] = outputChannelData[i]; channels[totalNumChans] = outputChannelData[i];
memcpy (channels[totalNumChans], inputChannelData[i], sizeof (float) * (size_t) numSamples);
memcpy (channels[totalNumChans], inputChannelData[i], (size_t) numSamples * sizeof (float));
++totalNumChans; ++totalNumChans;
} }
for (int i = numOutputChannels; i < numInputChannels; ++i) for (int i = numOutputChannels; i < numInputChannels; ++i)
{ {
channels[totalNumChans] = tempBuffer.getWritePointer (i - numOutputChannels); channels[totalNumChans] = tempBuffer.getWritePointer (i - numOutputChannels);
memcpy (channels[totalNumChans], inputChannelData[i], sizeof (float) * (size_t) numSamples);
memcpy (channels[totalNumChans], inputChannelData[i], (size_t) numSamples * sizeof (float));
++totalNumChans; ++totalNumChans;
} }
} }
@@ -138,14 +138,14 @@ void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChann
for (int i = 0; i < numInputChannels; ++i) for (int i = 0; i < numInputChannels; ++i)
{ {
channels[totalNumChans] = outputChannelData[i]; channels[totalNumChans] = outputChannelData[i];
memcpy (channels[totalNumChans], inputChannelData[i], sizeof (float) * (size_t) numSamples);
memcpy (channels[totalNumChans], inputChannelData[i], (size_t) numSamples * sizeof (float));
++totalNumChans; ++totalNumChans;
} }
for (int i = numInputChannels; i < numOutputChannels; ++i) for (int i = numInputChannels; i < numOutputChannels; ++i)
{ {
channels[totalNumChans] = outputChannelData[i]; channels[totalNumChans] = outputChannelData[i];
zeromem (channels[totalNumChans], sizeof (float) * (size_t) numSamples);
zeromem (channels[totalNumChans], (size_t) numSamples * sizeof (float));
++totalNumChans; ++totalNumChans;
} }
} }


+ 1
- 1
modules/juce_blocks_basics/littlefoot/juce_LittleFootRunner.h View File

@@ -583,7 +583,7 @@ struct Runner
//============================================================================== //==============================================================================
/** */ /** */
uint8 allMemory[((programAndHeapSpace + stackAndGlobalsSpace) + 3) & ~3];
uint8 allMemory[(size_t) (((programAndHeapSpace + stackAndGlobalsSpace) + 3) & ~3)];
/** */ /** */
Program program; Program program;


+ 4
- 4
modules/juce_blocks_basics/protocol/juce_BitPackingUtilities.h View File

@@ -181,7 +181,7 @@ struct Packed7BitArrayBuilder
{ {
const int bitsToDo = jmin (7 - bitsInCurrentByte, numBits); const int bitsToDo = jmin (7 - bitsInCurrentByte, numBits);
data[bytesWritten] |= ((value & ((1 << bitsToDo) - 1)) << bitsInCurrentByte);
data[bytesWritten] |= ((value & (uint32) ((1 << bitsToDo) - 1)) << bitsInCurrentByte);
value >>= bitsToDo; value >>= bitsToDo;
numBits -= bitsToDo; numBits -= bitsToDo;
bitsInCurrentByte += bitsToDo; bitsInCurrentByte += bitsToDo;
@@ -213,7 +213,7 @@ struct Packed7BitArrayBuilder
} }
private: private:
uint8 data[allocatedBytes];
uint8 data[(size_t) allocatedBytes];
int bytesWritten = 0, bitsInCurrentByte = 0; int bytesWritten = 0, bitsInCurrentByte = 0;
}; };
@@ -253,13 +253,13 @@ struct Packed7BitArrayReader
while (numBits > 0) while (numBits > 0)
{ {
const uint32 valueInCurrentByte = (*data >> bitsReadInCurrentByte);
const auto valueInCurrentByte = (uint32) (*data >> bitsReadInCurrentByte);
const int bitsAvailable = 7 - bitsReadInCurrentByte; const int bitsAvailable = 7 - bitsReadInCurrentByte;
if (bitsAvailable > numBits) if (bitsAvailable > numBits)
{ {
value |= ((valueInCurrentByte & ((1 << numBits) - 1)) << bitsSoFar);
value |= ((valueInCurrentByte & (uint32) ((1 << numBits) - 1)) << bitsSoFar);
bitsReadInCurrentByte += numBits; bitsReadInCurrentByte += numBits;
break; break;
} }


+ 3
- 3
modules/juce_blocks_basics/topology/internal/juce_BlockImplementation.cpp View File

@@ -1041,9 +1041,9 @@ public:
void write565Colour (uint32 bitIndex, LEDColour colour) void write565Colour (uint32 bitIndex, LEDColour colour)
{ {
block.setDataBits (bitIndex, 5, colour.getRed() >> 3);
block.setDataBits (bitIndex + 5, 6, colour.getGreen() >> 2);
block.setDataBits (bitIndex + 11, 5, colour.getBlue() >> 3);
block.setDataBits (bitIndex, 5, (uint32) (colour.getRed() >> 3));
block.setDataBits (bitIndex + 5, 6, (uint32) (colour.getGreen() >> 2));
block.setDataBits (bitIndex + 11, 5, (uint32) (colour.getBlue() >> 3));
} }
struct DefaultLEDGridProgram : public Block::Program struct DefaultLEDGridProgram : public Block::Program


+ 3
- 3
modules/juce_blocks_basics/visualisers/juce_BitmapLEDProgram.cpp View File

@@ -41,9 +41,9 @@ void BitmapLEDProgram::setLED (uint32 x, uint32 y, LEDColour colour)
{ {
auto bit = (x + y * w) * 16; auto bit = (x + y * w) * 16;
block.setDataBits (bit, 5, colour.getRed() >> 3);
block.setDataBits (bit + 5, 6, colour.getGreen() >> 2);
block.setDataBits (bit + 11, 5, colour.getBlue() >> 3);
block.setDataBits (bit, 5, (uint32) (colour.getRed() >> 3));
block.setDataBits (bit + 5, 6, (uint32) (colour.getGreen() >> 2));
block.setDataBits (bit + 11, 5, (uint32) (colour.getBlue() >> 3));
} }
} }
else else


+ 3
- 3
modules/juce_blocks_basics/visualisers/juce_DrumPadLEDProgram.cpp View File

@@ -102,9 +102,9 @@ void DrumPadGridProgram::setGridFills (int numColumns, int numRows, const Array<
const uint32 colourOffsetBytes = byteOffset + colours0_byte + i * colourSizeBytes; const uint32 colourOffsetBytes = byteOffset + colours0_byte + i * colourSizeBytes;
const uint32 colourOffsetBits = colourOffsetBytes * 8; const uint32 colourOffsetBits = colourOffsetBytes * 8;
block.setDataBits (colourOffsetBits, 5, fill.colour.getRed() >> 3);
block.setDataBits (colourOffsetBits + 5, 6, fill.colour.getGreen() >> 2);
block.setDataBits (colourOffsetBits + 11, 5, fill.colour.getBlue() >> 3);
block.setDataBits (colourOffsetBits, 5, (uint32) (fill.colour.getRed() >> 3));
block.setDataBits (colourOffsetBits + 5, 6, (uint32) (fill.colour.getGreen() >> 2));
block.setDataBits (colourOffsetBits + 11, 5, (uint32) (fill.colour.getBlue() >> 3));
block.setDataByte (byteOffset + fillTypes0_byte + i, static_cast<uint8> (fill.fillType)); block.setDataByte (byteOffset + fillTypes0_byte + i, static_cast<uint8> (fill.fillType));


+ 8
- 7
modules/juce_box2d/juce_box2d.cpp View File

@@ -33,21 +33,22 @@
#error "Incorrect use of JUCE cpp file" #error "Incorrect use of JUCE cpp file"
#endif #endif
#if defined (__clang__)
#include "juce_box2d.h"
#if defined JUCE_CLANG
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wsign-conversion" #pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wfloat-conversion" #pragma clang diagnostic ignored "-Wfloat-conversion"
#if __has_warning("-Wzero-as-null-pointer-constant") #if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif #endif
#elif defined (__GNUC__)
#elif defined JUCE_GCC
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable" #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif #endif
#include "juce_box2d.h"
#include <cstdarg> #include <cstdarg>
using int8 = juce::int8; using int8 = juce::int8;
@@ -105,8 +106,8 @@ using uint32 = juce::uint32;
#include "utils/juce_Box2DRenderer.cpp" #include "utils/juce_Box2DRenderer.cpp"
#if defined (__clang__)
#if defined JUCE_CLANG
#pragma clang diagnostic pop #pragma clang diagnostic pop
#elif defined (__GNUC__)
#elif defined JUCE_GCC
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif

+ 16
- 8
modules/juce_box2d/juce_box2d.h View File

@@ -54,22 +54,30 @@
//============================================================================== //==============================================================================
#include <juce_graphics/juce_graphics.h> #include <juce_graphics/juce_graphics.h>
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#if defined (__clang__)
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#ifdef JUCE_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"
#if __has_warning("-Wzero-as-null-pointer-constant")
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif #endif
#endif #endif
#ifdef JUCE_GCC
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <climits> #include <climits>
#include <cfloat> #include <cfloat>
#include "box2d/Box2D.h" #include "box2d/Box2D.h"
#ifdef __GNUC__
#ifdef JUCE_CLANG
#pragma clang diagnostic pop
#endif
#ifdef JUCE_GCC
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif


+ 2
- 2
modules/juce_core/containers/juce_ArrayBase.h View File

@@ -521,13 +521,13 @@ private:
{ {
memmove (elements + currentIndex, memmove (elements + currentIndex,
elements + currentIndex + 1, elements + currentIndex + 1,
sizeof (ElementType) * (size_t) (newIndex - currentIndex));
(size_t) (newIndex - currentIndex) * sizeof (ElementType));
} }
else else
{ {
memmove (elements + newIndex + 1, memmove (elements + newIndex + 1,
elements + newIndex, elements + newIndex,
sizeof (ElementType) * (size_t) (currentIndex - newIndex));
(size_t) (currentIndex - newIndex) * sizeof (ElementType));
} }
memcpy (elements + newIndex, tempCopy, sizeof (ElementType)); memcpy (elements + newIndex, tempCopy, sizeof (ElementType));


+ 3
- 3
modules/juce_core/maths/juce_BigInteger.cpp View File

@@ -1196,7 +1196,7 @@ void BigInteger::loadFromMemoryBlock (const MemoryBlock& data)
auto* values = ensureSize (numInts); auto* values = ensureSize (numInts);
for (int i = 0; i < (int) numInts - 1; ++i) for (int i = 0; i < (int) numInts - 1; ++i)
values[i] = (uint32) ByteOrder::littleEndianInt (addBytesToPointer (data.getData(), sizeof (uint32) * (size_t) i));
values[i] = (uint32) ByteOrder::littleEndianInt (addBytesToPointer (data.getData(), (size_t) i * sizeof (uint32)));
values[numInts - 1] = 0; values[numInts - 1] = 0;
@@ -1240,7 +1240,7 @@ void writeLittleEndianBitsInBuffer (void* buffer, uint32 startBit, uint32 numBit
} }
if (numBits > 0) if (numBits > 0)
*data = (uint8) ((*data & (0xff << numBits)) | value);
*data = (uint8) ((*data & (uint32) (0xff << numBits)) | value);
} }
uint32 readLittleEndianBitsInBuffer (const void* buffer, uint32 startBit, uint32 numBits) noexcept uint32 readLittleEndianBitsInBuffer (const void* buffer, uint32 startBit, uint32 numBits) noexcept
@@ -1255,7 +1255,7 @@ uint32 readLittleEndianBitsInBuffer (const void* buffer, uint32 startBit, uint32
if (const uint32 offset = (startBit & 7)) if (const uint32 offset = (startBit & 7))
{ {
const uint32 bitsInByte = 8 - offset; const uint32 bitsInByte = 8 - offset;
result = (*data >> offset);
result = (uint32) (*data >> offset);
if (bitsInByte >= numBits) if (bitsInByte >= numBits)
return result & ((1u << numBits) - 1u); return result & ((1u << numBits) - 1u);


+ 1
- 1
modules/juce_core/maths/juce_MathsFunctions.h View File

@@ -296,7 +296,7 @@ void ignoreUnused (Types&&...) noexcept {}
int numElements = numElementsInArray (myArray) // returns 3 int numElements = numElementsInArray (myArray) // returns 3
@endcode @endcode
*/ */
template <typename Type, int N>
template <typename Type, size_t N>
JUCE_CONSTEXPR int numElementsInArray (Type (&)[N]) noexcept { return N; } JUCE_CONSTEXPR int numElementsInArray (Type (&)[N]) noexcept { return N; }
//============================================================================== //==============================================================================


+ 1
- 1
modules/juce_core/memory/juce_MemoryBlock.cpp View File

@@ -356,7 +356,7 @@ String MemoryBlock::toBase64Encoding() const
String destString ((unsigned int) size); // store the length, followed by a '.', and then the data. String destString ((unsigned int) size); // store the length, followed by a '.', and then the data.
auto initialLen = destString.length(); auto initialLen = destString.length();
destString.preallocateBytes (sizeof (String::CharPointerType::CharType) * (size_t) initialLen + 2 + numChars);
destString.preallocateBytes ((size_t) initialLen * sizeof (String::CharPointerType::CharType) + 2 + numChars);
auto d = destString.getCharPointer(); auto d = destString.getCharPointer();
d += initialLen; d += initialLen;


+ 1
- 1
modules/juce_core/native/juce_linux_Files.cpp View File

@@ -207,7 +207,7 @@ bool Process::openDocument (const String& fileName, const String& parameters)
cmdString = cmdLines.joinIntoString (" || "); cmdString = cmdLines.joinIntoString (" || ");
} }
const char* const argv[4] = { "/bin/sh", "-c", cmdString.toUTF8(), 0 };
const char* const argv[4] = { "/bin/sh", "-c", cmdString.toUTF8(), nullptr };
auto cpid = fork(); auto cpid = fork();


+ 1
- 1
modules/juce_core/native/juce_linux_SystemStats.cpp View File

@@ -205,7 +205,7 @@ bool Time::setSystemTimeToThisTime() const
t.tv_sec = millisSinceEpoch / 1000; t.tv_sec = millisSinceEpoch / 1000;
t.tv_usec = (millisSinceEpoch - t.tv_sec * 1000) * 1000; t.tv_usec = (millisSinceEpoch - t.tv_sec * 1000) * 1000;
return settimeofday (&t, 0) == 0;
return settimeofday (&t, nullptr) == 0;
} }
JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() noexcept JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() noexcept


+ 2
- 2
modules/juce_core/native/juce_posix_SharedCode.h View File

@@ -1043,8 +1043,8 @@ void JUCE_CALLTYPE Thread::setCurrentThreadAffinityMask (uint32 affinityMask)
CPU_ZERO (&affinity); CPU_ZERO (&affinity);
for (int i = 0; i < 32; ++i) for (int i = 0; i < 32; ++i)
if ((affinityMask & (1 << i)) != 0)
CPU_SET (i, &affinity);
if ((affinityMask & (uint32) (1 << i)) != 0)
CPU_SET ((size_t) i, &affinity);
#if (! JUCE_ANDROID) && ((! JUCE_LINUX) || ((__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2004)) #if (! JUCE_ANDROID) && ((! JUCE_LINUX) || ((__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2004))
pthread_setaffinity_np (pthread_self(), sizeof (cpu_set_t), &affinity); pthread_setaffinity_np (pthread_self(), sizeof (cpu_set_t), &affinity);


+ 1
- 1
modules/juce_core/system/juce_TargetPlatform.h View File

@@ -183,7 +183,7 @@
//============================================================================== //==============================================================================
// Compiler type macros. // Compiler type macros.
#ifdef __clang__
#if defined (__clang__)
#define JUCE_CLANG 1 #define JUCE_CLANG 1
#elif defined (__GNUC__) #elif defined (__GNUC__)


+ 3
- 3
modules/juce_core/text/juce_CharacterFunctions.h View File

@@ -151,7 +151,7 @@ public:
#else #else
JUCE_CONSTEXPR const int maxSignificantDigits = 17 + 1; // An additional digit for rounding JUCE_CONSTEXPR const int maxSignificantDigits = 17 + 1; // An additional digit for rounding
JUCE_CONSTEXPR const int bufferSize = maxSignificantDigits + 7 + 1; // -.E-XXX and a trailing null-terminator JUCE_CONSTEXPR const int bufferSize = maxSignificantDigits + 7 + 1; // -.E-XXX and a trailing null-terminator
char buffer[bufferSize] = {};
char buffer[(size_t) bufferSize] = {};
char* currentCharacter = &(buffer[0]); char* currentCharacter = &(buffer[0]);
#endif #endif
@@ -505,12 +505,12 @@ public:
{ {
auto startAddress = dest.getAddress(); auto startAddress = dest.getAddress();
auto maxBytes = (ssize_t) maxBytesToWrite; auto maxBytes = (ssize_t) maxBytesToWrite;
maxBytes -= sizeof (typename DestCharPointerType::CharType); // (allow for a terminating null)
maxBytes -= (ssize_t) sizeof (typename DestCharPointerType::CharType); // (allow for a terminating null)
for (;;) for (;;)
{ {
auto c = src.getAndAdvance(); auto c = src.getAndAdvance();
auto bytesNeeded = DestCharPointerType::getBytesRequiredFor (c);
auto bytesNeeded = (ssize_t) DestCharPointerType::getBytesRequiredFor (c);
maxBytes -= bytesNeeded; maxBytes -= bytesNeeded;
if (c == 0 || maxBytes < 0) if (c == 0 || maxBytes < 0)


+ 2
- 2
modules/juce_core/text/juce_String.cpp View File

@@ -733,7 +733,7 @@ void String::appendCharPointer (const CharPointerType startOfTextToAppend,
if (extraBytesNeeded > 0) if (extraBytesNeeded > 0)
{ {
auto byteOffsetOfNull = getByteOffsetOfEnd(); auto byteOffsetOfNull = getByteOffsetOfEnd();
preallocateBytes (byteOffsetOfNull + (size_t) extraBytesNeeded);
preallocateBytes ((size_t) extraBytesNeeded + byteOffsetOfNull);
auto* newStringStart = addBytesToPointer (text.getAddress(), (int) byteOffsetOfNull); auto* newStringStart = addBytesToPointer (text.getAddress(), (int) byteOffsetOfNull);
memcpy (newStringStart, startOfTextToAppend.getAddress(), (size_t) extraBytesNeeded); memcpy (newStringStart, startOfTextToAppend.getAddress(), (size_t) extraBytesNeeded);
@@ -1929,7 +1929,7 @@ String String::toHexString (const void* const d, const int size, const int group
if (groupSize > 0) if (groupSize > 0)
numChars += size / groupSize; numChars += size / groupSize;
String s (PreallocationBytes (sizeof (CharPointerType::CharType) * (size_t) numChars));
String s (PreallocationBytes ((size_t) numChars * sizeof (CharPointerType::CharType)));
auto* data = static_cast<const unsigned char*> (d); auto* data = static_cast<const unsigned char*> (d);
auto dest = s.text; auto dest = s.text;


+ 1
- 1
modules/juce_core/text/juce_StringArray.cpp View File

@@ -300,7 +300,7 @@ String StringArray::joinIntoString (StringRef separator, int start, int numberTo
return strings.getReference (start); return strings.getReference (start);
auto separatorBytes = separator.text.sizeInBytes() - sizeof (String::CharPointerType::CharType); auto separatorBytes = separator.text.sizeInBytes() - sizeof (String::CharPointerType::CharType);
auto bytesNeeded = separatorBytes * (size_t) (last - start - 1);
auto bytesNeeded = (size_t) (last - start - 1) * separatorBytes;
for (int i = start; i < last; ++i) for (int i = start; i < last; ++i)
bytesNeeded += strings.getReference(i).getCharPointer().sizeInBytes() - sizeof (String::CharPointerType::CharType); bytesNeeded += strings.getReference(i).getCharPointer().sizeInBytes() - sizeof (String::CharPointerType::CharType);


+ 1
- 1
modules/juce_core/xml/juce_XmlDocument.cpp View File

@@ -80,7 +80,7 @@ namespace XmlIdentifierChars
{ {
static const uint32 legalChars[] = { 0, 0x7ff6000, 0x87fffffe, 0x7fffffe, 0 }; static const uint32 legalChars[] = { 0, 0x7ff6000, 0x87fffffe, 0x7fffffe, 0 };
return ((int) c < (int) numElementsInArray (legalChars) * 32) ? ((legalChars [c >> 5] & (1 << (c & 31))) != 0)
return ((int) c < (int) numElementsInArray (legalChars) * 32) ? ((legalChars [c >> 5] & (uint32) (1 << (c & 31))) != 0)
: isIdentifierCharSlow (c); : isIdentifierCharSlow (c);
} }


+ 12
- 0
modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp View File

@@ -44,6 +44,14 @@ namespace zlibNamespace
#endif #endif
#endif #endif
#if JUCE_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#undef OS_CODE #undef OS_CODE
#undef fdopen #undef fdopen
#define ZLIB_INTERNAL #define ZLIB_INTERNAL
@@ -78,6 +86,10 @@ namespace zlibNamespace
#if JUCE_CLANG #if JUCE_CLANG
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif
#if JUCE_GCC
#pragma GCC diagnostic pop
#endif
#else #else
#include JUCE_ZLIB_INCLUDE_PATH #include JUCE_ZLIB_INCLUDE_PATH


+ 10
- 10
modules/juce_core/zip/juce_ZipFile.cpp View File

@@ -55,12 +55,12 @@ struct ZipFile::ZipEntryHolder
static Time parseFileTime (uint32 time, uint32 date) noexcept static Time parseFileTime (uint32 time, uint32 date) noexcept
{ {
int year = 1980 + (date >> 9);
int month = ((date >> 5) & 15) - 1;
int day = date & 31;
int hours = time >> 11;
int minutes = (time >> 5) & 63;
int seconds = (int) ((time & 31) << 1);
auto year = (int) (1980 + (date >> 9));
auto month = (int) (((date >> 5) & 15) - 1);
auto day = (int) (date & 31);
auto hours = (int) time >> 11;
auto minutes = (int) ((time >> 5) & 63);
auto seconds = (int) ((time & 31) << 1);
return { year, month, day, hours, minutes, seconds }; return { year, month, day, hours, minutes, seconds };
} }
@@ -369,16 +369,16 @@ void ZipFile::init()
break; break;
auto* buffer = static_cast<const char*> (headerData.getData()) + pos; auto* buffer = static_cast<const char*> (headerData.getData()) + pos;
auto fileNameLen = readUnalignedLittleEndianShort (buffer + 28);
auto fileNameLen = readUnalignedLittleEndianShort (buffer + 28u);
if (pos + 46 + fileNameLen > size) if (pos + 46 + fileNameLen > size)
break; break;
entries.add (new ZipEntryHolder (buffer, fileNameLen)); entries.add (new ZipEntryHolder (buffer, fileNameLen));
pos += 46 + fileNameLen
+ readUnalignedLittleEndianShort (buffer + 30)
+ readUnalignedLittleEndianShort (buffer + 32);
pos += 46u + fileNameLen
+ readUnalignedLittleEndianShort (buffer + 30u)
+ readUnalignedLittleEndianShort (buffer + 32u);
} }
} }
} }


+ 1
- 1
modules/juce_cryptography/hashing/juce_SHA256.cpp View File

@@ -137,7 +137,7 @@ public:
break; break;
} }
numBytesToRead -= sizeof (buffer);
numBytesToRead -= (int64) sizeof (buffer);
processFullBlock (buffer); processFullBlock (buffer);
} }


+ 2
- 2
modules/juce_cryptography/hashing/juce_Whirlpool.cpp View File

@@ -51,7 +51,7 @@ struct WhirlpoolProcessor
if (bytesRead < (int) sizeof (data)) if (bytesRead < (int) sizeof (data))
break; break;
numBytesToRead -= sizeof (data);
numBytesToRead -= (int64) sizeof (data);
} }
finalize (result); finalize (result);
@@ -84,7 +84,7 @@ private:
while (numBits > 8) while (numBits > 8)
{ {
b = ((source[sourcePos] << sourceGap) & 0xff) b = ((source[sourcePos] << sourceGap) & 0xff)
| ((source[sourcePos + 1] & 0xff) >> (8 - sourceGap));
| (uint32) ((source[sourcePos + 1] & 0xff) >> (8 - sourceGap));
buffer[bufferPos++] |= (uint8) (b >> bufferRem); buffer[bufferPos++] |= (uint8) (b >> bufferRem);
bufferBits += 8 - bufferRem; bufferBits += 8 - bufferRem;


+ 1
- 1
modules/juce_dsp/containers/juce_SIMDRegister_Impl.h View File

@@ -120,7 +120,7 @@ struct CmplxSIMDOps<std::complex<Scalar>>
union union
{ {
vSIMDType v; vSIMDType v;
Scalar floats[n];
Scalar floats[(size_t) n];
} u; } u;
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)


+ 1
- 1
modules/juce_dsp/containers/juce_SIMDRegister_test.cpp View File

@@ -96,7 +96,7 @@ namespace SIMDRegister_test_internal
#ifdef _MSC_VER #ifdef _MSC_VER
__declspec(align(sizeof (SIMDRegister<type>))) type elements[size]; __declspec(align(sizeof (SIMDRegister<type>))) type elements[size];
#else #else
type elements[size] __attribute__((aligned(sizeof (SIMDRegister<type>))));
type elements[(size_t) size] __attribute__((aligned(sizeof (SIMDRegister<type>))));
#endif #endif
VecFiller<type>::fill (elements, size, random); VecFiller<type>::fill (elements, size, random);


+ 4
- 4
modules/juce_dsp/frequency/juce_FFT.cpp View File

@@ -132,7 +132,7 @@ struct FFTFallback : public FFT::Instance
if (size == 1) if (size == 1)
return; return;
const size_t scratchSize = 16 + sizeof (Complex<float>) * (size_t) size;
const size_t scratchSize = 16 + (size_t) size * sizeof (Complex<float>);
if (scratchSize < maxFFTScratchSpaceToAlloca) if (scratchSize < maxFFTScratchSpaceToAlloca)
{ {
@@ -150,7 +150,7 @@ struct FFTFallback : public FFT::Instance
if (size == 1) if (size == 1)
return; return;
const size_t scratchSize = 16 + sizeof (Complex<float>) * (size_t) size;
const size_t scratchSize = 16 + (size_t) size * sizeof (Complex<float>);
if (scratchSize < maxFFTScratchSpaceToAlloca) if (scratchSize < maxFFTScratchSpaceToAlloca)
{ {
@@ -316,7 +316,7 @@ struct FFTFallback : public FFT::Instance
default: jassertfalse; break; default: jassertfalse; break;
} }
auto* scratch = static_cast<Complex<float>*> (alloca (sizeof (Complex<float>) * (size_t) factor.radix));
auto* scratch = static_cast<Complex<float>*> (alloca ((size_t) factor.radix * sizeof (Complex<float>)));
for (int i = 0; i < factor.length; ++i) for (int i = 0; i < factor.length; ++i)
{ {
@@ -843,7 +843,7 @@ void FFT::performFrequencyOnlyForwardTransform (float* inputOutputData) const no
for (auto i = 0; i < size; ++i) for (auto i = 0; i < size; ++i)
inputOutputData[i] = std::abs (out[i]); inputOutputData[i] = std::abs (out[i]);
zeromem (&inputOutputData[size], sizeof (float) * static_cast<size_t> (size));
zeromem (&inputOutputData[size], static_cast<size_t> (size) * sizeof (float));
} }
} // namespace dsp } // namespace dsp


+ 1
- 1
modules/juce_dsp/maths/juce_Matrix.h View File

@@ -101,7 +101,7 @@ public:
Array<size_t> getSize() const noexcept { return { rows, columns }; } Array<size_t> getSize() const noexcept { return { rows, columns }; }
/** Fills the contents of the matrix with zeroes. */ /** Fills the contents of the matrix with zeroes. */
void clear() noexcept { zeromem (data.begin(), sizeof (ElementType) * (size_t) data.size()); }
void clear() noexcept { zeromem (data.begin(), (size_t) data.size() * sizeof (ElementType)); }
//============================================================================== //==============================================================================
/** Swaps the contents of two rows in the matrix and returns a reference to itself. */ /** Swaps the contents of two rows in the matrix and returns a reference to itself. */


+ 0
- 7
modules/juce_events/broadcasters/juce_ChangeListener.h View File

@@ -51,13 +51,6 @@ public:
@param source the ChangeBroadcaster that triggered the callback. @param source the ChangeBroadcaster that triggered the callback.
*/ */
virtual void changeListenerCallback (ChangeBroadcaster* source) = 0; virtual void changeListenerCallback (ChangeBroadcaster* source) = 0;
//==============================================================================
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE
// This method's signature has changed to take a ChangeBroadcaster parameter - please update your code!
private: virtual int changeListenerCallback (void*) { return 0; }
#endif
}; };
} // namespace juce } // namespace juce

+ 1
- 1
modules/juce_events/native/juce_linux_Messaging.cpp View File

@@ -188,7 +188,7 @@ namespace LinuxErrorHandling
saction.sa_handler = keyboardBreakSignalHandler; saction.sa_handler = keyboardBreakSignalHandler;
saction.sa_mask = maskSet; saction.sa_mask = maskSet;
saction.sa_flags = 0; saction.sa_flags = 0;
sigaction (SIGINT, &saction, 0);
sigaction (SIGINT, &saction, nullptr);
} }
} }


+ 8
- 3
modules/juce_graphics/image_formats/juce_JPEGLoader.cpp View File

@@ -51,9 +51,14 @@ namespace jpeglibNamespace
#endif #endif
#endif #endif
#if JUCE_GCC && __GNUC__ > 5
#if JUCE_GCC
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshift-negative-value"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#if __GNUC__ > 5
#pragma GCC diagnostic ignored "-Wshift-negative-value"
#endif
#endif #endif
#define JPEG_INTERNALS #define JPEG_INTERNALS
@@ -133,7 +138,7 @@ namespace jpeglibNamespace
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif
#if JUCE_GCC && __GNUC__ > 5
#if JUCE_GCC
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
#else #else


+ 15
- 4
modules/juce_graphics/image_formats/juce_PNGLoader.cpp View File

@@ -74,6 +74,12 @@ namespace pnglibNamespace
#endif #endif
#endif #endif
#if JUCE_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#undef check #undef check
using std::abs; using std::abs;
#define NO_DUMMY_DECL #define NO_DUMMY_DECL
@@ -294,6 +300,11 @@ namespace pnglibNamespace
#if JUCE_CLANG #if JUCE_CLANG
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif
#if JUCE_GCC
#pragma GCC diagnostic pop
#endif
#else #else
extern "C" extern "C"
{ {
@@ -358,7 +369,7 @@ namespace PNGHelpers
png_get_IHDR (pngReadStruct, pngInfoStruct, png_get_IHDR (pngReadStruct, pngInfoStruct,
&width, &height, &width, &height,
&bitDepth, &colorType, &bitDepth, &colorType,
&interlaceType, 0, 0);
&interlaceType, nullptr, nullptr);
if (bitDepth == 16) if (bitDepth == 16)
png_set_strip_16 (pngReadStruct); png_set_strip_16 (pngReadStruct);
@@ -472,16 +483,16 @@ namespace PNGHelpers
static Image readImage (InputStream& in) static Image readImage (InputStream& in)
{ {
if (png_structp pngReadStruct = png_create_read_struct (PNG_LIBPNG_VER_STRING, 0, 0, 0))
if (png_structp pngReadStruct = png_create_read_struct (PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr))
{ {
if (png_infop pngInfoStruct = png_create_info_struct (pngReadStruct)) if (png_infop pngInfoStruct = png_create_info_struct (pngReadStruct))
{ {
Image image (readImage (in, pngReadStruct, pngInfoStruct)); Image image (readImage (in, pngReadStruct, pngInfoStruct));
png_destroy_read_struct (&pngReadStruct, &pngInfoStruct, 0);
png_destroy_read_struct (&pngReadStruct, &pngInfoStruct, nullptr);
return image; return image;
} }
png_destroy_read_struct (&pngReadStruct, 0, 0);
png_destroy_read_struct (&pngReadStruct, nullptr, nullptr);
} }
return Image(); return Image();


+ 3
- 3
modules/juce_graphics/native/juce_freetype_Fonts.cpp View File

@@ -40,7 +40,7 @@ struct FTLibWrapper : public ReferenceCountedObject
~FTLibWrapper() ~FTLibWrapper()
{ {
if (library != 0)
if (library != nullptr)
FT_Done_FreeType (library); FT_Done_FreeType (library);
} }
@@ -71,7 +71,7 @@ struct FTFaceWrapper : public ReferenceCountedObject
~FTFaceWrapper() ~FTFaceWrapper()
{ {
if (face != 0)
if (face != nullptr)
FT_Done_Face (face); FT_Done_Face (face);
} }
@@ -244,7 +244,7 @@ private:
{ {
FTFaceWrapper face (library, file, faceIndex); FTFaceWrapper face (library, file, faceIndex);
if (face.face != 0)
if (face.face != nullptr)
{ {
if (faceIndex == 0) if (faceIndex == 0)
numFaces = (int) face.face->num_faces; numFaces = (int) face.face->num_faces;


+ 0
- 7
modules/juce_gui_basics/buttons/juce_Button.h View File

@@ -393,13 +393,6 @@ public:
virtual void drawDrawableButton (Graphics&, DrawableButton&, virtual void drawDrawableButton (Graphics&, DrawableButton&,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) = 0; bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) = 0;
private:
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE
// These method have been deprecated: see their replacements above.
virtual int getTextButtonFont (TextButton&) { return 0; }
virtual int changeTextButtonWidthToFitText (TextButton&, int) { return 0; }
#endif
}; };
// This method's parameters have changed - see the new version. // This method's parameters have changed - see the new version.


+ 4
- 2
modules/juce_gui_basics/buttons/juce_HyperlinkButton.h View File

@@ -112,14 +112,16 @@ protected:
void paintButton (Graphics&, bool, bool) override; void paintButton (Graphics&, bool, bool) override;
private: private:
//==============================================================================
using Button::clicked;
Font getFontToUse() const;
//============================================================================== //==============================================================================
URL url; URL url;
Font font; Font font;
bool resizeFont; bool resizeFont;
Justification justification; Justification justification;
Font getFontToUse() const;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HyperlinkButton) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HyperlinkButton)
}; };


+ 4
- 0
modules/juce_gui_basics/components/juce_ModalComponentManager.cpp View File

@@ -38,6 +38,8 @@ struct ModalComponentManager::ModalItem : public ComponentMovementWatcher
void componentMovedOrResized (bool, bool) override {} void componentMovedOrResized (bool, bool) override {}
using ComponentMovementWatcher::componentMovedOrResized;
void componentPeerChanged() override void componentPeerChanged() override
{ {
componentVisibilityChanged(); componentVisibilityChanged();
@@ -49,6 +51,8 @@ struct ModalComponentManager::ModalItem : public ComponentMovementWatcher
cancel(); cancel();
} }
using ComponentMovementWatcher::componentVisibilityChanged;
void componentBeingDeleted (Component& comp) override void componentBeingDeleted (Component& comp) override
{ {
ComponentMovementWatcher::componentBeingDeleted (comp); ComponentMovementWatcher::componentBeingDeleted (comp);


+ 2
- 0
modules/juce_gui_basics/layout/juce_ScrollBar.cpp View File

@@ -47,6 +47,8 @@ public:
owner.moveScrollbarInSteps ((direction == 1 || direction == 2) ? 1 : -1); owner.moveScrollbarInSteps ((direction == 1 || direction == 2) ? 1 : -1);
} }
using Button::clicked;
int direction; int direction;
private: private:


+ 1
- 0
modules/juce_gui_basics/layout/juce_TabbedButtonBar.h View File

@@ -128,6 +128,7 @@ protected:
ExtraComponentPlacement extraCompPlacement = afterText; ExtraComponentPlacement extraCompPlacement = afterText;
private: private:
using Button::clicked;
void calcAreas (Rectangle<int>&, Rectangle<int>&) const; void calcAreas (Rectangle<int>&, Rectangle<int>&) const;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TabBarButton) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TabBarButton)


+ 0
- 5
modules/juce_gui_basics/layout/juce_Viewport.h View File

@@ -334,11 +334,6 @@ private:
void updateVisibleArea(); void updateVisibleArea();
void deleteOrRemoveContentComp(); void deleteOrRemoveContentComp();
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE
// If you get an error here, it's because this method's parameters have changed! See the new definition above..
virtual int visibleAreaChanged (int, int, int, int) { return 0; }
#endif
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Viewport) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Viewport)
}; };


+ 0
- 2
modules/juce_gui_basics/mouse/juce_DragAndDropContainer.h View File

@@ -246,8 +246,6 @@ private:
virtual int dragOperationEnded() { return 0; } virtual int dragOperationEnded() { return 0; }
#endif #endif
JUCE_DEPRECATED_WITH_BODY (virtual bool shouldDropFilesWhenDraggedExternally (const String&, Component*, StringArray&, bool&), { return false; })
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DragAndDropContainer) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DragAndDropContainer)
}; };


+ 0
- 12
modules/juce_gui_basics/mouse/juce_DragAndDropTarget.h View File

@@ -136,18 +136,6 @@ public:
image will not be shown when the cursor is over this target. image will not be shown when the cursor is over this target.
*/ */
virtual bool shouldDrawDragImageWhenOver(); virtual bool shouldDrawDragImageWhenOver();
//==============================================================================
private:
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE
// The parameters for these methods have changed - please update your code!
virtual void isInterestedInDragSource (const String&, Component*) {}
virtual int itemDragEnter (const String&, Component*, int, int) { return 0; }
virtual int itemDragMove (const String&, Component*, int, int) { return 0; }
virtual int itemDragExit (const String&, Component*) { return 0; }
virtual int itemDropped (const String&, Component*, int, int) { return 0; }
#endif
}; };
} // namespace juce } // namespace juce

+ 0
- 8
modules/juce_gui_basics/mouse/juce_MouseListener.h View File

@@ -167,14 +167,6 @@ public:
values greater than 1.0 mean it should be enlarged. values greater than 1.0 mean it should be enlarged.
*/ */
virtual void mouseMagnify (const MouseEvent& event, float scaleFactor); virtual void mouseMagnify (const MouseEvent& event, float scaleFactor);
private:
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE
// This is just here to cause a compile error in old code that hasn't been
// updated to use the new version of this method.
virtual int mouseWheelMove (const MouseEvent&, float, float) { return 0; }
#endif
}; };
} // namespace juce } // namespace juce

+ 4
- 0
modules/juce_gui_basics/native/juce_android_Windowing.cpp View File

@@ -478,11 +478,15 @@ public:
return relativePosition + (getScreenPosition().toFloat() / scale); return relativePosition + (getScreenPosition().toFloat() / scale);
} }
using ComponentPeer::localToGlobal;
Point<float> globalToLocal (Point<float> screenPosition) override Point<float> globalToLocal (Point<float> screenPosition) override
{ {
return screenPosition - (getScreenPosition().toFloat() / scale); return screenPosition - (getScreenPosition().toFloat() / scale);
} }
using ComponentPeer::globalToLocal;
void setMinimised (bool /*shouldBeMinimised*/) override void setMinimised (bool /*shouldBeMinimised*/) override
{ {
// n/a // n/a


+ 2
- 0
modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm View File

@@ -194,7 +194,9 @@ public:
Rectangle<int> getBounds() const override { return getBounds (! isSharedWindow); } Rectangle<int> getBounds() const override { return getBounds (! isSharedWindow); }
Rectangle<int> getBounds (bool global) const; Rectangle<int> getBounds (bool global) const;
Point<float> localToGlobal (Point<float> relativePosition) override; Point<float> localToGlobal (Point<float> relativePosition) override;
using ComponentPeer::localToGlobal;
Point<float> globalToLocal (Point<float> screenPosition) override; Point<float> globalToLocal (Point<float> screenPosition) override;
using ComponentPeer::globalToLocal;
void setAlpha (float newAlpha) override; void setAlpha (float newAlpha) override;
void setMinimised (bool) override {} void setMinimised (bool) override {}
bool isMinimised() const override { return false; } bool isMinimised() const override { return false; }


+ 18
- 14
modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp View File

@@ -219,13 +219,13 @@ namespace XSHMHelpers
zerostruct (segmentInfo); zerostruct (segmentInfo);
if (auto* xImage = XShmCreateImage (display, DefaultVisual (display, DefaultScreen (display)), if (auto* xImage = XShmCreateImage (display, DefaultVisual (display, DefaultScreen (display)),
24, ZPixmap, 0, &segmentInfo, 50, 50))
24, ZPixmap, nullptr, &segmentInfo, 50, 50))
{ {
if ((segmentInfo.shmid = shmget (IPC_PRIVATE, if ((segmentInfo.shmid = shmget (IPC_PRIVATE,
(size_t) (xImage->bytes_per_line * xImage->height), (size_t) (xImage->bytes_per_line * xImage->height),
IPC_CREAT | 0777)) >= 0) IPC_CREAT | 0777)) >= 0)
{ {
segmentInfo.shmaddr = (char*) shmat (segmentInfo.shmid, 0, 0);
segmentInfo.shmaddr = (char*) shmat (segmentInfo.shmid, nullptr, 0);
if (segmentInfo.shmaddr != (void*) -1) if (segmentInfo.shmaddr != (void*) -1)
{ {
@@ -248,7 +248,7 @@ namespace XSHMHelpers
shmdt (segmentInfo.shmaddr); shmdt (segmentInfo.shmaddr);
} }
shmctl (segmentInfo.shmid, IPC_RMID, 0);
shmctl (segmentInfo.shmid, IPC_RMID, nullptr);
XSetErrorHandler (oldHandler); XSetErrorHandler (oldHandler);
if (trappedErrorCode != 0) if (trappedErrorCode != 0)
@@ -515,7 +515,7 @@ public:
segmentInfo.shmaddr = (char *) -1; segmentInfo.shmaddr = (char *) -1;
segmentInfo.readOnly = False; segmentInfo.readOnly = False;
xImage = XShmCreateImage (display, visual, imageDepth, ZPixmap, 0,
xImage = XShmCreateImage (display, visual, imageDepth, ZPixmap, nullptr,
&segmentInfo, (unsigned int) w, (unsigned int) h); &segmentInfo, (unsigned int) w, (unsigned int) h);
if (xImage != nullptr) if (xImage != nullptr)
@@ -526,7 +526,7 @@ public:
{ {
if (segmentInfo.shmid != -1) if (segmentInfo.shmid != -1)
{ {
segmentInfo.shmaddr = (char*) shmat (segmentInfo.shmid, 0, 0);
segmentInfo.shmaddr = (char*) shmat (segmentInfo.shmid, nullptr, 0);
if (segmentInfo.shmaddr != (void*) -1) if (segmentInfo.shmaddr != (void*) -1)
{ {
@@ -542,7 +542,7 @@ public:
} }
else else
{ {
shmctl (segmentInfo.shmid, IPC_RMID, 0);
shmctl (segmentInfo.shmid, IPC_RMID, nullptr);
} }
} }
} }
@@ -610,7 +610,7 @@ public:
XDestroyImage (xImage); XDestroyImage (xImage);
shmdt (segmentInfo.shmaddr); shmdt (segmentInfo.shmaddr);
shmctl (segmentInfo.shmid, IPC_RMID, 0);
shmctl (segmentInfo.shmid, IPC_RMID, nullptr);
} }
else else
#endif #endif
@@ -989,7 +989,7 @@ namespace PixmapHelpers
Pixmap pixmap = XCreatePixmap (display, DefaultRootWindow (display), Pixmap pixmap = XCreatePixmap (display, DefaultRootWindow (display),
width, height, 24); width, height, 24);
GC gc = XCreateGC (display, pixmap, 0, 0);
GC gc = XCreateGC (display, pixmap, 0, nullptr);
XPutImage (display, pixmap, gc, ximage, 0, 0, 0, 0, width, height); XPutImage (display, pixmap, gc, ximage, 0, 0, 0, 0, width, height);
XFreeGC (display, gc); XFreeGC (display, gc);
@@ -1252,11 +1252,15 @@ public:
return relativePosition + bounds.getPosition().toFloat(); return relativePosition + bounds.getPosition().toFloat();
} }
using ComponentPeer::localToGlobal;
Point<float> globalToLocal (Point<float> screenPosition) override Point<float> globalToLocal (Point<float> screenPosition) override
{ {
return screenPosition - bounds.getPosition().toFloat(); return screenPosition - bounds.getPosition().toFloat();
} }
using ComponentPeer::globalToLocal;
void setAlpha (float /* newAlpha */) override void setAlpha (float /* newAlpha */) override
{ {
//xxx todo! //xxx todo!
@@ -1662,9 +1666,9 @@ public:
ScopedXLock xlock (display); ScopedXLock xlock (display);
updateKeyStates ((int) keyEvent.keycode, true); updateKeyStates ((int) keyEvent.keycode, true);
String oldLocale (::setlocale (LC_ALL, 0));
String oldLocale (::setlocale (LC_ALL, nullptr));
::setlocale (LC_ALL, ""); ::setlocale (LC_ALL, "");
XLookupString (&keyEvent, utf8, sizeof (utf8), &sym, 0);
XLookupString (&keyEvent, utf8, sizeof (utf8), &sym, nullptr);
if (oldLocale.isNotEmpty()) if (oldLocale.isNotEmpty())
::setlocale (LC_ALL, oldLocale.toRawUTF8()); ::setlocale (LC_ALL, oldLocale.toRawUTF8());
@@ -2230,7 +2234,7 @@ private:
XShmSegmentInfo segmentinfo; XShmSegmentInfo segmentinfo;
auto testImage = XShmCreateImage (display, DefaultVisual (display, DefaultScreen (display)), auto testImage = XShmCreateImage (display, DefaultVisual (display, DefaultScreen (display)),
24, ZPixmap, 0, &segmentinfo, 64, 64);
24, ZPixmap, nullptr, &segmentinfo, 64, 64);
useARGBImagesForRendering = (testImage->bits_per_pixel == 32); useARGBImagesForRendering = (testImage->bits_per_pixel == 32);
XDestroyImage (testImage); XDestroyImage (testImage);
@@ -3180,12 +3184,12 @@ private:
for (;;) for (;;)
{ {
GetXProperty prop (display, evt.xany.window, evt.xselection.property, GetXProperty prop (display, evt.xany.window, evt.xselection.property,
dropData.getSize() / 4, 65536, false, AnyPropertyType);
(long) (dropData.getSize() / 4), 65536, false, AnyPropertyType);
if (! prop.success) if (! prop.success)
break; break;
dropData.append (prop.data, prop.numItems * (size_t) prop.actualFormat / 8);
dropData.append (prop.data, (size_t) (prop.actualFormat / 8) * prop.numItems);
if (prop.bytesLeft <= 0) if (prop.bytesLeft <= 0)
break; break;
@@ -3337,7 +3341,7 @@ private:
void initialisePointerMap() void initialisePointerMap()
{ {
const int numButtons = XGetPointerMapping (display, 0, 0);
const int numButtons = XGetPointerMapping (display, nullptr, 0);
pointerMap[2] = pointerMap[3] = pointerMap[4] = Keys::NoButton; pointerMap[2] = pointerMap[3] = pointerMap[4] = Keys::NoButton;
if (numButtons == 2) if (numButtons == 2)


+ 4
- 0
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -317,11 +317,15 @@ public:
return relativePosition + getBounds (true).getPosition().toFloat(); return relativePosition + getBounds (true).getPosition().toFloat();
} }
using ComponentPeer::localToGlobal;
Point<float> globalToLocal (Point<float> screenPosition) override Point<float> globalToLocal (Point<float> screenPosition) override
{ {
return screenPosition - getBounds (true).getPosition().toFloat(); return screenPosition - getBounds (true).getPosition().toFloat();
} }
using ComponentPeer::globalToLocal;
void setAlpha (float newAlpha) override void setAlpha (float newAlpha) override
{ {
if (isSharedWindow) if (isSharedWindow)


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save