Browse Source

Increased the Xcode warning level for some demo code and fixed resulting warnings

tags/2021-05-28
jules 7 years ago
parent
commit
7bc75e24c1
8 changed files with 22 additions and 21 deletions
  1. +1
    -1
      examples/Audio/MidiDemo.h
  2. +4
    -4
      examples/Audio/PluckedStringsDemo.h
  3. +5
    -5
      examples/BLOCKS/BlocksDrawingDemo.h
  4. +3
    -3
      examples/BLOCKS/BlocksSynthDemo.h
  5. +2
    -1
      examples/DemoRunner/DemoRunner.jucer
  6. +2
    -2
      examples/DemoRunner/Source/UI/DemoContentComponent.cpp
  7. +4
    -4
      examples/DemoRunner/Source/UI/MainComponent.cpp
  8. +1
    -1
      extras/UnitTestRunner/UnitTestRunner.jucer

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

@@ -101,7 +101,7 @@ public:
pairButton.setEnabled (false); pairButton.setEnabled (false);
addAndMakeVisible (pairButton); addAndMakeVisible (pairButton);
pairButton.onClick = [this]
pairButton.onClick = []
{ {
RuntimePermissions::request (RuntimePermissions::bluetoothMidi, RuntimePermissions::request (RuntimePermissions::bluetoothMidi,
[] (bool wasGranted) [] (bool wasGranted)


+ 4
- 4
examples/Audio/PluckedStringsDemo.h View File

@@ -109,7 +109,7 @@ public:
// cycle through the delay line and apply a simple averaging filter // cycle through the delay line and apply a simple averaging filter
for (auto i = 0; i < numSamples; ++i) for (auto i = 0; i < numSamples; ++i)
{ {
auto nextPos = (int) ((pos + 1) % delayLine.size());
auto nextPos = (pos + 1) % delayLine.size();
delayLine[nextPos] = (float) (decay * 0.5 * (delayLine[nextPos] + delayLine[pos])); delayLine[nextPos] = (float) (decay * 0.5 * (delayLine[nextPos] + delayLine[pos]));
outBuffer[i] += delayLine[pos]; outBuffer[i] += delayLine[pos];
@@ -151,7 +151,7 @@ private:
excitationSample.end(), excitationSample.end(),
delayLine.begin(), delayLine.begin(),
[this] (double sample) { return static_cast<float> (amplitude * sample); } ); [this] (double sample) { return static_cast<float> (amplitude * sample); } );
};
}
//============================================================================== //==============================================================================
const double decay = 0.998; const double decay = 0.998;
@@ -160,7 +160,7 @@ private:
Atomic<int> doPluckForNextBuffer; Atomic<int> doPluckForNextBuffer;
std::vector<float> excitationSample, delayLine; std::vector<float> excitationSample, delayLine;
int pos = 0;
size_t pos = 0;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StringSynthesiser) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StringSynthesiser)
}; };
@@ -294,7 +294,7 @@ public:
{ {
memcpy (channelData, memcpy (channelData,
bufferToFill.buffer->getReadPointer (0), bufferToFill.buffer->getReadPointer (0),
bufferToFill.numSamples * sizeof (float));
((size_t) bufferToFill.numSamples) * sizeof (float));
} }
} }
} }


+ 5
- 5
examples/BLOCKS/BlocksDrawingDemo.h View File

@@ -531,7 +531,7 @@ private:
for (uint32 y = 0; y < 15; ++ y) for (uint32 y = 0; y < 15; ++ y)
{ {
canvasProgram->setLED (x, y, Colours::black); canvasProgram->setLED (x, y, Colours::black);
lightpadComponent.setLEDColour (x, y, Colours::black);
lightpadComponent.setLEDColour ((int) x, (int) y, Colours::black);
} }
} }
@@ -554,7 +554,7 @@ private:
if (index >= 0) if (index >= 0)
{ {
canvasProgram->setLED (x0, y0, Colours::black); canvasProgram->setLED (x0, y0, Colours::black);
lightpadComponent.setLEDColour (x0, y0, Colours::black);
lightpadComponent.setLEDColour ((int) x0, (int) y0, Colours::black);
activeLeds.remove (index); activeLeds.remove (index);
} }
@@ -574,7 +574,7 @@ private:
activeLeds.add (led); activeLeds.add (led);
canvasProgram->setLED (led.x, led.y, led.colour.withBrightness (led.brightness)); canvasProgram->setLED (led.x, led.y, led.colour.withBrightness (led.brightness));
lightpadComponent.setLEDColour (led.x, led.y, led.colour.withBrightness (led.brightness));
lightpadComponent.setLEDColour ((int) led.x, (int) led.y, led.colour.withBrightness (led.brightness));
return; return;
} }
@@ -594,7 +594,7 @@ private:
if (canvasProgram != nullptr) if (canvasProgram != nullptr)
canvasProgram->setLED (currentLed.x, currentLed.y, currentLed.colour.withBrightness (currentLed.brightness)); canvasProgram->setLED (currentLed.x, currentLed.y, currentLed.colour.withBrightness (currentLed.brightness));
lightpadComponent.setLEDColour (currentLed.x, currentLed.y, currentLed.colour.withBrightness (currentLed.brightness));
lightpadComponent.setLEDColour ((int) currentLed.x, (int) currentLed.y, currentLed.colour.withBrightness (currentLed.brightness));
activeLeds.set (index, currentLed); activeLeds.set (index, currentLed);
} }
@@ -609,7 +609,7 @@ private:
for (auto led : activeLeds) for (auto led : activeLeds)
{ {
canvasProgram->setLED (led.x, led.y, led.colour.withBrightness (led.brightness)); canvasProgram->setLED (led.x, led.y, led.colour.withBrightness (led.brightness));
lightpadComponent.setLEDColour (led.x, led.y, led.colour.withBrightness (led.brightness));
lightpadComponent.setLEDColour ((int) led.x, (int) led.y, led.colour.withBrightness (led.brightness));
} }
} }
} }


+ 3
- 3
examples/BLOCKS/BlocksSynthDemo.h View File

@@ -160,7 +160,7 @@ struct SineSound : public SynthesiserSound
*/ */
struct SineVoice : public OscillatorBase struct SineVoice : public OscillatorBase
{ {
SineVoice() {};
SineVoice() {}
bool canPlaySound (SynthesiserSound* sound) override { return dynamic_cast<SineSound*> (sound) != nullptr; } bool canPlaySound (SynthesiserSound* sound) override { return dynamic_cast<SineSound*> (sound) != nullptr; }
@@ -191,7 +191,7 @@ struct SquareSound : public SynthesiserSound
*/ */
struct SquareVoice : public OscillatorBase struct SquareVoice : public OscillatorBase
{ {
SquareVoice() {};
SquareVoice() {}
bool canPlaySound (SynthesiserSound* sound) override { return dynamic_cast<SquareSound*> (sound) != nullptr; } bool canPlaySound (SynthesiserSound* sound) override { return dynamic_cast<SquareSound*> (sound) != nullptr; }
@@ -601,7 +601,7 @@ public:
#endif #endif
setSize (600, 400); setSize (600, 400);
};
}
~BlocksSynthDemo() ~BlocksSynthDemo()
{ {


+ 2
- 1
examples/DemoRunner/DemoRunner.jucer View File

@@ -29,7 +29,8 @@
</GROUP> </GROUP>
</MAINGROUP> </MAINGROUP>
<EXPORTFORMATS> <EXPORTFORMATS>
<XCODE_MAC targetFolder="Builds/MacOSX" smallIcon="YyqWd2" bigIcon="YyqWd2">
<XCODE_MAC targetFolder="Builds/MacOSX" smallIcon="YyqWd2" bigIcon="YyqWd2"
extraCompilerFlags="-Wall -Wshadow -Wno-missing-field-initializers -Wshadow -Wshorten-64-to-32 -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wconversion -Wsign-compare -Wint-conversion -Wconditional-uninitialized -Woverloaded-virtual -Wreorder -Wconstant-conversion -Wsign-conversion -Wunused-private-field -Wbool-conversion -Wextra-semi -Wno-ignored-qualifiers -Wunreachable-code">
<CONFIGURATIONS> <CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug"/> <CONFIGURATION isDebug="1" name="Debug"/>
<CONFIGURATION isDebug="0" name="Release"/> <CONFIGURATION isDebug="0" name="Release"/>


+ 2
- 2
examples/DemoRunner/Source/UI/DemoContentComponent.cpp View File

@@ -69,7 +69,7 @@ struct CodeContent : public Component
codeEditor.setScrollbarThickness (8); codeEditor.setScrollbarThickness (8);
lookAndFeelChanged(); lookAndFeelChanged();
};
}
void resized() override void resized() override
{ {
@@ -135,7 +135,7 @@ void DemoContentComponent::setDemo (const String& category, int selectedDemoInde
&& (currentDemoIndex == selectedDemoIndex)) && (currentDemoIndex == selectedDemoIndex))
return; return;
auto demo = JUCEDemos::getCategory (category).demos[selectedDemoIndex];
auto demo = JUCEDemos::getCategory (category).demos[(size_t) selectedDemoIndex];
#if ! (JUCE_ANDROID || JUCE_IOS) #if ! (JUCE_ANDROID || JUCE_IOS)
codeContent->document.replaceAllContent (trimPIP (demo.demoFile.loadFileAsString())); codeContent->document.replaceAllContent (trimPIP (demo.demoFile.loadFileAsString()));


+ 4
- 4
examples/DemoRunner/Source/UI/MainComponent.cpp View File

@@ -170,7 +170,7 @@ public:
if (selectedCategory.isEmpty()) if (selectedCategory.isEmpty())
{ {
if (isPositiveAndBelow (rowNumber, JUCEDemos::getCategories().size())) if (isPositiveAndBelow (rowNumber, JUCEDemos::getCategories().size()))
g.drawFittedText (JUCEDemos::getCategories()[rowNumber].name,
g.drawFittedText (JUCEDemos::getCategories()[(size_t) rowNumber].name,
bounds, Justification::centred, 1); bounds, Justification::centred, 1);
} }
else else
@@ -178,7 +178,7 @@ public:
auto& category = JUCEDemos::getCategory (selectedCategory); auto& category = JUCEDemos::getCategory (selectedCategory);
if (isPositiveAndBelow (rowNumber, category.demos.size())) if (isPositiveAndBelow (rowNumber, category.demos.size()))
g.drawFittedText (category.demos[rowNumber].demoFile.getFileName(),
g.drawFittedText (category.demos[(size_t) rowNumber].demoFile.getFileName(),
bounds, Justification::centred, 1); bounds, Justification::centred, 1);
} }
} }
@@ -191,11 +191,11 @@ public:
void selectedRowsChanged (int row) override void selectedRowsChanged (int row) override
{ {
if (row == -1)
if (row < 0)
return; return;
if (selectedCategory.isEmpty()) if (selectedCategory.isEmpty())
showCategory (JUCEDemos::getCategories()[row].name);
showCategory (JUCEDemos::getCategories()[(size_t) row].name);
else else
demoHolder.setDemo (selectedCategory, row); demoHolder.setDemo (selectedCategory, row);
} }


+ 1
- 1
extras/UnitTestRunner/UnitTestRunner.jucer View File

@@ -9,7 +9,7 @@
</GROUP> </GROUP>
</MAINGROUP> </MAINGROUP>
<EXPORTFORMATS> <EXPORTFORMATS>
<XCODE_MAC targetFolder="Builds/MacOSX" extraCompilerFlags="-Wall -Wshadow -Wstrict-aliasing -Wconversion -Wsign-compare -Woverloaded-virtual -Wextra-semi"
<XCODE_MAC targetFolder="Builds/MacOSX" extraCompilerFlags="-Wall -Wshadow -Wno-missing-field-initializers -Wshadow -Wshorten-64-to-32 -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wconversion -Wsign-compare -Wint-conversion -Wconditional-uninitialized -Woverloaded-virtual -Wreorder -Wconstant-conversion -Wsign-conversion -Wunused-private-field -Wbool-conversion -Wextra-semi -Wno-ignored-qualifiers -Wunreachable-code"
extraDefs=""> extraDefs="">
<CONFIGURATIONS> <CONFIGURATIONS>
<CONFIGURATION name="Debug" osxCompatibility="10.10 SDK" isDebug="1" targetName="UnitTestRunner" <CONFIGURATION name="Debug" osxCompatibility="10.10 SDK" isDebug="1" targetName="UnitTestRunner"


Loading…
Cancel
Save