mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added an option JUCE_ALLOW_STATIC_NULL_VARIABLES that can be used to turn off dangerous statics like String::empty, var::null, etc.
This commit is contained in:
parent
d03755c9e0
commit
9fa0d49be7
145 changed files with 407 additions and 343 deletions
|
|
@ -260,7 +260,7 @@ public:
|
|||
audioSourcePlayer.setSource (&synthAudioSource);
|
||||
|
||||
deviceManager.addAudioCallback (&audioSourcePlayer);
|
||||
deviceManager.addMidiInputCallback (String::empty, &(synthAudioSource.midiCollector));
|
||||
deviceManager.addMidiInputCallback (String(), &(synthAudioSource.midiCollector));
|
||||
|
||||
setOpaque (true);
|
||||
setSize (640, 480);
|
||||
|
|
@ -269,7 +269,7 @@ public:
|
|||
~AudioSynthesiserDemo()
|
||||
{
|
||||
audioSourcePlayer.setSource (nullptr);
|
||||
deviceManager.removeMidiInputCallback (String::empty, &(synthAudioSource.midiCollector));
|
||||
deviceManager.removeMidiInputCallback (String(), &(synthAudioSource.midiCollector));
|
||||
deviceManager.removeAudioCallback (&audioSourcePlayer);
|
||||
deviceManager.removeAudioCallback (&liveAudioDisplayComp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class CodeEditorDemo : public Component,
|
|||
{
|
||||
public:
|
||||
CodeEditorDemo()
|
||||
: fileChooser ("File", File::nonexistent, true, false, false,
|
||||
: fileChooser ("File", File(), true, false, false,
|
||||
"*.cpp;*.h;*.hpp;*.c;*.mm;*.m", String(),
|
||||
"Choose a C++ file to open it in the editor")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ class FontsDemo : public Component,
|
|||
{
|
||||
public:
|
||||
FontsDemo()
|
||||
: heightLabel (String::empty, "Height:"),
|
||||
kerningLabel (String::empty, "Kerning:"),
|
||||
scaleLabel (String::empty, "Scale:"),
|
||||
: heightLabel (String(), "Height:"),
|
||||
kerningLabel (String(), "Kerning:"),
|
||||
scaleLabel (String(), "Scale:"),
|
||||
styleLabel ("Style"),
|
||||
boldToggle ("Bold"),
|
||||
italicToggle ("Italic")
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ class ImagesRenderingDemo : public GraphicsDemoBase
|
|||
{
|
||||
public:
|
||||
ImagesRenderingDemo (ControllersComponent& cc, bool argb_, bool tiled_)
|
||||
: GraphicsDemoBase (cc, String ("Images") + (argb_ ? ": ARGB" : ": RGB") + (tiled_ ? " Tiled" : String::empty )),
|
||||
: GraphicsDemoBase (cc, String ("Images") + (argb_ ? ": ARGB" : ": RGB") + (tiled_ ? " Tiled" : String() )),
|
||||
isArgb (argb_), isTiled (tiled_)
|
||||
{
|
||||
argbImage = ImageFileFormat::loadFrom (BinaryData::juce_icon_png, (size_t) BinaryData::juce_icon_pngSize);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public:
|
|||
File getLastDocumentOpened() override
|
||||
{
|
||||
// not interested in this for now
|
||||
return File::nonexistent;
|
||||
return File();
|
||||
}
|
||||
|
||||
void setLastDocumentOpened (const File& /*file*/) override
|
||||
|
|
|
|||
|
|
@ -836,8 +836,8 @@ struct OpenGLDemoClasses
|
|||
controlsOverlay->statusLabel.setText (statusText, dontSendNotification);
|
||||
|
||||
|
||||
newVertexShader = String::empty;
|
||||
newFragmentShader = String::empty;
|
||||
newVertexShader = String();
|
||||
newFragmentShader = String();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
if (shader != nullptr)
|
||||
{
|
||||
statusLabel.setText (String::empty, dontSendNotification);
|
||||
statusLabel.setText (String(), dontSendNotification);
|
||||
|
||||
shader->fillRect (g.getInternalContext(), getLocalBounds());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ class MovieComponentWithFileBrowser : public Component,
|
|||
public:
|
||||
MovieComponentWithFileBrowser()
|
||||
: isDragOver (false),
|
||||
fileChooser ("movie", File::nonexistent, true, false, false,
|
||||
"*", String::empty, "(choose a video file to play)")
|
||||
fileChooser ("movie", File(), true, false, false,
|
||||
"*", String(), "(choose a video file to play)")
|
||||
{
|
||||
addAndMakeVisible (videoComp);
|
||||
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ private:
|
|||
|
||||
static String::CharPointerType findEndOfFaceToken (String::CharPointerType t) noexcept
|
||||
{
|
||||
return CharacterFunctions::findEndOfToken (t, CharPointer_ASCII ("/ \t"), String::empty.getCharPointer());
|
||||
return CharacterFunctions::findEndOfToken (t, CharPointer_ASCII ("/ \t"), String().getCharPointer());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -453,11 +453,11 @@ class ToolbarDemoComp : public Component,
|
|||
{
|
||||
public:
|
||||
ToolbarDemoComp()
|
||||
: depthLabel (String::empty, "Toolbar depth:"),
|
||||
infoLabel (String::empty, "As well as showing off toolbars, this demo illustrates how to store "
|
||||
"a set of SVG files in a Zip file, embed that in your application, and read "
|
||||
"them back in at runtime.\n\nThe icon images here are taken from the open-source "
|
||||
"Tango icon project."),
|
||||
: depthLabel (String(), "Toolbar depth:"),
|
||||
infoLabel (String(), "As well as showing off toolbars, this demo illustrates how to store "
|
||||
"a set of SVG files in a Zip file, embed that in your application, and read "
|
||||
"them back in at runtime.\n\nThe icon images here are taken from the open-source "
|
||||
"Tango icon project."),
|
||||
orientationButton ("Vertical/Horizontal"),
|
||||
customiseButton ("Customise...")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -356,9 +356,9 @@ private:
|
|||
{
|
||||
switch (type)
|
||||
{
|
||||
case xml: codeDocument.replaceAllContent (BinaryData::treedemo_xml); break;
|
||||
case json: codeDocument.replaceAllContent (BinaryData::juce_module_info); break;
|
||||
default: codeDocument.replaceAllContent (String::empty); break;
|
||||
case xml: codeDocument.replaceAllContent (BinaryData::treedemo_xml); break;
|
||||
case json: codeDocument.replaceAllContent (BinaryData::juce_module_info); break;
|
||||
default: codeDocument.replaceAllContent (String()); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -367,32 +367,32 @@ private:
|
|||
}
|
||||
|
||||
case MainAppWindow::useLookAndFeelV1:
|
||||
result.setInfo ("Use LookAndFeel_V1", String::empty, generalCategory, 0);
|
||||
result.setInfo ("Use LookAndFeel_V1", String(), generalCategory, 0);
|
||||
result.addDefaultKeypress ('i', ModifierKeys::commandModifier);
|
||||
result.setTicked (isLookAndFeelSelected<LookAndFeel_V1>());
|
||||
break;
|
||||
|
||||
case MainAppWindow::useLookAndFeelV2:
|
||||
result.setInfo ("Use LookAndFeel_V2", String::empty, generalCategory, 0);
|
||||
result.setInfo ("Use LookAndFeel_V2", String(), generalCategory, 0);
|
||||
result.addDefaultKeypress ('o', ModifierKeys::commandModifier);
|
||||
result.setTicked (isLookAndFeelSelected<LookAndFeel_V2>());
|
||||
break;
|
||||
|
||||
case MainAppWindow::useLookAndFeelV3:
|
||||
result.setInfo ("Use LookAndFeel_V3", String::empty, generalCategory, 0);
|
||||
result.setInfo ("Use LookAndFeel_V3", String(), generalCategory, 0);
|
||||
result.addDefaultKeypress ('p', ModifierKeys::commandModifier);
|
||||
result.setTicked (isLookAndFeelSelected<LookAndFeel_V3>());
|
||||
break;
|
||||
|
||||
case MainAppWindow::toggleRepaintDebugging:
|
||||
result.setInfo ("Toggle repaint display", String::empty, generalCategory, 0);
|
||||
result.setInfo ("Toggle repaint display", String(), generalCategory, 0);
|
||||
result.addDefaultKeypress ('r', ModifierKeys());
|
||||
result.setTicked (juceDemoRepaintDebuggingActive);
|
||||
break;
|
||||
|
||||
case MainAppWindow::useNativeTitleBar:
|
||||
{
|
||||
result.setInfo ("Use native window title bar", String::empty, generalCategory, 0);
|
||||
result.setInfo ("Use native window title bar", String(), generalCategory, 0);
|
||||
result.addDefaultKeypress ('n', ModifierKeys::commandModifier);
|
||||
bool nativeTitlebar = false;
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ private:
|
|||
|
||||
#if ! JUCE_LINUX
|
||||
case MainAppWindow::goToKioskMode:
|
||||
result.setInfo ("Show full-screen kiosk mode", String::empty, generalCategory, 0);
|
||||
result.setInfo ("Show full-screen kiosk mode", String(), generalCategory, 0);
|
||||
result.addDefaultKeypress ('f', ModifierKeys::commandModifier);
|
||||
result.setTicked (Desktop::getInstance().getKioskModeComponent() != 0);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -50,18 +50,18 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
MPESetupComponent()
|
||||
: masterChannelLabel (String::empty, "Master channel:"),
|
||||
noteChannelsLabel (String::empty, "Nr. of note channels:"),
|
||||
masterPitchbendRangeLabel (String::empty, "Master pitchbend range (semitones):"),
|
||||
notePitchbendRangeLabel (String::empty, "Note pitchbend range (semitones):"),
|
||||
: masterChannelLabel (String(), "Master channel:"),
|
||||
noteChannelsLabel (String(), "Nr. of note channels:"),
|
||||
masterPitchbendRangeLabel (String(), "Master pitchbend range (semitones):"),
|
||||
notePitchbendRangeLabel (String(), "Note pitchbend range (semitones):"),
|
||||
addZoneButton ("Add this zone"),
|
||||
clearAllZonesButton ("Clear all zones"),
|
||||
legacyStartChannelLabel (String::empty, "First channel:"),
|
||||
legacyEndChannelLabel (String::empty, "Last channel:"),
|
||||
legacyPitchbendRangeLabel (String::empty, "Pitchbend range (semitones):"),
|
||||
legacyStartChannelLabel (String(), "First channel:"),
|
||||
legacyEndChannelLabel (String(), "Last channel:"),
|
||||
legacyPitchbendRangeLabel (String(), "Pitchbend range (semitones):"),
|
||||
legacyModeEnabledToggle ("Enable Legacy Mode"),
|
||||
voiceStealingEnabledToggle ("Enable synth voice stealing"),
|
||||
numberOfVoicesLabel (String::empty, "Number of synth voices")
|
||||
numberOfVoicesLabel (String(), "Number of synth voices")
|
||||
{
|
||||
|
||||
initialiseComboBoxWithConsecutiveIntegers (masterChannel, masterChannelLabel, 1, 15, defaultMasterChannel);
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ public:
|
|||
{
|
||||
setLookAndFeel (&lookAndFeel);
|
||||
setSize (880, 720);
|
||||
audioDeviceManager.initialise (0, 2, 0, true, String::empty, 0);
|
||||
audioDeviceManager.addMidiInputCallback(String::empty, this);
|
||||
audioDeviceManager.initialise (0, 2, 0, true, String(), 0);
|
||||
audioDeviceManager.addMidiInputCallback (String(), this);
|
||||
audioDeviceManager.addAudioCallback (this);
|
||||
|
||||
addAndMakeVisible (audioSetupComp);
|
||||
|
|
@ -65,7 +65,7 @@ public:
|
|||
|
||||
~MainComponent()
|
||||
{
|
||||
audioDeviceManager.removeMidiInputCallback (String::empty, this);
|
||||
audioDeviceManager.removeMidiInputCallback (String(), this);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ MainContentComponent::MainContentComponent ()
|
|||
midiMonitor.setScrollbarsShown (true);
|
||||
midiMonitor.setCaretVisible (false);
|
||||
midiMonitor.setPopupMenuEnabled (false);
|
||||
midiMonitor.setText (String::empty);
|
||||
midiMonitor.setText (String());
|
||||
addAndMakeVisible (midiMonitor);
|
||||
|
||||
if (! BluetoothMidiDevicePairingDialogue::isAvailable())
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ private:
|
|||
|
||||
static String::CharPointerType findEndOfFaceToken (String::CharPointerType t) noexcept
|
||||
{
|
||||
return CharacterFunctions::findEndOfToken (t, CharPointer_ASCII ("/ \t"), String::empty.getCharPointer());
|
||||
return CharacterFunctions::findEndOfToken (t, CharPointer_ASCII ("/ \t"), String().getCharPointer());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ public:
|
|||
JuceDemoPluginAudioProcessorEditor::JuceDemoPluginAudioProcessorEditor (JuceDemoPluginAudioProcessor& owner)
|
||||
: AudioProcessorEditor (owner),
|
||||
midiKeyboard (owner.keyboardState, MidiKeyboardComponent::horizontalKeyboard),
|
||||
timecodeDisplayLabel (String::empty),
|
||||
gainLabel (String::empty, "Throughput level:"),
|
||||
delayLabel (String::empty, "Delay:")
|
||||
timecodeDisplayLabel (String()),
|
||||
gainLabel (String(), "Throughput level:"),
|
||||
delayLabel (String(), "Delay:")
|
||||
{
|
||||
// add some sliders..
|
||||
addAndMakeVisible (gainSlider = new ParameterSlider (*owner.gainParam));
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ Result FilterGraph::saveDocument (const File& file)
|
|||
{
|
||||
ScopedPointer<XmlElement> xml (createXml());
|
||||
|
||||
if (! xml->writeToFile (file, String::empty))
|
||||
if (! xml->writeToFile (file, String()))
|
||||
return Result::fail ("Couldn't write to the file");
|
||||
|
||||
return Result::ok();
|
||||
|
|
|
|||
|
|
@ -969,7 +969,7 @@ void GraphEditorPanel::dragConnector (const MouseEvent& e)
|
|||
|
||||
if (draggingConnector != nullptr)
|
||||
{
|
||||
draggingConnector->setTooltip (String::empty);
|
||||
draggingConnector->setTooltip (String());
|
||||
|
||||
int x = e2.x;
|
||||
int y = e2.y;
|
||||
|
|
@ -1013,7 +1013,7 @@ void GraphEditorPanel::endDraggingConnector (const MouseEvent& e)
|
|||
if (draggingConnector == nullptr)
|
||||
return;
|
||||
|
||||
draggingConnector->setTooltip (String::empty);
|
||||
draggingConnector->setTooltip (String());
|
||||
|
||||
const MouseEvent e2 (e.getEventRelativeTo (this));
|
||||
|
||||
|
|
@ -1108,7 +1108,7 @@ GraphDocumentComponent::GraphDocumentComponent (AudioPluginFormatManager& format
|
|||
addAndMakeVisible (statusBar = new TooltipBar());
|
||||
|
||||
deviceManager->addAudioCallback (&graphPlayer);
|
||||
deviceManager->addMidiInputCallback (String::empty, &graphPlayer.getMidiMessageCollector());
|
||||
deviceManager->addMidiInputCallback (String(), &graphPlayer.getMidiMessageCollector());
|
||||
|
||||
graphPanel->updateComponents();
|
||||
}
|
||||
|
|
@ -1143,7 +1143,7 @@ void GraphDocumentComponent::unfocusKeyboardComponent()
|
|||
void GraphDocumentComponent::releaseGraph()
|
||||
{
|
||||
deviceManager->removeAudioCallback (&graphPlayer);
|
||||
deviceManager->removeMidiInputCallback (String::empty, &graphPlayer.getMidiMessageCollector());
|
||||
deviceManager->removeMidiInputCallback (String(), &graphPlayer.getMidiMessageCollector());
|
||||
deviceManager->removeChangeListener (graphPanel);
|
||||
|
||||
deleteAllChildren();
|
||||
|
|
|
|||
|
|
@ -387,12 +387,12 @@ void MainHostWindow::getCommandInfo (const CommandID commandID, ApplicationComma
|
|||
break;
|
||||
|
||||
case CommandIDs::showPluginListEditor:
|
||||
result.setInfo ("Edit the list of available plug-Ins...", String::empty, category, 0);
|
||||
result.setInfo ("Edit the list of available plug-Ins...", String(), category, 0);
|
||||
result.addDefaultKeypress ('p', ModifierKeys::commandModifier);
|
||||
break;
|
||||
|
||||
case CommandIDs::showAudioSettings:
|
||||
result.setInfo ("Change the audio device settings", String::empty, category, 0);
|
||||
result.setInfo ("Change the audio device settings", String(), category, 0);
|
||||
result.addDefaultKeypress ('a', ModifierKeys::commandModifier);
|
||||
break;
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ void MainHostWindow::getCommandInfo (const CommandID commandID, ApplicationComma
|
|||
break;
|
||||
|
||||
case CommandIDs::aboutBox:
|
||||
result.setInfo ("About...", String::empty, category, 0);
|
||||
result.setInfo ("About...", String(), category, 0);
|
||||
break;
|
||||
|
||||
case CommandIDs::allWindowsForward:
|
||||
|
|
@ -437,7 +437,7 @@ bool MainHostWindow::perform (const InvocationInfo& info)
|
|||
|
||||
case CommandIDs::saveAs:
|
||||
if (graphEditor != nullptr && graphEditor->graph != nullptr)
|
||||
graphEditor->graph->saveAs (File::nonexistent, true, true, true);
|
||||
graphEditor->graph->saveAs (File(), true, true, true);
|
||||
break;
|
||||
|
||||
case CommandIDs::showPluginListEditor:
|
||||
|
|
@ -577,6 +577,6 @@ bool MainHostWindow::isDoublePrecisionProcessing()
|
|||
|
||||
void MainHostWindow::updatePrecisionMenuItem (ApplicationCommandInfo& info)
|
||||
{
|
||||
info.setInfo ("Double floating point precision rendering", String::empty, "General", 0);
|
||||
info.setInfo ("Double floating point precision rendering", String(), "General", 0);
|
||||
info.setTicked (isDoublePrecisionProcessing());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue