| @@ -27,7 +27,7 @@ | |||||
| #include "Main.h" | #include "Main.h" | ||||
| DSPSamplesApplication::DSPSamplesApplication() | DSPSamplesApplication::DSPSamplesApplication() | ||||
| : TimeSliceThread ("Audio File Reader Thread"), demoIndex (-1) | |||||
| : TimeSliceThread ("Audio File Reader Thread") | |||||
| { | { | ||||
| loopState.addListener (this); | loopState.addListener (this); | ||||
| } | } | ||||
| @@ -50,7 +50,7 @@ void DSPSamplesApplication::shutdown() | |||||
| stop(); | stop(); | ||||
| audioDeviceManager.removeAudioCallback (&audioSourcePlayer); | audioDeviceManager.removeAudioCallback (&audioSourcePlayer); | ||||
| waitForThreadToExit (10000); | waitForThreadToExit (10000); | ||||
| mainWindow = nullptr; | |||||
| mainWindow.reset(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -68,8 +68,8 @@ bool DSPSamplesApplication::loadFile (const File& fileToPlay) | |||||
| audioSourcePlayer.setSource (nullptr); | audioSourcePlayer.setSource (nullptr); | ||||
| mainWindow->setTransportSource (nullptr); | mainWindow->setTransportSource (nullptr); | ||||
| transportSource = nullptr; | |||||
| readerSource = nullptr; | |||||
| transportSource.reset(); | |||||
| readerSource.reset(); | |||||
| reader = formatManager.createReaderFor (fileToPlay); | reader = formatManager.createReaderFor (fileToPlay); | ||||
| @@ -125,7 +125,7 @@ void DSPSamplesApplication::init() | |||||
| } | } | ||||
| audioSourcePlayer.setSource (nullptr); | audioSourcePlayer.setSource (nullptr); | ||||
| currentDemo = nullptr; | |||||
| currentDemo.reset(); | |||||
| if (currentDemo == nullptr) | if (currentDemo == nullptr) | ||||
| if (auto demo = Demo::getList()[demoIndex]) | if (auto demo = Demo::getList()[demoIndex]) | ||||
| @@ -239,8 +239,7 @@ void MainContentComponent::initParameters() | |||||
| { | { | ||||
| auto& parameters = DSPSamplesApplication::getApp().getCurrentDemoParameters(); | auto& parameters = DSPSamplesApplication::getApp().getCurrentDemoParameters(); | ||||
| if (parametersComponent != nullptr) | |||||
| parametersComponent = nullptr; | |||||
| parametersComponent.reset(); | |||||
| if (parameters.size() > 0) | if (parameters.size() > 0) | ||||
| addAndMakeVisible (parametersComponent = new DemoParametersComponent (parameters)); | addAndMakeVisible (parametersComponent = new DemoParametersComponent (parameters)); | ||||
| @@ -328,8 +328,8 @@ public: | |||||
| { | { | ||||
| MainAppWindow::getSharedAudioDeviceManager().removeAudioCallback (liveAudioScroller); | MainAppWindow::getSharedAudioDeviceManager().removeAudioCallback (liveAudioScroller); | ||||
| startTestButton.removeListener (this); | startTestButton.removeListener (this); | ||||
| latencyTester = nullptr; | |||||
| liveAudioScroller = nullptr; | |||||
| latencyTester.reset(); | |||||
| liveAudioScroller.reset(); | |||||
| } | } | ||||
| void startTest() | void startTest() | ||||
| @@ -361,11 +361,9 @@ private: | |||||
| // unload the previous file source and delete it.. | // unload the previous file source and delete it.. | ||||
| transportSource.stop(); | transportSource.stop(); | ||||
| transportSource.setSource (nullptr); | transportSource.setSource (nullptr); | ||||
| currentAudioFileSource = nullptr; | |||||
| currentAudioFileSource.reset(); | |||||
| AudioFormatReader* reader = formatManager.createReaderFor (audioFile); | |||||
| if (reader != nullptr) | |||||
| if (auto* reader = formatManager.createReaderFor (audioFile)) | |||||
| { | { | ||||
| currentAudioFileSource = new AudioFormatReaderSource (reader, true); | currentAudioFileSource = new AudioFormatReaderSource (reader, true); | ||||
| @@ -95,7 +95,7 @@ public: | |||||
| // Now we can delete the writer object. It's done in this order because the deletion could | // Now we can delete the writer object. It's done in this order because the deletion could | ||||
| // take a little time while remaining data gets flushed to disk, so it's best to avoid blocking | // take a little time while remaining data gets flushed to disk, so it's best to avoid blocking | ||||
| // the audio callback while this happens. | // the audio callback while this happens. | ||||
| threadedWriter = nullptr; | |||||
| threadedWriter.reset(); | |||||
| } | } | ||||
| bool isRecording() const | bool isRecording() const | ||||
| @@ -84,7 +84,7 @@ public: | |||||
| ~ChildProcessDemo() | ~ChildProcessDemo() | ||||
| { | { | ||||
| masterProcess = nullptr; | |||||
| masterProcess.reset(); | |||||
| } | } | ||||
| void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
| @@ -134,7 +134,7 @@ public: | |||||
| { | { | ||||
| if (masterProcess != nullptr) | if (masterProcess != nullptr) | ||||
| { | { | ||||
| masterProcess = nullptr; | |||||
| masterProcess.reset(); | |||||
| logMessage ("Child process killed"); | logMessage ("Child process killed"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -183,7 +183,7 @@ private: | |||||
| //============================================================================== | //============================================================================== | ||||
| void setMidiOutput (int index) | void setMidiOutput (int index) | ||||
| { | { | ||||
| currentMidiOutput = nullptr; | |||||
| currentMidiOutput.reset(); | |||||
| if (MidiOutput::getDevices() [index].isNotEmpty()) | if (MidiOutput::getDevices() [index].isNotEmpty()) | ||||
| { | { | ||||
| @@ -642,10 +642,10 @@ struct OpenGLDemoClasses | |||||
| void freeAllContextObjects() | void freeAllContextObjects() | ||||
| { | { | ||||
| shape = nullptr; | |||||
| shader = nullptr; | |||||
| attributes = nullptr; | |||||
| uniforms = nullptr; | |||||
| shape.reset(); | |||||
| shader.reset(); | |||||
| attributes.reset(); | |||||
| uniforms.reset(); | |||||
| texture.release(); | texture.release(); | ||||
| } | } | ||||
| @@ -832,9 +832,9 @@ struct OpenGLDemoClasses | |||||
| && newShader->addFragmentShader (OpenGLHelpers::translateFragmentShaderToV3 (newFragmentShader)) | && newShader->addFragmentShader (OpenGLHelpers::translateFragmentShaderToV3 (newFragmentShader)) | ||||
| && newShader->link()) | && newShader->link()) | ||||
| { | { | ||||
| shape = nullptr; | |||||
| attributes = nullptr; | |||||
| uniforms = nullptr; | |||||
| shape.reset(); | |||||
| attributes.reset(); | |||||
| uniforms.reset(); | |||||
| shader = newShader; | shader = newShader; | ||||
| shader->use(); | shader->use(); | ||||
| @@ -69,7 +69,7 @@ public: | |||||
| ~OpenGL2DShaderDemo() | ~OpenGL2DShaderDemo() | ||||
| { | { | ||||
| shader = nullptr; | |||||
| shader.reset(); | |||||
| } | } | ||||
| void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
| @@ -78,7 +78,7 @@ public: | |||||
| if (shader == nullptr || shader->getFragmentShaderCode() != fragmentCode) | if (shader == nullptr || shader->getFragmentShaderCode() != fragmentCode) | ||||
| { | { | ||||
| shader = nullptr; | |||||
| shader.reset(); | |||||
| if (fragmentCode.isNotEmpty()) | if (fragmentCode.isNotEmpty()) | ||||
| { | { | ||||
| @@ -89,7 +89,7 @@ public: | |||||
| if (result.failed()) | if (result.failed()) | ||||
| { | { | ||||
| statusLabel.setText (result.getErrorMessage(), dontSendNotification); | statusLabel.setText (result.getErrorMessage(), dontSendNotification); | ||||
| shader = nullptr; | |||||
| shader.reset(); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -180,7 +180,7 @@ struct UnitTestClasses | |||||
| if (currentTestThread != nullptr) | if (currentTestThread != nullptr) | ||||
| { | { | ||||
| currentTestThread->stopThread (15000); | currentTestThread->stopThread (15000); | ||||
| currentTestThread = nullptr; | |||||
| currentTestThread.reset(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -296,14 +296,14 @@ private: | |||||
| { | { | ||||
| // clear the current tree | // clear the current tree | ||||
| resultsTree.setRootItem (nullptr); | resultsTree.setRootItem (nullptr); | ||||
| rootItem = nullptr; | |||||
| rootItem.reset(); | |||||
| // try and parse the editor's contents | // try and parse the editor's contents | ||||
| switch (typeBox.getSelectedItemIndex()) | switch (typeBox.getSelectedItemIndex()) | ||||
| { | { | ||||
| case xml: rootItem = rebuildXml(); break; | case xml: rootItem = rebuildXml(); break; | ||||
| case json: rootItem = rebuildJson(); break; | case json: rootItem = rebuildJson(); break; | ||||
| default: rootItem = nullptr; break; | |||||
| default: rootItem.reset(); break; | |||||
| } | } | ||||
| // if we have a valid TreeViewItem hide any old error messages and set our TreeView to use it | // if we have a valid TreeViewItem hide any old error messages and set our TreeView to use it | ||||
| @@ -318,7 +318,7 @@ private: | |||||
| /** Parses the editors contects as XML. */ | /** Parses the editors contects as XML. */ | ||||
| TreeViewItem* rebuildXml() | TreeViewItem* rebuildXml() | ||||
| { | { | ||||
| parsedXml = nullptr; | |||||
| parsedXml.reset(); | |||||
| XmlDocument doc (codeDocument.getAllContent()); | XmlDocument doc (codeDocument.getAllContent()); | ||||
| parsedXml = doc.getDocumentElement(); | parsedXml = doc.getDocumentElement(); | ||||
| @@ -51,7 +51,7 @@ public: | |||||
| void shutdown() override | void shutdown() override | ||||
| { | { | ||||
| // Do your application's shutdown code here.. | // Do your application's shutdown code here.. | ||||
| mainWindow = nullptr; | |||||
| mainWindow.reset(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -134,7 +134,7 @@ public: | |||||
| void clearCurrentDemo() | void clearCurrentDemo() | ||||
| { | { | ||||
| currentDemo = nullptr; | |||||
| currentDemo.reset(); | |||||
| } | } | ||||
| void resized() override | void resized() override | ||||
| @@ -202,7 +202,7 @@ public: | |||||
| { | { | ||||
| if (auto* selectedDemoType = JuceDemoTypeBase::getDemoTypeList() [lastRowSelected]) | if (auto* selectedDemoType = JuceDemoTypeBase::getDemoTypeList() [lastRowSelected]) | ||||
| { | { | ||||
| currentDemo = nullptr; | |||||
| currentDemo.reset(); | |||||
| addAndMakeVisible (currentDemo = selectedDemoType->createComponent()); | addAndMakeVisible (currentDemo = selectedDemoType->createComponent()); | ||||
| currentDemo->setName (selectedDemoType->name); | currentDemo->setName (selectedDemoType->name); | ||||
| resized(); | resized(); | ||||
| @@ -618,9 +618,9 @@ MainAppWindow::~MainAppWindow() | |||||
| { | { | ||||
| contentComponent->clearCurrentDemo(); | contentComponent->clearCurrentDemo(); | ||||
| clearContentComponent(); | clearContentComponent(); | ||||
| contentComponent = nullptr; | |||||
| applicationCommandManager = nullptr; | |||||
| sharedAudioDeviceManager = nullptr; | |||||
| contentComponent.reset(); | |||||
| applicationCommandManager.reset(); | |||||
| sharedAudioDeviceManager.reset(); | |||||
| #if JUCE_OPENGL | #if JUCE_OPENGL | ||||
| openGLContext.detach(); | openGLContext.detach(); | ||||
| @@ -41,7 +41,7 @@ public: | |||||
| bool showPurchaseButton = false; | bool showPurchaseButton = false; | ||||
| #if ! JUCER_ENABLE_GPL_MODE | #if ! JUCER_ENABLE_GPL_MODE | ||||
| if (LicenseController* controller = ProjucerApplication::getApp().licenseController) | |||||
| if (auto* controller = ProjucerApplication::getApp().licenseController.get()) | |||||
| showPurchaseButton = (controller->getState().type != LicenseState::Type::indie | showPurchaseButton = (controller->getState().type != LicenseState::Type::indie | ||||
| && controller->getState().type != LicenseState::Type::pro); | && controller->getState().type != LicenseState::Type::pro); | ||||
| #endif | #endif | ||||
| @@ -130,19 +130,17 @@ private: | |||||
| Rectangle<float> huckleberryLogoBounds; | Rectangle<float> huckleberryLogoBounds; | ||||
| Rectangle<float> juceLogoBounds; | Rectangle<float> juceLogoBounds; | ||||
| ScopedPointer<Drawable> juceLogo | |||||
| = Drawable::createFromImageData (BinaryData::juce_icon_png, | |||||
| BinaryData::juce_icon_pngSize); | |||||
| ScopedPointer<Drawable> juceLogo { Drawable::createFromImageData (BinaryData::juce_icon_png, | |||||
| BinaryData::juce_icon_pngSize) }; | |||||
| ScopedPointer<Drawable> huckleberryLogo | |||||
| = Drawable::createFromImageData (BinaryData::huckleberry_icon_svg, | |||||
| BinaryData::huckleberry_icon_svgSize); | |||||
| ScopedPointer<Drawable> huckleberryLogo { Drawable::createFromImageData (BinaryData::huckleberry_icon_svg, | |||||
| BinaryData::huckleberry_icon_svgSize) }; | |||||
| void buttonClicked (Button* b) override | void buttonClicked (Button* b) override | ||||
| { | { | ||||
| if (b == licenseButton) | |||||
| if (b == licenseButton.get()) | |||||
| { | { | ||||
| if (LicenseController* controller = ProjucerApplication::getApp().licenseController) | |||||
| if (auto* controller = ProjucerApplication::getApp().licenseController.get()) | |||||
| controller->chooseNewLicense(); | controller->chooseNewLicense(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -69,7 +69,7 @@ public: | |||||
| { | { | ||||
| addAndMakeVisible (shareApplicationUsageDataToggle = new ToggleButton()); | addAndMakeVisible (shareApplicationUsageDataToggle = new ToggleButton()); | ||||
| LicenseController* controller = ProjucerApplication::getApp().licenseController; | |||||
| auto* controller = ProjucerApplication::getApp().licenseController.get(); | |||||
| if (controller != nullptr && controller->getState().applicationUsageDataState == LicenseState::ApplicationUsageData::disabled) | if (controller != nullptr && controller->getState().applicationUsageDataState == LicenseState::ApplicationUsageData::disabled) | ||||
| shareApplicationUsageDataToggle->setToggleState (false, dontSendNotification); | shareApplicationUsageDataToggle->setToggleState (false, dontSendNotification); | ||||
| @@ -90,7 +90,7 @@ public: | |||||
| ~ApplicationUsageDataWindowComponent() | ~ApplicationUsageDataWindowComponent() | ||||
| { | { | ||||
| if (LicenseController* controller = ProjucerApplication::getApp().licenseController) | |||||
| if (auto* controller = ProjucerApplication::getApp().licenseController.get()) | |||||
| { | { | ||||
| auto newApplicationUsageDataState = LicenseState::ApplicationUsageData::enabled; | auto newApplicationUsageDataState = LicenseState::ApplicationUsageData::enabled; | ||||
| @@ -160,7 +160,7 @@ private: | |||||
| } | } | ||||
| else if (b == upgradeLicenseButton) | else if (b == upgradeLicenseButton) | ||||
| { | { | ||||
| if (LicenseController* controller = ProjucerApplication::getApp().licenseController) | |||||
| if (auto* controller = ProjucerApplication::getApp().licenseController.get()) | |||||
| controller->chooseNewLicense(); | controller->chooseNewLicense(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -39,7 +39,7 @@ public: | |||||
| else | else | ||||
| content = new AppearanceEditor::EditorPanel(); | content = new AppearanceEditor::EditorPanel(); | ||||
| changeContent (content); | |||||
| changeContent (content.get()); | |||||
| } | } | ||||
| void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
| @@ -68,7 +68,7 @@ struct FloatingToolWindow : public DialogWindow | |||||
| void closeButtonPressed() override | void closeButtonPressed() override | ||||
| { | { | ||||
| owner = nullptr; | |||||
| owner.reset(); | |||||
| } | } | ||||
| bool escapeKeyPressed() override | bool escapeKeyPressed() override | ||||
| @@ -195,31 +195,31 @@ void ProjucerApplication::shutdown() | |||||
| Logger::writeToLog ("Server shutdown cleanly"); | Logger::writeToLog ("Server shutdown cleanly"); | ||||
| } | } | ||||
| versionChecker = nullptr; | |||||
| utf8Window = nullptr; | |||||
| svgPathWindow = nullptr; | |||||
| aboutWindow = nullptr; | |||||
| pathsWindow = nullptr; | |||||
| editorColourSchemeWindow = nullptr; | |||||
| versionChecker.reset(); | |||||
| utf8Window.reset(); | |||||
| svgPathWindow.reset(); | |||||
| aboutWindow.reset(); | |||||
| pathsWindow.reset(); | |||||
| editorColourSchemeWindow.reset(); | |||||
| if (licenseController != nullptr) | if (licenseController != nullptr) | ||||
| { | { | ||||
| licenseController->removeLicenseStatusChangedCallback (this); | licenseController->removeLicenseStatusChangedCallback (this); | ||||
| licenseController = nullptr; | |||||
| licenseController.reset(); | |||||
| } | } | ||||
| mainWindowList.forceCloseAllWindows(); | mainWindowList.forceCloseAllWindows(); | ||||
| openDocumentManager.clear(); | openDocumentManager.clear(); | ||||
| childProcessCache = nullptr; | |||||
| childProcessCache.reset(); | |||||
| #if JUCE_MAC | #if JUCE_MAC | ||||
| MenuBarModel::setMacMainMenu (nullptr); | MenuBarModel::setMacMainMenu (nullptr); | ||||
| #endif | #endif | ||||
| menuModel = nullptr; | |||||
| commandManager = nullptr; | |||||
| settings = nullptr; | |||||
| menuModel.reset(); | |||||
| commandManager.reset(); | |||||
| settings.reset(); | |||||
| LookAndFeel::setDefaultLookAndFeel (nullptr); | LookAndFeel::setDefaultLookAndFeel (nullptr); | ||||
| @@ -739,7 +739,7 @@ void ProjucerApplication::showApplicationUsageDataAgreementPopup() | |||||
| void ProjucerApplication::dismissApplicationUsageDataAgreementPopup() | void ProjucerApplication::dismissApplicationUsageDataAgreementPopup() | ||||
| { | { | ||||
| if (applicationUsageDataWindow != nullptr) | if (applicationUsageDataWindow != nullptr) | ||||
| applicationUsageDataWindow = nullptr; | |||||
| applicationUsageDataWindow.reset(); | |||||
| } | } | ||||
| void ProjucerApplication::showPathsWindow() | void ProjucerApplication::showPathsWindow() | ||||
| @@ -804,7 +804,7 @@ void ProjucerApplication::deleteLogger() | |||||
| } | } | ||||
| } | } | ||||
| logger = nullptr; | |||||
| logger.reset(); | |||||
| } | } | ||||
| PropertiesFile::Options ProjucerApplication::getPropertyFileOptionsFor (const String& filename, bool isProjectSettings) | PropertiesFile::Options ProjucerApplication::getPropertyFileOptionsFor (const String& filename, bool isProjectSettings) | ||||
| @@ -308,16 +308,16 @@ public: | |||||
| ~UpdateUserDialog() | ~UpdateUserDialog() | ||||
| { | { | ||||
| titleLabel = nullptr; | |||||
| contentLabel = nullptr; | |||||
| okButton = nullptr; | |||||
| cancelButton = nullptr; | |||||
| changeLogLabel = nullptr; | |||||
| changeLog = nullptr; | |||||
| overwriteLabel = nullptr; | |||||
| overwritePath = nullptr; | |||||
| overwriteButton = nullptr; | |||||
| juceIcon = nullptr; | |||||
| titleLabel.reset(); | |||||
| contentLabel.reset(); | |||||
| okButton.reset(); | |||||
| cancelButton.reset(); | |||||
| changeLogLabel.reset(); | |||||
| changeLog.reset(); | |||||
| overwriteLabel.reset(); | |||||
| overwritePath.reset(); | |||||
| overwriteButton.reset(); | |||||
| juceIcon.reset(); | |||||
| } | } | ||||
| void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
| @@ -136,7 +136,7 @@ namespace | |||||
| if (! project->loadFrom (projectFile, true)) | if (! project->loadFrom (projectFile, true)) | ||||
| { | { | ||||
| project = nullptr; | |||||
| project.reset(); | |||||
| throw CommandLineError ("Failed to load the project file: " + projectFile.getFullPathName()); | throw CommandLineError ("Failed to load the project file: " + projectFile.getFullPathName()); | ||||
| } | } | ||||
| } | } | ||||
| @@ -148,7 +148,7 @@ namespace | |||||
| Result error (justSaveResources ? project->saveResourcesOnly (project->getFile()) | Result error (justSaveResources ? project->saveResourcesOnly (project->getFile()) | ||||
| : project->saveProject (project->getFile(), true)); | : project->saveProject (project->getFile(), true)); | ||||
| project = nullptr; | |||||
| project.reset(); | |||||
| if (error.failed()) | if (error.failed()) | ||||
| throw CommandLineError ("Error when saving: " + error.getErrorMessage()); | throw CommandLineError ("Error when saving: " + error.getErrorMessage()); | ||||
| @@ -302,7 +302,7 @@ namespace | |||||
| ScopedPointer<FileOutputStream> out (temp.getFile().createOutputStream()); | ScopedPointer<FileOutputStream> out (temp.getFile().createOutputStream()); | ||||
| bool ok = out != nullptr && zip.writeToStream (*out, nullptr); | bool ok = out != nullptr && zip.writeToStream (*out, nullptr); | ||||
| out = nullptr; | |||||
| out.reset(); | |||||
| ok = ok && temp.overwriteTargetFileWithTemporary(); | ok = ok && temp.overwriteTargetFileWithTemporary(); | ||||
| if (! ok) | if (! ok) | ||||
| @@ -90,7 +90,7 @@ MainWindow::~MainWindow() | |||||
| getGlobalProperties().setValue ("lastMainWindowPos", getWindowStateAsString()); | getGlobalProperties().setValue ("lastMainWindowPos", getWindowStateAsString()); | ||||
| clearContentComponent(); | clearContentComponent(); | ||||
| currentProject = nullptr; | |||||
| currentProject.reset(); | |||||
| } | } | ||||
| void MainWindow::createProjectContentCompIfNeeded() | void MainWindow::createProjectContentCompIfNeeded() | ||||
| @@ -155,7 +155,7 @@ bool MainWindow::closeProject (Project* project) | |||||
| bool MainWindow::closeCurrentProject() | bool MainWindow::closeCurrentProject() | ||||
| { | { | ||||
| return currentProject == nullptr || closeProject (currentProject); | |||||
| return currentProject == nullptr || closeProject (currentProject.get()); | |||||
| } | } | ||||
| void MainWindow::setProject (Project* newProject) | void MainWindow::setProject (Project* newProject) | ||||
| @@ -200,17 +200,17 @@ bool MainWindow::openFile (const File& file) | |||||
| { | { | ||||
| ScopedPointer<Project> newDoc (new Project (file)); | ScopedPointer<Project> newDoc (new Project (file)); | ||||
| Result result (newDoc->loadFrom (file, true)); | |||||
| auto result = newDoc->loadFrom (file, true); | |||||
| if (result.wasOk() && closeCurrentProject()) | if (result.wasOk() && closeCurrentProject()) | ||||
| { | { | ||||
| setProject (newDoc); | |||||
| setProject (newDoc.get()); | |||||
| newDoc.release()->setChangedFlag (false); | newDoc.release()->setChangedFlag (false); | ||||
| jassert (getProjectContentComponent() != nullptr); | jassert (getProjectContentComponent() != nullptr); | ||||
| getProjectContentComponent()->reloadLastOpenDocuments(); | getProjectContentComponent()->reloadLastOpenDocuments(); | ||||
| if (Project* p = getProject()) | |||||
| if (auto* p = getProject()) | |||||
| p->updateDeprecatedProjectSettingsInteractively(); | p->updateDeprecatedProjectSettingsInteractively(); | ||||
| return true; | return true; | ||||
| @@ -50,7 +50,7 @@ public: | |||||
| bool canOpenFile (const File& file) const; | bool canOpenFile (const File& file) const; | ||||
| bool openFile (const File& file); | bool openFile (const File& file); | ||||
| void setProject (Project* newProject); | void setProject (Project* newProject); | ||||
| Project* getProject() const { return currentProject; } | |||||
| Project* getProject() const { return currentProject.get(); } | |||||
| void makeVisible(); | void makeVisible(); | ||||
| void restoreWindowPosition(); | void restoreWindowPosition(); | ||||
| @@ -81,7 +81,7 @@ private: | |||||
| { | { | ||||
| facts.clear(); | facts.clear(); | ||||
| facts.add (file.getFullPathName()); | facts.add (file.getFullPathName()); | ||||
| drawable = nullptr; | |||||
| drawable.reset(); | |||||
| { | { | ||||
| ScopedPointer<InputStream> input (file.createInputStream()); | ScopedPointer<InputStream> input (file.createInputStream()); | ||||
| @@ -94,7 +94,7 @@ private: | |||||
| if (ImageFileFormat* format = ImageFileFormat::findImageFormatForStream (*input)) | if (ImageFileFormat* format = ImageFileFormat::findImageFormatForStream (*input)) | ||||
| formatName = " " + format->getFormatName(); | formatName = " " + format->getFormatName(); | ||||
| input = nullptr; | |||||
| input.reset(); | |||||
| Image image (ImageCache::getFromFile (file)); | Image image (ImageCache::getFromFile (file)); | ||||
| @@ -345,7 +345,7 @@ private: | |||||
| || underMouse->findParentComponentOfClass<ControlsComponent>() != nullptr)) | || underMouse->findParentComponentOfClass<ControlsComponent>() != nullptr)) | ||||
| return; | return; | ||||
| overlay = nullptr; | |||||
| overlay.reset(); | |||||
| if (hasKeyboardFocus (true) && underMouse != nullptr | if (hasKeyboardFocus (true) && underMouse != nullptr | ||||
| && (underMouse == this || underMouse->isParentOf (this))) | && (underMouse == this || underMouse->isParentOf (this))) | ||||
| @@ -372,7 +372,7 @@ private: | |||||
| void hideOverlay() | void hideOverlay() | ||||
| { | { | ||||
| stopTimer(); | stopTimer(); | ||||
| overlay = nullptr; | |||||
| overlay.reset(); | |||||
| } | } | ||||
| void focusLost (FocusChangeType) override | void focusLost (FocusChangeType) override | ||||
| @@ -474,7 +474,7 @@ void GenericCodeEditorComponent::showFindPanel() | |||||
| void GenericCodeEditorComponent::hideFindPanel() | void GenericCodeEditorComponent::hideFindPanel() | ||||
| { | { | ||||
| findPanel = nullptr; | |||||
| findPanel.reset(); | |||||
| } | } | ||||
| void GenericCodeEditorComponent::findSelection() | void GenericCodeEditorComponent::findSelection() | ||||
| @@ -46,11 +46,11 @@ public: | |||||
| bool hasFileBeenModifiedExternally() override { return modDetector.hasBeenModified(); } | bool hasFileBeenModifiedExternally() override { return modDetector.hasBeenModified(); } | ||||
| void fileHasBeenRenamed (const File& newFile) override { modDetector.fileHasBeenRenamed (newFile); } | void fileHasBeenRenamed (const File& newFile) override { modDetector.fileHasBeenRenamed (newFile); } | ||||
| String getState() const override { return lastState != nullptr ? lastState->toString() : String(); } | String getState() const override { return lastState != nullptr ? lastState->toString() : String(); } | ||||
| void restoreState (const String& state) override { lastState = new CodeEditorComponent::State (state); } | |||||
| void restoreState (const String& state) override { lastState.reset (new CodeEditorComponent::State (state)); } | |||||
| File getCounterpartFile() const override | File getCounterpartFile() const override | ||||
| { | { | ||||
| const File file (getFile()); | |||||
| auto file = getFile(); | |||||
| if (file.hasFileExtension (sourceFileExtensions)) | if (file.hasFileExtension (sourceFileExtensions)) | ||||
| { | { | ||||
| @@ -378,7 +378,7 @@ private: | |||||
| || jucerComp->getOwnerDocument() == nullptr | || jucerComp->getOwnerDocument() == nullptr | ||||
| || jucerComp->getFilename() != jucerComponentFile) | || jucerComp->getFilename() != jucerComponentFile) | ||||
| { | { | ||||
| jucerComp = nullptr; | |||||
| jucerComp.reset(); | |||||
| jucerComp = new TestComponent (ComponentTypeHandler::findParentDocument (this), 0, false); | jucerComp = new TestComponent (ComponentTypeHandler::findParentDocument (this), 0, false); | ||||
| jucerComp->setFilename (jucerComponentFile); | jucerComp->setFilename (jucerComponentFile); | ||||
| @@ -389,7 +389,7 @@ private: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| jucerComp = nullptr; | |||||
| jucerComp.reset(); | |||||
| } | } | ||||
| resized(); | resized(); | ||||
| @@ -113,14 +113,14 @@ PaintRoutine* ButtonDocument::getPaintRoutine (const int index) const | |||||
| if (paintStatesEnabled [i]) | if (paintStatesEnabled [i]) | ||||
| { | { | ||||
| if (index == n) | if (index == n) | ||||
| return paintRoutines [i]; | |||||
| else | |||||
| ++n; | |||||
| return paintRoutines[i].get(); | |||||
| ++n; | |||||
| } | } | ||||
| } | } | ||||
| jassertfalse; | jassertfalse; | ||||
| return 0; | |||||
| return {}; | |||||
| } | } | ||||
| void ButtonDocument::setStatePaintRoutineEnabled (const int index, bool b) | void ButtonDocument::setStatePaintRoutineEnabled (const int index, bool b) | ||||
| @@ -45,7 +45,7 @@ public: | |||||
| StringArray getPaintRoutineNames() const { return StringArray ("Graphics"); } | StringArray getPaintRoutineNames() const { return StringArray ("Graphics"); } | ||||
| PaintRoutine* getPaintRoutine (const int index) const { return index == 0 ? backgroundGraphics.get() : nullptr; } | PaintRoutine* getPaintRoutine (const int index) const { return index == 0 ? backgroundGraphics.get() : nullptr; } | ||||
| ComponentLayout* getComponentLayout() const { return components; } | |||||
| ComponentLayout* getComponentLayout() const { return components.get(); } | |||||
| //============================================================================== | //============================================================================== | ||||
| XmlElement* createXml() const; | XmlElement* createXml() const; | ||||
| @@ -598,8 +598,7 @@ void JucerDocumentEditor::saveLastSelectedTab() const | |||||
| { | { | ||||
| if (document != nullptr) | if (document != nullptr) | ||||
| { | { | ||||
| auto* project = document->getCppDocument().getProject(); | |||||
| if (project != nullptr) | |||||
| if (auto* project = document->getCppDocument().getProject()) | |||||
| { | { | ||||
| auto& projectProps = project->getStoredProperties(); | auto& projectProps = project->getStoredProperties(); | ||||
| @@ -617,7 +616,7 @@ void JucerDocumentEditor::saveLastSelectedTab() const | |||||
| child->setAttribute ("tab", tabbedComponent.getCurrentTabIndex()); | child->setAttribute ("tab", tabbedComponent.getCurrentTabIndex()); | ||||
| projectProps.setValue ("GUIComponentsLastTab", root); | |||||
| projectProps.setValue ("GUIComponentsLastTab", root.get()); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -626,10 +625,10 @@ void JucerDocumentEditor::restoreLastSelectedTab() | |||||
| { | { | ||||
| if (document != nullptr) | if (document != nullptr) | ||||
| { | { | ||||
| auto* project = document->getCppDocument().getProject(); | |||||
| if (project != nullptr) | |||||
| if (auto* project = document->getCppDocument().getProject()) | |||||
| { | { | ||||
| ScopedPointer<XmlElement> root (project->getStoredProperties().getXmlValue ("GUIComponentsLastTab")); | ScopedPointer<XmlElement> root (project->getStoredProperties().getXmlValue ("GUIComponentsLastTab")); | ||||
| if (root != nullptr) | if (root != nullptr) | ||||
| { | { | ||||
| auto* child = root->getChildByName (document->getCppFile().getFileName()); | auto* child = root->getChildByName (document->getCppFile().getFileName()); | ||||
| @@ -154,7 +154,7 @@ void PaintRoutineEditor::visibilityChanged() | |||||
| void PaintRoutineEditor::refreshAllElements() | void PaintRoutineEditor::refreshAllElements() | ||||
| { | { | ||||
| for (int i = getNumChildComponents(); --i >= 0;) | for (int i = getNumChildComponents(); --i >= 0;) | ||||
| if (PaintElement* const e = dynamic_cast<PaintElement*> (getChildComponent (i))) | |||||
| if (auto* e = dynamic_cast<PaintElement*> (getChildComponent (i))) | |||||
| if (! graphics.containsElement (e)) | if (! graphics.containsElement (e)) | ||||
| removeChildComponent (e); | removeChildComponent (e); | ||||
| @@ -162,7 +162,7 @@ void PaintRoutineEditor::refreshAllElements() | |||||
| for (int i = graphics.getNumElements(); --i >= 0;) | for (int i = graphics.getNumElements(); --i >= 0;) | ||||
| { | { | ||||
| PaintElement* const e = graphics.getElement (i); | |||||
| auto* e = graphics.getElement (i); | |||||
| addAndMakeVisible (e); | addAndMakeVisible (e); | ||||
| @@ -268,7 +268,7 @@ void PaintRoutineEditor::filesDropped (const StringArray& filenames, int x, int | |||||
| if (d != nullptr) | if (d != nullptr) | ||||
| { | { | ||||
| d = nullptr; | |||||
| d.reset(); | |||||
| document.beginTransaction(); | document.beginTransaction(); | ||||
| @@ -94,7 +94,7 @@ void TestComponent::setFilename (const String& newName) | |||||
| { | { | ||||
| recursiveFiles.add (newFile.getFullPathName()); | recursiveFiles.add (newFile.getFullPathName()); | ||||
| loadedDocument = nullptr; | |||||
| loadedDocument.reset(); | |||||
| filename = newName; | filename = newName; | ||||
| lastModificationTime = findFile().getLastModificationTime(); | lastModificationTime = findFile().getLastModificationTime(); | ||||
| @@ -121,7 +121,7 @@ void BinaryResources::add (const String& name, const String& originalFileName, c | |||||
| r->originalFilename = originalFileName; | r->originalFilename = originalFileName; | ||||
| r->data = data; | r->data = data; | ||||
| r->drawable = nullptr; | |||||
| r->drawable.reset(); | |||||
| changed(); | changed(); | ||||
| } | } | ||||
| @@ -420,7 +420,7 @@ Component* ComponentLayout::addNewComponent (ComponentTypeHandler* const type, i | |||||
| c->getProperties().set ("id", nextCompUID++); | c->getProperties().set ("id", nextCompUID++); | ||||
| ScopedPointer<XmlElement> xml (type->createXmlFor (c, this)); | ScopedPointer<XmlElement> xml (type->createXmlFor (c, this)); | ||||
| c = nullptr; | |||||
| c.reset(); | |||||
| c = addComponentFromXml (*xml, true); | c = addComponentFromXml (*xml, true); | ||||
| String memberName (CodeHelpers::makeValidIdentifier (type->getClassName (c), true, true, false)); | String memberName (CodeHelpers::makeValidIdentifier (type->getClassName (c), true, true, false)); | ||||
| @@ -564,7 +564,7 @@ bool JucerDocument::flushChangesToDocuments (Project* project) | |||||
| cpp->getCodeDocument().replaceAllContent (cppTemplate); | cpp->getCodeDocument().replaceAllContent (cppTemplate); | ||||
| } | } | ||||
| userDocChangeTimer = nullptr; | |||||
| userDocChangeTimer.reset(); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -771,7 +771,7 @@ public: | |||||
| jucerDoc->setClassName (newFile.getFileNameWithoutExtension()); | jucerDoc->setClassName (newFile.getFileNameWithoutExtension()); | ||||
| jucerDoc->flushChangesToDocuments (&project); | jucerDoc->flushChangesToDocuments (&project); | ||||
| jucerDoc = nullptr; | |||||
| jucerDoc.reset(); | |||||
| cpp->save(); | cpp->save(); | ||||
| header->save(); | header->save(); | ||||
| @@ -553,7 +553,7 @@ void PaintRoutine::dropImageAt (const File& f, int x, int y) | |||||
| if (d != nullptr) | if (d != nullptr) | ||||
| { | { | ||||
| auto bounds = d->getDrawableBounds(); | auto bounds = d->getDrawableBounds(); | ||||
| d = nullptr; | |||||
| d.reset(); | |||||
| auto* newElement = addNewElement (ObjectTypes::createNewImageElement (this), -1, true); | auto* newElement = addNewElement (ObjectTypes::createNewImageElement (this), -1, true); | ||||
| @@ -114,7 +114,7 @@ LicenseController::LicenseController() | |||||
| LicenseController::~LicenseController() | LicenseController::~LicenseController() | ||||
| { | { | ||||
| #if !JUCER_ENABLE_GPL_MODE | #if !JUCER_ENABLE_GPL_MODE | ||||
| thread = nullptr; | |||||
| thread.reset(); | |||||
| closeWebview (-1); | closeWebview (-1); | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -155,7 +155,7 @@ void LicenseController::logout() | |||||
| jassert (MessageManager::getInstance()->isThisTheMessageThread()); | jassert (MessageManager::getInstance()->isThisTheMessageThread()); | ||||
| #if ! JUCER_ENABLE_GPL_MODE | #if ! JUCER_ENABLE_GPL_MODE | ||||
| thread = nullptr; | |||||
| thread.reset(); | |||||
| updateState ({}); | updateState ({}); | ||||
| #if ! JUCE_LINUX | #if ! JUCE_LINUX | ||||
| @@ -171,7 +171,7 @@ void LicenseController::chooseNewLicense() | |||||
| jassert (MessageManager::getInstance()->isThisTheMessageThread()); | jassert (MessageManager::getInstance()->isThisTheMessageThread()); | ||||
| #if ! JUCER_ENABLE_GPL_MODE | #if ! JUCER_ENABLE_GPL_MODE | ||||
| thread = nullptr; | |||||
| thread.reset(); | |||||
| thread = new LicenseThread (*this, true); | thread = new LicenseThread (*this, true); | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -174,7 +174,7 @@ struct LicenseThread : NetWorkerThread | |||||
| if (statusCode == 200) | if (statusCode == 200) | ||||
| { | { | ||||
| var result = JSON::parse (shared->readEntireStreamAsString()); | var result = JSON::parse (shared->readEntireStreamAsString()); | ||||
| shared = nullptr; | |||||
| shared.reset(); | |||||
| auto newState = licenseStateFromJSON (result, stateToUpdate.authToken, stateToUpdate.avatar); | auto newState = licenseStateFromJSON (result, stateToUpdate.authToken, stateToUpdate.avatar); | ||||
| @@ -222,7 +222,7 @@ struct LicenseThread : NetWorkerThread | |||||
| var json = JSON::parse (shared->withExtraHeaders (accessTokenHeader) | var json = JSON::parse (shared->withExtraHeaders (accessTokenHeader) | ||||
| .readEntireStreamAsString()); | .readEntireStreamAsString()); | ||||
| shared = nullptr; | |||||
| shared.reset(); | |||||
| if (auto* jsonLicenses = json.getArray()) | if (auto* jsonLicenses = json.getArray()) | ||||
| { | { | ||||
| @@ -81,15 +81,14 @@ private: | |||||
| struct Header : public Component, private LicenseController::StateChangedCallback, | struct Header : public Component, private LicenseController::StateChangedCallback, | ||||
| private Button::Listener | private Button::Listener | ||||
| { | { | ||||
| Header () | |||||
| : avatarButton ("User Settings", &getIcons().user) | |||||
| Header() : avatarButton ("User Settings", &getIcons().user) | |||||
| { | { | ||||
| setOpaque (true); | setOpaque (true); | ||||
| addChildComponent (avatarButton); | addChildComponent (avatarButton); | ||||
| avatarButton.addListener (this); | avatarButton.addListener (this); | ||||
| if (LicenseController* licenseController = ProjucerApplication::getApp().licenseController) | |||||
| if (auto* licenseController = ProjucerApplication::getApp().licenseController.get()) | |||||
| { | { | ||||
| licenseController->addLicenseStatusChangedCallback (this); | licenseController->addLicenseStatusChangedCallback (this); | ||||
| licenseStateChanged (licenseController->getState()); | licenseStateChanged (licenseController->getState()); | ||||
| @@ -100,7 +99,7 @@ private: | |||||
| { | { | ||||
| avatarButton.removeListener (this); | avatarButton.removeListener (this); | ||||
| if (LicenseController* licenseController = ProjucerApplication::getApp().licenseController) | |||||
| if (auto* licenseController = ProjucerApplication::getApp().licenseController.get()) | |||||
| licenseController->removeLicenseStatusChangedCallback (this); | licenseController->removeLicenseStatusChangedCallback (this); | ||||
| } | } | ||||
| @@ -128,9 +127,9 @@ private: | |||||
| void buttonClicked (Button*) override | void buttonClicked (Button*) override | ||||
| { | { | ||||
| if (LicenseController* licenseController = ProjucerApplication::getApp().licenseController) | |||||
| if (auto* licenseController = ProjucerApplication::getApp().licenseController.get()) | |||||
| { | { | ||||
| const LicenseState::Type type = licenseController->getState().type; | |||||
| auto type = licenseController->getState().type; | |||||
| auto* content = new UserSettingsPopup (true); | auto* content = new UserSettingsPopup (true); | ||||
| content->setSize (200, (type == LicenseState::Type::noLicenseChosenYet ? 100 : 150)); | content->setSize (200, (type == LicenseState::Type::noLicenseChosenYet ? 100 : 150)); | ||||
| @@ -293,12 +293,12 @@ public: | |||||
| if (isRunningApp && server != nullptr) | if (isRunningApp && server != nullptr) | ||||
| server->killServerWithoutMercy(); | server->killServerWithoutMercy(); | ||||
| server = nullptr; | |||||
| server.reset(); | |||||
| } | } | ||||
| void restartServer() | void restartServer() | ||||
| { | { | ||||
| server = nullptr; | |||||
| server.reset(); | |||||
| server = new ClientIPC (owner); | server = new ClientIPC (owner); | ||||
| sendRebuild(); | sendRebuild(); | ||||
| } | } | ||||
| @@ -578,7 +578,7 @@ CompileEngineChildProcess::~CompileEngineChildProcess() | |||||
| { | { | ||||
| ProjucerApplication::getApp().openDocumentManager.removeListener (this); | ProjucerApplication::getApp().openDocumentManager.removeListener (this); | ||||
| process = nullptr; | |||||
| process.reset(); | |||||
| lastComponentList.clear(); | lastComponentList.clear(); | ||||
| } | } | ||||
| @@ -588,7 +588,7 @@ void CompileEngineChildProcess::createProcess() | |||||
| process = new ChildProcess (*this, project); | process = new ChildProcess (*this, project); | ||||
| if (! process->openedOk) | if (! process->openedOk) | ||||
| process = nullptr; | |||||
| process.reset(); | |||||
| updateAllEditors(); | updateAllEditors(); | ||||
| } | } | ||||
| @@ -662,7 +662,7 @@ bool CompileEngineChildProcess::canKillApp() const | |||||
| void CompileEngineChildProcess::killApp() | void CompileEngineChildProcess::killApp() | ||||
| { | { | ||||
| runningAppProcess = nullptr; | |||||
| runningAppProcess.reset(); | |||||
| } | } | ||||
| void CompileEngineChildProcess::handleAppLaunched() | void CompileEngineChildProcess::handleAppLaunched() | ||||
| @@ -675,7 +675,7 @@ void CompileEngineChildProcess::handleAppLaunched() | |||||
| void CompileEngineChildProcess::handleAppQuit() | void CompileEngineChildProcess::handleAppQuit() | ||||
| { | { | ||||
| DBG ("handleAppQuit"); | DBG ("handleAppQuit"); | ||||
| runningAppProcess = nullptr; | |||||
| runningAppProcess.reset(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -162,7 +162,7 @@ public: | |||||
| ~ServerIPC() | ~ServerIPC() | ||||
| { | { | ||||
| zombieKiller = nullptr; | |||||
| zombieKiller.reset(); | |||||
| if (dll.isLoaded()) | if (dll.isLoaded()) | ||||
| dll.projucer_deleteBuilder (liveCodeBuilder); | dll.projucer_deleteBuilder (liveCodeBuilder); | ||||
| @@ -69,12 +69,12 @@ public: | |||||
| Icon getIcon() const override | Icon getIcon() const override | ||||
| { | { | ||||
| return getIconForExporter (exporter).withColour (getContentColour (true)); | |||||
| return getIconForExporter (exporter.get()).withColour (getContentColour (true)); | |||||
| } | } | ||||
| void showDocument() override | void showDocument() override | ||||
| { | { | ||||
| showSettingsPage (new SettingsComp (exporter)); | |||||
| showSettingsPage (new SettingsComp (exporter.get())); | |||||
| } | } | ||||
| void deleteItem() override | void deleteItem() override | ||||
| @@ -142,7 +142,7 @@ public: | |||||
| void itemDropped (const DragAndDropTarget::SourceDetails& dragSourceDetails, int insertIndex) override | void itemDropped (const DragAndDropTarget::SourceDetails& dragSourceDetails, int insertIndex) override | ||||
| { | { | ||||
| const int oldIndex = indexOfConfig (dragSourceDetails.description.toString().fromLastOccurrenceOf ("||", false, false)); | |||||
| auto oldIndex = indexOfConfig (dragSourceDetails.description.toString().fromLastOccurrenceOf ("||", false, false)); | |||||
| if (oldIndex >= 0) | if (oldIndex >= 0) | ||||
| configListTree.moveChild (oldIndex, insertIndex, project.getUndoManagerFor (configListTree)); | configListTree.moveChild (oldIndex, insertIndex, project.getUndoManagerFor (configListTree)); | ||||
| @@ -201,10 +201,10 @@ public: | |||||
| ~ConcertinaTreeComponent() | ~ConcertinaTreeComponent() | ||||
| { | { | ||||
| treeToDisplay = nullptr; | |||||
| addButton = nullptr; | |||||
| findPanel = nullptr; | |||||
| settingsButton = nullptr; | |||||
| treeToDisplay.reset(); | |||||
| addButton.reset(); | |||||
| findPanel.reset(); | |||||
| settingsButton.reset(); | |||||
| } | } | ||||
| void resized() override | void resized() override | ||||
| @@ -98,7 +98,7 @@ public: | |||||
| if (existingComponentToUpdate == nullptr | if (existingComponentToUpdate == nullptr | ||||
| || dynamic_cast<FileOptionComponent*> (existing.get())->item != child) | || dynamic_cast<FileOptionComponent*> (existing.get())->item != child) | ||||
| { | { | ||||
| existing = nullptr; | |||||
| existing.reset(); | |||||
| existing = new FileOptionComponent (child, dynamic_cast<ListBoxHeader*> (list.getHeaderComponent())); | existing = new FileOptionComponent (child, dynamic_cast<ListBoxHeader*> (list.getHeaderComponent())); | ||||
| } | } | ||||
| } | } | ||||
| @@ -99,11 +99,11 @@ ProjectContentComponent::~ProjectContentComponent() | |||||
| ProjucerApplication::getApp().openDocumentManager.removeListener (this); | ProjucerApplication::getApp().openDocumentManager.removeListener (this); | ||||
| logo = nullptr; | |||||
| header = nullptr; | |||||
| logo.reset(); | |||||
| header.reset(); | |||||
| setProject (nullptr); | setProject (nullptr); | ||||
| contentView = nullptr; | |||||
| fileNameLabel = nullptr; | |||||
| contentView.reset(); | |||||
| fileNameLabel.reset(); | |||||
| removeChildComponent (&bubbleMessage); | removeChildComponent (&bubbleMessage); | ||||
| jassert (getNumChildComponents() <= 1); | jassert (getNumChildComponents() <= 1); | ||||
| } | } | ||||
| @@ -178,8 +178,8 @@ void ProjectContentComponent::setProject (Project* newProject) | |||||
| if (project != nullptr) | if (project != nullptr) | ||||
| project->removeChangeListener (this); | project->removeChangeListener (this); | ||||
| contentView = nullptr; | |||||
| resizerBar = nullptr; | |||||
| contentView.reset(); | |||||
| resizerBar.reset(); | |||||
| deleteProjectTabs(); | deleteProjectTabs(); | ||||
| project = newProject; | project = newProject; | ||||
| @@ -391,7 +391,7 @@ bool ProjectContentComponent::showDocument (OpenDocumentManager::Document* doc, | |||||
| void ProjectContentComponent::hideEditor() | void ProjectContentComponent::hideEditor() | ||||
| { | { | ||||
| currentDocument = nullptr; | currentDocument = nullptr; | ||||
| contentView = nullptr; | |||||
| contentView.reset(); | |||||
| if (fileNameLabel != nullptr) | if (fileNameLabel != nullptr) | ||||
| fileNameLabel->setVisible (false); | fileNameLabel->setVisible (false); | ||||
| @@ -416,7 +416,7 @@ bool ProjectContentComponent::setEditorComponent (Component* editor, | |||||
| { | { | ||||
| if (editor != nullptr) | if (editor != nullptr) | ||||
| { | { | ||||
| contentView = nullptr; | |||||
| contentView.reset(); | |||||
| if (doc == nullptr) | if (doc == nullptr) | ||||
| { | { | ||||
| @@ -67,7 +67,7 @@ public: | |||||
| void hideEditor(); | void hideEditor(); | ||||
| bool setEditorComponent (Component* editor, OpenDocumentManager::Document* doc); | bool setEditorComponent (Component* editor, OpenDocumentManager::Document* doc); | ||||
| Component* getEditorComponentContent() const; | Component* getEditorComponentContent() const; | ||||
| Component* getEditorComponent() const { return contentView; } | |||||
| Component* getEditorComponent() const { return contentView.get(); } | |||||
| Component& getSidebarComponent() { return sidebarTabs; } | Component& getSidebarComponent() { return sidebarTabs; } | ||||
| bool goToPreviousFile(); | bool goToPreviousFile(); | ||||
| @@ -407,7 +407,7 @@ Result Project::loadDocument (const File& file) | |||||
| return Result::fail ("The document contains errors and couldn't be parsed!"); | return Result::fail ("The document contains errors and couldn't be parsed!"); | ||||
| registerRecentFile (file); | registerRecentFile (file); | ||||
| enabledModulesList = nullptr; | |||||
| enabledModulesList.reset(); | |||||
| projectRoot = newTree; | projectRoot = newTree; | ||||
| removeDefunctExporters(); | removeDefunctExporters(); | ||||
| @@ -297,7 +297,7 @@ public: | |||||
| bool next(); | bool next(); | ||||
| ProjectExporter& operator*() const { return *exporter; } | ProjectExporter& operator*() const { return *exporter; } | ||||
| ProjectExporter* operator->() const { return exporter; } | |||||
| ProjectExporter* operator->() const { return exporter.get(); } | |||||
| ScopedPointer<ProjectExporter> exporter; | ScopedPointer<ProjectExporter> exporter; | ||||
| int index; | int index; | ||||
| @@ -84,7 +84,7 @@ private: | |||||
| propertyFiles.getUnchecked (0)->setValue (isProjectDefaults ? "PROJECT_DEFAULT_SETTINGS" | propertyFiles.getUnchecked (0)->setValue (isProjectDefaults ? "PROJECT_DEFAULT_SETTINGS" | ||||
| : "FALLBACK_PATHS", | : "FALLBACK_PATHS", | ||||
| data); | |||||
| data.get()); | |||||
| } | } | ||||
| void updateGlobalPreferences(); | void updateGlobalPreferences(); | ||||
| @@ -54,10 +54,10 @@ void TreePanelBase::saveOpenness() | |||||
| { | { | ||||
| if (project != nullptr) | if (project != nullptr) | ||||
| { | { | ||||
| const ScopedPointer<XmlElement> opennessState (tree.getOpennessState (true)); | |||||
| ScopedPointer<XmlElement> opennessState (tree.getOpennessState (true)); | |||||
| if (opennessState != nullptr) | if (opennessState != nullptr) | ||||
| project->getStoredProperties().setValue (opennessStateKey, opennessState); | |||||
| project->getStoredProperties().setValue (opennessStateKey, opennessState.get()); | |||||
| else | else | ||||
| project->getStoredProperties().removeValue (opennessStateKey); | project->getStoredProperties().removeValue (opennessStateKey); | ||||
| } | } | ||||
| @@ -269,5 +269,5 @@ void JucerTreeViewBase::itemDoubleClicked (const MouseEvent&) | |||||
| void JucerTreeViewBase::cancelDelayedSelectionTimer() | void JucerTreeViewBase::cancelDelayedSelectionTimer() | ||||
| { | { | ||||
| delayedSelectionTimer = nullptr; | |||||
| delayedSelectionTimer.reset(); | |||||
| } | } | ||||
| @@ -72,7 +72,7 @@ public: | |||||
| switchLicenseButton->addListener (this); | switchLicenseButton->addListener (this); | ||||
| } | } | ||||
| if (LicenseController* controller = ProjucerApplication::getApp().licenseController) | |||||
| if (auto* controller = ProjucerApplication::getApp().licenseController.get()) | |||||
| licenseStateChanged (controller->getState()); | licenseStateChanged (controller->getState()); | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -120,7 +120,7 @@ private: | |||||
| else if (b == switchLicenseButton) | else if (b == switchLicenseButton) | ||||
| { | { | ||||
| dismissCalloutBox(); | dismissCalloutBox(); | ||||
| if (LicenseController* controller = ProjucerApplication::getApp().licenseController) | |||||
| if (auto* controller = ProjucerApplication::getApp().licenseController.get()) | |||||
| controller->chooseNewLicense(); | controller->chooseNewLicense(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -53,23 +53,23 @@ struct NewProjectWizardClasses | |||||
| return 9; | return 9; | ||||
| } | } | ||||
| static NewProjectWizard* createWizardType (int index) | |||||
| static ScopedPointer<NewProjectWizard> createWizardType (int index) | |||||
| { | { | ||||
| switch (index) | switch (index) | ||||
| { | { | ||||
| case 0: return new NewProjectWizardClasses::GUIAppWizard(); | |||||
| case 1: return new NewProjectWizardClasses::AnimatedAppWizard(); | |||||
| case 2: return new NewProjectWizardClasses::OpenGLAppWizard(); | |||||
| case 3: return new NewProjectWizardClasses::ConsoleAppWizard(); | |||||
| case 4: return new NewProjectWizardClasses::AudioAppWizard(); | |||||
| case 5: return new NewProjectWizardClasses::AudioPluginAppWizard(); | |||||
| case 6: return new NewProjectWizardClasses::StaticLibraryWizard(); | |||||
| case 7: return new NewProjectWizardClasses::DynamicLibraryWizard(); | |||||
| case 8: return new NewProjectWizardClasses::BlankAppWizard(); | |||||
| case 0: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::GUIAppWizard()); | |||||
| case 1: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::AnimatedAppWizard()); | |||||
| case 2: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::OpenGLAppWizard()); | |||||
| case 3: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::ConsoleAppWizard()); | |||||
| case 4: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::AudioAppWizard()); | |||||
| case 5: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::AudioPluginAppWizard()); | |||||
| case 6: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::StaticLibraryWizard()); | |||||
| case 7: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::DynamicLibraryWizard()); | |||||
| case 8: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::BlankAppWizard()); | |||||
| default: jassertfalse; break; | default: jassertfalse; break; | ||||
| } | } | ||||
| return nullptr; | |||||
| return {}; | |||||
| } | } | ||||
| static StringArray getWizardNames() | static StringArray getWizardNames() | ||||
| @@ -77,10 +77,7 @@ struct NewProjectWizardClasses | |||||
| StringArray s; | StringArray s; | ||||
| for (int i = 0; i < getNumWizards(); ++i) | for (int i = 0; i < getNumWizards(); ++i) | ||||
| { | |||||
| ScopedPointer<NewProjectWizard> wiz (createWizardType (i)); | |||||
| s.add (wiz->getName()); | |||||
| } | |||||
| s.add (createWizardType (i)->getName()); | |||||
| return s; | return s; | ||||
| } | } | ||||
| @@ -519,7 +519,7 @@ private: | |||||
| TextButton cancelButton { TRANS("Cancel") }; | TextButton cancelButton { TRANS("Cancel") }; | ||||
| ModulesFolderPathBox modulesPathBox; | ModulesFolderPathBox modulesPathBox; | ||||
| NewProjectWizardClasses::NewProjectWizard* createWizard() | |||||
| ScopedPointer<NewProjectWizardClasses::NewProjectWizard> createWizard() | |||||
| { | { | ||||
| return createWizardType (projectType.getSelectedItemIndex()); | return createWizardType (projectType.getSelectedItemIndex()); | ||||
| } | } | ||||
| @@ -144,7 +144,7 @@ public: | |||||
| for (int i = 0; i < numWizardButtons; ++i) | for (int i = 0; i < numWizardButtons; ++i) | ||||
| { | { | ||||
| ScopedPointer<NewProjectWizard> wizard (createWizardType (i)); | |||||
| auto wizard = createWizardType (i); | |||||
| TemplateOptionButton* b = new TemplateOptionButton (wizard->getName(), | TemplateOptionButton* b = new TemplateOptionButton (wizard->getName(), | ||||
| TemplateOptionButton::ImageFitted, | TemplateOptionButton::ImageFitted, | ||||
| @@ -101,8 +101,8 @@ AudioDeviceManager::AudioDeviceManager() | |||||
| AudioDeviceManager::~AudioDeviceManager() | AudioDeviceManager::~AudioDeviceManager() | ||||
| { | { | ||||
| currentAudioDevice = nullptr; | |||||
| defaultMidiOutput = nullptr; | |||||
| currentAudioDevice.reset(); | |||||
| defaultMidiOutput.reset(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -316,7 +316,7 @@ String AudioDeviceManager::initialiseFromXML (const XmlElement& xml, | |||||
| String AudioDeviceManager::initialiseWithDefaultDevices (int numInputChannelsNeeded, | String AudioDeviceManager::initialiseWithDefaultDevices (int numInputChannelsNeeded, | ||||
| int numOutputChannelsNeeded) | int numOutputChannelsNeeded) | ||||
| { | { | ||||
| lastExplicitSettings = nullptr; | |||||
| lastExplicitSettings.reset(); | |||||
| return initialise (numInputChannelsNeeded, numOutputChannelsNeeded, | return initialise (numInputChannelsNeeded, numOutputChannelsNeeded, | ||||
| nullptr, false, String(), nullptr); | nullptr, false, String(), nullptr); | ||||
| @@ -389,7 +389,7 @@ void AudioDeviceManager::getAudioDeviceSetup (AudioDeviceSetup& setup) const | |||||
| void AudioDeviceManager::deleteCurrentDevice() | void AudioDeviceManager::deleteCurrentDevice() | ||||
| { | { | ||||
| currentAudioDevice = nullptr; | |||||
| currentAudioDevice.reset(); | |||||
| currentSetup.inputDeviceName.clear(); | currentSetup.inputDeviceName.clear(); | ||||
| currentSetup.outputDeviceName.clear(); | currentSetup.outputDeviceName.clear(); | ||||
| } | } | ||||
| @@ -588,13 +588,13 @@ void AudioDeviceManager::stopDevice() | |||||
| if (currentAudioDevice != nullptr) | if (currentAudioDevice != nullptr) | ||||
| currentAudioDevice->stop(); | currentAudioDevice->stop(); | ||||
| testSound = nullptr; | |||||
| testSound.reset(); | |||||
| } | } | ||||
| void AudioDeviceManager::closeAudioDevice() | void AudioDeviceManager::closeAudioDevice() | ||||
| { | { | ||||
| stopDevice(); | stopDevice(); | ||||
| currentAudioDevice = nullptr; | |||||
| currentAudioDevice.reset(); | |||||
| } | } | ||||
| void AudioDeviceManager::restartLastAudioDevice() | void AudioDeviceManager::restartLastAudioDevice() | ||||
| @@ -705,14 +705,14 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat | |||||
| if (callbacks.size() > 0) | if (callbacks.size() > 0) | ||||
| { | { | ||||
| const double callbackStartTime = Time::getMillisecondCounterHiRes(); | |||||
| auto callbackStartTime = Time::getMillisecondCounterHiRes(); | |||||
| tempBuffer.setSize (jmax (1, numOutputChannels), jmax (1, numSamples), false, false, true); | tempBuffer.setSize (jmax (1, numOutputChannels), jmax (1, numSamples), false, false, true); | ||||
| callbacks.getUnchecked(0)->audioDeviceIOCallback (inputChannelData, numInputChannels, | callbacks.getUnchecked(0)->audioDeviceIOCallback (inputChannelData, numInputChannels, | ||||
| outputChannelData, numOutputChannels, numSamples); | outputChannelData, numOutputChannels, numSamples); | ||||
| float** const tempChans = tempBuffer.getArrayOfWritePointers(); | |||||
| auto** tempChans = tempBuffer.getArrayOfWritePointers(); | |||||
| for (int i = callbacks.size(); --i > 0;) | for (int i = callbacks.size(); --i > 0;) | ||||
| { | { | ||||
| @@ -721,14 +721,14 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat | |||||
| for (int chan = 0; chan < numOutputChannels; ++chan) | for (int chan = 0; chan < numOutputChannels; ++chan) | ||||
| { | { | ||||
| if (const float* const src = tempChans [chan]) | |||||
| if (float* const dst = outputChannelData [chan]) | |||||
| if (auto* src = tempChans [chan]) | |||||
| if (auto* dst = outputChannelData [chan]) | |||||
| for (int j = 0; j < numSamples; ++j) | for (int j = 0; j < numSamples; ++j) | ||||
| dst[j] += src[j]; | dst[j] += src[j]; | ||||
| } | } | ||||
| } | } | ||||
| const double msTaken = Time::getMillisecondCounterHiRes() - callbackStartTime; | |||||
| auto msTaken = Time::getMillisecondCounterHiRes() - callbackStartTime; | |||||
| const double filterAmount = 0.2; | const double filterAmount = 0.2; | ||||
| cpuUsageMs += filterAmount * (msTaken - cpuUsageMs); | cpuUsageMs += filterAmount * (msTaken - cpuUsageMs); | ||||
| @@ -743,16 +743,17 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat | |||||
| if (testSound != nullptr) | if (testSound != nullptr) | ||||
| { | { | ||||
| const int numSamps = jmin (numSamples, testSound->getNumSamples() - testSoundPosition); | |||||
| const float* const src = testSound->getReadPointer (0, testSoundPosition); | |||||
| auto numSamps = jmin (numSamples, testSound->getNumSamples() - testSoundPosition); | |||||
| auto* src = testSound->getReadPointer (0, testSoundPosition); | |||||
| for (int i = 0; i < numOutputChannels; ++i) | for (int i = 0; i < numOutputChannels; ++i) | ||||
| for (int j = 0; j < numSamps; ++j) | for (int j = 0; j < numSamps; ++j) | ||||
| outputChannelData [i][j] += src[j]; | outputChannelData [i][j] += src[j]; | ||||
| testSoundPosition += numSamps; | testSoundPosition += numSamps; | ||||
| if (testSoundPosition >= testSound->getNumSamples()) | if (testSoundPosition >= testSound->getNumSamples()) | ||||
| testSound = nullptr; | |||||
| testSound.reset(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -761,8 +762,8 @@ void AudioDeviceManager::audioDeviceAboutToStartInt (AudioIODevice* const device | |||||
| cpuUsageMs = 0; | cpuUsageMs = 0; | ||||
| xruns = 0; | xruns = 0; | ||||
| const double sampleRate = device->getCurrentSampleRate(); | |||||
| const int blockSize = device->getCurrentBufferSizeSamples(); | |||||
| auto sampleRate = device->getCurrentSampleRate(); | |||||
| auto blockSize = device->getCurrentBufferSizeSamples(); | |||||
| if (sampleRate > 0.0 && blockSize > 0) | if (sampleRate > 0.0 && blockSize > 0) | ||||
| { | { | ||||
| @@ -772,6 +773,7 @@ void AudioDeviceManager::audioDeviceAboutToStartInt (AudioIODevice* const device | |||||
| { | { | ||||
| const ScopedLock sl (audioCallbackLock); | const ScopedLock sl (audioCallbackLock); | ||||
| for (int i = callbacks.size(); --i >= 0;) | for (int i = callbacks.size(); --i >= 0;) | ||||
| callbacks.getUnchecked(i)->audioDeviceAboutToStart (device); | callbacks.getUnchecked(i)->audioDeviceAboutToStart (device); | ||||
| } | } | ||||
| @@ -787,6 +789,7 @@ void AudioDeviceManager::audioDeviceStoppedInt() | |||||
| sendChangeMessage(); | sendChangeMessage(); | ||||
| const ScopedLock sl (audioCallbackLock); | const ScopedLock sl (audioCallbackLock); | ||||
| for (int i = callbacks.size(); --i >= 0;) | for (int i = callbacks.size(); --i >= 0;) | ||||
| callbacks.getUnchecked(i)->audioDeviceStopped(); | callbacks.getUnchecked(i)->audioDeviceStopped(); | ||||
| } | } | ||||
| @@ -794,6 +797,7 @@ void AudioDeviceManager::audioDeviceStoppedInt() | |||||
| void AudioDeviceManager::audioDeviceErrorInt (const String& message) | void AudioDeviceManager::audioDeviceErrorInt (const String& message) | ||||
| { | { | ||||
| const ScopedLock sl (audioCallbackLock); | const ScopedLock sl (audioCallbackLock); | ||||
| for (int i = callbacks.size(); --i >= 0;) | for (int i = callbacks.size(); --i >= 0;) | ||||
| callbacks.getUnchecked(i)->audioDeviceError (message); | callbacks.getUnchecked(i)->audioDeviceError (message); | ||||
| } | } | ||||
| @@ -903,7 +907,7 @@ void AudioDeviceManager::setDefaultMidiOutput (const String& deviceName) | |||||
| for (int i = oldCallbacks.size(); --i >= 0;) | for (int i = oldCallbacks.size(); --i >= 0;) | ||||
| oldCallbacks.getUnchecked(i)->audioDeviceStopped(); | oldCallbacks.getUnchecked(i)->audioDeviceStopped(); | ||||
| defaultMidiOutput = nullptr; | |||||
| defaultMidiOutput.reset(); | |||||
| defaultMidiOutputName = deviceName; | defaultMidiOutputName = deviceName; | ||||
| if (deviceName.isNotEmpty()) | if (deviceName.isNotEmpty()) | ||||
| @@ -318,8 +318,7 @@ namespace CoreMidiHelpers | |||||
| class MidiPortAndCallback | class MidiPortAndCallback | ||||
| { | { | ||||
| public: | public: | ||||
| MidiPortAndCallback (MidiInputCallback& cb) | |||||
| : input (nullptr), active (false), callback (cb), concatenator (2048) | |||||
| MidiPortAndCallback (MidiInputCallback& cb) : callback (cb) | |||||
| { | { | ||||
| } | } | ||||
| @@ -332,18 +331,19 @@ namespace CoreMidiHelpers | |||||
| activeCallbacks.removeFirstMatchingValue (this); | activeCallbacks.removeFirstMatchingValue (this); | ||||
| } | } | ||||
| if (portAndEndpoint != 0 && portAndEndpoint->port != 0) | |||||
| if (portAndEndpoint != nullptr && portAndEndpoint->port != 0) | |||||
| CHECK_ERROR (MIDIPortDisconnectSource (portAndEndpoint->port, portAndEndpoint->endPoint)); | CHECK_ERROR (MIDIPortDisconnectSource (portAndEndpoint->port, portAndEndpoint->endPoint)); | ||||
| } | } | ||||
| void handlePackets (const MIDIPacketList* const pktlist) | void handlePackets (const MIDIPacketList* const pktlist) | ||||
| { | { | ||||
| const double time = Time::getMillisecondCounterHiRes() * 0.001; | |||||
| auto time = Time::getMillisecondCounterHiRes() * 0.001; | |||||
| const ScopedLock sl (callbackLock); | const ScopedLock sl (callbackLock); | ||||
| if (activeCallbacks.contains (this) && active) | if (activeCallbacks.contains (this) && active) | ||||
| { | { | ||||
| const MIDIPacket* packet = &pktlist->packet[0]; | |||||
| auto* packet = &pktlist->packet[0]; | |||||
| for (unsigned int i = 0; i < pktlist->numPackets; ++i) | for (unsigned int i = 0; i < pktlist->numPackets; ++i) | ||||
| { | { | ||||
| @@ -355,13 +355,13 @@ namespace CoreMidiHelpers | |||||
| } | } | ||||
| } | } | ||||
| MidiInput* input; | |||||
| MidiInput* input = nullptr; | |||||
| ScopedPointer<MidiPortAndEndpoint> portAndEndpoint; | ScopedPointer<MidiPortAndEndpoint> portAndEndpoint; | ||||
| volatile bool active; | |||||
| volatile bool active = false; | |||||
| private: | private: | ||||
| MidiInputCallback& callback; | MidiInputCallback& callback; | ||||
| MidiDataConcatenator concatenator; | |||||
| MidiDataConcatenator concatenator { 2048 }; | |||||
| }; | }; | ||||
| static void midiInputProc (const MIDIPacketList* pktlist, void* readProcRefCon, void* /*srcConnRefCon*/) | static void midiInputProc (const MIDIPacketList* pktlist, void* readProcRefCon, void* /*srcConnRefCon*/) | ||||
| @@ -1749,8 +1749,8 @@ namespace WavFileHelpers | |||||
| outStream.release(); | outStream.release(); | ||||
| bool ok = writer->writeFromAudioReader (*reader, 0, -1); | bool ok = writer->writeFromAudioReader (*reader, 0, -1); | ||||
| writer = nullptr; | |||||
| reader = nullptr; | |||||
| writer.reset(); | |||||
| reader.reset(); | |||||
| return ok && tempFile.overwriteTargetFileWithTemporary(); | return ok && tempFile.overwriteTargetFileWithTemporary(); | ||||
| } | } | ||||
| @@ -1769,7 +1769,7 @@ bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPai | |||||
| { | { | ||||
| auto bwavPos = reader->bwavChunkStart; | auto bwavPos = reader->bwavChunkStart; | ||||
| auto bwavSize = reader->bwavSize; | auto bwavSize = reader->bwavSize; | ||||
| reader = nullptr; | |||||
| reader.reset(); | |||||
| if (bwavSize > 0) | if (bwavSize > 0) | ||||
| { | { | ||||
| @@ -389,7 +389,7 @@ bool MemoryMappedAudioFormatReader::mapSectionOfFile (Range<int64> samplesToMap) | |||||
| { | { | ||||
| if (map == nullptr || samplesToMap != mappedSection) | if (map == nullptr || samplesToMap != mappedSection) | ||||
| { | { | ||||
| map = nullptr; | |||||
| map.reset(); | |||||
| const Range<int64> fileRange (sampleToFilePos (samplesToMap.getStart()), | const Range<int64> fileRange (sampleToFilePos (samplesToMap.getStart()), | ||||
| sampleToFilePos (samplesToMap.getEnd())); | sampleToFilePos (samplesToMap.getEnd())); | ||||
| @@ -397,7 +397,7 @@ bool MemoryMappedAudioFormatReader::mapSectionOfFile (Range<int64> samplesToMap) | |||||
| map = new MemoryMappedFile (file, fileRange, MemoryMappedFile::readOnly); | map = new MemoryMappedFile (file, fileRange, MemoryMappedFile::readOnly); | ||||
| if (map->getData() == nullptr) | if (map->getData() == nullptr) | ||||
| map = nullptr; | |||||
| map.reset(); | |||||
| else | else | ||||
| mappedSection = Range<int64> (jmax ((int64) 0, filePosToSample (map->getRange().getStart() + (bytesPerFrame - 1))), | mappedSection = Range<int64> (jmax ((int64) 0, filePosToSample (map->getRange().getStart() + (bytesPerFrame - 1))), | ||||
| jmin (lengthInSamples, filePosToSample (map->getRange().getEnd()))); | jmin (lengthInSamples, filePosToSample (map->getRange().getEnd()))); | ||||
| @@ -113,7 +113,7 @@ void AudioProcessorEditor::setResizable (const bool shouldBeResizable, const boo | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| resizableCorner = nullptr; | |||||
| resizableCorner.reset(); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -1177,8 +1177,8 @@ void AudioProcessorGraph::buildRenderingSequence() | |||||
| { | { | ||||
| { | { | ||||
| const ScopedLock sl (getCallbackLock()); | const ScopedLock sl (getCallbackLock()); | ||||
| renderSequenceFloat = nullptr; | |||||
| renderSequenceDouble = nullptr; | |||||
| renderSequenceFloat.reset(); | |||||
| renderSequenceDouble.reset(); | |||||
| } | } | ||||
| for (auto* node : nodes) | for (auto* node : nodes) | ||||
| @@ -385,7 +385,7 @@ public: | |||||
| if (pool != nullptr) | if (pool != nullptr) | ||||
| { | { | ||||
| pool->removeAllJobs (true, 60000); | pool->removeAllJobs (true, 60000); | ||||
| pool = nullptr; | |||||
| pool.reset(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -580,7 +580,7 @@ void PluginListComponent::scanFinished (const StringArray& failedFiles) | |||||
| for (int i = 0; i < failedFiles.size(); ++i) | for (int i = 0; i < failedFiles.size(); ++i) | ||||
| shortNames.add (File::createFileWithoutCheckingPath (failedFiles[i]).getFileName()); | shortNames.add (File::createFileWithoutCheckingPath (failedFiles[i]).getFileName()); | ||||
| currentScanner = nullptr; // mustn't delete this before using the failed files array | |||||
| currentScanner.reset(); // mustn't delete this before using the failed files array | |||||
| if (shortNames.size() > 0) | if (shortNames.size() > 0) | ||||
| AlertWindow::showMessageBoxAsync (AlertWindow::InfoIcon, | AlertWindow::showMessageBoxAsync (AlertWindow::InfoIcon, | ||||
| @@ -459,8 +459,8 @@ public: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| outputChanLabel = nullptr; | |||||
| outputChanList = nullptr; | |||||
| outputChanLabel.reset(); | |||||
| outputChanList.reset(); | |||||
| } | } | ||||
| if (setup.maxNumInputChannels > 0 | if (setup.maxNumInputChannels > 0 | ||||
| @@ -480,8 +480,8 @@ public: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| inputChanLabel = nullptr; | |||||
| inputChanList = nullptr; | |||||
| inputChanLabel.reset(); | |||||
| inputChanList.reset(); | |||||
| } | } | ||||
| updateSampleRateComboBox (currentDevice); | updateSampleRateComboBox (currentDevice); | ||||
| @@ -491,15 +491,15 @@ public: | |||||
| { | { | ||||
| jassert (setup.manager->getCurrentAudioDevice() == nullptr); // not the correct device type! | jassert (setup.manager->getCurrentAudioDevice() == nullptr); // not the correct device type! | ||||
| inputChanLabel = nullptr; | |||||
| outputChanLabel = nullptr; | |||||
| sampleRateLabel = nullptr; | |||||
| bufferSizeLabel = nullptr; | |||||
| inputChanLabel.reset(); | |||||
| outputChanLabel.reset(); | |||||
| sampleRateLabel.reset(); | |||||
| bufferSizeLabel.reset(); | |||||
| inputChanList = nullptr; | |||||
| outputChanList = nullptr; | |||||
| sampleRateDropDown = nullptr; | |||||
| bufferSizeDropDown = nullptr; | |||||
| inputChanList.reset(); | |||||
| outputChanList.reset(); | |||||
| sampleRateDropDown.reset(); | |||||
| bufferSizeDropDown.reset(); | |||||
| if (outputDeviceDropDown != nullptr) | if (outputDeviceDropDown != nullptr) | ||||
| outputDeviceDropDown->setSelectedId (-1, dontSendNotification); | outputDeviceDropDown->setSelectedId (-1, dontSendNotification); | ||||
| @@ -574,8 +574,8 @@ private: | |||||
| void updateControlPanelButton() | void updateControlPanelButton() | ||||
| { | { | ||||
| AudioIODevice* const currentDevice = setup.manager->getCurrentAudioDevice(); | |||||
| showUIButton = nullptr; | |||||
| auto* currentDevice = setup.manager->getCurrentAudioDevice(); | |||||
| showUIButton.reset(); | |||||
| if (currentDevice != nullptr && currentDevice->hasControlPanel()) | if (currentDevice != nullptr && currentDevice->hasControlPanel()) | ||||
| { | { | ||||
| @@ -606,7 +606,7 @@ private: | |||||
| } | } | ||||
| } | } | ||||
| resetDeviceButton = nullptr; | |||||
| resetDeviceButton.reset(); | |||||
| } | } | ||||
| void updateOutputsComboBox() | void updateOutputsComboBox() | ||||
| @@ -1033,9 +1033,9 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager& | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| midiInputsList = nullptr; | |||||
| midiInputsLabel = nullptr; | |||||
| bluetoothButton = nullptr; | |||||
| midiInputsList.reset(); | |||||
| midiInputsLabel.reset(); | |||||
| bluetoothButton.reset(); | |||||
| } | } | ||||
| if (showMidiOutputSelector) | if (showMidiOutputSelector) | ||||
| @@ -1048,8 +1048,8 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager& | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| midiOutputSelector = nullptr; | |||||
| midiOutputLabel = nullptr; | |||||
| midiOutputSelector.reset(); | |||||
| midiOutputLabel.reset(); | |||||
| } | } | ||||
| deviceManager.addChangeListener (this); | deviceManager.addChangeListener (this); | ||||
| @@ -1123,7 +1123,7 @@ void AudioDeviceSelectorComponent::comboBoxChanged (ComboBox* comboBoxThatHasCha | |||||
| { | { | ||||
| if (AudioIODeviceType* const type = deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown->getSelectedId() - 1]) | if (AudioIODeviceType* const type = deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown->getSelectedId() - 1]) | ||||
| { | { | ||||
| audioDeviceSettingsComp = nullptr; | |||||
| audioDeviceSettingsComp.reset(); | |||||
| deviceManager.setCurrentAudioDeviceType (type->getTypeName(), true); | deviceManager.setCurrentAudioDeviceType (type->getTypeName(), true); | ||||
| updateAllControls(); // needed in case the type hasn't actually changed | updateAllControls(); // needed in case the type hasn't actually changed | ||||
| } | } | ||||
| @@ -1153,11 +1153,10 @@ void AudioDeviceSelectorComponent::updateAllControls() | |||||
| || audioDeviceSettingsCompType != deviceManager.getCurrentAudioDeviceType()) | || audioDeviceSettingsCompType != deviceManager.getCurrentAudioDeviceType()) | ||||
| { | { | ||||
| audioDeviceSettingsCompType = deviceManager.getCurrentAudioDeviceType(); | audioDeviceSettingsCompType = deviceManager.getCurrentAudioDeviceType(); | ||||
| audioDeviceSettingsComp = nullptr; | |||||
| audioDeviceSettingsComp.reset(); | |||||
| if (AudioIODeviceType* const type | |||||
| = deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown == nullptr | |||||
| ? 0 : deviceTypeDropDown->getSelectedId() - 1]) | |||||
| if (auto* type = deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown == nullptr | |||||
| ? 0 : deviceTypeDropDown->getSelectedId() - 1]) | |||||
| { | { | ||||
| AudioDeviceSetupDetails details; | AudioDeviceSetupDetails details; | ||||
| details.manager = &deviceManager; | details.manager = &deviceManager; | ||||
| @@ -1167,7 +1166,7 @@ void AudioDeviceSelectorComponent::updateAllControls() | |||||
| details.maxNumOutputChannels = maxOutputChannels; | details.maxNumOutputChannels = maxOutputChannels; | ||||
| details.useStereoPairs = showChannelsAsStereoPairs; | details.useStereoPairs = showChannelsAsStereoPairs; | ||||
| AudioDeviceSettingsPanel* sp = new AudioDeviceSettingsPanel (*type, details, hideAdvancedOptionsWithButton); | |||||
| auto* sp = new AudioDeviceSettingsPanel (*type, details, hideAdvancedOptionsWithButton); | |||||
| audioDeviceSettingsComp = sp; | audioDeviceSettingsComp = sp; | ||||
| addAndMakeVisible (sp); | addAndMakeVisible (sp); | ||||
| sp->updateAllControls(); | sp->updateAllControls(); | ||||
| @@ -1185,7 +1184,7 @@ void AudioDeviceSelectorComponent::updateAllControls() | |||||
| { | { | ||||
| midiOutputSelector->clear(); | midiOutputSelector->clear(); | ||||
| const StringArray midiOuts (MidiOutput::getDevices()); | |||||
| auto midiOuts = MidiOutput::getDevices(); | |||||
| midiOutputSelector->addItem (getNoDeviceString(), -1); | midiOutputSelector->addItem (getNoDeviceString(), -1); | ||||
| midiOutputSelector->addSeparator(); | midiOutputSelector->addSeparator(); | ||||
| @@ -120,7 +120,7 @@ public: | |||||
| sampleRate = reader->sampleRate; | sampleRate = reader->sampleRate; | ||||
| if (lengthInSamples <= 0 || isFullyLoaded()) | if (lengthInSamples <= 0 || isFullyLoaded()) | ||||
| reader = nullptr; | |||||
| reader.reset(); | |||||
| else | else | ||||
| owner.cache.getTimeSliceThread().addTimeSliceClient (this); | owner.cache.getTimeSliceThread().addTimeSliceClient (this); | ||||
| } | } | ||||
| @@ -155,7 +155,7 @@ public: | |||||
| void releaseResources() | void releaseResources() | ||||
| { | { | ||||
| const ScopedLock sl (readerLock); | const ScopedLock sl (readerLock); | ||||
| reader = nullptr; | |||||
| reader.reset(); | |||||
| } | } | ||||
| int useTimeSlice() override | int useTimeSlice() override | ||||
| @@ -557,7 +557,7 @@ AudioThumbnail::~AudioThumbnail() | |||||
| void AudioThumbnail::clear() | void AudioThumbnail::clear() | ||||
| { | { | ||||
| source = nullptr; | |||||
| source.reset(); | |||||
| const ScopedLock sl (lock); | const ScopedLock sl (lock); | ||||
| clearChannelData(); | clearChannelData(); | ||||
| } | } | ||||
| @@ -51,7 +51,6 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Creates an empty array. */ | /** Creates an empty array. */ | ||||
| OwnedArray() noexcept | OwnedArray() noexcept | ||||
| : numUsed (0) | |||||
| { | { | ||||
| } | } | ||||
| @@ -139,7 +138,7 @@ public: | |||||
| if (isPositiveAndBelow (index, numUsed)) | if (isPositiveAndBelow (index, numUsed)) | ||||
| { | { | ||||
| jassert (data.elements != nullptr); | jassert (data.elements != nullptr); | ||||
| return data.elements [index]; | |||||
| return data.elements[index]; | |||||
| } | } | ||||
| return nullptr; | return nullptr; | ||||
| @@ -154,7 +153,7 @@ public: | |||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| jassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr); | jassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr); | ||||
| return data.elements [index]; | |||||
| return data.elements[index]; | |||||
| } | } | ||||
| /** Returns a pointer to the first object in the array. | /** Returns a pointer to the first object in the array. | ||||
| @@ -169,7 +168,7 @@ public: | |||||
| if (numUsed > 0) | if (numUsed > 0) | ||||
| { | { | ||||
| jassert (data.elements != nullptr); | jassert (data.elements != nullptr); | ||||
| return data.elements [0]; | |||||
| return data.elements[0]; | |||||
| } | } | ||||
| return nullptr; | return nullptr; | ||||
| @@ -187,7 +186,7 @@ public: | |||||
| if (numUsed > 0) | if (numUsed > 0) | ||||
| { | { | ||||
| jassert (data.elements != nullptr); | jassert (data.elements != nullptr); | ||||
| return data.elements [numUsed - 1]; | |||||
| return data.elements[numUsed - 1]; | |||||
| } | } | ||||
| return nullptr; | return nullptr; | ||||
| @@ -233,8 +232,8 @@ public: | |||||
| int indexOf (const ObjectClass* objectToLookFor) const noexcept | int indexOf (const ObjectClass* objectToLookFor) const noexcept | ||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| ObjectClass* const* e = data.elements.get(); | |||||
| ObjectClass* const* const end_ = e + numUsed; | |||||
| auto** e = data.elements.get(); | |||||
| auto** end_ = e + numUsed; | |||||
| for (; e != end_; ++e) | for (; e != end_; ++e) | ||||
| if (objectToLookFor == *e) | if (objectToLookFor == *e) | ||||
| @@ -251,8 +250,8 @@ public: | |||||
| bool contains (const ObjectClass* objectToLookFor) const noexcept | bool contains (const ObjectClass* objectToLookFor) const noexcept | ||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| ObjectClass* const* e = data.elements.get(); | |||||
| ObjectClass* const* const end_ = e + numUsed; | |||||
| auto** e = data.elements.get(); | |||||
| auto** end_ = e + numUsed; | |||||
| for (; e != end_; ++e) | for (; e != end_; ++e) | ||||
| if (objectToLookFor == *e) | if (objectToLookFor == *e) | ||||
| @@ -279,7 +278,7 @@ public: | |||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| data.ensureAllocatedSize (numUsed + 1); | data.ensureAllocatedSize (numUsed + 1); | ||||
| jassert (data.elements != nullptr); | jassert (data.elements != nullptr); | ||||
| data.elements [numUsed++] = newObject; | |||||
| data.elements[numUsed++] = newObject; | |||||
| return newObject; | return newObject; | ||||
| } | } | ||||
| @@ -314,8 +313,8 @@ public: | |||||
| data.ensureAllocatedSize (numUsed + 1); | data.ensureAllocatedSize (numUsed + 1); | ||||
| jassert (data.elements != nullptr); | jassert (data.elements != nullptr); | ||||
| ObjectClass** const e = data.elements + indexToInsertAt; | |||||
| const int numToMove = numUsed - indexToInsertAt; | |||||
| auto** e = data.elements + indexToInsertAt; | |||||
| auto numToMove = numUsed - indexToInsertAt; | |||||
| if (numToMove > 0) | if (numToMove > 0) | ||||
| memmove (e + 1, e, sizeof (ObjectClass*) * (size_t) numToMove); | memmove (e + 1, e, sizeof (ObjectClass*) * (size_t) numToMove); | ||||
| @@ -345,12 +344,12 @@ public: | |||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| data.ensureAllocatedSize (numUsed + numberOfElements); | data.ensureAllocatedSize (numUsed + numberOfElements); | ||||
| ObjectClass** insertPos = data.elements; | |||||
| auto* insertPos = data.elements.get(); | |||||
| if (isPositiveAndBelow (indexToInsertAt, numUsed)) | if (isPositiveAndBelow (indexToInsertAt, numUsed)) | ||||
| { | { | ||||
| insertPos += indexToInsertAt; | insertPos += indexToInsertAt; | ||||
| const size_t numberToMove = (size_t) (numUsed - indexToInsertAt); | |||||
| auto numberToMove = (size_t) (numUsed - indexToInsertAt); | |||||
| memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ObjectClass*)); | memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ObjectClass*)); | ||||
| } | } | ||||
| else | else | ||||
| @@ -410,18 +409,18 @@ public: | |||||
| { | { | ||||
| if (deleteOldElement) | if (deleteOldElement) | ||||
| { | { | ||||
| toDelete = data.elements [indexToChange]; | |||||
| toDelete = data.elements[indexToChange]; | |||||
| if (toDelete == newObject) | if (toDelete == newObject) | ||||
| toDelete.release(); | toDelete.release(); | ||||
| } | } | ||||
| data.elements [indexToChange] = newObject; | |||||
| data.elements[indexToChange] = newObject; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| data.ensureAllocatedSize (numUsed + 1); | data.ensureAllocatedSize (numUsed + 1); | ||||
| data.elements [numUsed++] = newObject; | |||||
| data.elements[numUsed++] = newObject; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -465,7 +464,7 @@ public: | |||||
| while (--numElementsToAdd >= 0) | while (--numElementsToAdd >= 0) | ||||
| { | { | ||||
| data.elements [numUsed] = arrayToAddFrom.getUnchecked (startIndex++); | |||||
| data.elements[numUsed] = arrayToAddFrom.getUnchecked (startIndex++); | |||||
| ++numUsed; | ++numUsed; | ||||
| } | } | ||||
| } | } | ||||
| @@ -505,7 +504,7 @@ public: | |||||
| jassert (numElementsToAdd <= 0 || data.elements != nullptr); | jassert (numElementsToAdd <= 0 || data.elements != nullptr); | ||||
| while (--numElementsToAdd >= 0) | while (--numElementsToAdd >= 0) | ||||
| data.elements [numUsed++] = createCopyIfNotNull (arrayToAddFrom.getUnchecked (startIndex++)); | |||||
| data.elements[numUsed++] = createCopyIfNotNull (arrayToAddFrom.getUnchecked (startIndex++)); | |||||
| } | } | ||||
| /** Inserts a new object into the array assuming that the array is sorted. | /** Inserts a new object into the array assuming that the array is sorted. | ||||
| @@ -552,14 +551,15 @@ public: | |||||
| while (s < e) | while (s < e) | ||||
| { | { | ||||
| if (comparator.compareElements (objectToLookFor, data.elements [s]) == 0) | |||||
| if (comparator.compareElements (objectToLookFor, data.elements[s]) == 0) | |||||
| return s; | return s; | ||||
| const int halfway = (s + e) / 2; | |||||
| auto halfway = (s + e) / 2; | |||||
| if (halfway == s) | if (halfway == s) | ||||
| break; | break; | ||||
| if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0) | |||||
| if (comparator.compareElements (objectToLookFor, data.elements[halfway]) >= 0) | |||||
| s = halfway; | s = halfway; | ||||
| else | else | ||||
| e = halfway; | e = halfway; | ||||
| @@ -588,13 +588,13 @@ public: | |||||
| if (isPositiveAndBelow (indexToRemove, numUsed)) | if (isPositiveAndBelow (indexToRemove, numUsed)) | ||||
| { | { | ||||
| ObjectClass** const e = data.elements + indexToRemove; | |||||
| auto** e = data.elements + indexToRemove; | |||||
| if (deleteObject) | if (deleteObject) | ||||
| toDelete = *e; | |||||
| toDelete.reset (*e); | |||||
| --numUsed; | --numUsed; | ||||
| const int numToShift = numUsed - indexToRemove; | |||||
| auto numToShift = numUsed - indexToRemove; | |||||
| if (numToShift > 0) | if (numToShift > 0) | ||||
| memmove (e, e + 1, sizeof (ObjectClass*) * (size_t) numToShift); | memmove (e, e + 1, sizeof (ObjectClass*) * (size_t) numToShift); | ||||
| @@ -621,7 +621,7 @@ public: | |||||
| if (isPositiveAndBelow (indexToRemove, numUsed)) | if (isPositiveAndBelow (indexToRemove, numUsed)) | ||||
| { | { | ||||
| ObjectClass** const e = data.elements + indexToRemove; | |||||
| auto** e = data.elements + indexToRemove; | |||||
| removedItem = *e; | removedItem = *e; | ||||
| --numUsed; | --numUsed; | ||||
| @@ -648,7 +648,7 @@ public: | |||||
| void removeObject (const ObjectClass* objectToRemove, bool deleteObject = true) | void removeObject (const ObjectClass* objectToRemove, bool deleteObject = true) | ||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| ObjectClass** const e = data.elements.get(); | |||||
| auto** e = data.elements.get(); | |||||
| for (int i = 0; i < numUsed; ++i) | for (int i = 0; i < numUsed; ++i) | ||||
| { | { | ||||
| @@ -676,7 +676,7 @@ public: | |||||
| void removeRange (int startIndex, int numberToRemove, bool deleteObjects = true) | void removeRange (int startIndex, int numberToRemove, bool deleteObjects = true) | ||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove); | |||||
| auto endIndex = jlimit (0, numUsed, startIndex + numberToRemove); | |||||
| startIndex = jlimit (0, numUsed, startIndex); | startIndex = jlimit (0, numUsed, startIndex); | ||||
| if (endIndex > startIndex) | if (endIndex > startIndex) | ||||
| @@ -685,19 +685,19 @@ public: | |||||
| { | { | ||||
| for (int i = startIndex; i < endIndex; ++i) | for (int i = startIndex; i < endIndex; ++i) | ||||
| { | { | ||||
| ContainerDeletePolicy<ObjectClass>::destroy (data.elements [i]); | |||||
| data.elements [i] = nullptr; // (in case one of the destructors accesses this array and hits a dangling pointer) | |||||
| ContainerDeletePolicy<ObjectClass>::destroy (data.elements[i]); | |||||
| data.elements[i] = nullptr; // (in case one of the destructors accesses this array and hits a dangling pointer) | |||||
| } | } | ||||
| } | } | ||||
| const int rangeSize = endIndex - startIndex; | |||||
| ObjectClass** e = data.elements + startIndex; | |||||
| int numToShift = numUsed - endIndex; | |||||
| auto rangeSize = endIndex - startIndex; | |||||
| auto** e = data.elements + startIndex; | |||||
| auto numToShift = numUsed - endIndex; | |||||
| numUsed -= rangeSize; | numUsed -= rangeSize; | ||||
| while (--numToShift >= 0) | while (--numToShift >= 0) | ||||
| { | { | ||||
| *e = e [rangeSize]; | |||||
| *e = e[rangeSize]; | |||||
| ++e; | ++e; | ||||
| } | } | ||||
| @@ -736,8 +736,8 @@ public: | |||||
| if (isPositiveAndBelow (index1, numUsed) | if (isPositiveAndBelow (index1, numUsed) | ||||
| && isPositiveAndBelow (index2, numUsed)) | && isPositiveAndBelow (index2, numUsed)) | ||||
| { | { | ||||
| std::swap (data.elements [index1], | |||||
| data.elements [index2]); | |||||
| std::swap (data.elements[index1], | |||||
| data.elements[index2]); | |||||
| } | } | ||||
| } | } | ||||
| @@ -765,7 +765,7 @@ public: | |||||
| if (! isPositiveAndBelow (newIndex, numUsed)) | if (! isPositiveAndBelow (newIndex, numUsed)) | ||||
| newIndex = numUsed - 1; | newIndex = numUsed - 1; | ||||
| ObjectClass* const value = data.elements [currentIndex]; | |||||
| auto* value = data.elements[currentIndex]; | |||||
| if (newIndex > currentIndex) | if (newIndex > currentIndex) | ||||
| { | { | ||||
| @@ -780,7 +780,7 @@ public: | |||||
| sizeof (ObjectClass*) * (size_t) (currentIndex - newIndex)); | sizeof (ObjectClass*) * (size_t) (currentIndex - newIndex)); | ||||
| } | } | ||||
| data.elements [newIndex] = value; | |||||
| data.elements[newIndex] = value; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -882,12 +882,12 @@ public: | |||||
| private: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data; | ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data; | ||||
| int numUsed; | |||||
| int numUsed = 0; | |||||
| void deleteAllObjects() | void deleteAllObjects() | ||||
| { | { | ||||
| while (numUsed > 0) | while (numUsed > 0) | ||||
| ContainerDeletePolicy<ObjectClass>::destroy (data.elements [--numUsed]); | |||||
| ContainerDeletePolicy<ObjectClass>::destroy (data.elements[--numUsed]); | |||||
| } | } | ||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OwnedArray) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OwnedArray) | ||||
| @@ -79,7 +79,7 @@ bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResul | |||||
| if (subIterator->next (isDirResult, isHiddenResult, fileSize, modTime, creationTime, isReadOnly)) | if (subIterator->next (isDirResult, isHiddenResult, fileSize, modTime, creationTime, isReadOnly)) | ||||
| return true; | return true; | ||||
| subIterator = nullptr; | |||||
| subIterator.reset(); | |||||
| } | } | ||||
| String filename; | String filename; | ||||
| @@ -1103,7 +1103,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||||
| Expression* parseInPlaceOpExpression (ExpPtr& lhs) | Expression* parseInPlaceOpExpression (ExpPtr& lhs) | ||||
| { | { | ||||
| ExpPtr rhs (parseExpression()); | ExpPtr rhs (parseExpression()); | ||||
| Expression* bareLHS = lhs; // careful - bare pointer is deliberately alised | |||||
| Expression* bareLHS = lhs.get(); // careful - bare pointer is deliberately alised | |||||
| return new SelfAssignment (location, bareLHS, new OpType (location, lhs, rhs)); | return new SelfAssignment (location, bareLHS, new OpType (location, lhs, rhs)); | ||||
| } | } | ||||
| @@ -98,7 +98,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns the object that this pointer is managing. */ | /** Returns the object that this pointer is managing. */ | ||||
| inline operator ObjectType*() const noexcept { return object; } | |||||
| inline operator ObjectType*() const noexcept { return object.get(); } | |||||
| /** Returns the object that this pointer is managing. */ | /** Returns the object that this pointer is managing. */ | ||||
| inline ObjectType* get() const noexcept { return object; } | inline ObjectType* get() const noexcept { return object; } | ||||
| @@ -107,7 +107,7 @@ public: | |||||
| inline ObjectType& operator*() const noexcept { return *object; } | inline ObjectType& operator*() const noexcept { return *object; } | ||||
| /** Lets you access methods and properties of the object that this pointer is holding. */ | /** Lets you access methods and properties of the object that this pointer is holding. */ | ||||
| inline ObjectType* operator->() const noexcept { return object; } | |||||
| inline ObjectType* operator->() const noexcept { return object.get(); } | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Removes the current object from this OptionalScopedPointer without deleting it. | /** Removes the current object from this OptionalScopedPointer without deleting it. | ||||
| @@ -170,6 +170,12 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| /** Sets this pointer to a new object, deleting the old object that it was previously pointing to if there was one. */ | |||||
| void reset (ScopedPointer& newObject) | |||||
| { | |||||
| reset (newObject.release()); | |||||
| } | |||||
| /** Detaches and returns the current object from this ScopedPointer without deleting it. | /** Detaches and returns the current object from this ScopedPointer without deleting it. | ||||
| This will return the current object, and set the ScopedPointer to a null pointer. | This will return the current object, and set the ScopedPointer to a null pointer. | ||||
| */ | */ | ||||
| @@ -191,7 +197,7 @@ public: | |||||
| /** If the pointer is non-null, this will attempt to return a new copy of the object that is pointed to. | /** If the pointer is non-null, this will attempt to return a new copy of the object that is pointed to. | ||||
| If the pointer is null, this will safely return a nullptr. | If the pointer is null, this will safely return a nullptr. | ||||
| */ | */ | ||||
| inline ObjectType* createCopy() const { return createCopyIfNotNull (object); } | |||||
| inline ObjectType* createCopy() const { return createCopyIfNotNull (object); } | |||||
| private: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -206,22 +212,74 @@ private: | |||||
| }; | }; | ||||
| //============================================================================== | //============================================================================== | ||||
| /** Compares a ScopedPointer with another pointer. | |||||
| This can be handy for checking whether this is a null pointer. | |||||
| */ | |||||
| /** Compares a ScopedPointer with another pointer. */ | |||||
| template <typename ObjectType1, typename ObjectType2> | |||||
| bool operator== (ObjectType1* pointer1, const ScopedPointer<ObjectType2>& pointer2) noexcept | |||||
| { | |||||
| return pointer1 == pointer2.get(); | |||||
| } | |||||
| /** Compares a ScopedPointer with another pointer. */ | |||||
| template <typename ObjectType1, typename ObjectType2> | |||||
| bool operator!= (ObjectType1* pointer1, const ScopedPointer<ObjectType2>& pointer2) noexcept | |||||
| { | |||||
| return pointer1 != pointer2.get(); | |||||
| } | |||||
| /** Compares a ScopedPointer with another pointer. */ | |||||
| template <typename ObjectType1, typename ObjectType2> | |||||
| bool operator== (const ScopedPointer<ObjectType1>& pointer1, ObjectType2* pointer2) noexcept | |||||
| { | |||||
| return pointer1.get() == pointer2; | |||||
| } | |||||
| /** Compares a ScopedPointer with another pointer. */ | |||||
| template <typename ObjectType1, typename ObjectType2> | |||||
| bool operator!= (const ScopedPointer<ObjectType1>& pointer1, ObjectType2* pointer2) noexcept | |||||
| { | |||||
| return pointer1.get() != pointer2; | |||||
| } | |||||
| /** Compares a ScopedPointer with another pointer. */ | |||||
| template <typename ObjectType1, typename ObjectType2> | |||||
| bool operator== (const ScopedPointer<ObjectType1>& pointer1, const ScopedPointer<ObjectType2>& pointer2) noexcept | |||||
| { | |||||
| return pointer1.get() == pointer2.get(); | |||||
| } | |||||
| /** Compares a ScopedPointer with another pointer. */ | |||||
| template <typename ObjectType1, typename ObjectType2> | |||||
| bool operator!= (const ScopedPointer<ObjectType1>& pointer1, const ScopedPointer<ObjectType2>& pointer2) noexcept | |||||
| { | |||||
| return pointer1.get() != pointer2.get(); | |||||
| } | |||||
| /** Compares a ScopedPointer with a nullptr. */ | |||||
| template <class ObjectType> | template <class ObjectType> | ||||
| bool operator== (const ScopedPointer<ObjectType>& pointer1, ObjectType* pointer2) noexcept | |||||
| bool operator== (decltype (nullptr), const ScopedPointer<ObjectType>& pointer) noexcept | |||||
| { | { | ||||
| return static_cast<ObjectType*> (pointer1) == pointer2; | |||||
| return pointer.get() == nullptr; | |||||
| } | } | ||||
| /** Compares a ScopedPointer with another pointer. | |||||
| This can be handy for checking whether this is a null pointer. | |||||
| */ | |||||
| /** Compares a ScopedPointer with a nullptr. */ | |||||
| template <class ObjectType> | |||||
| bool operator!= (decltype (nullptr), const ScopedPointer<ObjectType>& pointer) noexcept | |||||
| { | |||||
| return pointer.get() != nullptr; | |||||
| } | |||||
| /** Compares a ScopedPointer with a nullptr. */ | |||||
| template <class ObjectType> | |||||
| bool operator== (const ScopedPointer<ObjectType>& pointer, decltype (nullptr)) noexcept | |||||
| { | |||||
| return pointer.get() == nullptr; | |||||
| } | |||||
| /** Compares a ScopedPointer with a nullptr. */ | |||||
| template <class ObjectType> | template <class ObjectType> | ||||
| bool operator!= (const ScopedPointer<ObjectType>& pointer1, ObjectType* pointer2) noexcept | |||||
| bool operator!= (const ScopedPointer<ObjectType>& pointer, decltype (nullptr)) noexcept | |||||
| { | { | ||||
| return static_cast<ObjectType*> (pointer1) != pointer2; | |||||
| return pointer.get() != nullptr; | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -176,7 +176,7 @@ public: | |||||
| ScopedPointer<std::function<int()>> fStackTmp (new std::function<int()> (fStack)); | ScopedPointer<std::function<int()>> fStackTmp (new std::function<int()> (fStack)); | ||||
| std::function<int()> f1 (static_cast<std::function<int()>&&> (*fStackTmp)); | std::function<int()> f1 (static_cast<std::function<int()>&&> (*fStackTmp)); | ||||
| fStackTmp = nullptr; | |||||
| fStackTmp.reset(); | |||||
| expectEquals (f1(), 3); | expectEquals (f1(), 3); | ||||
| ScopedPointer<std::function<int()>> fHeapTmp (new std::function<int()> (fHeap)); | ScopedPointer<std::function<int()>> fHeapTmp (new std::function<int()> (fHeap)); | ||||
| @@ -184,12 +184,12 @@ public: | |||||
| if (*fHeapTmp) | if (*fHeapTmp) | ||||
| expect (false); | expect (false); | ||||
| fHeapTmp = nullptr; | |||||
| fHeapTmp.reset(); | |||||
| expectEquals (f2(), FunctionTestsHelpers::BigData::bigDataSum); | expectEquals (f2(), FunctionTestsHelpers::BigData::bigDataSum); | ||||
| ScopedPointer<std::function<int()>> fEmptyTmp (new std::function<int()>()); | ScopedPointer<std::function<int()>> fEmptyTmp (new std::function<int()>()); | ||||
| std::function<int()> f3 (static_cast<std::function<int()>&&> (*fEmptyTmp)); | std::function<int()> f3 (static_cast<std::function<int()>&&> (*fEmptyTmp)); | ||||
| fEmptyTmp = nullptr; | |||||
| fEmptyTmp.reset(); | |||||
| if (f3) | if (f3) | ||||
| expect (false); | expect (false); | ||||
| } | } | ||||
| @@ -201,7 +201,7 @@ public: | |||||
| ScopedPointer<std::function<int()>> fStackTmp (new std::function<int()> (fStack)); | ScopedPointer<std::function<int()>> fStackTmp (new std::function<int()> (fStack)); | ||||
| f1 = static_cast<std::function<int()>&&> (*fStackTmp); | f1 = static_cast<std::function<int()>&&> (*fStackTmp); | ||||
| fStackTmp = nullptr; | |||||
| fStackTmp.reset(); | |||||
| expectEquals (f1(), 3); | expectEquals (f1(), 3); | ||||
| std::function<int()> f2 (fStack); | std::function<int()> f2 (fStack); | ||||
| @@ -210,13 +210,13 @@ public: | |||||
| if (*fHeapTmp) | if (*fHeapTmp) | ||||
| expect (false); | expect (false); | ||||
| fHeapTmp = nullptr; | |||||
| fHeapTmp.reset(); | |||||
| expectEquals (f2(), FunctionTestsHelpers::BigData::bigDataSum); | expectEquals (f2(), FunctionTestsHelpers::BigData::bigDataSum); | ||||
| std::function<int()> f3 (fHeap); | std::function<int()> f3 (fHeap); | ||||
| ScopedPointer<std::function<int()>> fEmptyTmp (new std::function<int()>()); | ScopedPointer<std::function<int()>> fEmptyTmp (new std::function<int()>()); | ||||
| f3 = static_cast<std::function<int()>&&> (*fEmptyTmp); | f3 = static_cast<std::function<int()>&&> (*fEmptyTmp); | ||||
| fEmptyTmp = nullptr; | |||||
| fEmptyTmp.reset(); | |||||
| if (f3) | if (f3) | ||||
| expect (false); | expect (false); | ||||
| } | } | ||||
| @@ -941,7 +941,7 @@ public: | |||||
| ~Pimpl() | ~Pimpl() | ||||
| { | { | ||||
| connection = nullptr; | |||||
| connection.reset(); | |||||
| } | } | ||||
| bool connect (WebInputStream::Listener* webInputListener, int numRetries = 0) | bool connect (WebInputStream::Listener* webInputListener, int numRetries = 0) | ||||
| @@ -963,12 +963,12 @@ public: | |||||
| #if ! (JUCE_IOS || (defined (__MAC_OS_X_VERSION_MIN_REQUIRED) && defined (__MAC_10_10) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10)) | #if ! (JUCE_IOS || (defined (__MAC_OS_X_VERSION_MIN_REQUIRED) && defined (__MAC_10_10) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10)) | ||||
| if (numRetries == 0 && connection->nsUrlErrorCode == NSURLErrorNetworkConnectionLost) | if (numRetries == 0 && connection->nsUrlErrorCode == NSURLErrorNetworkConnectionLost) | ||||
| { | { | ||||
| connection = nullptr; | |||||
| connection.reset(); | |||||
| return connect (webInputListener, ++numRetries); | return connect (webInputListener, ++numRetries); | ||||
| } | } | ||||
| #endif | #endif | ||||
| connection = nullptr; | |||||
| connection.reset(); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -191,7 +191,7 @@ void NamedPipe::close() | |||||
| ignoreUnused (done); | ignoreUnused (done); | ||||
| ScopedWriteLock sl (lock); | ScopedWriteLock sl (lock); | ||||
| pimpl = nullptr; | |||||
| pimpl.reset(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -211,7 +211,7 @@ bool NamedPipe::openInternal (const String& pipeName, const bool createPipe, boo | |||||
| if (createPipe && ! pimpl->createFifos (mustNotExist)) | if (createPipe && ! pimpl->createFifos (mustNotExist)) | ||||
| { | { | ||||
| pimpl = nullptr; | |||||
| pimpl.reset(); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -880,7 +880,7 @@ bool InterProcessLock::enter (const int timeOutMillisecs) | |||||
| pimpl = new Pimpl (name, timeOutMillisecs); | pimpl = new Pimpl (name, timeOutMillisecs); | ||||
| if (pimpl->handle == 0) | if (pimpl->handle == 0) | ||||
| pimpl = nullptr; | |||||
| pimpl.reset(); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -898,7 +898,7 @@ void InterProcessLock::exit() | |||||
| jassert (pimpl != nullptr); | jassert (pimpl != nullptr); | ||||
| if (pimpl != nullptr && --(pimpl->refCount) == 0) | if (pimpl != nullptr && --(pimpl->refCount) == 0) | ||||
| pimpl = nullptr; | |||||
| pimpl.reset(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1260,7 +1260,7 @@ bool ChildProcess::start (const StringArray& args, int streamFlags) | |||||
| activeProcess = new ActiveProcess (args, streamFlags); | activeProcess = new ActiveProcess (args, streamFlags); | ||||
| if (activeProcess->childPID == 0) | if (activeProcess->childPID == 0) | ||||
| activeProcess = nullptr; | |||||
| activeProcess.reset(); | |||||
| return activeProcess != nullptr; | return activeProcess != nullptr; | ||||
| } | } | ||||
| @@ -534,7 +534,7 @@ private: | |||||
| uncompressedSize += bytesRead; | uncompressedSize += bytesRead; | ||||
| } | } | ||||
| stream = nullptr; | |||||
| stream.reset(); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -28,7 +28,6 @@ namespace juce | |||||
| { | { | ||||
| ApplicationProperties::ApplicationProperties() | ApplicationProperties::ApplicationProperties() | ||||
| : commonSettingsAreReadOnly (0) | |||||
| { | { | ||||
| } | } | ||||
| @@ -56,16 +55,16 @@ void ApplicationProperties::openFiles() | |||||
| if (userProps == nullptr) | if (userProps == nullptr) | ||||
| { | { | ||||
| o.commonToAllUsers = false; | o.commonToAllUsers = false; | ||||
| userProps = new PropertiesFile (o); | |||||
| userProps.reset (new PropertiesFile (o)); | |||||
| } | } | ||||
| if (commonProps == nullptr) | if (commonProps == nullptr) | ||||
| { | { | ||||
| o.commonToAllUsers = true; | o.commonToAllUsers = true; | ||||
| commonProps = new PropertiesFile (o); | |||||
| commonProps.reset (new PropertiesFile (o)); | |||||
| } | } | ||||
| userProps->setFallbackPropertySet (commonProps); | |||||
| userProps->setFallbackPropertySet (commonProps.get()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -74,7 +73,7 @@ PropertiesFile* ApplicationProperties::getUserSettings() | |||||
| if (userProps == nullptr) | if (userProps == nullptr) | ||||
| openFiles(); | openFiles(); | ||||
| return userProps; | |||||
| return userProps.get(); | |||||
| } | } | ||||
| PropertiesFile* ApplicationProperties::getCommonSettings (const bool returnUserPropsIfReadOnly) | PropertiesFile* ApplicationProperties::getCommonSettings (const bool returnUserPropsIfReadOnly) | ||||
| @@ -88,10 +87,10 @@ PropertiesFile* ApplicationProperties::getCommonSettings (const bool returnUserP | |||||
| commonSettingsAreReadOnly = commonProps->save() ? -1 : 1; | commonSettingsAreReadOnly = commonProps->save() ? -1 : 1; | ||||
| if (commonSettingsAreReadOnly > 0) | if (commonSettingsAreReadOnly > 0) | ||||
| return userProps; | |||||
| return userProps.get(); | |||||
| } | } | ||||
| return commonProps; | |||||
| return commonProps.get(); | |||||
| } | } | ||||
| bool ApplicationProperties::saveIfNeeded() | bool ApplicationProperties::saveIfNeeded() | ||||
| @@ -102,8 +101,8 @@ bool ApplicationProperties::saveIfNeeded() | |||||
| void ApplicationProperties::closeFiles() | void ApplicationProperties::closeFiles() | ||||
| { | { | ||||
| userProps = nullptr; | |||||
| commonProps = nullptr; | |||||
| userProps.reset(); | |||||
| commonProps.reset(); | |||||
| } | } | ||||
| } // namespace juce | } // namespace juce | ||||
| @@ -122,7 +122,7 @@ private: | |||||
| //============================================================================== | //============================================================================== | ||||
| PropertiesFile::Options options; | PropertiesFile::Options options; | ||||
| ScopedPointer<PropertiesFile> userProps, commonProps; | ScopedPointer<PropertiesFile> userProps, commonProps; | ||||
| int commonSettingsAreReadOnly; | |||||
| int commonSettingsAreReadOnly = 0; | |||||
| void openFiles(); | void openFiles(); | ||||
| @@ -331,7 +331,7 @@ bool PropertiesFile::saveAsBinary() | |||||
| out->writeString (values[i]); | out->writeString (values[i]); | ||||
| } | } | ||||
| out = nullptr; | |||||
| out.reset(); | |||||
| if (tempFile.overwriteTargetFileWithTemporary()) | if (tempFile.overwriteTargetFileWithTemporary()) | ||||
| { | { | ||||
| @@ -36,8 +36,8 @@ struct UndoManager::ActionSet | |||||
| bool perform() const | bool perform() const | ||||
| { | { | ||||
| for (int i = 0; i < actions.size(); ++i) | |||||
| if (! actions.getUnchecked(i)->perform()) | |||||
| for (auto* a : actions) | |||||
| if (! a->perform()) | |||||
| return false; | return false; | ||||
| return true; | return true; | ||||
| @@ -56,8 +56,8 @@ struct UndoManager::ActionSet | |||||
| { | { | ||||
| int total = 0; | int total = 0; | ||||
| for (int i = actions.size(); --i >= 0;) | |||||
| total += actions.getUnchecked(i)->getSizeInUnits(); | |||||
| for (auto* a : actions) | |||||
| total += a->getSizeInUnits(); | |||||
| return total; | return total; | ||||
| } | } | ||||
| @@ -68,15 +68,9 @@ struct UndoManager::ActionSet | |||||
| }; | }; | ||||
| //============================================================================== | //============================================================================== | ||||
| UndoManager::UndoManager (const int maxNumberOfUnitsToKeep, | |||||
| const int minimumTransactions) | |||||
| : totalUnitsStored (0), | |||||
| nextIndex (0), | |||||
| newTransaction (true), | |||||
| reentrancyCheck (false) | |||||
| UndoManager::UndoManager (int maxNumberOfUnitsToKeep, int minimumTransactions) | |||||
| { | { | ||||
| setMaxNumberOfStoredUnits (maxNumberOfUnitsToKeep, | |||||
| minimumTransactions); | |||||
| setMaxNumberOfStoredUnits (maxNumberOfUnitsToKeep, minimumTransactions); | |||||
| } | } | ||||
| UndoManager::~UndoManager() | UndoManager::~UndoManager() | ||||
| @@ -97,11 +91,10 @@ int UndoManager::getNumberOfUnitsTakenUpByStoredCommands() const | |||||
| return totalUnitsStored; | return totalUnitsStored; | ||||
| } | } | ||||
| void UndoManager::setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep, | |||||
| const int minimumTransactions) | |||||
| void UndoManager::setMaxNumberOfStoredUnits (int maxUnits, int minTransactions) | |||||
| { | { | ||||
| maxNumUnitsToKeep = jmax (1, maxNumberOfUnitsToKeep); | |||||
| minimumTransactionsToKeep = jmax (1, minimumTransactions); | |||||
| maxNumUnitsToKeep = jmax (1, maxUnits); | |||||
| minimumTransactionsToKeep = jmax (1, minTransactions); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -118,7 +111,7 @@ bool UndoManager::perform (UndoableAction* const newAction, const String& action | |||||
| return false; | return false; | ||||
| } | } | ||||
| bool UndoManager::perform (UndoableAction* const newAction) | |||||
| bool UndoManager::perform (UndoableAction* newAction) | |||||
| { | { | ||||
| if (newAction != nullptr) | if (newAction != nullptr) | ||||
| { | { | ||||
| @@ -133,15 +126,15 @@ bool UndoManager::perform (UndoableAction* const newAction) | |||||
| if (action->perform()) | if (action->perform()) | ||||
| { | { | ||||
| ActionSet* actionSet = getCurrentSet(); | |||||
| auto* actionSet = getCurrentSet(); | |||||
| if (actionSet != nullptr && ! newTransaction) | if (actionSet != nullptr && ! newTransaction) | ||||
| { | { | ||||
| if (UndoableAction* const lastAction = actionSet->actions.getLast()) | |||||
| if (auto* lastAction = actionSet->actions.getLast()) | |||||
| { | { | ||||
| if (UndoableAction* const coalescedAction = lastAction->createCoalescedAction (action)) | |||||
| if (auto coalescedAction = lastAction->createCoalescedAction (action.get())) | |||||
| { | { | ||||
| action = coalescedAction; | |||||
| action.reset (coalescedAction); | |||||
| totalUnitsStored -= lastAction->getSizeInUnits(); | totalUnitsStored -= lastAction->getSizeInUnits(); | ||||
| actionSet->actions.removeLast(); | actionSet->actions.removeLast(); | ||||
| } | } | ||||
| @@ -176,7 +169,7 @@ void UndoManager::moveFutureTransactionsToStash() | |||||
| while (nextIndex < transactions.size()) | while (nextIndex < transactions.size()) | ||||
| { | { | ||||
| ActionSet* removed = transactions.removeAndReturn (nextIndex); | |||||
| auto* removed = transactions.removeAndReturn (nextIndex); | |||||
| stashedFutureTransactions.add (removed); | stashedFutureTransactions.add (removed); | ||||
| totalUnitsStored -= removed->getTotalSize(); | totalUnitsStored -= removed->getTotalSize(); | ||||
| } | } | ||||
| @@ -191,11 +184,10 @@ void UndoManager::restoreStashedFutureTransactions() | |||||
| transactions.remove (nextIndex); | transactions.remove (nextIndex); | ||||
| } | } | ||||
| for (int i = 0; i < stashedFutureTransactions.size(); ++i) | |||||
| for (auto* stashed : stashedFutureTransactions) | |||||
| { | { | ||||
| ActionSet* action = stashedFutureTransactions.removeAndReturn (i); | |||||
| totalUnitsStored += action->getTotalSize(); | |||||
| transactions.add (action); | |||||
| transactions.add (stashed); | |||||
| totalUnitsStored += stashed->getTotalSize(); | |||||
| } | } | ||||
| stashedFutureTransactions.clearQuick (false); | stashedFutureTransactions.clearQuick (false); | ||||
| @@ -219,7 +211,7 @@ void UndoManager::dropOldTransactionsIfTooLarge() | |||||
| void UndoManager::beginNewTransaction() noexcept | void UndoManager::beginNewTransaction() noexcept | ||||
| { | { | ||||
| beginNewTransaction (String()); | |||||
| beginNewTransaction ({}); | |||||
| } | } | ||||
| void UndoManager::beginNewTransaction (const String& actionName) noexcept | void UndoManager::beginNewTransaction (const String& actionName) noexcept | ||||
| @@ -232,13 +224,13 @@ void UndoManager::setCurrentTransactionName (const String& newName) noexcept | |||||
| { | { | ||||
| if (newTransaction) | if (newTransaction) | ||||
| newTransactionName = newName; | newTransactionName = newName; | ||||
| else if (ActionSet* action = getCurrentSet()) | |||||
| else if (auto* action = getCurrentSet()) | |||||
| action->name = newName; | action->name = newName; | ||||
| } | } | ||||
| String UndoManager::getCurrentTransactionName() const noexcept | String UndoManager::getCurrentTransactionName() const noexcept | ||||
| { | { | ||||
| if (ActionSet* action = getCurrentSet()) | |||||
| if (auto* action = getCurrentSet()) | |||||
| return action->name; | return action->name; | ||||
| return newTransactionName; | return newTransactionName; | ||||
| @@ -253,7 +245,7 @@ bool UndoManager::canRedo() const noexcept { return getNextSet() != nullptr | |||||
| bool UndoManager::undo() | bool UndoManager::undo() | ||||
| { | { | ||||
| if (const ActionSet* const s = getCurrentSet()) | |||||
| if (auto* s = getCurrentSet()) | |||||
| { | { | ||||
| const ScopedValueSetter<bool> setter (reentrancyCheck, true); | const ScopedValueSetter<bool> setter (reentrancyCheck, true); | ||||
| @@ -272,7 +264,7 @@ bool UndoManager::undo() | |||||
| bool UndoManager::redo() | bool UndoManager::redo() | ||||
| { | { | ||||
| if (const ActionSet* const s = getNextSet()) | |||||
| if (auto* s = getNextSet()) | |||||
| { | { | ||||
| const ScopedValueSetter<bool> setter (reentrancyCheck, true); | const ScopedValueSetter<bool> setter (reentrancyCheck, true); | ||||
| @@ -335,15 +327,15 @@ bool UndoManager::undoCurrentTransactionOnly() | |||||
| void UndoManager::getActionsInCurrentTransaction (Array<const UndoableAction*>& actionsFound) const | void UndoManager::getActionsInCurrentTransaction (Array<const UndoableAction*>& actionsFound) const | ||||
| { | { | ||||
| if (! newTransaction) | if (! newTransaction) | ||||
| if (const ActionSet* const s = getCurrentSet()) | |||||
| for (int i = 0; i < s->actions.size(); ++i) | |||||
| actionsFound.add (s->actions.getUnchecked(i)); | |||||
| if (auto* s = getCurrentSet()) | |||||
| for (auto* a : s->actions) | |||||
| actionsFound.add (a); | |||||
| } | } | ||||
| int UndoManager::getNumActionsInCurrentTransaction() const | int UndoManager::getNumActionsInCurrentTransaction() const | ||||
| { | { | ||||
| if (! newTransaction) | if (! newTransaction) | ||||
| if (const ActionSet* const s = getCurrentSet()) | |||||
| if (auto* s = getCurrentSet()) | |||||
| return s->actions.size(); | return s->actions.size(); | ||||
| return 0; | return 0; | ||||
| @@ -232,8 +232,8 @@ private: | |||||
| friend struct ContainerDeletePolicy<ActionSet>; | friend struct ContainerDeletePolicy<ActionSet>; | ||||
| OwnedArray<ActionSet> transactions, stashedFutureTransactions; | OwnedArray<ActionSet> transactions, stashedFutureTransactions; | ||||
| String newTransactionName; | String newTransactionName; | ||||
| int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex; | |||||
| bool newTransaction, reentrancyCheck; | |||||
| int totalUnitsStored = 0, maxNumUnitsToKeep = 0, minimumTransactionsToKeep = 0, nextIndex = 0; | |||||
| bool newTransaction = true, reentrancyCheck = false; | |||||
| ActionSet* getCurrentSet() const noexcept; | ActionSet* getCurrentSet() const noexcept; | ||||
| ActionSet* getNextSet() const noexcept; | ActionSet* getNextSet() const noexcept; | ||||
| void moveFutureTransactionsToStash(); | void moveFutureTransactionsToStash(); | ||||
| @@ -128,7 +128,7 @@ ChildProcessMaster::~ChildProcessMaster() | |||||
| { | { | ||||
| sendMessageToSlave (MemoryBlock (killMessage, specialMessageSize)); | sendMessageToSlave (MemoryBlock (killMessage, specialMessageSize)); | ||||
| connection->disconnect(); | connection->disconnect(); | ||||
| connection = nullptr; | |||||
| connection.reset(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -145,10 +145,10 @@ bool ChildProcessMaster::sendMessageToSlave (const MemoryBlock& mb) | |||||
| bool ChildProcessMaster::launchSlaveProcess (const File& executable, const String& commandLineUniqueID, int timeoutMs, int streamFlags) | bool ChildProcessMaster::launchSlaveProcess (const File& executable, const String& commandLineUniqueID, int timeoutMs, int streamFlags) | ||||
| { | { | ||||
| connection = nullptr; | |||||
| connection.reset(); | |||||
| jassert (childProcess.kill()); | jassert (childProcess.kill()); | ||||
| const String pipeName ("p" + String::toHexString (Random().nextInt64())); | |||||
| auto pipeName = "p" + String::toHexString (Random().nextInt64()); | |||||
| StringArray args; | StringArray args; | ||||
| args.add (executable.getFullPathName()); | args.add (executable.getFullPathName()); | ||||
| @@ -164,7 +164,7 @@ bool ChildProcessMaster::launchSlaveProcess (const File& executable, const Strin | |||||
| return true; | return true; | ||||
| } | } | ||||
| connection = nullptr; | |||||
| connection.reset(); | |||||
| } | } | ||||
| return false; | return false; | ||||
| @@ -257,7 +257,7 @@ bool ChildProcessSlave::initialiseFromCommandLine (const String& commandLine, | |||||
| connection = new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs); | connection = new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs); | ||||
| if (! connection->isConnected()) | if (! connection->isConnected()) | ||||
| connection = nullptr; | |||||
| connection.reset(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -45,7 +45,7 @@ InterprocessConnection::~InterprocessConnection() | |||||
| callbackConnectionState = false; | callbackConnectionState = false; | ||||
| disconnect(); | disconnect(); | ||||
| masterReference.clear(); | masterReference.clear(); | ||||
| thread = nullptr; | |||||
| thread.reset(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -65,7 +65,7 @@ bool InterprocessConnection::connectToSocket (const String& hostName, | |||||
| return true; | return true; | ||||
| } | } | ||||
| socket = nullptr; | |||||
| socket.reset(); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -121,8 +121,8 @@ void InterprocessConnection::disconnect() | |||||
| void InterprocessConnection::deletePipeAndSocket() | void InterprocessConnection::deletePipeAndSocket() | ||||
| { | { | ||||
| const ScopedLock sl (pipeAndSocketLock); | const ScopedLock sl (pipeAndSocketLock); | ||||
| socket = nullptr; | |||||
| pipe = nullptr; | |||||
| socket.reset(); | |||||
| pipe.reset(); | |||||
| } | } | ||||
| bool InterprocessConnection::isConnected() const | bool InterprocessConnection::isConnected() const | ||||
| @@ -122,10 +122,10 @@ public: | |||||
| bool isConnected() const; | bool isConnected() const; | ||||
| /** Returns the socket that this connection is using (or nullptr if it uses a pipe). */ | /** Returns the socket that this connection is using (or nullptr if it uses a pipe). */ | ||||
| StreamingSocket* getSocket() const noexcept { return socket; } | |||||
| StreamingSocket* getSocket() const noexcept { return socket.get(); } | |||||
| /** Returns the pipe that this connection is using (or nullptr if it uses a socket). */ | /** Returns the pipe that this connection is using (or nullptr if it uses a socket). */ | ||||
| NamedPipe* getPipe() const noexcept { return pipe; } | |||||
| NamedPipe* getPipe() const noexcept { return pipe.get(); } | |||||
| /** Returns the name of the machine at the other end of this connection. | /** Returns the name of the machine at the other end of this connection. | ||||
| This may return an empty string if the name is unknown. | This may return an empty string if the name is unknown. | ||||
| @@ -46,7 +46,7 @@ bool InterprocessConnectionServer::beginWaitingForSocket (const int portNumber, | |||||
| return true; | return true; | ||||
| } | } | ||||
| socket = nullptr; | |||||
| socket.reset(); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -58,7 +58,7 @@ void InterprocessConnectionServer::stop() | |||||
| socket->close(); | socket->close(); | ||||
| stopThread (4000); | stopThread (4000); | ||||
| socket = nullptr; | |||||
| socket.reset(); | |||||
| } | } | ||||
| int InterprocessConnectionServer::getBoundPort() const noexcept | int InterprocessConnectionServer::getBoundPort() const noexcept | ||||
| @@ -304,7 +304,7 @@ bool JUCEApplicationBase::initialiseApp() | |||||
| #if JUCE_HANDLE_MULTIPLE_INSTANCES | #if JUCE_HANDLE_MULTIPLE_INSTANCES | ||||
| if (multipleInstanceHandler != nullptr) | if (multipleInstanceHandler != nullptr) | ||||
| MessageManager::getInstance()->registerBroadcastListener (multipleInstanceHandler); | |||||
| MessageManager::getInstance()->registerBroadcastListener (multipleInstanceHandler.get()); | |||||
| #endif | #endif | ||||
| return true; | return true; | ||||
| @@ -316,7 +316,7 @@ int JUCEApplicationBase::shutdownApp() | |||||
| #if JUCE_HANDLE_MULTIPLE_INSTANCES | #if JUCE_HANDLE_MULTIPLE_INSTANCES | ||||
| if (multipleInstanceHandler != nullptr) | if (multipleInstanceHandler != nullptr) | ||||
| MessageManager::getInstance()->deregisterBroadcastListener (multipleInstanceHandler); | |||||
| MessageManager::getInstance()->deregisterBroadcastListener (multipleInstanceHandler.get()); | |||||
| #endif | #endif | ||||
| JUCE_TRY | JUCE_TRY | ||||
| @@ -326,7 +326,7 @@ int JUCEApplicationBase::shutdownApp() | |||||
| } | } | ||||
| JUCE_CATCH_EXCEPTION | JUCE_CATCH_EXCEPTION | ||||
| multipleInstanceHandler = nullptr; | |||||
| multipleInstanceHandler.reset(); | |||||
| return getApplicationReturnValue(); | return getApplicationReturnValue(); | ||||
| } | } | ||||
| @@ -32,7 +32,7 @@ MessageManager::MessageManager() noexcept | |||||
| MessageManager::~MessageManager() noexcept | MessageManager::~MessageManager() noexcept | ||||
| { | { | ||||
| broadcaster = nullptr; | |||||
| broadcaster.reset(); | |||||
| doPlatformSpecificShutdown(); | doPlatformSpecificShutdown(); | ||||
| @@ -37,13 +37,13 @@ FillType::FillType (Colour c) noexcept | |||||
| { | { | ||||
| } | } | ||||
| FillType::FillType (const ColourGradient& gradient_) | |||||
| : colour (0xff000000), gradient (new ColourGradient (gradient_)) | |||||
| FillType::FillType (const ColourGradient& g) | |||||
| : colour (0xff000000), gradient (new ColourGradient (g)) | |||||
| { | { | ||||
| } | } | ||||
| FillType::FillType (const Image& image_, const AffineTransform& transform_) noexcept | |||||
| : colour (0xff000000), image (image_), transform (transform_) | |||||
| FillType::FillType (const Image& im, const AffineTransform& t) noexcept | |||||
| : colour (0xff000000), image (im), transform (t) | |||||
| { | { | ||||
| } | } | ||||
| @@ -106,7 +106,7 @@ bool FillType::operator!= (const FillType& other) const | |||||
| void FillType::setColour (Colour newColour) noexcept | void FillType::setColour (Colour newColour) noexcept | ||||
| { | { | ||||
| gradient = nullptr; | |||||
| gradient.reset(); | |||||
| image = Image(); | image = Image(); | ||||
| colour = newColour; | colour = newColour; | ||||
| } | } | ||||
| @@ -125,11 +125,11 @@ void FillType::setGradient (const ColourGradient& newGradient) | |||||
| } | } | ||||
| } | } | ||||
| void FillType::setTiledImage (const Image& image_, const AffineTransform& transform_) noexcept | |||||
| void FillType::setTiledImage (const Image& newImage, const AffineTransform& newTransform) noexcept | |||||
| { | { | ||||
| gradient = nullptr; | |||||
| image = image_; | |||||
| transform = transform_; | |||||
| gradient.reset(); | |||||
| image = newImage; | |||||
| transform = newTransform; | |||||
| colour = Colours::black; | colour = Colours::black; | ||||
| } | } | ||||
| @@ -297,10 +297,10 @@ public: | |||||
| snapToIntegerCoordinate = typeface->isHinted(); | snapToIntegerCoordinate = typeface->isHinted(); | ||||
| glyph = glyphNumber; | glyph = glyphNumber; | ||||
| const float fontHeight = font.getHeight(); | |||||
| edgeTable = typeface->getEdgeTableForGlyph (glyphNumber, | |||||
| AffineTransform::scale (fontHeight * font.getHorizontalScale(), | |||||
| fontHeight), fontHeight); | |||||
| auto fontHeight = font.getHeight(); | |||||
| edgeTable.reset (typeface->getEdgeTableForGlyph (glyphNumber, | |||||
| AffineTransform::scale (fontHeight * font.getHorizontalScale(), | |||||
| fontHeight), fontHeight)); | |||||
| } | } | ||||
| Font font; | Font font; | ||||
| @@ -76,27 +76,7 @@ private: | |||||
| }; | }; | ||||
| //============================================================================== | //============================================================================== | ||||
| Button::Button (const String& name) | |||||
| : Component (name), | |||||
| text (name), | |||||
| buttonPressTime (0), | |||||
| lastRepeatTime (0), | |||||
| commandManagerToUse (nullptr), | |||||
| autoRepeatDelay (-1), | |||||
| autoRepeatSpeed (0), | |||||
| autoRepeatMinimumDelay (-1), | |||||
| radioGroupId (0), | |||||
| connectedEdgeFlags (0), | |||||
| commandID(), | |||||
| buttonState (buttonNormal), | |||||
| lastStatePainted (buttonNormal), | |||||
| lastToggleState (false), | |||||
| clickTogglesState (false), | |||||
| needsToRelease (false), | |||||
| needsRepainting (false), | |||||
| isKeyDown (false), | |||||
| triggerOnMouseDown (false), | |||||
| generateTooltip (false) | |||||
| Button::Button (const String& name) : Component (name), text (name) | |||||
| { | { | ||||
| callbackHelper = new CallbackHelper (*this); | callbackHelper = new CallbackHelper (*this); | ||||
| @@ -112,7 +92,7 @@ Button::~Button() | |||||
| commandManagerToUse->removeListener (callbackHelper); | commandManagerToUse->removeListener (callbackHelper); | ||||
| isOn.removeListener (callbackHelper); | isOn.removeListener (callbackHelper); | ||||
| callbackHelper = nullptr; | |||||
| callbackHelper.reset(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -479,21 +479,21 @@ private: | |||||
| friend class CallbackHelper; | friend class CallbackHelper; | ||||
| friend struct ContainerDeletePolicy<CallbackHelper>; | friend struct ContainerDeletePolicy<CallbackHelper>; | ||||
| ScopedPointer<CallbackHelper> callbackHelper; | ScopedPointer<CallbackHelper> callbackHelper; | ||||
| uint32 buttonPressTime, lastRepeatTime; | |||||
| ApplicationCommandManager* commandManagerToUse; | |||||
| int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay; | |||||
| int radioGroupId, connectedEdgeFlags; | |||||
| CommandID commandID; | |||||
| ButtonState buttonState, lastStatePainted; | |||||
| uint32 buttonPressTime = 0, lastRepeatTime = 0; | |||||
| ApplicationCommandManager* commandManagerToUse = nullptr; | |||||
| int autoRepeatDelay = -1, autoRepeatSpeed = 0, autoRepeatMinimumDelay = -1; | |||||
| int radioGroupId = 0, connectedEdgeFlags = 0; | |||||
| CommandID commandID = {}; | |||||
| ButtonState buttonState = buttonNormal, lastStatePainted = buttonNormal; | |||||
| Value isOn; | Value isOn; | ||||
| bool lastToggleState; | |||||
| bool clickTogglesState; | |||||
| bool needsToRelease; | |||||
| bool needsRepainting; | |||||
| bool isKeyDown; | |||||
| bool triggerOnMouseDown; | |||||
| bool generateTooltip; | |||||
| bool lastToggleState = false; | |||||
| bool clickTogglesState = false; | |||||
| bool needsToRelease = false; | |||||
| bool needsRepainting = false; | |||||
| bool isKeyDown = false; | |||||
| bool triggerOnMouseDown = false; | |||||
| bool generateTooltip = false; | |||||
| void repeatTimerCallback(); | void repeatTimerCallback(); | ||||
| bool keyStateChangedCallback(); | bool keyStateChangedCallback(); | ||||
| @@ -28,7 +28,6 @@ namespace juce | |||||
| { | { | ||||
| ApplicationCommandManager::ApplicationCommandManager() | ApplicationCommandManager::ApplicationCommandManager() | ||||
| : firstTarget (nullptr) | |||||
| { | { | ||||
| keyMappings = new KeyPressMappingSet (*this); | keyMappings = new KeyPressMappingSet (*this); | ||||
| Desktop::getInstance().addFocusChangeListener (this); | Desktop::getInstance().addFocusChangeListener (this); | ||||
| @@ -37,7 +36,7 @@ ApplicationCommandManager::ApplicationCommandManager() | |||||
| ApplicationCommandManager::~ApplicationCommandManager() | ApplicationCommandManager::~ApplicationCommandManager() | ||||
| { | { | ||||
| Desktop::getInstance().removeFocusChangeListener (this); | Desktop::getInstance().removeFocusChangeListener (this); | ||||
| keyMappings = nullptr; | |||||
| keyMappings.reset(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -198,7 +198,7 @@ public: | |||||
| @see KeyPressMappingSet | @see KeyPressMappingSet | ||||
| */ | */ | ||||
| KeyPressMappingSet* getKeyMappings() const noexcept { return keyMappings; } | |||||
| KeyPressMappingSet* getKeyMappings() const noexcept { return keyMappings.get(); } | |||||
| //============================================================================== | //============================================================================== | ||||
| @@ -304,7 +304,7 @@ private: | |||||
| OwnedArray<ApplicationCommandInfo> commands; | OwnedArray<ApplicationCommandInfo> commands; | ||||
| ListenerList<ApplicationCommandManagerListener> listeners; | ListenerList<ApplicationCommandManagerListener> listeners; | ||||
| ScopedPointer<KeyPressMappingSet> keyMappings; | ScopedPointer<KeyPressMappingSet> keyMappings; | ||||
| ApplicationCommandTarget* firstTarget; | |||||
| ApplicationCommandTarget* firstTarget = nullptr; | |||||
| void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo&); | void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo&); | ||||
| void handleAsyncUpdate() override; | void handleAsyncUpdate() override; | ||||
| @@ -853,7 +853,7 @@ void Component::setBufferedToImage (const bool shouldBeBuffered) | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| cachedImage = nullptr; | |||||
| cachedImage.reset(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1334,7 +1334,7 @@ void Component::setTransform (const AffineTransform& newTransform) | |||||
| if (affineTransform != nullptr) | if (affineTransform != nullptr) | ||||
| { | { | ||||
| repaint(); | repaint(); | ||||
| affineTransform = nullptr; | |||||
| affineTransform.reset(); | |||||
| repaint(); | repaint(); | ||||
| sendMovedResizedMessages (false, false); | sendMovedResizedMessages (false, false); | ||||
| @@ -2812,7 +2812,7 @@ void Component::grabFocusInternal (const FocusChangeType cause, const bool canTr | |||||
| if (traverser != nullptr) | if (traverser != nullptr) | ||||
| { | { | ||||
| auto* defaultComp = traverser->getDefaultComponent (this); | auto* defaultComp = traverser->getDefaultComponent (this); | ||||
| traverser = nullptr; | |||||
| traverser.reset(); | |||||
| if (defaultComp != nullptr) | if (defaultComp != nullptr) | ||||
| { | { | ||||
| @@ -2859,7 +2859,7 @@ void Component::moveKeyboardFocusToSibling (const bool moveToNext) | |||||
| { | { | ||||
| auto* nextComp = moveToNext ? traverser->getNextComponent (this) | auto* nextComp = moveToNext ? traverser->getNextComponent (this) | ||||
| : traverser->getPreviousComponent (this); | : traverser->getPreviousComponent (this); | ||||
| traverser = nullptr; | |||||
| traverser.reset(); | |||||
| if (nextComp != nullptr) | if (nextComp != nullptr) | ||||
| { | { | ||||
| @@ -2222,7 +2222,7 @@ public: | |||||
| /** Returns the object that was set by setCachedComponentImage(). | /** Returns the object that was set by setCachedComponentImage(). | ||||
| @see setCachedComponentImage | @see setCachedComponentImage | ||||
| */ | */ | ||||
| CachedComponentImage* getCachedComponentImage() const noexcept { return cachedImage; } | |||||
| CachedComponentImage* getCachedComponentImage() const noexcept { return cachedImage.get(); } | |||||
| /** Sets a flag to indicate whether mouse drag events on this Component should be ignored when it is inside a | /** Sets a flag to indicate whether mouse drag events on this Component should be ignored when it is inside a | ||||
| Viewport with drag-to-scroll functionality enabled. This is useful for Components such as sliders that | Viewport with drag-to-scroll functionality enabled. This is useful for Components such as sliders that | ||||
| @@ -143,7 +143,7 @@ void DrawablePath::setPath (const RelativePointPath& newRelativePath) | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| relativePath = nullptr; | |||||
| relativePath.reset(); | |||||
| applyRelativePath (newRelativePath, nullptr); | applyRelativePath (newRelativePath, nullptr); | ||||
| } | } | ||||
| } | } | ||||
| @@ -103,7 +103,7 @@ void DrawableShape::setFillInternal (RelativeFillType& fill, const RelativeFillT | |||||
| if (fill != newFill) | if (fill != newFill) | ||||
| { | { | ||||
| fill = newFill; | fill = newFill; | ||||
| pos = nullptr; | |||||
| pos.reset(); | |||||
| if (fill.isDynamic()) | if (fill.isDynamic()) | ||||
| { | { | ||||
| @@ -87,7 +87,7 @@ void DirectoryContentsList::stopSearching() | |||||
| { | { | ||||
| shouldStop = true; | shouldStop = true; | ||||
| thread.removeTimeSliceClient (this); | thread.removeTimeSliceClient (this); | ||||
| fileFindHandle = nullptr; | |||||
| fileFindHandle.reset(); | |||||
| } | } | ||||
| void DirectoryContentsList::clear() | void DirectoryContentsList::clear() | ||||
| @@ -210,7 +210,7 @@ bool DirectoryContentsList::checkNextFile (bool& hasChanged) | |||||
| return true; | return true; | ||||
| } | } | ||||
| fileFindHandle = nullptr; | |||||
| fileFindHandle.reset(); | |||||
| } | } | ||||
| return false; | return false; | ||||
| @@ -121,8 +121,8 @@ FileBrowserComponent::FileBrowserComponent (int flags_, | |||||
| FileBrowserComponent::~FileBrowserComponent() | FileBrowserComponent::~FileBrowserComponent() | ||||
| { | { | ||||
| fileListComponent = nullptr; | |||||
| fileList = nullptr; | |||||
| fileListComponent.reset(); | |||||
| fileList.reset(); | |||||
| thread.stopThread (10000); | thread.stopThread (10000); | ||||
| } | } | ||||
| @@ -88,7 +88,7 @@ void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText) | |||||
| void FilenameComponent::lookAndFeelChanged() | void FilenameComponent::lookAndFeelChanged() | ||||
| { | { | ||||
| browseButton = nullptr; | |||||
| browseButton.reset(); | |||||
| addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText)); | addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText)); | ||||
| browseButton->setConnectedEdges (Button::ConnectedOnLeft); | browseButton->setConnectedEdges (Button::ConnectedOnLeft); | ||||
| @@ -61,7 +61,7 @@ public: | |||||
| if (useProxyComponent) | if (useProxyComponent) | ||||
| proxy = new ProxyComponent (*component); | proxy = new ProxyComponent (*component); | ||||
| else | else | ||||
| proxy = nullptr; | |||||
| proxy.reset(); | |||||
| component->setVisible (! useProxyComponent); | component->setVisible (! useProxyComponent); | ||||
| } | } | ||||
| @@ -282,7 +282,7 @@ bool MultiDocumentPanel::closeDocument (Component* component, | |||||
| delete component; | delete component; | ||||
| if (tabComponent != nullptr && tabComponent->getNumTabs() <= numDocsBeforeTabsUsed) | if (tabComponent != nullptr && tabComponent->getNumTabs() <= numDocsBeforeTabsUsed) | ||||
| tabComponent = nullptr; | |||||
| tabComponent.reset(); | |||||
| components.removeFirstMatchingValue (component); | components.removeFirstMatchingValue (component); | ||||
| @@ -387,7 +387,7 @@ void MultiDocumentPanel::setLayoutMode (const LayoutMode newLayoutMode) | |||||
| if (mode == FloatingWindows) | if (mode == FloatingWindows) | ||||
| { | { | ||||
| tabComponent = nullptr; | |||||
| tabComponent.reset(); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -242,7 +242,7 @@ public: | |||||
| Colour getBackgroundColour() const noexcept { return backgroundColour; } | Colour getBackgroundColour() const noexcept { return backgroundColour; } | ||||
| /** If the panel is being used in tabbed mode, this returns the TabbedComponent that's involved. */ | /** If the panel is being used in tabbed mode, this returns the TabbedComponent that's involved. */ | ||||
| TabbedComponent* getCurrentTabbedComponent() const noexcept { return tabComponent; } | |||||
| TabbedComponent* getCurrentTabbedComponent() const noexcept { return tabComponent.get(); } | |||||
| //============================================================================== | //============================================================================== | ||||
| /** A subclass must override this to say whether its currently ok for a document | /** A subclass must override this to say whether its currently ok for a document | ||||