From 8ed41ed14ba6e07605bbbb2ef6fe6abf3d61ace0 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 27 Mar 2017 13:06:24 +0100 Subject: [PATCH] Fixed some whitespace style and cleaned up some code using C++11 --- .../Application/jucer_GlobalPreferences.cpp | 2 +- .../Application/jucer_OpenDocumentManager.cpp | 2 +- .../Application/jucer_ProjucerLicenses.h | 2 +- .../jucer_AudioPluginFilterTemplate.cpp | 2 +- .../components/jucer_ComponentTypeHandler.cpp | 2 +- .../components/jucer_SliderHandler.h | 6 +- .../components/jucer_TabbedComponentHandler.h | 2 +- .../ComponentEditor/jucer_ComponentLayout.cpp | 4 +- .../paintelements/jucer_ColouredElement.cpp | 2 +- .../paintelements/jucer_FillType.h | 2 +- .../paintelements/jucer_PaintElementImage.h | 2 +- .../properties/jucer_FontPropertyComponent.h | 2 +- .../jucer_ProjectExport_Android.h | 2 +- .../jucer_ProjectExport_CodeBlocks.h | 35 +++++------ .../Project Saving/jucer_ProjectExport_MSVC.h | 60 +++++++++---------- .../Project Saving/jucer_ProjectExport_Make.h | 32 +++++----- .../jucer_ProjectExport_XCode.h | 12 ++-- .../Project Saving/jucer_ProjectExporter.cpp | 2 +- .../Project Saving/jucer_ProjectExporter.h | 2 +- .../Source/Project/jucer_ConfigTree_Base.h | 2 +- .../Projucer/Source/Project/jucer_Module.cpp | 13 ++-- .../Projucer/Source/Project/jucer_Project.cpp | 4 +- .../Source/Project/jucer_ProjectTree_Base.h | 2 +- .../Source/Utility/jucer_StoredSettings.cpp | 6 +- .../midi/juce_MidiMessage.cpp | 2 +- .../audio_io/juce_AudioDeviceManager.cpp | 4 +- .../native/juce_android_Midi.cpp | 6 +- .../native/juce_android_OpenSL.cpp | 8 +-- .../native/juce_linux_Midi.cpp | 10 ++-- .../native/juce_mac_CoreAudio.cpp | 2 +- .../native/juce_win32_DirectSound.cpp | 4 +- .../native/juce_win32_Midi.cpp | 2 +- .../codecs/juce_MP3AudioFormat.cpp | 6 +- .../format/juce_AudioFormat.cpp | 2 +- .../Standalone/juce_StandaloneFilterWindow.h | 2 +- .../VST3/juce_VST3_Wrapper.cpp | 2 +- .../juce_AudioUnitPluginFormat.mm | 10 ++-- .../format_types/juce_LADSPAPluginFormat.cpp | 10 ++-- .../format_types/juce_VST3PluginFormat.cpp | 4 +- .../format_types/juce_VSTPluginFormat.cpp | 8 +-- .../processors/juce_AudioProcessor.cpp | 34 +++++------ .../processors/juce_AudioProcessorGraph.cpp | 4 +- .../processors/juce_AudioProcessorGraph.h | 2 +- .../gui/juce_MidiKeyboardComponent.cpp | 2 +- ...oid_BluetoothMidiDevicePairingDialogue.cpp | 2 +- .../native/juce_mac_AudioCDBurner.mm | 2 +- .../players/juce_SoundPlayer.h | 2 +- .../containers/juce_DynamicObject.cpp | 6 +- .../containers/juce_ListenerList.cpp | 2 +- modules/juce_core/containers/juce_Variant.cpp | 34 +++++------ modules/juce_core/files/juce_File.cpp | 6 +- modules/juce_core/javascript/juce_JSON.cpp | 4 +- .../juce_core/javascript/juce_Javascript.cpp | 6 +- modules/juce_core/maths/juce_BigInteger.cpp | 2 +- modules/juce_core/maths/juce_Expression.cpp | 4 +- .../juce_core/native/juce_android_Files.cpp | 2 +- .../native/juce_android_SystemStats.cpp | 4 +- .../juce_core/native/juce_curl_Network.cpp | 4 +- modules/juce_core/native/juce_linux_Files.cpp | 2 +- .../juce_core/native/juce_linux_Network.cpp | 6 +- .../native/juce_linux_SystemStats.cpp | 4 +- modules/juce_core/native/juce_mac_Files.mm | 2 +- modules/juce_core/native/juce_mac_Network.mm | 2 +- modules/juce_core/native/juce_mac_Strings.mm | 2 +- .../juce_core/native/juce_posix_SharedCode.h | 2 +- .../juce_core/native/juce_win32_Network.cpp | 2 +- .../native/juce_win32_SystemStats.cpp | 2 +- modules/juce_core/network/juce_URL.cpp | 2 +- modules/juce_core/network/juce_URL.h | 8 +-- modules/juce_core/text/juce_String.cpp | 28 ++++----- modules/juce_core/text/juce_StringArray.cpp | 4 +- modules/juce_core/text/juce_StringPool.cpp | 8 +-- modules/juce_core/time/juce_Time.cpp | 18 +++--- modules/juce_core/xml/juce_XmlDocument.cpp | 2 +- .../undomanager/juce_UndoManager.cpp | 14 ++--- .../juce_InterprocessConnection.cpp | 2 +- .../messages/juce_ApplicationBase.cpp | 4 +- .../native/juce_linux_Messaging.cpp | 2 +- .../juce_graphics/native/juce_win32_Fonts.cpp | 4 +- .../juce_ApplicationCommandManager.cpp | 26 ++++---- .../drawables/juce_SVGParser.cpp | 4 +- .../native/juce_win32_Windowing.cpp | 2 +- .../juce_gui_basics/widgets/juce_ComboBox.cpp | 8 +-- .../juce_gui_basics/widgets/juce_ListBox.cpp | 6 +- .../widgets/juce_TableHeaderComponent.cpp | 6 +- .../widgets/juce_TableListBox.cpp | 8 +-- .../widgets/juce_TextEditor.cpp | 6 +- .../juce_gui_basics/widgets/juce_TreeView.cpp | 6 +- .../windows/juce_AlertWindow.cpp | 4 +- .../windows/juce_TooltipWindow.cpp | 4 +- .../code_editor/juce_CodeDocument.cpp | 16 ++--- .../native/juce_mac_WebBrowserComponent.mm | 2 +- .../juce_opengl/opengl/juce_OpenGLContext.cpp | 2 +- modules/juce_osc/osc/juce_OSCArgument.cpp | 2 +- .../native/juce_android_CameraDevice.cpp | 2 +- 95 files changed, 310 insertions(+), 320 deletions(-) diff --git a/extras/Projucer/Source/Application/jucer_GlobalPreferences.cpp b/extras/Projucer/Source/Application/jucer_GlobalPreferences.cpp index 7624506e3c..c1aec66331 100644 --- a/extras/Projucer/Source/Application/jucer_GlobalPreferences.cpp +++ b/extras/Projucer/Source/Application/jucer_GlobalPreferences.cpp @@ -77,7 +77,7 @@ Identifier PathSettingsTab::getKeyForPropertyComponent (TextPropertyComponent* c // this property component does not have a key associated to it! jassertfalse; - return String(); + return {}; } Component* PathSettingsTab::getContent() diff --git a/extras/Projucer/Source/Application/jucer_OpenDocumentManager.cpp b/extras/Projucer/Source/Application/jucer_OpenDocumentManager.cpp index bbc46d09dc..4046a23e04 100644 --- a/extras/Projucer/Source/Application/jucer_OpenDocumentManager.cpp +++ b/extras/Projucer/Source/Application/jucer_OpenDocumentManager.cpp @@ -62,7 +62,7 @@ public: Component* createEditor() override { return new ItemPreviewComponent (file); } Component* createViewer() override { return createEditor(); } void fileHasBeenRenamed (const File& newFile) override { file = newFile; } - String getState() const override { return String(); } + String getState() const override { return {}; } void restoreState (const String&) override {} String getType() const override diff --git a/extras/Projucer/Source/Application/jucer_ProjucerLicenses.h b/extras/Projucer/Source/Application/jucer_ProjucerLicenses.h index 05b612be26..7af883d898 100644 --- a/extras/Projucer/Source/Application/jucer_ProjucerLicenses.h +++ b/extras/Projucer/Source/Application/jucer_ProjucerLicenses.h @@ -87,7 +87,7 @@ struct ProjucerLicenses : private DeletedAtShutdown return String::fromUTF8 (name); } - return String(); + return {}; } bool isDLLPresent() const diff --git a/extras/Projucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.cpp b/extras/Projucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.cpp index 04345cfcf1..fe3c9051e3 100644 --- a/extras/Projucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.cpp +++ b/extras/Projucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.cpp @@ -76,7 +76,7 @@ void FILTERCLASSNAME::setCurrentProgram (int index) const String FILTERCLASSNAME::getProgramName (int index) { - return String(); + return {}; } void FILTERCLASSNAME::changeProgramName (int index, const String& newName) diff --git a/extras/Projucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp b/extras/Projucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp index 16bdedeebe..5581ef416d 100644 --- a/extras/Projucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp +++ b/extras/Projucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp @@ -523,7 +523,7 @@ void ComponentTypeHandler::fillInResizeCode (GeneratedCode& code, Component* com String ComponentTypeHandler::getCreationParameters (GeneratedCode&, Component*) { - return String(); + return {}; } void ComponentTypeHandler::fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) diff --git a/extras/Projucer/Source/ComponentEditor/components/jucer_SliderHandler.h b/extras/Projucer/Source/ComponentEditor/components/jucer_SliderHandler.h index 3603985073..9a31fe024d 100644 --- a/extras/Projucer/Source/ComponentEditor/components/jucer_SliderHandler.h +++ b/extras/Projucer/Source/ComponentEditor/components/jucer_SliderHandler.h @@ -546,7 +546,7 @@ private: default: jassertfalse; break; } - return String(); + return {}; } private: @@ -660,7 +660,7 @@ private: default: jassertfalse; break; } - return String(); + return {}; } static Slider::SliderStyle sliderStringToStyle (const String& s) @@ -685,7 +685,7 @@ private: default: jassertfalse; break; } - return String(); + return {}; } static Slider::TextEntryBoxPosition stringToTextBoxPos (const String& s) diff --git a/extras/Projucer/Source/ComponentEditor/components/jucer_TabbedComponentHandler.h b/extras/Projucer/Source/ComponentEditor/components/jucer_TabbedComponentHandler.h index 399a35890c..48a306e55d 100644 --- a/extras/Projucer/Source/ComponentEditor/components/jucer_TabbedComponentHandler.h +++ b/extras/Projucer/Source/ComponentEditor/components/jucer_TabbedComponentHandler.h @@ -147,7 +147,7 @@ public: default: jassertfalse; break; } - return String(); + return {}; } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) diff --git a/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.cpp b/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.cpp index 77d349caf9..8014b0f414 100644 --- a/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.cpp +++ b/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.cpp @@ -715,7 +715,7 @@ void ComponentLayout::fillInGeneratedCode (GeneratedCode& code) const String ComponentLayout::getComponentMemberVariableName (Component* comp) const { if (comp == nullptr) - return String(); + return {}; String name (comp->getProperties() ["memberName"].toString()); @@ -775,7 +775,7 @@ String ComponentLayout::getUnusedMemberName (String nameRoot, Component* comp) c String ComponentLayout::getComponentVirtualClassName (Component* comp) const { if (comp == nullptr) - return String(); + return {}; return comp->getProperties() ["virtualName"]; } diff --git a/extras/Projucer/Source/ComponentEditor/paintelements/jucer_ColouredElement.cpp b/extras/Projucer/Source/ComponentEditor/paintelements/jucer_ColouredElement.cpp index 0e65f2cd10..2eb02d2009 100644 --- a/extras/Projucer/Source/ComponentEditor/paintelements/jucer_ColouredElement.cpp +++ b/extras/Projucer/Source/ComponentEditor/paintelements/jucer_ColouredElement.cpp @@ -377,7 +377,7 @@ public: String getResource() const { if (element == nullptr) - return String(); + return {}; if (isForStroke) return element->getStrokeType().fill.imageResourceName; diff --git a/extras/Projucer/Source/ComponentEditor/paintelements/jucer_FillType.h b/extras/Projucer/Source/ComponentEditor/paintelements/jucer_FillType.h index c8cad69bb9..56ec491775 100644 --- a/extras/Projucer/Source/ComponentEditor/paintelements/jucer_FillType.h +++ b/extras/Projucer/Source/ComponentEditor/paintelements/jucer_FillType.h @@ -201,7 +201,7 @@ public: break; } - return String(); + return {}; } void restoreFromString (const String& s) diff --git a/extras/Projucer/Source/ComponentEditor/paintelements/jucer_PaintElementImage.h b/extras/Projucer/Source/ComponentEditor/paintelements/jucer_PaintElementImage.h index 4dac2ca917..5470db3880 100644 --- a/extras/Projucer/Source/ComponentEditor/paintelements/jucer_PaintElementImage.h +++ b/extras/Projucer/Source/ComponentEditor/paintelements/jucer_PaintElementImage.h @@ -404,7 +404,7 @@ private: if (element != nullptr) return element->getResource(); - return String(); + return {}; } }; diff --git a/extras/Projucer/Source/ComponentEditor/properties/jucer_FontPropertyComponent.h b/extras/Projucer/Source/ComponentEditor/properties/jucer_FontPropertyComponent.h index bd406ff641..180cbc392b 100644 --- a/extras/Projucer/Source/ComponentEditor/properties/jucer_FontPropertyComponent.h +++ b/extras/Projucer/Source/ComponentEditor/properties/jucer_FontPropertyComponent.h @@ -94,7 +94,7 @@ public: static String getTypefaceNameCode (const String& typefaceName) { - if (typefaceName == getDefaultFont()) return String(); + if (typefaceName == getDefaultFont()) return {}; if (typefaceName == getDefaultSans()) return "Font::getDefaultSansSerifFontName(), "; if (typefaceName == getDefaultSerif()) return "Font::getDefaultSerifFontName(), "; if (typefaceName == getDefaultMono()) return "Font::getDefaultMonospacedFontName(), "; diff --git a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_Android.h b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_Android.h index 5702eaec64..ca3666c909 100644 --- a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_Android.h +++ b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_Android.h @@ -488,7 +488,7 @@ private: } //============================================================================== - String getAppBuildGradleFileContent () const + String getAppBuildGradleFileContent() const { MemoryOutputStream mo; mo << "apply plugin: 'com.android." << (isLibrary() ? "library" : "application") << "'" << newLine << newLine; diff --git a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h index 44c191fa6c..77346df982 100644 --- a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h +++ b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h @@ -214,7 +214,7 @@ private: Array (archFlags, numElementsInArray (archFlags)))); } - String getLibrarySubdirPath () const override + String getLibrarySubdirPath() const override { const String archFlag = getArchitectureTypeVar(); @@ -227,7 +227,7 @@ private: return "/i386"; jassertfalse; - return String(); + return {}; } }; @@ -254,38 +254,35 @@ private: String getTargetSuffix() const { - const ProjectType::Target::TargetFileType fileType = getTargetFileType(); + auto fileType = getTargetFileType(); switch (fileType) { - case executable: - return ""; - case staticLibrary: - return ".a"; - case sharedLibraryOrDLL: - return ".so"; + case executable: return {}; + case staticLibrary: return ".a"; + case sharedLibraryOrDLL: return ".so"; + case pluginBundle: switch (type) - { - case VST3PlugIn: - return ".vst3"; - case VSTPlugIn: - return ".so"; - default: - break; - } + { + case VST3PlugIn: return ".vst3"; + case VSTPlugIn: return ".so"; + default: break; + } return ".so"; + default: break; } - return String(); + return {}; } bool isDynamicLibrary() const { - return (type == DynamicLibrary || type == VST3PlugIn || type == VSTPlugIn || type == AAXPlugIn); + return (type == DynamicLibrary || type == VST3PlugIn + || type == VSTPlugIn || type == AAXPlugIn); } }; diff --git a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_MSVC.h index b109772ec7..7e817a50ce 100644 --- a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_MSVC.h @@ -163,10 +163,11 @@ public: } } - String getLibrarySubdirPath () const override + String getLibrarySubdirPath() const override { - auto result = String ("$(Platform)\\"); + String result ("$(Platform)\\"); result += isUsingRuntimeLibDLL() ? "MD" : "MT"; + if (isDebug()) result += "d"; @@ -246,31 +247,26 @@ public: switch (fileType) { - case executable: - return ".exe"; - case staticLibrary: - return ".lib"; - case sharedLibraryOrDLL: - return ".dll"; - case pluginBundle: - switch (type) - { - case VST3PlugIn: - return ".vst3"; - case AAXPlugIn: - return ".aaxdll"; - case RTASPlugIn: - return ".dpm"; + case executable: return ".exe"; + case staticLibrary: return ".lib"; + case sharedLibraryOrDLL: return ".dll"; + + case pluginBundle: + switch (type) + { + case VST3PlugIn: return ".vst3"; + case AAXPlugIn: return ".aaxdll"; + case RTASPlugIn: return ".dpm"; + default: break; + } + + return ".dll"; + default: break; - } - - return ".dll"; - default: - break; } - return String(); + return {}; } XmlElement* createToolElement (XmlElement& parent, const String& toolName) const @@ -350,7 +346,7 @@ public: createRebasedPath (bundleScript) + String (" \"") + macOSDir + String ("\" ") + createRebasedPath (iconFilePath); } - return String(); + return {}; } String getExtraPreBuildSteps (const MSVCBuildConfiguration& config) const @@ -372,7 +368,7 @@ public: return script; } - return String(); + return {}; } String getPostBuildSteps (const MSVCBuildConfiguration& config) const @@ -418,9 +414,10 @@ public: String getExtraLinkerFlags() const { - if (type == RTASPlugIn) return "/FORCE:multiple"; + if (type == RTASPlugIn) + return "/FORCE:multiple"; - return String(); + return {}; } StringArray getExtraSearchPaths() const @@ -533,7 +530,7 @@ public: RelativePath::buildTargetFolder).toWindowsStyle()); } - return String(); + return {}; } bool shouldUseRuntimeDLL (const MSVCBuildConfiguration& config) const @@ -748,7 +745,7 @@ protected: if (target->type == ProjectType::Target::SharedCodeTarget) return target->getProjectGuid(); - return String(); + return {}; } //============================================================================== @@ -1067,9 +1064,10 @@ protected: return path.getFileNameWithoutExtension().startsWithIgnoreCase ("juce_audio_plugin_client_RTAS_"); } - StringArray getModuleLibs () const + StringArray getModuleLibs() const { StringArray result; + for (auto& lib : windowsLibs) result.add (lib + ".lib"); @@ -1487,7 +1485,7 @@ public: Value getPlatformToolsetValue() { return getSetting (Ids::toolset); } Value getIPPLibraryValue() { return getSetting (Ids::IPPLibrary); } String getIPPLibrary() const { return settings [Ids::IPPLibrary]; } - virtual String getCppLanguageStandard() const { return String(); } + virtual String getCppLanguageStandard() const { return {}; } String getPlatformToolset() const { diff --git a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_Make.h b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_Make.h index 61e9a9d810..632ed770b9 100644 --- a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_Make.h +++ b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_Make.h @@ -51,19 +51,21 @@ protected: Array (archFlags, numElementsInArray (archFlags)))); } - String getLibrarySubdirPath () const override + String getLibrarySubdirPath() const override { - const String archFlag = getArchitectureTypeVar(); + String archFlag = getArchitectureTypeVar(); + String prefix ("-march="); - const auto prefix = String ("-march="); if (archFlag.startsWith (prefix)) return archFlag.substring (prefix.length()); - else if (archFlag == "-m64") + + if (archFlag == "-m64") return "x86_64"; - else if (archFlag == "-m32") + + if (archFlag == "-m32") return "i386"; - else - return "$(shell uname -m)"; + + return "$(shell uname -m)"; } }; @@ -86,7 +88,7 @@ public: if (type == AggregateTarget) // the aggregate target should not specify any settings at all! // it just defines dependencies on the other targets. - return StringArray(); + return {}; StringPairArray commonOptions = owner.getAllPreprocessorDefs (config, ProjectType::Target::unspecified); StringPairArray targetSpecific = owner.getAllPreprocessorDefs (config, type); @@ -140,17 +142,13 @@ public: { switch (type) { - case VSTPlugIn: - return ".so"; - case VST3PlugIn: - return ".vst3"; - case SharedCodeTarget: - return ".a"; - default: - break; + case VSTPlugIn: return ".so"; + case VST3PlugIn: return ".vst3"; + case SharedCodeTarget: return ".a"; + default: break; } - return String(); + return {}; } String getTargetVarName() const diff --git a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_XCode.h index e48dba8179..69b4253b31 100644 --- a/extras/Projucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Projucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -445,7 +445,7 @@ protected: "Enable this to strip any locally defined symbols resulting in a smaller binary size. Enabling this will also remove any function names from crash logs. Must be disabled for static library projects."); } - String getLibrarySubdirPath () const override + String getLibrarySubdirPath() const override { return "${CURRENT_ARCH}"; } @@ -779,7 +779,7 @@ public: if (type == AggregateTarget) // the aggregate target should not specify any settings at all! // it just defines dependencies on the other targets. - return StringArray(); + return {}; StringArray s; @@ -979,7 +979,7 @@ public: case RTASPlugIn: return config.rtasBinaryLocation.get(); case AAXPlugIn: return config.aaxBinaryLocation.get(); case SharedCodeTarget: return owner.isiOS() ? "@executable_path/Frameworks" : "@executable_path/../Frameworks"; - default: return String(); + default: return {}; } } @@ -2240,7 +2240,7 @@ private: } } - return String(); + return {}; } String getEntitlementsFileName() const @@ -2328,7 +2328,7 @@ private: xcodeTarget); } - return String(); + return {}; } String addFramework (const String& frameworkName) const @@ -2475,7 +2475,7 @@ private: } } - return StringArray(); + return {}; } StringArray getNamesOfTargets() const diff --git a/extras/Projucer/Source/Project Saving/jucer_ProjectExporter.cpp b/extras/Projucer/Source/Project Saving/jucer_ProjectExporter.cpp index 944841c10c..69c9c6fb6f 100644 --- a/extras/Projucer/Source/Project Saving/jucer_ProjectExporter.cpp +++ b/extras/Projucer/Source/Project Saving/jucer_ProjectExporter.cpp @@ -873,5 +873,5 @@ String ProjectExporter::getExternalLibraryFlags (const BuildConfiguration& confi if (libraries.size() != 0) return replacePreprocessorTokens (config, "-l" + libraries.joinIntoString (" -l")).trim(); - return String(); + return {}; } diff --git a/extras/Projucer/Source/Project Saving/jucer_ProjectExporter.h b/extras/Projucer/Source/Project Saving/jucer_ProjectExporter.h index aae2f33055..a9ae5970b3 100644 --- a/extras/Projucer/Source/Project Saving/jucer_ProjectExporter.h +++ b/extras/Projucer/Source/Project Saving/jucer_ProjectExporter.h @@ -218,7 +218,7 @@ public: //============================================================================== virtual void createConfigProperties (PropertyListBuilder&) = 0; virtual var getDefaultOptimisationLevel() const = 0; - virtual String getLibrarySubdirPath() const { return String(); } + virtual String getLibrarySubdirPath() const { return {}; } //============================================================================== diff --git a/extras/Projucer/Source/Project/jucer_ConfigTree_Base.h b/extras/Projucer/Source/Project/jucer_ConfigTree_Base.h index 7e787b29a9..5035091a43 100644 --- a/extras/Projucer/Source/Project/jucer_ConfigTree_Base.h +++ b/extras/Projucer/Source/Project/jucer_ConfigTree_Base.h @@ -137,7 +137,7 @@ private: c = c->getParentComponent(); } - return String(); + return {}; } }; diff --git a/extras/Projucer/Source/Project/jucer_Module.cpp b/extras/Projucer/Source/Project/jucer_Module.cpp index b2f6b697b1..dee2d89096 100644 --- a/extras/Projucer/Source/Project/jucer_Module.cpp +++ b/extras/Projucer/Source/Project/jucer_Module.cpp @@ -81,7 +81,7 @@ static var parseModuleDesc (const File& header) } } - return var(); + return {}; } ModuleDescription::ModuleDescription (const File& folder) @@ -135,13 +135,9 @@ ModuleList& ModuleList::operator= (const ModuleList& other) const ModuleDescription* ModuleList::getModuleWithID (const String& moduleID) const { - for (int i = 0; i < modules.size(); ++i) - { - ModuleDescription* m = modules.getUnchecked(i); - + for (auto* m : modules) if (m->getID() == moduleID) return m; - } return nullptr; } @@ -164,8 +160,8 @@ StringArray ModuleList::getIDs() const { StringArray results; - for (int i = 0; i < modules.size(); ++i) - results.add (modules.getUnchecked(i)->getID()); + for (auto* m : modules) + results.add (m->getID()); results.sort (true); return results; @@ -174,6 +170,7 @@ StringArray ModuleList::getIDs() const Result ModuleList::tryToAddModuleFromFolder (const File& path) { ModuleDescription m (path); + if (m.isValid()) { modules.add (new ModuleDescription (m)); diff --git a/extras/Projucer/Source/Project/jucer_Project.cpp b/extras/Projucer/Source/Project/jucer_Project.cpp index 042b19c7d8..191a699735 100644 --- a/extras/Projucer/Source/Project/jucer_Project.cpp +++ b/extras/Projucer/Source/Project/jucer_Project.cpp @@ -855,7 +855,7 @@ String Project::Item::getFilePath() const if (isFile()) return state [Ids::file].toString(); - return String(); + return {}; } File Project::Item::getFile() const @@ -1363,7 +1363,7 @@ String Project::getFileTemplate (const String& templateName) return String::fromUTF8 (data, dataSize); jassertfalse; - return String(); + return {}; } diff --git a/extras/Projucer/Source/Project/jucer_ProjectTree_Base.h b/extras/Projucer/Source/Project/jucer_ProjectTree_Base.h index 1ae766516f..392cf34631 100644 --- a/extras/Projucer/Source/Project/jucer_ProjectTree_Base.h +++ b/extras/Projucer/Source/Project/jucer_ProjectTree_Base.h @@ -235,7 +235,7 @@ public: bool mightContainSubItems() override { return item.getNumChildren() > 0; } String getUniqueName() const override { jassert (item.getID().isNotEmpty()); return item.getID(); } bool canBeSelected() const override { return true; } - String getTooltip() override { return String(); } + String getTooltip() override { return {}; } File getDraggableFile() const override { return getFile(); } var getDragSourceDescription() override diff --git a/extras/Projucer/Source/Utility/jucer_StoredSettings.cpp b/extras/Projucer/Source/Utility/jucer_StoredSettings.cpp index 8c2163d2e7..af5a428c9a 100644 --- a/extras/Projucer/Source/Utility/jucer_StoredSettings.cpp +++ b/extras/Projucer/Source/Utility/jucer_StoredSettings.cpp @@ -251,7 +251,7 @@ String StoredSettings::getFallbackPath (const Identifier& key, DependencyPathOS // no RTAS on this OS! jassertfalse; - return String(); + return {}; } if (key == Ids::aaxPath) @@ -261,7 +261,7 @@ String StoredSettings::getFallbackPath (const Identifier& key, DependencyPathOS // no AAX on this OS! jassertfalse; - return String(); + return {}; } if (key == Ids::androidSDKPath) @@ -272,7 +272,7 @@ String StoredSettings::getFallbackPath (const Identifier& key, DependencyPathOS // didn't recognise the key provided! jassertfalse; - return String(); + return {}; } bool StoredSettings::isGlobalPathValid (const File& relativeTo, const Identifier& key, const String& path) diff --git a/modules/juce_audio_basics/midi/juce_MidiMessage.cpp b/modules/juce_audio_basics/midi/juce_MidiMessage.cpp index d077f7be91..e406bc985e 100644 --- a/modules/juce_audio_basics/midi/juce_MidiMessage.cpp +++ b/modules/juce_audio_basics/midi/juce_MidiMessage.cpp @@ -1023,7 +1023,7 @@ String MidiMessage::getMidiNoteName (int note, bool useSharps, bool includeOctav return s; } - return String(); + return {}; } double MidiMessage::getMidiNoteInHertz (const int noteNumber, const double frequencyOfA) noexcept diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp index 450d99d165..b8ee5a65df 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp @@ -442,7 +442,7 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup jassert (&newSetup != ¤tSetup); // this will have no effect if (newSetup == currentSetup && currentAudioDevice != nullptr) - return String(); + return {}; if (! (newSetup == currentSetup)) sendChangeMessage(); @@ -462,7 +462,7 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup if (treatAsChosenDevice) updateXml(); - return String(); + return {}; } if (currentSetup.inputDeviceName != newInputDeviceName diff --git a/modules/juce_audio_devices/native/juce_android_Midi.cpp b/modules/juce_audio_devices/native/juce_android_Midi.cpp index 392a0bfb69..067c82b687 100644 --- a/modules/juce_audio_devices/native/juce_android_Midi.cpp +++ b/modules/juce_audio_devices/native/juce_android_Midi.cpp @@ -172,7 +172,7 @@ public: return juceString (string); } - return String(); + return {}; } String getOutputPortNameForJuceIndex (int idx) @@ -183,7 +183,7 @@ public: return juceString (string); } - return String(); + return {}; } StringArray getDevices (bool input) @@ -200,7 +200,7 @@ public: return javaStringArrayToJuce (devices); } - return StringArray(); + return {}; } AndroidMidiInput* openMidiInputPortWithIndex (int idx, MidiInput* juceMidiInput, juce::MidiInputCallback* callback) diff --git a/modules/juce_audio_devices/native/juce_android_OpenSL.cpp b/modules/juce_audio_devices/native/juce_android_OpenSL.cpp index f0eddfe319..9609f40d11 100644 --- a/modules/juce_audio_devices/native/juce_android_OpenSL.cpp +++ b/modules/juce_audio_devices/native/juce_android_OpenSL.cpp @@ -78,7 +78,7 @@ class SlObjectRef { public: //============================================================================== - SlObjectRef () noexcept {} + SlObjectRef() noexcept {} SlObjectRef (const SlObjectRef& obj) noexcept : cb (obj.cb) {} SlObjectRef (SlObjectRef&& obj) noexcept : cb (static_cast&&> (obj.cb)) { obj.cb = nullptr; } explicit SlObjectRef (SLObjectItf o) : cb (new ControlBlock (o)) {} @@ -108,7 +108,7 @@ class SlRef : public SlObjectRef { public: //============================================================================== - SlRef () noexcept : type (nullptr) {} + SlRef() noexcept : type (nullptr) {} SlRef (SlRef& r) noexcept : SlObjectRef (r), type (r.type) {} SlRef (SlRef&& r) noexcept : SlObjectRef (static_cast (r)), type (r.type) { r.type = nullptr; } @@ -315,7 +315,7 @@ public: (*queue)->Clear (queue); } - void enqueueBuffer () + void enqueueBuffer() { (*queue)->Enqueue (queue, getCurrentBuffer(), static_cast (getBufferSizeInSamples() * sizeof (T))); ++numBlocksOut; @@ -986,7 +986,7 @@ private: if (text.get() != 0) return juceString (text); - return String(); + return {}; } static bool androidHasSystemFeature (const String& property) diff --git a/modules/juce_audio_devices/native/juce_linux_Midi.cpp b/modules/juce_audio_devices/native/juce_linux_Midi.cpp index c027786193..62855050cd 100644 --- a/modules/juce_audio_devices/native/juce_linux_Midi.cpp +++ b/modules/juce_audio_devices/native/juce_linux_Midi.cpp @@ -212,7 +212,7 @@ public: return instance; } - void registerCallback () + void registerCallback() { if (inputThread == nullptr) inputThread = new MidiInputThread (*this); @@ -221,7 +221,7 @@ public: inputThread->startThread(); } - void unregisterCallback () + void unregisterCallback() { jassert (activeCallbacks.get() > 0); if (--activeCallbacks == 0 && inputThread->isThreadRunning()) @@ -273,7 +273,7 @@ private: friend class ReferenceCountedObjectPtr; friend struct ContainerDeletePolicy; - AlsaClient () + AlsaClient() : handle (nullptr), inputThread (nullptr) { @@ -601,7 +601,7 @@ MidiInput* MidiInput::createNewDevice (const String& deviceName, MidiInputCallba // (These are just stub functions if ALSA is unavailable...) -StringArray MidiOutput::getDevices() { return StringArray(); } +StringArray MidiOutput::getDevices() { return {}; } int MidiOutput::getDefaultDeviceIndex() { return 0; } MidiOutput* MidiOutput::openDevice (int) { return nullptr; } MidiOutput* MidiOutput::createNewDevice (const String&) { return nullptr; } @@ -613,7 +613,7 @@ MidiInput::~MidiInput() {} void MidiInput::start() {} void MidiInput::stop() {} int MidiInput::getDefaultDeviceIndex() { return 0; } -StringArray MidiInput::getDevices() { return StringArray(); } +StringArray MidiInput::getDevices() { return {}; } MidiInput* MidiInput::openDevice (int, MidiInputCallback*) { return nullptr; } MidiInput* MidiInput::createNewDevice (const String&, MidiInputCallback*) { return nullptr; } diff --git a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp index 0d00e75b06..693af99425 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp +++ b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp @@ -1284,7 +1284,7 @@ public: fifos.clear(); startThread (9); - return String(); + return {}; } void close() override diff --git a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp index 4b09c943f4..0a11eb2fed 100644 --- a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp +++ b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp @@ -358,7 +358,7 @@ public: hr = pOutputBuffer->Play (0, 0, 1 /* DSBPLAY_LOOPING */); if (SUCCEEDED (hr)) - return String(); + return {}; } } } @@ -601,7 +601,7 @@ public: hr = pInputBuffer->Start (1 /* DSCBSTART_LOOPING */); if (SUCCEEDED (hr)) - return String(); + return {}; } } diff --git a/modules/juce_audio_devices/native/juce_win32_Midi.cpp b/modules/juce_audio_devices/native/juce_win32_Midi.cpp index f133a1764b..f89aac6d2a 100644 --- a/modules/juce_audio_devices/native/juce_win32_Midi.cpp +++ b/modules/juce_audio_devices/native/juce_win32_Midi.cpp @@ -42,7 +42,7 @@ struct MidiServiceType struct OutputWrapper { - virtual ~OutputWrapper () {} + virtual ~OutputWrapper() {} virtual String getDeviceName() = 0; diff --git a/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp index 680933a0cd..2634aba8d6 100644 --- a/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp @@ -3131,12 +3131,12 @@ private: MP3AudioFormat::MP3AudioFormat() : AudioFormat (MP3Decoder::mp3FormatName, ".mp3") {} MP3AudioFormat::~MP3AudioFormat() {} -Array MP3AudioFormat::getPossibleSampleRates() { return Array(); } -Array MP3AudioFormat::getPossibleBitDepths() { return Array(); } +Array MP3AudioFormat::getPossibleSampleRates() { return {}; } +Array MP3AudioFormat::getPossibleBitDepths() { return {}; } bool MP3AudioFormat::canDoStereo() { return true; } bool MP3AudioFormat::canDoMono() { return true; } bool MP3AudioFormat::isCompressed() { return true; } -StringArray MP3AudioFormat::getQualityOptions() { return StringArray(); } +StringArray MP3AudioFormat::getQualityOptions() { return {}; } AudioFormatReader* MP3AudioFormat::createReaderFor (InputStream* sourceStream, const bool deleteStreamIfOpeningFails) { diff --git a/modules/juce_audio_formats/format/juce_AudioFormat.cpp b/modules/juce_audio_formats/format/juce_AudioFormat.cpp index 0bbc6e5209..df0a2bf427 100644 --- a/modules/juce_audio_formats/format/juce_AudioFormat.cpp +++ b/modules/juce_audio_formats/format/juce_AudioFormat.cpp @@ -48,7 +48,7 @@ bool AudioFormat::canHandleFile (const File& f) const String& AudioFormat::getFormatName() const { return formatName; } const StringArray& AudioFormat::getFileExtensions() const { return fileExtensions; } bool AudioFormat::isCompressed() { return false; } -StringArray AudioFormat::getQualityOptions() { return StringArray(); } +StringArray AudioFormat::getQualityOptions() { return {}; } MemoryMappedAudioFormatReader* AudioFormat::createMemoryMappedReader (const File&) { diff --git a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h index 1e4aea0aca..6c4509a953 100644 --- a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h +++ b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h @@ -105,7 +105,7 @@ public: static String getFilePatterns (const String& fileSuffix) { if (fileSuffix.isEmpty()) - return String(); + return {}; return (fileSuffix.startsWithChar ('.') ? "*" : "*.") + fileSuffix; } diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp index 84c7a3fa81..7dfec7bff5 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -862,7 +862,7 @@ private: private: void timerCallback() override { - stopTimer (); + stopTimer(); ViewRect viewRect; getSize (&viewRect); diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index 6fcd01038f..ccbac5c2dc 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -882,7 +882,7 @@ public: if (isPositiveAndBelow (index, getTotalNumInputChannels())) return "Input " + String (index + 1); - return String(); + return {}; } const String getOutputChannelName (int index) const override @@ -890,7 +890,7 @@ public: if (isPositiveAndBelow (index, getTotalNumOutputChannels())) return "Output " + String (index + 1); - return String(); + return {}; } bool isInputChannelStereoPair (int index) const override { return isPositiveAndBelow (index, getTotalNumInputChannels()); } @@ -972,17 +972,17 @@ public: const String getParameterName (int index) override { - if (const ParamInfo* p = parameters[index]) + if (auto* p = parameters[index]) return p->name; - return String(); + return {}; } const String getParameterText (int index) override { return String (getParameter (index)); } bool isParameterAutomatable (int index) const override { - if (const ParamInfo* p = parameters[index]) + if (auto* p = parameters[index]) return p->automatable; return false; diff --git a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp index 630b43fef1..7e8196eb87 100644 --- a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp @@ -338,7 +338,7 @@ public: if (isPositiveAndBelow (index, getTotalNumInputChannels())) return String (plugin->PortNames [inputs [index]]).trim(); - return String(); + return {}; } const String getOutputChannelName (const int index) const @@ -346,7 +346,7 @@ public: if (isPositiveAndBelow (index, getTotalNumInputChannels())) return String (plugin->PortNames [outputs [index]]).trim(); - return String(); + return {}; } //============================================================================== @@ -390,7 +390,7 @@ public: return String (plugin->PortNames [parameters [index]]).trim(); } - return String(); + return {}; } const String getParameterText (int index) @@ -407,7 +407,7 @@ public: return String (parameterValues[index].scaled, 4); } - return String(); + return {}; } //============================================================================== @@ -424,7 +424,7 @@ public: const String getProgramName (int index) { // XXX - return String(); + return {}; } void changeProgramName (int index, const String& newName) diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index f3a985721f..25cb292ead 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -2131,7 +2131,7 @@ public: return toString (busInfo.name); } - return String(); + return {}; } const String getInputChannelName (int channelIndex) const override { return getChannelName (channelIndex, true, true); } @@ -2223,7 +2223,7 @@ public: return toString (result); } - return String(); + return {}; } void setParameter (int parameterIndex, float newValue) override diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 97f61c4fca..ec9fe71686 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -470,7 +470,7 @@ public: } } - return String(); + return {}; } #endif #else @@ -981,7 +981,7 @@ public: return String (pinProps.text, sizeof (pinProps.text)); } - return String(); + return {}; } bool isInputChannelStereoPair (int index) const override @@ -1005,7 +1005,7 @@ public: return String (pinProps.text, sizeof (pinProps.text)); } - return String(); + return {}; } bool isOutputChannelStereoPair (int index) const override @@ -1810,7 +1810,7 @@ private: String getTextForOpcode (const int index, const VstHostToPlugInOpcodes opcode) const { if (vstEffect == nullptr) - return String(); + return {}; jassert (index >= 0 && index < vstEffect->numParameters); char nm[256] = { 0 }; diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp index e9bf4a3642..dc997559d9 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp @@ -471,7 +471,7 @@ void AudioProcessor::sendParamChangeMessageToListeners (const int parameterIndex if (isPositiveAndBelow (parameterIndex, getNumParameters())) { for (int i = listeners.size(); --i >= 0;) - if (AudioProcessorListener* l = getListenerLocked (i)) + if (auto* l = getListenerLocked (i)) l->audioProcessorParameterChanged (this, parameterIndex, newValue); } else @@ -492,7 +492,7 @@ void AudioProcessor::beginParameterChangeGesture (int parameterIndex) #endif for (int i = listeners.size(); --i >= 0;) - if (AudioProcessorListener* l = getListenerLocked (i)) + if (auto* l = getListenerLocked (i)) l->audioProcessorParameterChangeGestureBegin (this, parameterIndex); } else @@ -542,7 +542,7 @@ int AudioProcessor::getNumParameters() float AudioProcessor::getParameter (int index) { - if (AudioProcessorParameter* p = getParamChecked (index)) + if (auto* p = getParamChecked (index)) return p->getValue(); return 0; @@ -550,13 +550,13 @@ float AudioProcessor::getParameter (int index) void AudioProcessor::setParameter (int index, float newValue) { - if (AudioProcessorParameter* p = getParamChecked (index)) + if (auto* p = getParamChecked (index)) p->setValue (newValue); } float AudioProcessor::getParameterDefaultValue (int index) { - if (AudioProcessorParameter* p = managedParameters[index]) + if (auto* p = managedParameters[index]) return p->getDefaultValue(); return 0; @@ -564,16 +564,16 @@ float AudioProcessor::getParameterDefaultValue (int index) const String AudioProcessor::getParameterName (int index) { - if (AudioProcessorParameter* p = getParamChecked (index)) + if (auto* p = getParamChecked (index)) return p->getName (512); - return String(); + return {}; } String AudioProcessor::getParameterID (int index) { // Don't use getParamChecked here, as this must also work for legacy plug-ins - if (AudioProcessorParameterWithID* p = dynamic_cast (managedParameters[index])) + if (auto* p = dynamic_cast (managedParameters[index])) return p->paramID; return String (index); @@ -581,7 +581,7 @@ String AudioProcessor::getParameterID (int index) String AudioProcessor::getParameterName (int index, int maximumStringLength) { - if (AudioProcessorParameter* p = managedParameters[index]) + if (auto* p = managedParameters[index]) return p->getName (maximumStringLength); return getParameterName (index).substring (0, maximumStringLength); @@ -601,7 +601,7 @@ const String AudioProcessor::getParameterText (int index) String AudioProcessor::getParameterText (int index, int maximumStringLength) { - if (AudioProcessorParameter* p = managedParameters[index]) + if (auto* p = managedParameters[index]) return p->getText (p->getValue(), maximumStringLength); return getParameterText (index).substring (0, maximumStringLength); @@ -609,7 +609,7 @@ String AudioProcessor::getParameterText (int index, int maximumStringLength) int AudioProcessor::getParameterNumSteps (int index) { - if (AudioProcessorParameter* p = managedParameters[index]) + if (auto* p = managedParameters[index]) return p->getNumSteps(); return AudioProcessor::getDefaultNumParameterSteps(); @@ -622,15 +622,15 @@ int AudioProcessor::getDefaultNumParameterSteps() noexcept String AudioProcessor::getParameterLabel (int index) const { - if (AudioProcessorParameter* p = managedParameters[index]) + if (auto* p = managedParameters[index]) return p->getLabel(); - return String(); + return {}; } bool AudioProcessor::isParameterAutomatable (int index) const { - if (AudioProcessorParameter* p = managedParameters[index]) + if (auto* p = managedParameters[index]) return p->isAutomatable(); return true; @@ -638,7 +638,7 @@ bool AudioProcessor::isParameterAutomatable (int index) const bool AudioProcessor::isParameterOrientationInverted (int index) const { - if (AudioProcessorParameter* p = managedParameters[index]) + if (auto* p = managedParameters[index]) return p->isOrientationInverted(); return false; @@ -646,7 +646,7 @@ bool AudioProcessor::isParameterOrientationInverted (int index) const bool AudioProcessor::isMetaParameter (int index) const { - if (AudioProcessorParameter* p = managedParameters[index]) + if (auto* p = managedParameters[index]) return p->isMetaParameter(); return false; @@ -654,7 +654,7 @@ bool AudioProcessor::isMetaParameter (int index) const AudioProcessorParameter::Category AudioProcessor::getParameterCategory (int index) const { - if (AudioProcessorParameter* p = managedParameters[index]) + if (auto* p = managedParameters[index]) return p->getCategory(); return AudioProcessorParameter::genericParameter; diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp index 53612b60b9..a5daff35f1 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp @@ -1527,7 +1527,7 @@ const String AudioProcessorGraph::AudioGraphIOProcessor::getName() const default: break; } - return String(); + return {}; } void AudioProcessorGraph::AudioGraphIOProcessor::fillInPluginDescription (PluginDescription& d) const @@ -1649,7 +1649,7 @@ int AudioProcessorGraph::AudioGraphIOProcessor::getNumPrograms() int AudioProcessorGraph::AudioGraphIOProcessor::getCurrentProgram() { return 0; } void AudioProcessorGraph::AudioGraphIOProcessor::setCurrentProgram (int) { } -const String AudioProcessorGraph::AudioGraphIOProcessor::getProgramName (int) { return String(); } +const String AudioProcessorGraph::AudioGraphIOProcessor::getProgramName (int) { return {}; } void AudioProcessorGraph::AudioGraphIOProcessor::changeProgramName (int, const String&) {} void AudioProcessorGraph::AudioGraphIOProcessor::getStateInformation (juce::MemoryBlock&) {} diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h index 1bafb7ac25..c653892033 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h @@ -365,7 +365,7 @@ public: int getNumPrograms() override { return 0; } int getCurrentProgram() override { return 0; } void setCurrentProgram (int) override { } - const String getProgramName (int) override { return String(); } + const String getProgramName (int) override { return {}; } void changeProgramName (int, const String&) override { } void getStateInformation (juce::MemoryBlock&) override; void setStateInformation (const void* data, int sizeInBytes) override; diff --git a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp index 23016d075f..c8e5e6d99e 100644 --- a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp @@ -558,7 +558,7 @@ String MidiKeyboardComponent::getWhiteNoteText (const int midiNoteNumber) if (midiNoteNumber % 12 == 0) return MidiMessage::getMidiNoteName (midiNoteNumber, true, true, octaveNumForMiddleC); - return String(); + return {}; } void MidiKeyboardComponent::drawUpDownButton (Graphics& g, int w, int h, diff --git a/modules/juce_audio_utils/native/juce_android_BluetoothMidiDevicePairingDialogue.cpp b/modules/juce_audio_utils/native/juce_android_BluetoothMidiDevicePairingDialogue.cpp index 5129d36f0e..17c89f44cd 100644 --- a/modules/juce_audio_utils/native/juce_android_BluetoothMidiDevicePairingDialogue.cpp +++ b/modules/juce_audio_utils/native/juce_android_BluetoothMidiDevicePairingDialogue.cpp @@ -56,7 +56,7 @@ struct AndroidBluetoothMidiInterface // if this is null then bluetooth is not enabled if (btManager.get() == nullptr) - return StringArray(); + return {}; jobjectArray jDevices = (jobjectArray) env->CallObjectMethod (btManager.get(), AndroidBluetoothManager.getMidiBluetoothAddresses); diff --git a/modules/juce_audio_utils/native/juce_mac_AudioCDBurner.mm b/modules/juce_audio_utils/native/juce_mac_AudioCDBurner.mm index eec9e87f31..8fbc6c26de 100644 --- a/modules/juce_audio_utils/native/juce_mac_AudioCDBurner.mm +++ b/modules/juce_audio_utils/native/juce_mac_AudioCDBurner.mm @@ -254,7 +254,7 @@ struct OpenDiskDevice [device releaseMediaReservation]; [device releaseExclusiveAccess]; - return String(); + return {}; } DRDevice* device; diff --git a/modules/juce_audio_utils/players/juce_SoundPlayer.h b/modules/juce_audio_utils/players/juce_SoundPlayer.h index 1f7e7cb1c4..e6a12c0a1f 100644 --- a/modules/juce_audio_utils/players/juce_SoundPlayer.h +++ b/modules/juce_audio_utils/players/juce_SoundPlayer.h @@ -35,7 +35,7 @@ class JUCE_API SoundPlayer : public AudioIODeviceCallback { public: //============================================================================== - SoundPlayer (); + SoundPlayer(); /** Destructor. */ virtual ~SoundPlayer(); diff --git a/modules/juce_core/containers/juce_DynamicObject.cpp b/modules/juce_core/containers/juce_DynamicObject.cpp index 56d5a83be9..69e977925c 100644 --- a/modules/juce_core/containers/juce_DynamicObject.cpp +++ b/modules/juce_core/containers/juce_DynamicObject.cpp @@ -69,10 +69,10 @@ bool DynamicObject::hasMethod (const Identifier& methodName) const var DynamicObject::invokeMethod (Identifier method, const var::NativeFunctionArgs& args) { - if (var::NativeFunction function = properties [method].getNativeFunction()) + if (auto function = properties [method].getNativeFunction()) return function (args); - return var(); + return {}; } void DynamicObject::setMethod (Identifier name, var::NativeFunction function) @@ -88,7 +88,7 @@ void DynamicObject::clear() void DynamicObject::cloneAllProperties() { for (int i = properties.size(); --i >= 0;) - if (var* v = properties.getVarPointerAt (i)) + if (auto* v = properties.getVarPointerAt (i)) *v = v->clone(); } diff --git a/modules/juce_core/containers/juce_ListenerList.cpp b/modules/juce_core/containers/juce_ListenerList.cpp index bc2f5edc28..ac9b46dd01 100644 --- a/modules/juce_core/containers/juce_ListenerList.cpp +++ b/modules/juce_core/containers/juce_ListenerList.cpp @@ -33,7 +33,7 @@ struct ListenerBase { ListenerBase (int& counter) : c (counter) {} - virtual ~ListenerBase () {} + virtual ~ListenerBase() {} virtual void f () = 0; virtual void f (void*) = 0; diff --git a/modules/juce_core/containers/juce_Variant.cpp b/modules/juce_core/containers/juce_Variant.cpp index b61ba6883e..2e1a479b58 100644 --- a/modules/juce_core/containers/juce_Variant.cpp +++ b/modules/juce_core/containers/juce_Variant.cpp @@ -51,7 +51,7 @@ public: virtual int toInt (const ValueUnion&) const noexcept { return 0; } virtual int64 toInt64 (const ValueUnion&) const noexcept { return 0; } virtual double toDouble (const ValueUnion&) const noexcept { return 0; } - virtual String toString (const ValueUnion&) const { return String(); } + virtual String toString (const ValueUnion&) const { return {}; } virtual bool toBool (const ValueUnion&) const noexcept { return false; } virtual ReferenceCountedObject* toObject (const ValueUnion&) const noexcept { return nullptr; } virtual Array* toArray (const ValueUnion&) const noexcept { return nullptr; } @@ -291,7 +291,7 @@ public: return d->clone().get(); jassertfalse; // can only clone DynamicObjects! - return var(); + return {}; } void writeToStream (const ValueUnion&, OutputStream& output) const override @@ -314,7 +314,7 @@ public: Array* toArray (const ValueUnion& data) const noexcept override { - if (RefCountedArray* a = dynamic_cast (data.objectValue)) + if (auto* a = dynamic_cast (data.objectValue)) return &(a->array); return nullptr; @@ -331,7 +331,7 @@ public: { Array arrayCopy; - if (const Array* array = toArray (original.value)) + if (auto* array = toArray (original.value)) for (int i = 0; i < array->size(); ++i) arrayCopy.add (array->getReference(i).clone()); @@ -340,7 +340,7 @@ public: void writeToStream (const ValueUnion& data, OutputStream& output) const override { - if (const Array* array = toArray (data)) + if (auto* array = toArray (data)) { MemoryOutputStream buffer (512); const int numItems = array->size(); @@ -593,7 +593,7 @@ var var::clone() const noexcept //============================================================================== const var& var::operator[] (const Identifier& propertyName) const { - if (DynamicObject* const o = getDynamicObject()) + if (auto* o = getDynamicObject()) return o->getProperty (propertyName); return getNullVarRef(); @@ -606,7 +606,7 @@ const var& var::operator[] (const char* const propertyName) const var var::getProperty (const Identifier& propertyName, const var& defaultReturnValue) const { - if (DynamicObject* const o = getDynamicObject()) + if (auto* o = getDynamicObject()) return o->getProperties().getWithDefault (propertyName, defaultReturnValue); return defaultReturnValue; @@ -619,10 +619,10 @@ var::NativeFunction var::getNativeFunction() const var var::invoke (const Identifier& method, const var* arguments, int numArguments) const { - if (DynamicObject* const o = getDynamicObject()) + if (auto* o = getDynamicObject()) return o->invokeMethod (method, var::NativeFunctionArgs (*this, arguments, numArguments)); - return var(); + return {}; } var var::call (const Identifier& method) const @@ -662,7 +662,7 @@ var var::call (const Identifier& method, const var& arg1, const var& arg2, const //============================================================================== int var::size() const { - if (const Array* const array = getArray()) + if (auto* array = getArray()) return array->size(); return 0; @@ -670,7 +670,7 @@ int var::size() const const var& var::operator[] (int arrayIndex) const { - const Array* const array = getArray(); + auto* array = getArray(); // When using this method, the var must actually be an array, and the index // must be in-range! @@ -681,7 +681,7 @@ const var& var::operator[] (int arrayIndex) const var& var::operator[] (int arrayIndex) { - const Array* const array = getArray(); + auto* array = getArray(); // When using this method, the var must actually be an array, and the index // must be in-range! @@ -692,7 +692,7 @@ var& var::operator[] (int arrayIndex) Array* var::convertToArray() { - if (Array* array = getArray()) + if (auto* array = getArray()) return array; Array tempVar; @@ -710,7 +710,7 @@ void var::append (const var& n) void var::remove (const int index) { - if (Array* const array = getArray()) + if (auto* const array = getArray()) array->remove (index); } @@ -726,7 +726,7 @@ void var::resize (const int numArrayElementsWanted) int var::indexOf (const var& n) const { - if (const Array* const array = getArray()) + if (auto* const array = getArray()) return array->indexOf (n); return -1; @@ -774,7 +774,7 @@ var var::readFromStream (InputStream& input) case varMarker_Array: { var v; - Array* const destArray = v.convertToArray(); + auto* destArray = v.convertToArray(); for (int i = input.readCompressedInt(); --i >= 0;) destArray->add (readFromStream (input)); @@ -787,7 +787,7 @@ var var::readFromStream (InputStream& input) } } - return var(); + return {}; } var::NativeFunctionArgs::NativeFunctionArgs (const var& t, const var* args, int numArgs) noexcept diff --git a/modules/juce_core/files/juce_File.cpp b/modules/juce_core/files/juce_File.cpp index 56e2e62d4b..a1db679cb6 100644 --- a/modules/juce_core/files/juce_File.cpp +++ b/modules/juce_core/files/juce_File.cpp @@ -114,7 +114,7 @@ static String removeEllipsis (const String& path) String File::parseAbsolutePath (const String& p) { if (p.isEmpty()) - return String(); + return {}; #if JUCE_WINDOWS // Windows.. @@ -548,7 +548,7 @@ bool File::loadFileAsData (MemoryBlock& destBlock) const String File::loadFileAsString() const { if (! existsAsFile()) - return String(); + return {}; FileInputStream in (*this); return in.openedOk() ? in.readEntireStreamAsString() @@ -667,7 +667,7 @@ String File::getFileExtension() const if (indexOfDot > fullPath.lastIndexOfChar (separator)) return fullPath.substring (indexOfDot); - return String(); + return {}; } bool File::hasFileExtension (StringRef possibleSuffix) const diff --git a/modules/juce_core/javascript/juce_JSON.cpp b/modules/juce_core/javascript/juce_JSON.cpp index a6cc163a6d..64eef61db1 100644 --- a/modules/juce_core/javascript/juce_JSON.cpp +++ b/modules/juce_core/javascript/juce_JSON.cpp @@ -590,7 +590,7 @@ public: { switch (r.nextInt (depth > 3 ? 6 : 8)) { - case 0: return var(); + case 0: return {}; case 1: return r.nextInt(); case 2: return r.nextInt64(); case 3: return r.nextBool(); @@ -618,7 +618,7 @@ public: } default: - return var(); + return {}; } } diff --git a/modules/juce_core/javascript/juce_Javascript.cpp b/modules/juce_core/javascript/juce_Javascript.cpp index a697f9d85b..91fe668c0a 100644 --- a/modules/juce_core/javascript/juce_Javascript.cpp +++ b/modules/juce_core/javascript/juce_Javascript.cpp @@ -158,7 +158,7 @@ struct JavascriptEngine::RootObject : public DynamicObject // if there's a class with an overridden DynamicObject::hasMethod, this avoids an error if (o->hasMethod (functionName)) - return var(); + return {}; } if (targetObject.isString()) @@ -517,7 +517,7 @@ struct JavascriptEngine::RootObject : public DynamicObject } var throwError (const char* typeName) const - { location.throwError (getTokenName (operation) + " is not allowed on the " + typeName + " type"); return var(); } + { location.throwError (getTokenName (operation) + " is not allowed on the " + typeName + " type"); return {}; } }; struct EqualsOp : public BinaryOperator @@ -757,7 +757,7 @@ struct JavascriptEngine::RootObject : public DynamicObject if (o->hasMethod (dot->child)) // allow an overridden DynamicObject::invokeMethod to accept a method call. return o->invokeMethod (dot->child, args); - location.throwError ("This expression is not a function!"); return var(); + location.throwError ("This expression is not a function!"); return {}; } ExpPtr object; diff --git a/modules/juce_core/maths/juce_BigInteger.cpp b/modules/juce_core/maths/juce_BigInteger.cpp index 16b51720dc..2b782eb805 100644 --- a/modules/juce_core/maths/juce_BigInteger.cpp +++ b/modules/juce_core/maths/juce_BigInteger.cpp @@ -1135,7 +1135,7 @@ String BigInteger::toString (const int base, const int minimumNumCharacters) con else { jassertfalse; // can't do the specified base! - return String(); + return {}; } s = s.paddedLeft ('0', minimumNumCharacters); diff --git a/modules/juce_core/maths/juce_Expression.cpp b/modules/juce_core/maths/juce_Expression.cpp index 31ff87b102..85ec2f5afb 100644 --- a/modules/juce_core/maths/juce_Expression.cpp +++ b/modules/juce_core/maths/juce_Expression.cpp @@ -55,7 +55,7 @@ public: virtual String getName() const { jassertfalse; // You shouldn't call this for an expression that's not actually a function! - return String(); + return {}; } virtual void renameSymbol (const Symbol& oldSymbol, const String& newName, const Scope& scope, int recursionDepth) @@ -1173,5 +1173,5 @@ void Expression::Scope::visitRelativeScope (const String& scopeName, Visitor&) c String Expression::Scope::getScopeUID() const { - return String(); + return {}; } diff --git a/modules/juce_core/native/juce_android_Files.cpp b/modules/juce_core/native/juce_android_Files.cpp index 177a5f75b3..cdf8219bf2 100644 --- a/modules/juce_core/native/juce_android_Files.cpp +++ b/modules/juce_core/native/juce_android_Files.cpp @@ -45,7 +45,7 @@ bool File::isOnRemovableDrive() const String File::getVersion() const { - return String(); + return {}; } static File getSpecialFile (jmethodID type) diff --git a/modules/juce_core/native/juce_android_SystemStats.cpp b/modules/juce_core/native/juce_android_SystemStats.cpp index c37703b271..5b40772262 100644 --- a/modules/juce_core/native/juce_android_SystemStats.cpp +++ b/modules/juce_core/native/juce_android_SystemStats.cpp @@ -257,7 +257,7 @@ String SystemStats::getLogonName() if (struct passwd* const pw = getpwuid (getuid())) return CharPointer_UTF8 (pw->pw_name); - return String(); + return {}; } String SystemStats::getFullUserName() @@ -271,7 +271,7 @@ String SystemStats::getComputerName() if (gethostname (name, sizeof (name) - 1) == 0) return name; - return String(); + return {}; } diff --git a/modules/juce_core/native/juce_curl_Network.cpp b/modules/juce_core/native/juce_curl_Network.cpp index 9b54feaf72..312fb57c04 100644 --- a/modules/juce_core/native/juce_curl_Network.cpp +++ b/modules/juce_core/native/juce_curl_Network.cpp @@ -143,7 +143,7 @@ public: } //============================================================================== - bool setOptions () + bool setOptions() { const String address = url.toString (! isPost); @@ -209,7 +209,7 @@ public: bool connect (WebInputStream::Listener* webInputListener) { - if (! setOptions ()) + if (! setOptions()) { cleanup(); return false; diff --git a/modules/juce_core/native/juce_linux_Files.cpp b/modules/juce_core/native/juce_linux_Files.cpp index b285eae09d..1767798578 100644 --- a/modules/juce_core/native/juce_linux_Files.cpp +++ b/modules/juce_core/native/juce_linux_Files.cpp @@ -74,7 +74,7 @@ bool File::isOnRemovableDrive() const String File::getVersion() const { - return String(); // xxx not yet implemented + return {}; // xxx not yet implemented } //============================================================================== diff --git a/modules/juce_core/native/juce_linux_Network.cpp b/modules/juce_core/native/juce_linux_Network.cpp index 916a0ec5dd..9129e3dbb2 100644 --- a/modules/juce_core/native/juce_linux_Network.cpp +++ b/modules/juce_core/native/juce_linux_Network.cpp @@ -428,7 +428,7 @@ private: { char c = 0; if (read (&c, 1) != 1) - return String(); + return {}; buffer.writeByte (c); @@ -443,7 +443,7 @@ private: if (header.startsWithIgnoreCase ("HTTP/")) return header; - return String(); + return {}; } static void writeValueIfNotPresent (MemoryOutputStream& dest, const String& headers, const String& key, const String& value) @@ -561,7 +561,7 @@ private: if (lines[i].startsWithIgnoreCase (itemName)) return lines[i].substring (itemName.length()).trim(); - return String(); + return {}; } JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Pimpl) diff --git a/modules/juce_core/native/juce_linux_SystemStats.cpp b/modules/juce_core/native/juce_linux_SystemStats.cpp index 3b2a2240e0..fd81efd825 100644 --- a/modules/juce_core/native/juce_linux_SystemStats.cpp +++ b/modules/juce_core/native/juce_linux_SystemStats.cpp @@ -109,7 +109,7 @@ String SystemStats::getLogonName() if (struct passwd* const pw = getpwuid (getuid())) return CharPointer_UTF8 (pw->pw_name); - return String(); + return {}; } String SystemStats::getFullUserName() @@ -123,7 +123,7 @@ String SystemStats::getComputerName() if (gethostname (name, sizeof (name) - 1) == 0) return name; - return String(); + return {}; } static String getLocaleValue (nl_item key) diff --git a/modules/juce_core/native/juce_mac_Files.mm b/modules/juce_core/native/juce_mac_Files.mm index 91e3d1ede6..2b8f77b7e4 100644 --- a/modules/juce_core/native/juce_mac_Files.mm +++ b/modules/juce_core/native/juce_mac_Files.mm @@ -273,7 +273,7 @@ String File::getVersion() const return nsStringToJuce (name); } - return String(); + return {}; } //============================================================================== diff --git a/modules/juce_core/native/juce_mac_Network.mm b/modules/juce_core/native/juce_mac_Network.mm index 3b7b5b5f5f..2f8ad8530e 100644 --- a/modules/juce_core/native/juce_mac_Network.mm +++ b/modules/juce_core/native/juce_mac_Network.mm @@ -613,7 +613,7 @@ struct BackgroundDownloadTask : public URL::DownloadTask static void didBecomeInvalidWithError (id self, SEL, NSURLSession*, NSURLSessionTask*, NSError*) { - if (auto state = getState (self)) state->didBecomeInvalidWithError (); + if (auto state = getState (self)) state->didBecomeInvalidWithError(); } }; }; diff --git a/modules/juce_core/native/juce_mac_Strings.mm b/modules/juce_core/native/juce_mac_Strings.mm index 1dd39a516d..7a359cb3a8 100644 --- a/modules/juce_core/native/juce_mac_Strings.mm +++ b/modules/juce_core/native/juce_mac_Strings.mm @@ -31,7 +31,7 @@ String String::fromCFString (CFStringRef cfString) { if (cfString == 0) - return String(); + return {}; CFRange range = { 0, CFStringGetLength (cfString) }; CFIndex bytesNeeded = 0; diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index 248ad5085c..e46defebcf 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -715,7 +715,7 @@ String File::getVolumeLabel() const } #endif - return String(); + return {}; } int File::getVolumeSerialNumber() const diff --git a/modules/juce_core/native/juce_win32_Network.cpp b/modules/juce_core/native/juce_win32_Network.cpp index 0c76e6063d..4e3825e720 100644 --- a/modules/juce_core/native/juce_win32_Network.cpp +++ b/modules/juce_core/native/juce_win32_Network.cpp @@ -501,7 +501,7 @@ void MACAddress::findAllAddresses (Array& result) void IPAddress::findAllAddresses (Array& result, bool includeIPv6) { - result.addIfNotAlreadyThere (IPAddress::local ()); + result.addIfNotAlreadyThere (IPAddress::local()); if (includeIPv6) result.addIfNotAlreadyThere (IPAddress::local (true)); diff --git a/modules/juce_core/native/juce_win32_SystemStats.cpp b/modules/juce_core/native/juce_win32_SystemStats.cpp index e7ad563f62..6540e17784 100644 --- a/modules/juce_core/native/juce_win32_SystemStats.cpp +++ b/modules/juce_core/native/juce_win32_SystemStats.cpp @@ -242,7 +242,7 @@ String SystemStats::getOperatingSystemName() String SystemStats::getDeviceDescription() { - return String(); + return {}; } bool SystemStats::isOperatingSystem64Bit() diff --git a/modules/juce_core/network/juce_URL.cpp b/modules/juce_core/network/juce_URL.cpp index d6a7929001..7d2f05e1fe 100644 --- a/modules/juce_core/network/juce_URL.cpp +++ b/modules/juce_core/network/juce_URL.cpp @@ -526,7 +526,7 @@ String URL::readEntireTextStream (const bool usePostCommand) const if (in != nullptr) return in->readEntireStreamAsString(); - return String(); + return {}; } XmlElement* URL::readEntireXmlStream (const bool usePostCommand) const diff --git a/modules/juce_core/network/juce_URL.h b/modules/juce_core/network/juce_URL.h index 08697faa6a..6ff00093ac 100644 --- a/modules/juce_core/network/juce_URL.h +++ b/modules/juce_core/network/juce_URL.h @@ -240,10 +240,10 @@ public: URL withPOSTData (const MemoryBlock& postData) const; /** Returns the data that was set using withPOSTData(). */ - String getPostData() const noexcept { return postData.toString(); } + String getPostData() const noexcept { return postData.toString(); } /** Returns the data that was set using withPOSTData() as MemoryBlock. */ - const MemoryBlock& getPostDataAsMemoryBlock() const noexcept { return postData; } + const MemoryBlock& getPostDataAsMemoryBlock() const noexcept { return postData; } //============================================================================== /** Tries to launch the system's default browser to open the URL. @@ -375,7 +375,7 @@ public: bool finished, error; int httpCode; - DownloadTask (); + DownloadTask(); private: friend class URL; @@ -441,7 +441,7 @@ public: /** Tries to download the entire contents of this URL and parse it as XML. If it fails, or if the text that it reads can't be parsed as XML, this will - return 0. + return nullptr. When it returns a valid XmlElement object, the caller is responsibile for deleting this object when no longer needed. diff --git a/modules/juce_core/text/juce_String.cpp b/modules/juce_core/text/juce_String.cpp index d063e9011f..51b5676507 100644 --- a/modules/juce_core/text/juce_String.cpp +++ b/modules/juce_core/text/juce_String.cpp @@ -1179,7 +1179,7 @@ bool String::matchesWildcard (StringRef wildcard, const bool ignoreCase) const n String String::repeatedString (StringRef stringToRepeat, int numberOfTimesToRepeat) { if (numberOfTimesToRepeat <= 0) - return String(); + return {}; String result (PreallocationBytes (findByteOffsetOfEnd (stringToRepeat) * (size_t) numberOfTimesToRepeat)); CharPointerType n (result.text); @@ -1291,7 +1291,7 @@ String String::replaceSection (int index, int numCharsToReplace, StringRef strin const size_t newTotalBytes = initialBytes + newStringBytes + remainderBytes; if (newTotalBytes <= 0) - return String(); + return {}; String result (PreallocationBytes ((size_t) newTotalBytes)); @@ -1537,7 +1537,7 @@ String String::substring (int start, const int end) const start = 0; if (end <= start) - return String(); + return {}; int i = 0; CharPointerType t1 (text); @@ -1545,7 +1545,7 @@ String String::substring (int start, const int end) const while (i < start) { if (t1.isEmpty()) - return String(); + return {}; ++i; ++t1; @@ -1579,7 +1579,7 @@ String String::substring (int start) const while (--start >= 0) { if (t.isEmpty()) - return String(); + return {}; ++t; } @@ -1604,7 +1604,7 @@ String String::fromFirstOccurrenceOf (StringRef sub, const int i = ignoreCase ? indexOfIgnoreCase (sub) : indexOf (sub); if (i < 0) - return String(); + return {}; return substring (includeSubString ? i : i + sub.length()); } @@ -1658,7 +1658,7 @@ String String::unquoted() const const int len = length(); if (len == 0) - return String(); + return {}; const juce_wchar lastChar = text [len - 1]; const int dropAtStart = (*text == '"' || *text == '\'') ? 1 : 0; @@ -1709,7 +1709,7 @@ String String::trim() const CharPointerType trimmedEnd (findTrimmedEnd (start, end)); if (trimmedEnd <= start) - return String(); + return {}; if (text < start || trimmedEnd < end) return String (start, trimmedEnd); @@ -1782,7 +1782,7 @@ String String::trimCharactersAtEnd (StringRef charactersToTrim) const String String::retainCharacters (StringRef charactersToRetain) const { if (isEmpty()) - return String(); + return {}; StringCreationHelper builder (text); @@ -1804,7 +1804,7 @@ String String::retainCharacters (StringRef charactersToRetain) const String String::removeCharacters (StringRef charactersToRemove) const { if (isEmpty()) - return String(); + return {}; StringCreationHelper builder (text); @@ -1903,7 +1903,7 @@ String String::formattedRaw (const char* pf, ...) break; // returns -1 because of an error rather than because it needs more space. } - return String(); + return {}; } //============================================================================== @@ -1963,7 +1963,7 @@ String String::toHexString (short number) { return toHexString ((int) (unsig String String::toHexString (const void* const d, const int size, const int groupSize) { if (size <= 0) - return String(); + return {}; int numChars = (size * 2) + 2; if (groupSize > 0) @@ -2008,7 +2008,7 @@ String String::createStringFromData (const void* const unknownData, int size) const uint8* const data = static_cast (unknownData); if (size <= 0 || data == nullptr) - return String(); + return {}; if (size == 1) return charToString ((juce_wchar) data[0]); @@ -2174,7 +2174,7 @@ String String::fromUTF8 (const char* const buffer, int bufferSizeBytes) } } - return String(); + return {}; } #if JUCE_MSVC diff --git a/modules/juce_core/text/juce_StringArray.cpp b/modules/juce_core/text/juce_StringArray.cpp index 45e22b79bb..594e9bee46 100644 --- a/modules/juce_core/text/juce_StringArray.cpp +++ b/modules/juce_core/text/juce_StringArray.cpp @@ -320,7 +320,7 @@ String StringArray::joinIntoString (StringRef separator, int start, int numberTo start = 0; if (start >= last) - return String(); + return {}; if (start == last - 1) return strings.getReference (start); @@ -334,7 +334,7 @@ String StringArray::joinIntoString (StringRef separator, int start, int numberTo String result; result.preallocateBytes (bytesNeeded); - String::CharPointerType dest (result.getCharPointer()); + auto dest = result.getCharPointer(); while (start < last) { diff --git a/modules/juce_core/text/juce_StringPool.cpp b/modules/juce_core/text/juce_StringPool.cpp index d88820ceeb..adbbada7cd 100644 --- a/modules/juce_core/text/juce_StringPool.cpp +++ b/modules/juce_core/text/juce_StringPool.cpp @@ -106,7 +106,7 @@ static String addPooledString (Array& strings, const NewStringType& newS String StringPool::getPooledString (const char* const newString) { if (newString == nullptr || *newString == 0) - return String(); + return {}; const ScopedLock sl (lock); garbageCollectIfNeeded(); @@ -116,7 +116,7 @@ String StringPool::getPooledString (const char* const newString) String StringPool::getPooledString (String::CharPointerType start, String::CharPointerType end) { if (start.isEmpty() || start == end) - return String(); + return {}; const ScopedLock sl (lock); garbageCollectIfNeeded(); @@ -126,7 +126,7 @@ String StringPool::getPooledString (String::CharPointerType start, String::CharP String StringPool::getPooledString (StringRef newString) { if (newString.isEmpty()) - return String(); + return {}; const ScopedLock sl (lock); garbageCollectIfNeeded(); @@ -136,7 +136,7 @@ String StringPool::getPooledString (StringRef newString) String StringPool::getPooledString (const String& newString) { if (newString.isEmpty()) - return String(); + return {}; const ScopedLock sl (lock); garbageCollectIfNeeded(); diff --git a/modules/juce_core/time/juce_Time.cpp b/modules/juce_core/time/juce_Time.cpp index 71e6eaa3a5..74272f3b98 100644 --- a/modules/juce_core/time/juce_Time.cpp +++ b/modules/juce_core/time/juce_Time.cpp @@ -108,7 +108,7 @@ namespace TimeHelpers #ifdef JUCE_MSVC if (tm->tm_year < -1900 || tm->tm_year > 8099) - return String(); // Visual Studio's library can only handle 0 -> 9999 AD + return {}; // Visual Studio's library can only handle 0 -> 9999 AD #endif for (size_t bufferSize = 256; ; bufferSize += 256) @@ -491,15 +491,15 @@ Time Time::fromISO8601 (StringRef iso) noexcept const int year = parseFixedSizeIntAndSkip (t, 4, '-'); if (year < 0) - return Time(); + return {}; const int month = parseFixedSizeIntAndSkip (t, 2, '-'); if (month < 0) - return Time(); + return {}; const int day = parseFixedSizeIntAndSkip (t, 2, 0); if (day < 0) - return Time(); + return {}; int hours = 0, minutes = 0, milliseconds = 0; @@ -508,11 +508,11 @@ Time Time::fromISO8601 (StringRef iso) noexcept ++t; hours = parseFixedSizeIntAndSkip (t, 2, ':'); if (hours < 0) - return Time(); + return {}; minutes = parseFixedSizeIntAndSkip (t, 2, ':'); if (minutes < 0) - return Time(); + return {}; milliseconds = (int) (1000.0 * CharacterFunctions::readDoubleValue (t)); } @@ -523,18 +523,18 @@ Time Time::fromISO8601 (StringRef iso) noexcept { const int offsetHours = parseFixedSizeIntAndSkip (t, 2, ':'); if (offsetHours < 0) - return Time(); + return {}; const int offsetMinutes = parseFixedSizeIntAndSkip (t, 2, 0); if (offsetMinutes < 0) - return Time(); + return {}; const int offsetMs = (offsetHours * 60 + offsetMinutes) * 60 * 1000; milliseconds += nextChar == '-' ? offsetMs : -offsetMs; // NB: this seems backwards but is correct! } else if (nextChar != 0 && nextChar != 'Z') { - return Time(); + return {}; } return Time (year, month - 1, day, hours, minutes, 0, milliseconds, false); diff --git a/modules/juce_core/xml/juce_XmlDocument.cpp b/modules/juce_core/xml/juce_XmlDocument.cpp index 09ddb1033e..a49f4872e1 100644 --- a/modules/juce_core/xml/juce_XmlDocument.cpp +++ b/modules/juce_core/xml/juce_XmlDocument.cpp @@ -174,7 +174,7 @@ String XmlDocument::getFileContents (const String& filename) const return in->readEntireStreamAsString(); } - return String(); + return {}; } juce_wchar XmlDocument::readNextChar() noexcept diff --git a/modules/juce_data_structures/undomanager/juce_UndoManager.cpp b/modules/juce_data_structures/undomanager/juce_UndoManager.cpp index 819d55a108..613e7c4cd8 100644 --- a/modules/juce_data_structures/undomanager/juce_UndoManager.cpp +++ b/modules/juce_data_structures/undomanager/juce_UndoManager.cpp @@ -286,31 +286,31 @@ bool UndoManager::redo() String UndoManager::getUndoDescription() const { - if (const ActionSet* const s = getCurrentSet()) + if (auto* s = getCurrentSet()) return s->name; - return String(); + return {}; } String UndoManager::getRedoDescription() const { - if (const ActionSet* const s = getNextSet()) + if (auto* s = getNextSet()) return s->name; - return String(); + return {}; } Time UndoManager::getTimeOfUndoTransaction() const { - if (const ActionSet* const s = getCurrentSet()) + if (auto* s = getCurrentSet()) return s->time; - return Time(); + return {}; } Time UndoManager::getTimeOfRedoTransaction() const { - if (const ActionSet* const s = getNextSet()) + if (auto* s = getNextSet()) return s->time; return Time::getCurrentTime(); diff --git a/modules/juce_events/interprocess/juce_InterprocessConnection.cpp b/modules/juce_events/interprocess/juce_InterprocessConnection.cpp index 8f5cbeb869..4250eabc3b 100644 --- a/modules/juce_events/interprocess/juce_InterprocessConnection.cpp +++ b/modules/juce_events/interprocess/juce_InterprocessConnection.cpp @@ -151,7 +151,7 @@ String InterprocessConnection::getConnectedHostName() const const ScopedLock sl (pipeAndSocketLock); if (pipe == nullptr && socket == nullptr) - return String(); + return {}; if (socket != nullptr && ! socket->isLocal()) return socket->getHostName(); diff --git a/modules/juce_events/messages/juce_ApplicationBase.cpp b/modules/juce_events/messages/juce_ApplicationBase.cpp index 5779dc6027..ac6e8e1645 100644 --- a/modules/juce_events/messages/juce_ApplicationBase.cpp +++ b/modules/juce_events/messages/juce_ApplicationBase.cpp @@ -139,8 +139,8 @@ struct JUCEApplicationBase::MultipleInstanceHandler {}; //============================================================================== #if JUCE_ANDROID -StringArray JUCEApplicationBase::getCommandLineParameterArray() { return StringArray(); } -String JUCEApplicationBase::getCommandLineParameters() { return String(); } +StringArray JUCEApplicationBase::getCommandLineParameterArray() { return {}; } +String JUCEApplicationBase::getCommandLineParameters() { return {}; } #else diff --git a/modules/juce_events/native/juce_linux_Messaging.cpp b/modules/juce_events/native/juce_linux_Messaging.cpp index aa9117cd4f..5dc0a8b368 100644 --- a/modules/juce_events/native/juce_linux_Messaging.cpp +++ b/modules/juce_events/native/juce_linux_Messaging.cpp @@ -107,7 +107,7 @@ public: readCallback[WINDOW_SYSTEM_FD]->active = true; } - void removeWindowSystemFd () + void removeWindowSystemFd() { jassert (fdCount == FD_COUNT); diff --git a/modules/juce_graphics/native/juce_win32_Fonts.cpp b/modules/juce_graphics/native/juce_win32_Fonts.cpp index 5fa28a3218..f90115a9a6 100644 --- a/modules/juce_graphics/native/juce_win32_Fonts.cpp +++ b/modules/juce_graphics/native/juce_win32_Fonts.cpp @@ -110,7 +110,7 @@ namespace TTFNameExtractor } } - return String(); + return {}; } static String getTypefaceNameFromFile (MemoryInputStream& input) @@ -128,7 +128,7 @@ namespace TTFNameExtractor return parseNameTable (input, ByteOrder::swapIfLittleEndian (tableDirectory.offset)); } - return String(); + return {}; } } diff --git a/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp b/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp index 0d3a1d0836..264ca3702b 100644 --- a/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp +++ b/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp @@ -51,7 +51,7 @@ void ApplicationCommandManager::registerCommand (const ApplicationCommandInfo& n // the name isn't optional! jassert (newCommand.shortName.isNotEmpty()); - if (ApplicationCommandInfo* command = getMutableCommandForID (newCommand.commandID)) + if (auto* command = getMutableCommandForID (newCommand.commandID)) { // Trying to re-register the same command ID with different parameters can often indicate a typo. // This assertion is here because I've found it useful catching some mistakes, but it may also cause @@ -132,19 +132,19 @@ const ApplicationCommandInfo* ApplicationCommandManager::getCommandForID (const String ApplicationCommandManager::getNameOfCommand (const CommandID commandID) const noexcept { - if (const ApplicationCommandInfo* const ci = getCommandForID (commandID)) + if (auto* ci = getCommandForID (commandID)) return ci->shortName; - return String(); + return {}; } String ApplicationCommandManager::getDescriptionOfCommand (const CommandID commandID) const noexcept { - if (const ApplicationCommandInfo* const ci = getCommandForID (commandID)) + if (auto* ci = getCommandForID (commandID)) return ci->description.isNotEmpty() ? ci->description : ci->shortName; - return String(); + return {}; } StringArray ApplicationCommandManager::getCommandCategories() const @@ -186,7 +186,7 @@ bool ApplicationCommandManager::invoke (const ApplicationCommandTarget::Invocati bool ok = false; ApplicationCommandInfo commandInfo (0); - if (ApplicationCommandTarget* const target = getTargetForCommand (inf.commandID, commandInfo)) + if (auto* target = getTargetForCommand (inf.commandID, commandInfo)) { ApplicationCommandTarget::InvocationInfo info (inf); info.commandFlags = commandInfo.flags; @@ -248,7 +248,7 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget( if (c == nullptr) { - if (TopLevelWindow* const activeWindow = TopLevelWindow::getActiveTopLevelWindow()) + if (auto* activeWindow = TopLevelWindow::getActiveTopLevelWindow()) { c = activeWindow->getPeer()->getLastFocusedSubcomponent(); @@ -259,12 +259,12 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget( if (c == nullptr && Process::isForegroundProcess()) { - Desktop& desktop = Desktop::getInstance(); + auto& desktop = Desktop::getInstance(); // getting a bit desperate now: try all desktop comps.. for (int i = desktop.getNumComponents(); --i >= 0;) - if (ComponentPeer* const peer = desktop.getComponent(i)->getPeer()) - if (ApplicationCommandTarget* const target = findTargetForComponent (peer->getLastFocusedSubcomponent())) + if (auto* peer = desktop.getComponent(i)->getPeer()) + if (auto* target = findTargetForComponent (peer->getLastFocusedSubcomponent())) return target; } @@ -274,11 +274,11 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget( // component that really should get the event. And if not, the event will // still be passed up to the top level window anyway, so let's send it to the // content comp. - if (ResizableWindow* const resizableWindow = dynamic_cast (c)) - if (Component* const content = resizableWindow->getContentComponent()) + if (auto* resizableWindow = dynamic_cast (c)) + if (auto* content = resizableWindow->getContentComponent()) c = content; - if (ApplicationCommandTarget* const target = findTargetForComponent (c)) + if (auto* target = findTargetForComponent (c)) return target; } diff --git a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp index 8b17df846d..148172decf 100644 --- a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp +++ b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp @@ -606,7 +606,7 @@ private: return str.fromFirstOccurrenceOf ("#", false, false) .upToLastOccurrenceOf (")", false, false).trim(); - return String(); + return {}; } //============================================================================== @@ -1160,7 +1160,7 @@ private: if (xml.parent != nullptr) return getInheritedAttribute (*xml.parent, attributeName); - return String(); + return {}; } static int parsePlacementFlags (const String& align) noexcept diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index ab0fe7244c..595aa14419 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -3376,7 +3376,7 @@ private: return String (buffer); } - return String(); + return {}; } int getCompositionCaretPos (HIMC hImc, LPARAM lParam, const String& currentIMEString) const diff --git a/modules/juce_gui_basics/widgets/juce_ComboBox.cpp b/modules/juce_gui_basics/widgets/juce_ComboBox.cpp index 57f1254958..49102b0dc8 100644 --- a/modules/juce_gui_basics/widgets/juce_ComboBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ComboBox.cpp @@ -200,15 +200,15 @@ int ComboBox::getNumItems() const noexcept String ComboBox::getItemText (const int index) const { - if (const PopupMenu::Item* const item = getItemForIndex (index)) + if (auto* item = getItemForIndex (index)) return item->text; - return String(); + return {}; } int ComboBox::getItemId (const int index) const noexcept { - if (const PopupMenu::Item* const item = getItemForIndex (index)) + if (auto* item = getItemForIndex (index)) return item->itemID; return 0; @@ -223,7 +223,7 @@ int ComboBox::indexOfItemId (const int itemId) const noexcept while (iterator.next()) { - PopupMenu::Item &item = iterator.getItem(); + auto& item = iterator.getItem(); if (item.itemID == itemId) return n; diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index fcc1acdcdd..96b94eee7b 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -138,7 +138,7 @@ public: if (ListBoxModel* m = owner.getModel()) return m->getTooltipForRow (row); - return String(); + return {}; } ScopedPointer customComponent; @@ -968,6 +968,6 @@ void ListBoxModel::selectedRowsChanged (int) {} void ListBoxModel::deleteKeyPressed (int) {} void ListBoxModel::returnKeyPressed (int) {} void ListBoxModel::listWasScrolled() {} -var ListBoxModel::getDragSourceDescription (const SparseSet&) { return var(); } -String ListBoxModel::getTooltipForRow (int) { return String(); } +var ListBoxModel::getDragSourceDescription (const SparseSet&) { return {}; } +String ListBoxModel::getTooltipForRow (int) { return {}; } MouseCursor ListBoxModel::getMouseCursorForRow (int) { return MouseCursor::NormalCursor; } diff --git a/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp b/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp index 8f2fdf5ec2..bab6d210ff 100644 --- a/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp +++ b/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp @@ -92,15 +92,15 @@ int TableHeaderComponent::getNumColumns (const bool onlyCountVisibleColumns) con String TableHeaderComponent::getColumnName (const int columnId) const { - if (const ColumnInfo* const ci = getInfoForId (columnId)) + if (auto* ci = getInfoForId (columnId)) return ci->name; - return String(); + return {}; } void TableHeaderComponent::setColumnName (const int columnId, const String& newName) { - if (ColumnInfo* const ci = getInfoForId (columnId)) + if (auto* ci = getInfoForId (columnId)) { if (ci->name != newName) { diff --git a/modules/juce_gui_basics/widgets/juce_TableListBox.cpp b/modules/juce_gui_basics/widgets/juce_TableListBox.cpp index deb7785bba..4eec68d179 100644 --- a/modules/juce_gui_basics/widgets/juce_TableListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_TableListBox.cpp @@ -206,10 +206,10 @@ public: const int columnId = owner.getHeader().getColumnIdAtX (getMouseXYRelative().getX()); if (columnId != 0) - if (TableListBoxModel* m = owner.getModel()) + if (auto* m = owner.getModel()) return m->getCellTooltip (row, columnId); - return String(); + return {}; } Component* findChildComponentForColumn (const int columnId) const @@ -477,8 +477,8 @@ void TableListBoxModel::deleteKeyPressed (int) {} void TableListBoxModel::returnKeyPressed (int) {} void TableListBoxModel::listWasScrolled() {} -String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String(); } -var TableListBoxModel::getDragSourceDescription (const SparseSet&) { return var(); } +String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return {}; } +var TableListBoxModel::getDragSourceDescription (const SparseSet&) { return {}; } Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate) { diff --git a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp index c0a0775c72..92a846f003 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp @@ -49,7 +49,7 @@ struct TextAtom return atomText.substring (0, numChars); if (isNewLine()) - return String(); + return {}; return String::repeatedString (String::charToString (passwordCharacter), numChars); } @@ -2344,7 +2344,7 @@ String TextEditor::getText() const String TextEditor::getTextInRange (const Range& range) const { if (range.isEmpty()) - return String(); + return {}; MemoryOutputStream mo; mo.preallocate ((size_t) jmin (getTotalNumChars(), range.getLength())); @@ -2353,7 +2353,7 @@ String TextEditor::getTextInRange (const Range& range) const for (int i = 0; i < sections.size(); ++i) { - const UniformTextSection* const s = sections.getUnchecked (i); + auto* s = sections.getUnchecked (i); const int nextIndex = index + s->getTotalLength(); if (range.getStart() < nextIndex) diff --git a/modules/juce_gui_basics/widgets/juce_TreeView.cpp b/modules/juce_gui_basics/widgets/juce_TreeView.cpp index 67845cd0a6..8d320bb0bc 100644 --- a/modules/juce_gui_basics/widgets/juce_TreeView.cpp +++ b/modules/juce_gui_basics/widgets/juce_TreeView.cpp @@ -1156,7 +1156,7 @@ TreeViewItem::~TreeViewItem() String TreeViewItem::getUniqueName() const { - return String(); + return {}; } void TreeViewItem::itemOpennessChanged (bool) @@ -1378,7 +1378,7 @@ void TreeViewItem::itemSelectionChanged (bool) String TreeViewItem::getTooltip() { - return String(); + return {}; } void TreeViewItem::ownerViewChanged (TreeView*) @@ -1387,7 +1387,7 @@ void TreeViewItem::ownerViewChanged (TreeView*) var TreeViewItem::getDragSourceDescription() { - return var(); + return {}; } bool TreeViewItem::isInterestedInFileDrag (const StringArray&) diff --git a/modules/juce_gui_basics/windows/juce_AlertWindow.cpp b/modules/juce_gui_basics/windows/juce_AlertWindow.cpp index 821229f9e7..725a60cd02 100644 --- a/modules/juce_gui_basics/windows/juce_AlertWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_AlertWindow.cpp @@ -173,10 +173,10 @@ TextEditor* AlertWindow::getTextEditor (const String& nameOfTextEditor) const String AlertWindow::getTextEditorContents (const String& nameOfTextEditor) const { - if (TextEditor* const t = getTextEditor (nameOfTextEditor)) + if (auto* t = getTextEditor (nameOfTextEditor)) return t->getText(); - return String(); + return {}; } diff --git a/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp b/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp index 4a52d4377c..7101176bfc 100644 --- a/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp @@ -80,7 +80,7 @@ void TooltipWindow::displayTip (Point screenPos, const String& tip) repaint(); } - if (Component* const parent = getParentComponent()) + if (auto* parent = getParentComponent()) { updatePosition (tip, parent->getLocalPoint (nullptr, screenPos), parent->getLocalBounds()); @@ -111,7 +111,7 @@ String TooltipWindow::getTipFor (Component* const c) return ttc->getTooltip(); } - return String(); + return {}; } void TooltipWindow::hideTip() diff --git a/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp b/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp index 6662ee8ced..4bddebfa41 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp @@ -422,7 +422,7 @@ CodeDocument::Position CodeDocument::Position::movedByLines (const int deltaLine juce_wchar CodeDocument::Position::getCharacter() const { - if (const CodeDocumentLine* const l = owner->lines [line]) + if (auto* l = owner->lines [line]) return l->line [getIndexInLine()]; return 0; @@ -430,10 +430,10 @@ juce_wchar CodeDocument::Position::getCharacter() const String CodeDocument::Position::getLineText() const { - if (const CodeDocumentLine* const l = owner->lines [line]) + if (auto* l = owner->lines [line]) return l->line; - return String(); + return {}; } void CodeDocument::Position::setPositionMaintained (const bool isMaintained) @@ -482,7 +482,7 @@ String CodeDocument::getAllContent() const String CodeDocument::getTextBetween (const Position& start, const Position& end) const { if (end.getPosition() <= start.getPosition()) - return String(); + return {}; const int startLine = start.getLineNumber(); const int endLine = end.getLineNumber(); @@ -492,7 +492,7 @@ String CodeDocument::getTextBetween (const Position& start, const Position& end) if (CodeDocumentLine* const line = lines [startLine]) return line->line.substring (start.getIndexInLine(), end.getIndexInLine()); - return String(); + return {}; } MemoryOutputStream mo; @@ -526,7 +526,7 @@ String CodeDocument::getTextBetween (const Position& start, const Position& end) int CodeDocument::getNumCharacters() const noexcept { - if (const CodeDocumentLine* const lastLine = lines.getLast()) + if (auto* lastLine = lines.getLast()) return lastLine->lineStartInFile + lastLine->lineLength; return 0; @@ -534,10 +534,10 @@ int CodeDocument::getNumCharacters() const noexcept String CodeDocument::getLine (const int lineIndex) const noexcept { - if (const CodeDocumentLine* const line = lines [lineIndex]) + if (auto* line = lines [lineIndex]) return line->line; - return String(); + return {}; } int CodeDocument::getMaximumLineLength() noexcept diff --git a/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm b/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm index 855d820297..610ad4792b 100644 --- a/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm +++ b/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm @@ -50,7 +50,7 @@ private: if (NSURL* url = [actionInformation valueForKey: nsStringLiteral ("WebActionOriginalURLKey")]) return nsStringToJuce ([url absoluteString]); - return String(); + return {}; } static void decidePolicyForNavigationAction (id self, SEL, WebView*, NSDictionary* actionInformation, diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index 2539712b84..89b04b2722 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -547,7 +547,7 @@ public: finishedSignal.signal(); } - void block() { finishedSignal.wait (); } + void block() { finishedSignal.wait(); } OpenGLContext::AsyncWorker::Ptr originalWorker; WaitableEvent finishedSignal; diff --git a/modules/juce_osc/osc/juce_OSCArgument.cpp b/modules/juce_osc/osc/juce_OSCArgument.cpp index 3bf8d4d9a8..437a79ce4b 100644 --- a/modules/juce_osc/osc/juce_OSCArgument.cpp +++ b/modules/juce_osc/osc/juce_OSCArgument.cpp @@ -49,7 +49,7 @@ String OSCArgument::getString() const noexcept return stringValue; jassertfalse; // you must check the type of an argument before attempting to get its value! - return String(); + return {}; } int32 OSCArgument::getInt32() const noexcept diff --git a/modules/juce_video/native/juce_android_CameraDevice.cpp b/modules/juce_video/native/juce_android_CameraDevice.cpp index b91ac034f2..814c2d811a 100644 --- a/modules/juce_video/native/juce_android_CameraDevice.cpp +++ b/modules/juce_video/native/juce_android_CameraDevice.cpp @@ -42,7 +42,7 @@ struct CameraDevice::Pimpl Time getTimeOfFirstRecordedFrame() const { - return Time(); + return {}; } void addListener (CameraDevice::Listener* listenerToAdd)