From 59af7327634e26b724cd909cce397c750b0fd25a Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 10 Apr 2016 14:15:51 -0400 Subject: [PATCH] Mac build fixes; and implement deleters for our imitation unique_ptr --- mac/Audacity.xcodeproj/project.pbxproj | 358 +++++++++++++------------ src/AudacityApp.cpp | 2 +- src/MemoryX.h | 145 +++++++--- src/ModuleManager.cpp | 2 +- src/effects/LoadEffects.cpp | 2 +- src/import/ImportFFmpeg.cpp | 4 +- src/import/ImportLOF.cpp | 6 +- src/import/ImportMP3.cpp | 2 +- src/import/ImportOGG.cpp | 4 +- src/import/ImportPCM.cpp | 4 +- src/import/ImportQT.cpp | 6 +- 11 files changed, 299 insertions(+), 236 deletions(-) diff --git a/mac/Audacity.xcodeproj/project.pbxproj b/mac/Audacity.xcodeproj/project.pbxproj index ca406ec6a..c61fc79cf 100644 --- a/mac/Audacity.xcodeproj/project.pbxproj +++ b/mac/Audacity.xcodeproj/project.pbxproj @@ -2967,6 +2967,7 @@ 28FE4A060ABF4E960056F5C4 /* mmx_optimized.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = mmx_optimized.cpp; sourceTree = ""; tabWidth = 3; }; 28FE4A070ABF4E960056F5C4 /* sse_optimized.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = sse_optimized.cpp; sourceTree = ""; tabWidth = 3; }; 28FEC1B21A12B6FB00FACE48 /* EffectAutomationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EffectAutomationParameters.h; path = ../include/audacity/EffectAutomationParameters.h; sourceTree = SOURCE_ROOT; }; + 5E61EE0C1CBAA6BB0009FCF1 /* MemoryX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryX.h; sourceTree = ""; }; 82FF184D13CF01A600C1B664 /* dBTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dBTable.cpp; path = sbsms/src/dBTable.cpp; sourceTree = ""; }; 82FF184E13CF01A600C1B664 /* dBTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dBTable.h; path = sbsms/src/dBTable.h; sourceTree = ""; }; 82FF184F13CF01A600C1B664 /* slide.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = slide.cpp; path = sbsms/src/slide.cpp; sourceTree = ""; }; @@ -3790,6 +3791,185 @@ 1790AFC409883BFD008A330A /* src */ = { isa = PBXGroup; children = ( + 1790AFC709883BFD008A330A /* AboutDialog.cpp */, + 1790AFC909883BFD008A330A /* AColor.cpp */, + 1790AFCE09883BFD008A330A /* AudacityApp.cpp */, + 28C3946B1818356800FDDAC9 /* AudacityLogger.cpp */, + 1790AFD209883BFD008A330A /* AudioIO.cpp */, + 28560C8F0A75E40F00A3429E /* AutoRecovery.cpp */, + 1790AFD409883BFD008A330A /* BatchCommandDialog.cpp */, + 1790AFD609883BFD008A330A /* BatchCommands.cpp */, + 1790AFD809883BFD008A330A /* BatchProcessDialog.cpp */, + 1790AFDA09883BFD008A330A /* Benchmark.cpp */, + 1790AFE809883BFD008A330A /* BlockFile.cpp */, + 1790AFF409883BFD008A330A /* CrossFade.cpp */, + 2849B4600A7444BE00ECF12D /* Dependencies.cpp */, + 28D000A31A32920C00367B21 /* DeviceChange.cpp */, + 8484F31213086237002DF7F0 /* DeviceManager.cpp */, + 2888A1611AE25F9A00E06FDC /* Diags.cpp */, + 1790AFF709883BFD008A330A /* DirManager.cpp */, + 1790AFF909883BFD008A330A /* Dither.cpp */, + 1790B05F09883BFD008A330A /* Envelope.cpp */, + 283135FD0DFBA2E80076D551 /* FFmpeg.cpp */, + 1790B07009883BFD008A330A /* FFT.cpp */, + 1790B07209883BFD008A330A /* FileFormats.cpp */, + 2809C4B60BCB7E560006010F /* FileIO.cpp */, + 28F00A900A3E2FF100A3E5F5 /* FileNames.cpp */, + 1790B07509883BFD008A330A /* FreqWindow.cpp */, + 28501E9D0CEECEF80029ABAA /* HelpText.cpp */, + 1790B07909883BFD008A330A /* HistoryWindow.cpp */, + 1790B07B09883BFD008A330A /* ImageManipulation.cpp */, + 1790B09909883BFD008A330A /* Internat.cpp */, + 28EBA7FD0A78FAF800C8BB1F /* InterpolateAudio.cpp */, + 280828530A75E0D0000002EF /* LabelDialog.cpp */, + 1790B09B09883BFD008A330A /* LabelTrack.cpp */, + 1790B09F09883BFD008A330A /* LangChoice.cpp */, + 1790B0A109883BFD008A330A /* Languages.cpp */, + 1790B0A309883BFD008A330A /* Legacy.cpp */, + 1865A9B41004490400946EE6 /* Lyrics.cpp */, + 1865A9B61004490500946EE6 /* LyricsWindow.cpp */, + 28EBA7FF0A78FAF800C8BB1F /* Matrix.cpp */, + 1790B0A709883BFD008A330A /* Menus.cpp */, + 1790B0AB09883BFD008A330A /* Mix.cpp */, + 289E75081006D0BD00CEF79B /* MixerBoard.cpp */, + 280A8B4519F4403B0091DE70 /* ModuleManager.cpp */, + 1790B0AF09883BFD008A330A /* NoteTrack.cpp */, + EDF3B7AF1588C0D50032D35F /* Paulstretch.cpp */, + 1790B0B109883BFD008A330A /* PitchName.cpp */, + 1790B0B309883BFD008A330A /* PlatformCompatibility.cpp */, + 287E207E102561F300BF47A2 /* PluginManager.cpp */, + 1790B0CC09883BFD008A330A /* Prefs.cpp */, + 1790B0CE09883BFD008A330A /* Printing.cpp */, + 186CCEA30E523C8E00659159 /* Profiler.cpp */, + 1790B0D009883BFD008A330A /* Project.cpp */, + 28DABFBC0FF19DB100AC7848 /* RealFFTf.cpp */, + EDFCEBA218894B2A00C98E51 /* RealFFTf48x.cpp */, + 1790B0D209883BFD008A330A /* Resample.cpp */, + 1790B0D409883BFD008A330A /* RingBuffer.cpp */, + 1790B0D609883BFD008A330A /* SampleFormat.cpp */, + 285DE1F80BF03C7800A20DF0 /* Screenshot.cpp */, + 28D8425B1AD8D69D00551353 /* SelectedRegion.cpp */, + 1790B0DA09883BFD008A330A /* Sequence.cpp */, + 1790B0DC09883BFD008A330A /* Shuttle.cpp */, + 283A11A60A2C0E15004372C4 /* ShuttleGui.cpp */, + 288217790A35D8730029AF41 /* ShuttlePrefs.cpp */, + 282D474A0B9E8D900034BC49 /* Snap.cpp */, + 2860BA200E0F0D8600A13878 /* SoundActivatedRecord.cpp */, + 1790B0DE09883BFD008A330A /* Spectrum.cpp */, + 28501E9F0CEECEF80029ABAA /* SplashDialog.cpp */, + EDFCEBA418894B2A00C98E51 /* SseMathFuncs.cpp */, + 1790B0E009883BFD008A330A /* Tags.cpp */, + 283A11A80A2C0E15004372C4 /* Theme.cpp */, + 287F9F3C0A69748F00F025FA /* TimeDialog.cpp */, + 2860BA220E0F0D8600A13878 /* TimerRecordDialog.cpp */, + 1790B0E209883BFD008A330A /* TimeTrack.cpp */, + 1790B0E809883BFD008A330A /* Track.cpp */, + 1790B0EA09883BFD008A330A /* TrackArtist.cpp */, + 1790B0EC09883BFD008A330A /* TrackPanel.cpp */, + 1790B0EE09883BFD008A330A /* TrackPanelAx.cpp */, + 1790B0F209883BFD008A330A /* UndoManager.cpp */, + 28C8211C1B5C661E00B53328 /* ViewInfo.cpp */, + 1790B0F709883BFD008A330A /* VoiceKey.cpp */, + 1790B0F909883BFD008A330A /* WaveClip.cpp */, + 1790B0FB09883BFD008A330A /* WaveTrack.cpp */, + 28FC1AF90A47762C00A188AE /* WrappedType.cpp */, + 1790AFC809883BFD008A330A /* AboutDialog.h */, + 1790AFCA09883BFD008A330A /* AColor.h */, + 28FB12230A3790DF006F0917 /* AllThemeResources.h */, + 1790AFCC09883BFD008A330A /* Audacity.h */, + 1790AFCF09883BFD008A330A /* AudacityApp.h */, + 1790AFD009883BFD008A330A /* AudacityHeaders.h */, + 28C3946C1818356800FDDAC9 /* AudacityLogger.h */, + 1790AFD309883BFD008A330A /* AudioIO.h */, + 28F996D91A2A9261008FEEF3 /* AudioIOListener.h */, + 28560C900A75E40F00A3429E /* AutoRecovery.h */, + 1790AFD509883BFD008A330A /* BatchCommandDialog.h */, + 1790AFD709883BFD008A330A /* BatchCommands.h */, + 1790AFD909883BFD008A330A /* BatchProcessDialog.h */, + 1790AFDB09883BFD008A330A /* Benchmark.h */, + 1790AFE909883BFD008A330A /* BlockFile.h */, + 1790AFF009883BFD008A330A /* configtemplate.h */, + 1790AFF509883BFD008A330A /* CrossFade.h */, + 2849B4610A7444BE00ECF12D /* Dependencies.h */, + 28D000A41A32920C00367B21 /* DeviceChange.h */, + 8484F31313086237002DF7F0 /* DeviceManager.h */, + 2888A1621AE25F9A00E06FDC /* Diags.h */, + 1790AFF809883BFD008A330A /* DirManager.h */, + 1790AFFA09883BFD008A330A /* Dither.h */, + 1790B06009883BFD008A330A /* Envelope.h */, + 1790B06109883BFD008A330A /* Experimental.h */, + 283135FE0DFBA2E80076D551 /* FFmpeg.h */, + 1790B07109883BFD008A330A /* FFT.h */, + 1790B07309883BFD008A330A /* FileFormats.h */, + 2809C4B70BCB7E560006010F /* FileIO.h */, + 28F00A910A3E2FF100A3E5F5 /* FileNames.h */, + 1790B07409883BFD008A330A /* float_cast.h */, + 1790B07609883BFD008A330A /* FreqWindow.h */, + 28501E9E0CEECEF80029ABAA /* HelpText.h */, + 1790B07A09883BFD008A330A /* HistoryWindow.h */, + 1790B07C09883BFD008A330A /* ImageManipulation.h */, + 1790B09A09883BFD008A330A /* Internat.h */, + 28EBA7FE0A78FAF800C8BB1F /* InterpolateAudio.h */, + 280828540A75E0D0000002EF /* LabelDialog.h */, + 1790B09C09883BFD008A330A /* LabelTrack.h */, + 1790B0A009883BFD008A330A /* LangChoice.h */, + 1790B0A209883BFD008A330A /* Languages.h */, + 1790B0A409883BFD008A330A /* Legacy.h */, + 1865A9B51004490400946EE6 /* Lyrics.h */, + 1865A9B71004490500946EE6 /* LyricsWindow.h */, + 28FB121F0A3790A8006F0917 /* MacroMagic.h */, + 28EBA8000A78FAF800C8BB1F /* Matrix.h */, + 5E61EE0C1CBAA6BB0009FCF1 /* MemoryX.h */, + 1790B0A809883BFD008A330A /* Menus.h */, + 1790B0AC09883BFD008A330A /* Mix.h */, + 289E75091006D0BD00CEF79B /* MixerBoard.h */, + 280A8B4619F4403B0091DE70 /* ModuleManager.h */, + 1790B0B009883BFD008A330A /* NoteTrack.h */, + 280F5C8B1B676699003022C5 /* NumberScale.h */, + EDF3B7AE1588C0D50032D35F /* Paulstretch.h */, + 1790B0B209883BFD008A330A /* PitchName.h */, + 1790B0B409883BFD008A330A /* PlatformCompatibility.h */, + 2803C8B519F35AA000278526 /* PluginManager.h */, + 1790B0CD09883BFD008A330A /* Prefs.h */, + 1790B0CF09883BFD008A330A /* Printing.h */, + 186CCEA20E523C8D00659159 /* Profiler.h */, + 1790B0D109883BFD008A330A /* Project.h */, + 28DABFBD0FF19DB100AC7848 /* RealFFTf.h */, + EDFCEBA318894B2A00C98E51 /* RealFFTf48x.h */, + 1790B0D309883BFD008A330A /* Resample.h */, + 28D8425A1AD8D69D00551353 /* RevisionIdent.h */, + 1790B0D509883BFD008A330A /* RingBuffer.h */, + 1790B0D709883BFD008A330A /* SampleFormat.h */, + 285DE1F90BF03C7800A20DF0 /* Screenshot.h */, + 2813897919E6163C004111ED /* SelectedRegion.h */, + 1790B0DB09883BFD008A330A /* Sequence.h */, + 1790B0DD09883BFD008A330A /* Shuttle.h */, + 283A11A70A2C0E15004372C4 /* ShuttleGui.h */, + 2882177A0A35D8730029AF41 /* ShuttlePrefs.h */, + 282D474B0B9E8D900034BC49 /* Snap.h */, + 2860BA210E0F0D8600A13878 /* SoundActivatedRecord.h */, + 1790B0DF09883BFD008A330A /* Spectrum.h */, + 28501EA00CEECEF80029ABAA /* SplashDialog.h */, + EDFCEBA518894B2A00C98E51 /* SseMathFuncs.h */, + 1790B0E109883BFD008A330A /* Tags.h */, + 283A11A90A2C0E15004372C4 /* Theme.h */, + 28F00A920A3E2FF100A3E5F5 /* ThemeAsCeeCode.h */, + 287F9F3B0A69748F00F025FA /* TimeDialog.h */, + 2860BA230E0F0D8600A13878 /* TimerRecordDialog.h */, + 1790B0E309883BFD008A330A /* TimeTrack.h */, + 1790B0E909883BFD008A330A /* Track.h */, + 1790B0EB09883BFD008A330A /* TrackArtist.h */, + 1790B0ED09883BFD008A330A /* TrackPanel.h */, + 1790B0EF09883BFD008A330A /* TrackPanelAx.h */, + 2803C8B619F35AA000278526 /* TrackPanelListener.h */, + 284416391B82D6BC0000574D /* TranslatableStringArray.h */, + 1790B0F309883BFD008A330A /* UndoManager.h */, + 1790B0F609883BFD008A330A /* ViewInfo.h */, + 1790B0F809883BFD008A330A /* VoiceKey.h */, + 1790B0FA09883BFD008A330A /* WaveClip.h */, + 1790B0FC09883BFD008A330A /* WaveTrack.h */, + 2844163A1B82D6BC0000574D /* WaveTrackLocation.h */, + 28FC1AFA0A47762C00A188AE /* WrappedType.h */, 1790AFDC09883BFD008A330A /* blockfile */, 174D9025098C78AF00D5909F /* commands */, 1790AFFD09883BFD008A330A /* effects */, @@ -3800,184 +3980,6 @@ 2897F6DB0AB3DB5A003C20C5 /* toolbars */, 1790B0FD09883BFD008A330A /* widgets */, 1790B10D09883BFD008A330A /* xml */, - 1790AFC709883BFD008A330A /* AboutDialog.cpp */, - 1790AFC809883BFD008A330A /* AboutDialog.h */, - 1790AFC909883BFD008A330A /* AColor.cpp */, - 1790AFCA09883BFD008A330A /* AColor.h */, - 28FB12230A3790DF006F0917 /* AllThemeResources.h */, - 1790AFCC09883BFD008A330A /* Audacity.h */, - 1790AFCE09883BFD008A330A /* AudacityApp.cpp */, - 1790AFCF09883BFD008A330A /* AudacityApp.h */, - 1790AFD009883BFD008A330A /* AudacityHeaders.h */, - 28C3946B1818356800FDDAC9 /* AudacityLogger.cpp */, - 28C3946C1818356800FDDAC9 /* AudacityLogger.h */, - 1790AFD209883BFD008A330A /* AudioIO.cpp */, - 1790AFD309883BFD008A330A /* AudioIO.h */, - 28F996D91A2A9261008FEEF3 /* AudioIOListener.h */, - 28560C8F0A75E40F00A3429E /* AutoRecovery.cpp */, - 28560C900A75E40F00A3429E /* AutoRecovery.h */, - 1790AFD409883BFD008A330A /* BatchCommandDialog.cpp */, - 1790AFD509883BFD008A330A /* BatchCommandDialog.h */, - 1790AFD609883BFD008A330A /* BatchCommands.cpp */, - 1790AFD709883BFD008A330A /* BatchCommands.h */, - 1790AFD809883BFD008A330A /* BatchProcessDialog.cpp */, - 1790AFD909883BFD008A330A /* BatchProcessDialog.h */, - 1790AFDA09883BFD008A330A /* Benchmark.cpp */, - 1790AFDB09883BFD008A330A /* Benchmark.h */, - 1790AFE809883BFD008A330A /* BlockFile.cpp */, - 1790AFE909883BFD008A330A /* BlockFile.h */, - 1790AFF009883BFD008A330A /* configtemplate.h */, - 1790AFF409883BFD008A330A /* CrossFade.cpp */, - 1790AFF509883BFD008A330A /* CrossFade.h */, - 2849B4600A7444BE00ECF12D /* Dependencies.cpp */, - 2849B4610A7444BE00ECF12D /* Dependencies.h */, - 28D000A31A32920C00367B21 /* DeviceChange.cpp */, - 28D000A41A32920C00367B21 /* DeviceChange.h */, - 8484F31213086237002DF7F0 /* DeviceManager.cpp */, - 8484F31313086237002DF7F0 /* DeviceManager.h */, - 2888A1611AE25F9A00E06FDC /* Diags.cpp */, - 2888A1621AE25F9A00E06FDC /* Diags.h */, - 1790AFF709883BFD008A330A /* DirManager.cpp */, - 1790AFF809883BFD008A330A /* DirManager.h */, - 1790AFF909883BFD008A330A /* Dither.cpp */, - 1790AFFA09883BFD008A330A /* Dither.h */, - 1790B05F09883BFD008A330A /* Envelope.cpp */, - 1790B06009883BFD008A330A /* Envelope.h */, - 1790B06109883BFD008A330A /* Experimental.h */, - 283135FD0DFBA2E80076D551 /* FFmpeg.cpp */, - 283135FE0DFBA2E80076D551 /* FFmpeg.h */, - 1790B07009883BFD008A330A /* FFT.cpp */, - 1790B07109883BFD008A330A /* FFT.h */, - 1790B07209883BFD008A330A /* FileFormats.cpp */, - 1790B07309883BFD008A330A /* FileFormats.h */, - 2809C4B60BCB7E560006010F /* FileIO.cpp */, - 2809C4B70BCB7E560006010F /* FileIO.h */, - 28F00A900A3E2FF100A3E5F5 /* FileNames.cpp */, - 28F00A910A3E2FF100A3E5F5 /* FileNames.h */, - 1790B07409883BFD008A330A /* float_cast.h */, - 1790B07509883BFD008A330A /* FreqWindow.cpp */, - 1790B07609883BFD008A330A /* FreqWindow.h */, - 28501E9D0CEECEF80029ABAA /* HelpText.cpp */, - 28501E9E0CEECEF80029ABAA /* HelpText.h */, - 1790B07909883BFD008A330A /* HistoryWindow.cpp */, - 1790B07A09883BFD008A330A /* HistoryWindow.h */, - 1790B07B09883BFD008A330A /* ImageManipulation.cpp */, - 1790B07C09883BFD008A330A /* ImageManipulation.h */, - 1790B09909883BFD008A330A /* Internat.cpp */, - 1790B09A09883BFD008A330A /* Internat.h */, - 28EBA7FD0A78FAF800C8BB1F /* InterpolateAudio.cpp */, - 28EBA7FE0A78FAF800C8BB1F /* InterpolateAudio.h */, - 280828530A75E0D0000002EF /* LabelDialog.cpp */, - 280828540A75E0D0000002EF /* LabelDialog.h */, - 1790B09B09883BFD008A330A /* LabelTrack.cpp */, - 1790B09C09883BFD008A330A /* LabelTrack.h */, - 1790B09F09883BFD008A330A /* LangChoice.cpp */, - 1790B0A009883BFD008A330A /* LangChoice.h */, - 1790B0A109883BFD008A330A /* Languages.cpp */, - 1790B0A209883BFD008A330A /* Languages.h */, - 1790B0A309883BFD008A330A /* Legacy.cpp */, - 1790B0A409883BFD008A330A /* Legacy.h */, - 1865A9B41004490400946EE6 /* Lyrics.cpp */, - 1865A9B51004490400946EE6 /* Lyrics.h */, - 1865A9B61004490500946EE6 /* LyricsWindow.cpp */, - 1865A9B71004490500946EE6 /* LyricsWindow.h */, - 28FB121F0A3790A8006F0917 /* MacroMagic.h */, - 28EBA7FF0A78FAF800C8BB1F /* Matrix.cpp */, - 28EBA8000A78FAF800C8BB1F /* Matrix.h */, - 1790B0A709883BFD008A330A /* Menus.cpp */, - 1790B0A809883BFD008A330A /* Menus.h */, - 1790B0AB09883BFD008A330A /* Mix.cpp */, - 1790B0AC09883BFD008A330A /* Mix.h */, - 289E75081006D0BD00CEF79B /* MixerBoard.cpp */, - 289E75091006D0BD00CEF79B /* MixerBoard.h */, - 280A8B4519F4403B0091DE70 /* ModuleManager.cpp */, - 280A8B4619F4403B0091DE70 /* ModuleManager.h */, - 1790B0AF09883BFD008A330A /* NoteTrack.cpp */, - 1790B0B009883BFD008A330A /* NoteTrack.h */, - 280F5C8B1B676699003022C5 /* NumberScale.h */, - EDF3B7AF1588C0D50032D35F /* Paulstretch.cpp */, - EDF3B7AE1588C0D50032D35F /* Paulstretch.h */, - 1790B0B109883BFD008A330A /* PitchName.cpp */, - 1790B0B209883BFD008A330A /* PitchName.h */, - 1790B0B309883BFD008A330A /* PlatformCompatibility.cpp */, - 1790B0B409883BFD008A330A /* PlatformCompatibility.h */, - 287E207E102561F300BF47A2 /* PluginManager.cpp */, - 2803C8B519F35AA000278526 /* PluginManager.h */, - 1790B0CC09883BFD008A330A /* Prefs.cpp */, - 1790B0CD09883BFD008A330A /* Prefs.h */, - 1790B0CE09883BFD008A330A /* Printing.cpp */, - 1790B0CF09883BFD008A330A /* Printing.h */, - 186CCEA30E523C8E00659159 /* Profiler.cpp */, - 186CCEA20E523C8D00659159 /* Profiler.h */, - 1790B0D009883BFD008A330A /* Project.cpp */, - 1790B0D109883BFD008A330A /* Project.h */, - 28DABFBC0FF19DB100AC7848 /* RealFFTf.cpp */, - 28DABFBD0FF19DB100AC7848 /* RealFFTf.h */, - EDFCEBA218894B2A00C98E51 /* RealFFTf48x.cpp */, - EDFCEBA318894B2A00C98E51 /* RealFFTf48x.h */, - 1790B0D209883BFD008A330A /* Resample.cpp */, - 1790B0D309883BFD008A330A /* Resample.h */, - 28D8425A1AD8D69D00551353 /* RevisionIdent.h */, - 1790B0D409883BFD008A330A /* RingBuffer.cpp */, - 1790B0D509883BFD008A330A /* RingBuffer.h */, - 1790B0D609883BFD008A330A /* SampleFormat.cpp */, - 1790B0D709883BFD008A330A /* SampleFormat.h */, - 285DE1F80BF03C7800A20DF0 /* Screenshot.cpp */, - 285DE1F90BF03C7800A20DF0 /* Screenshot.h */, - 28D8425B1AD8D69D00551353 /* SelectedRegion.cpp */, - 2813897919E6163C004111ED /* SelectedRegion.h */, - 1790B0DA09883BFD008A330A /* Sequence.cpp */, - 1790B0DB09883BFD008A330A /* Sequence.h */, - 1790B0DC09883BFD008A330A /* Shuttle.cpp */, - 1790B0DD09883BFD008A330A /* Shuttle.h */, - 283A11A60A2C0E15004372C4 /* ShuttleGui.cpp */, - 283A11A70A2C0E15004372C4 /* ShuttleGui.h */, - 288217790A35D8730029AF41 /* ShuttlePrefs.cpp */, - 2882177A0A35D8730029AF41 /* ShuttlePrefs.h */, - 282D474A0B9E8D900034BC49 /* Snap.cpp */, - 282D474B0B9E8D900034BC49 /* Snap.h */, - 2860BA200E0F0D8600A13878 /* SoundActivatedRecord.cpp */, - 2860BA210E0F0D8600A13878 /* SoundActivatedRecord.h */, - 1790B0DE09883BFD008A330A /* Spectrum.cpp */, - 1790B0DF09883BFD008A330A /* Spectrum.h */, - 28501E9F0CEECEF80029ABAA /* SplashDialog.cpp */, - 28501EA00CEECEF80029ABAA /* SplashDialog.h */, - EDFCEBA418894B2A00C98E51 /* SseMathFuncs.cpp */, - EDFCEBA518894B2A00C98E51 /* SseMathFuncs.h */, - 1790B0E009883BFD008A330A /* Tags.cpp */, - 1790B0E109883BFD008A330A /* Tags.h */, - 283A11A80A2C0E15004372C4 /* Theme.cpp */, - 283A11A90A2C0E15004372C4 /* Theme.h */, - 28F00A920A3E2FF100A3E5F5 /* ThemeAsCeeCode.h */, - 287F9F3C0A69748F00F025FA /* TimeDialog.cpp */, - 287F9F3B0A69748F00F025FA /* TimeDialog.h */, - 1790B0E209883BFD008A330A /* TimeTrack.cpp */, - 1790B0E309883BFD008A330A /* TimeTrack.h */, - 2860BA220E0F0D8600A13878 /* TimerRecordDialog.cpp */, - 2860BA230E0F0D8600A13878 /* TimerRecordDialog.h */, - 1790B0E809883BFD008A330A /* Track.cpp */, - 1790B0E909883BFD008A330A /* Track.h */, - 1790B0EA09883BFD008A330A /* TrackArtist.cpp */, - 1790B0EB09883BFD008A330A /* TrackArtist.h */, - 1790B0EC09883BFD008A330A /* TrackPanel.cpp */, - 1790B0ED09883BFD008A330A /* TrackPanel.h */, - 1790B0EE09883BFD008A330A /* TrackPanelAx.cpp */, - 1790B0EF09883BFD008A330A /* TrackPanelAx.h */, - 2803C8B619F35AA000278526 /* TrackPanelListener.h */, - 284416391B82D6BC0000574D /* TranslatableStringArray.h */, - 1790B0F209883BFD008A330A /* UndoManager.cpp */, - 1790B0F309883BFD008A330A /* UndoManager.h */, - 28C8211C1B5C661E00B53328 /* ViewInfo.cpp */, - 1790B0F609883BFD008A330A /* ViewInfo.h */, - 1790B0F709883BFD008A330A /* VoiceKey.cpp */, - 1790B0F809883BFD008A330A /* VoiceKey.h */, - 1790B0F909883BFD008A330A /* WaveClip.cpp */, - 1790B0FA09883BFD008A330A /* WaveClip.h */, - 1790B0FB09883BFD008A330A /* WaveTrack.cpp */, - 1790B0FC09883BFD008A330A /* WaveTrack.h */, - 2844163A1B82D6BC0000574D /* WaveTrackLocation.h */, - 28FC1AF90A47762C00A188AE /* WrappedType.cpp */, - 28FC1AFA0A47762C00A188AE /* WrappedType.h */, ); name = src; path = ../src; diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 38f2da07d..ab80fbb98 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1819,7 +1819,7 @@ std::unique_ptr AudacityApp::ParseCommandLine() auto parser = std::make_unique(argc, argv); if (!parser) { - return NULL; + return nullptr; } /*i18n-hint: This controls the number of bytes that Audacity will diff --git a/src/MemoryX.h b/src/MemoryX.h index 4cddab89d..796a25575 100644 --- a/src/MemoryX.h +++ b/src/MemoryX.h @@ -35,6 +35,35 @@ namespace std { using std::tr1::shared_ptr; using std::tr1::remove_reference; + template struct default_delete + { + default_delete() {} + + // Allow copy from other deleter classes + template + default_delete(const default_delete& that) + { + // Break compilation if Y* does not convert to X* + // I should figure out the right use of enable_if instead + static_assert((static_cast((Y*){}), true)); + } + + inline void operator() (void *p) const + { + delete static_cast(p); + } + }; + + // Specialization for arrays + template struct default_delete + { + // Do not allow copy from other deleter classes + inline void operator() (void *p) const + { + delete[] static_cast(p); + } + }; + struct nullptr_t { void* __lx; @@ -64,27 +93,41 @@ namespace std { #define nullptr std::__get_nullptr_t() - template class unique_ptr { + template> class unique_ptr + : private D // use empty base optimization + { public: // Default constructor unique_ptr() {} + + // Implicit constrution from nullptr + unique_ptr(nullptr_t) {} - // Explicit constructor from pointer - explicit unique_ptr(T *p_) : p{ p_ } {} - // Template constructor for upcasting + // Explicit constructor from pointer and optional deleter + explicit unique_ptr(T *p_) + : p{ p_ } {} + explicit unique_ptr(T *p_, const D &d) + : D(d), p{ p_ } {} + // Template constructors for upcasting template - explicit unique_ptr(U* p_) : p{ p_ } {} + explicit unique_ptr(U* p_) + : p{ p_ } {} + template + explicit unique_ptr(U* p_, const D& d) + : D(d), p{ p_ } {} // Copy is disallowed unique_ptr(const unique_ptr &) PROHIBITED; unique_ptr& operator= (const unique_ptr &) PROHIBITED; // But move is allowed! - unique_ptr(unique_ptr &&that) : p{ that.release() } { } + unique_ptr(unique_ptr &&that) + : D(move(that.get_deleter())), p{ that.release() } { } unique_ptr& operator= (unique_ptr &&that) { if (this != &that) { - delete p; + get_deleter()(p); + ((D&)*this) = move(that.get_deleter()); p = that.release(); } return *this; @@ -93,24 +136,29 @@ namespace std { // Assign null unique_ptr& operator= (nullptr_t) { - delete p; + get_deleter()(p); p = nullptr; return *this; } // Template versions of move for upcasting - template - unique_ptr(unique_ptr &&that) : p{ that.release() } { } - template - unique_ptr& operator= (unique_ptr &&that) + template + unique_ptr(unique_ptr &&that) + : D(move(that.get_deleter())), p{ that.release() } { } + template + unique_ptr& operator= (unique_ptr &&that) { // Skip the self-assignment test -- self-assignment should go to the non-template overload - delete p; + get_deleter()(p); p = that.release(); + ((D&)*this) = move(that.get_deleter()); return *this; } + + D& get_deleter() { return *this; } + const D& get_deleter() const { return *this; } - ~unique_ptr() { delete p; } + ~unique_ptr() { get_deleter()(p); } T* operator -> () const { return p; } T& operator * () const { return *p; } @@ -128,28 +176,30 @@ namespace std { p = __p; if (old__p != nullptr) { - delete old__p; + get_deleter()(old__p); } } - - // Equality tests - bool operator== (nullptr_t) const { return p != nullptr; } - template friend bool operator== (nullptr_t, const unique_ptr&); - template friend bool operator== (const unique_ptr&, const unique_ptr&); - private: T *p{}; }; // Now specialize the class for array types - template class unique_ptr { + template class unique_ptr + : private D // use empty base optimization + { public: // Default constructor unique_ptr() {} + // Implicit constrution from nullptr + unique_ptr(nullptr_t) {} + // Explicit constructor from pointer - explicit unique_ptr(T *p_) : p{ p_ } {} + explicit unique_ptr(T *p_) + : p{ p_ } {} + explicit unique_ptr(T *p_, const D &d) + : D( d ), p{ p_ } {} // NO template constructor for upcasting! // Copy is disallowed @@ -157,12 +207,14 @@ namespace std { unique_ptr& operator= (const unique_ptr &)PROHIBITED; // But move is allowed! - unique_ptr(unique_ptr &&that) : p{ that.release() } { } + unique_ptr(unique_ptr &&that) + : D( move(that.get_deleter()) ), p{ that.release() } { } unique_ptr& operator= (unique_ptr &&that) { if (this != &that) { - delete[] p; + get_deleter()(p); p = that.release(); + ((D&)*this) = move(that.get_deleter()); } return *this; } @@ -170,18 +222,20 @@ namespace std { // Assign null unique_ptr& operator= (nullptr_t) { - delete[] p; + get_deleter()(p); p = nullptr; return *this; } + + D& get_deleter() { return *this; } + const D& get_deleter() const { return *this; } // NO template versions of move for upcasting! - // delete[] not delete! - ~unique_ptr() { delete[] p; } + ~unique_ptr() { get_deleter()(p); } // No operator ->, but [] instead - T& operator [] (ptrdiff_t n) const { return p[n]; } + T& operator [] (size_t n) const { return p[n]; } T& operator * () const { return *p; } T* get() const { return p; } @@ -198,29 +252,35 @@ namespace std { p = __p; if (old__p != nullptr) { - delete[] old__p; + get_deleter()(old__p); } } - // Equality tests - bool operator== (nullptr_t) const { return p != nullptr; } - template friend bool operator== (nullptr_t, const unique_ptr&); - template friend bool operator== (const unique_ptr&, const unique_ptr&); - private: T *p{}; }; // Equality operators for unique_ptr, don't need the specializations for array case - template - inline bool operator== (nullptr_t, const unique_ptr& ptr) + template + inline bool operator== (nullptr_t, const unique_ptr& ptr) { - return ptr == nullptr; + return ptr.get() == nullptr; + } + template + inline bool operator== (const unique_ptr& ptr, nullptr_t) + { + return ptr.get() == nullptr; + } + template + inline bool operator == (const unique_ptr &ptr1, + const unique_ptr &ptr2) + { + return ptr1.get() == ptr2.get(); } - template inline bool operator != (nullptr_t, const unique_ptr &ptr) { return !(ptr == nullptr); } - template inline bool operator != (const unique_ptr &ptr, nullptr_t) { return !(ptr == nullptr); } - template inline bool operator != (const unique_ptr& ptr1, const unique_ptr &ptr2) + template inline bool operator != (nullptr_t, const unique_ptr &ptr) { return !(ptr == nullptr); } + template inline bool operator != (const unique_ptr &ptr, nullptr_t) { return !(ptr == nullptr); } + template inline bool operator != (const unique_ptr& ptr1, const unique_ptr &ptr2) { return !(ptr1 == ptr2); } // Forward -- pass along rvalue references as rvalue references, anything else as it is @@ -491,7 +551,7 @@ public: // NULL state -- giving exception safety but only weakly // (previous value was lost if present) template - void create(Args... args) + void create(Args&&... args) { // Lose any old value reset(); @@ -597,6 +657,7 @@ public: movable_ptr_with_deleter() {}; movable_ptr_with_deleter(T* p, const Deleter &d) : movable_ptr_with_deleter_base( p, d ) {} + movable_ptr_with_deleter(const movable_ptr_with_deleter &that) = default; movable_ptr_with_deleter &operator= (movable_ptr_with_deleter&& that) { if (this != &that) { diff --git a/src/ModuleManager.cpp b/src/ModuleManager.cpp index 51b2e3b3c..9f9f8be21 100755 --- a/src/ModuleManager.cpp +++ b/src/ModuleManager.cpp @@ -440,7 +440,7 @@ void ModuleManager::InitializeBuiltins() ModuleInterface *ModuleManager::LoadModule(const wxString & path) { - auto lib = std::make_unique(); + auto lib = make_movable(); if (lib->Load(path, wxDL_NOW)) { diff --git a/src/effects/LoadEffects.cpp b/src/effects/LoadEffects.cpp index 11fa5dc8b..111efa264 100644 --- a/src/effects/LoadEffects.cpp +++ b/src/effects/LoadEffects.cpp @@ -356,5 +356,5 @@ std::unique_ptr BuiltinEffectsModule::Instantiate(const wxString & path) EXCLUDE_LIST; } - return NULL; + return nullptr; } diff --git a/src/import/ImportFFmpeg.cpp b/src/import/ImportFFmpeg.cpp index 0f7743527..04b947d70 100644 --- a/src/import/ImportFFmpeg.cpp +++ b/src/import/ImportFFmpeg.cpp @@ -323,13 +323,13 @@ std::unique_ptr FFmpegImportPlugin::Open(const wxString &filen } if (!FFmpegLibsInst->ValidLibsLoaded()) { - return NULL; + return nullptr; } // Open the file for import bool success = handle->Init(); if (!success) { - return NULL; + return nullptr; } return std::move(handle); diff --git a/src/import/ImportLOF.cpp b/src/import/ImportLOF.cpp index 99ceaf7a0..99a2652ad 100644 --- a/src/import/ImportLOF.cpp +++ b/src/import/ImportLOF.cpp @@ -190,7 +190,7 @@ std::unique_ptr LOFImportPlugin::Open(const wxString &filename // Check if it is a binary file wxFile binaryFile; if (!binaryFile.Open(filename)) - return NULL; // File not found + return nullptr; // File not found char buf[BINARY_FILE_CHECK_BUFFER_SIZE]; int count = binaryFile.Read(buf, BINARY_FILE_CHECK_BUFFER_SIZE); @@ -203,7 +203,7 @@ std::unique_ptr LOFImportPlugin::Open(const wxString &filename { // Assume it is a binary file binaryFile.Close(); - return NULL; + return nullptr; } } @@ -217,7 +217,7 @@ std::unique_ptr LOFImportPlugin::Open(const wxString &filename if (!file->IsOpened()) { delete file; - return NULL; + return nullptr; } return std::make_unique(filename, file); diff --git a/src/import/ImportMP3.cpp b/src/import/ImportMP3.cpp index f97ad0125..5c5ed9ac1 100644 --- a/src/import/ImportMP3.cpp +++ b/src/import/ImportMP3.cpp @@ -186,7 +186,7 @@ std::unique_ptr MP3ImportPlugin::Open(const wxString &Filename if (!file->IsOpened()) { delete file; - return NULL; + return nullptr; } /* There's no way to tell if this is a valid mp3 file before actually diff --git a/src/import/ImportOGG.cpp b/src/import/ImportOGG.cpp index 744a2b8b5..406c535ac 100644 --- a/src/import/ImportOGG.cpp +++ b/src/import/ImportOGG.cpp @@ -185,7 +185,7 @@ std::unique_ptr OggImportPlugin::Open(const wxString &filename // No need for a message box, it's done automatically (but how?) delete vorbisFile; delete file; - return NULL; + return nullptr; } int err = ov_open(file->fp(), vorbisFile, NULL, 0); @@ -215,7 +215,7 @@ std::unique_ptr OggImportPlugin::Open(const wxString &filename file->Close(); delete vorbisFile; delete file; - return NULL; + return nullptr; } return std::make_unique(filename, file, vorbisFile); diff --git a/src/import/ImportPCM.cpp b/src/import/ImportPCM.cpp index 132e4eb7b..c837248f8 100644 --- a/src/import/ImportPCM.cpp +++ b/src/import/ImportPCM.cpp @@ -167,7 +167,7 @@ std::unique_ptr PCMImportPlugin::Open(const wxString &filename //char str[1000]; //sf_error_str((SNDFILE *)NULL, str, 1000); - return NULL; + return nullptr; } else if (file && (info.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_OGG) { // mchinen 15.1.2012 - disallowing libsndfile to handle @@ -181,7 +181,7 @@ std::unique_ptr PCMImportPlugin::Open(const wxString &filename // When the bug is fixed, we can check version to avoid only // the broken builds. - return NULL; + return nullptr; } return std::make_unique(filename, file, info); diff --git a/src/import/ImportQT.cpp b/src/import/ImportQT.cpp index 17d9a4c31..97d808ca9 100644 --- a/src/import/ImportQT.cpp +++ b/src/import/ImportQT.cpp @@ -191,12 +191,12 @@ std::unique_ptr QTImportPlugin::Open(const wxString & Filename #endif if (err != noErr) { - return NULL; + return nullptr; } err = QTNewDataReferenceFromFSRef(&inRef, 0, &dataRef, &dataRefType); if (err != noErr) { - return NULL; + return nullptr; } // instantiate the movie @@ -207,7 +207,7 @@ std::unique_ptr QTImportPlugin::Open(const wxString & Filename dataRefType); DisposeHandle(dataRef); if (err != noErr) { - return NULL; + return nullptr; } return std::make_unique(Filename, theMovie);