1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-19 17:40:51 +02:00

auto_ptr (deprecated) -> unique_ptr (preferred in C++11)

This commit is contained in:
Paul Licameli 2016-02-05 20:27:09 -05:00
parent 9019df832f
commit daa7617e88
9 changed files with 16 additions and 16 deletions

View File

@ -213,7 +213,7 @@ private:
int mMouseX; int mMouseX;
int mMouseY; int mMouseY;
std::auto_ptr<SpectrumAnalyst> mAnalyst; std::unique_ptr<SpectrumAnalyst> mAnalyst;
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();

View File

@ -636,7 +636,7 @@ protected:
// and is ignored otherwise. // and is ignored otherwise.
double mFreqSelPin; double mFreqSelPin;
const WaveTrack *mFreqSelTrack; const WaveTrack *mFreqSelTrack;
std::auto_ptr<SpectrumAnalyst> mFrequencySnapper; std::unique_ptr<SpectrumAnalyst> mFrequencySnapper;
// For toggling of spectral seletion // For toggling of spectral seletion
double mLastF0; double mLastF0;

View File

@ -560,7 +560,7 @@ bool WaveClip::GetWaveDisplay(WaveDisplay &display, double t0,
return true; return true;
} }
std::auto_ptr<WaveCache> oldCache(mWaveCache); std::unique_ptr<WaveCache> oldCache(mWaveCache);
mWaveCache = 0; mWaveCache = 0;
int oldX0 = 0; int oldX0 = 0;
@ -599,7 +599,7 @@ bool WaveClip::GetWaveDisplay(WaveDisplay &display, double t0,
// with the current one, re-use as much of the cache as // with the current one, re-use as much of the cache as
// possible // possible
if (oldCache.get()) { if (oldCache) {
//TODO: only load inval regions if //TODO: only load inval regions if
//necessary. (usually is the case, so no rush.) //necessary. (usually is the case, so no rush.)
@ -1111,7 +1111,7 @@ bool WaveClip::GetSpectrogram(WaveTrackCache &waveTrackCache,
// a complete hit, because of the complications of time reassignment // a complete hit, because of the complications of time reassignment
match = false; match = false;
std::auto_ptr<SpecCache> oldCache(mSpecCache); std::unique_ptr<SpecCache> oldCache(mSpecCache);
mSpecCache = 0; mSpecCache = 0;
const double tstep = 1.0 / pixelsPerSecond; const double tstep = 1.0 / pixelsPerSecond;
@ -1149,7 +1149,7 @@ bool WaveClip::GetSpectrogram(WaveTrackCache &waveTrackCache,
// Optimization: if the old cache is good and overlaps // Optimization: if the old cache is good and overlaps
// with the current one, re-use as much of the cache as // with the current one, re-use as much of the cache as
// possible // possible
if (oldCache.get()) { if (oldCache) {
memcpy(&mSpecCache->freq[half * copyBegin], memcpy(&mSpecCache->freq[half * copyBegin],
&oldCache->freq[half * (copyBegin + oldX0)], &oldCache->freq[half * (copyBegin + oldX0)],
half * (copyEnd - copyBegin) * sizeof(float)); half * (copyEnd - copyBegin) * sizeof(float));
@ -1437,7 +1437,7 @@ bool WaveClip::Paste(double t0, const WaveClip* other)
const bool clipNeedsResampling = other->mRate != mRate; const bool clipNeedsResampling = other->mRate != mRate;
const bool clipNeedsNewFormat = const bool clipNeedsNewFormat =
other->mSequence->GetSampleFormat() != mSequence->GetSampleFormat(); other->mSequence->GetSampleFormat() != mSequence->GetSampleFormat();
std::auto_ptr<WaveClip> newClip; std::unique_ptr<WaveClip> newClip;
const WaveClip* pastedClip; const WaveClip* pastedClip;
if (clipNeedsResampling || clipNeedsNewFormat) if (clipNeedsResampling || clipNeedsNewFormat)

View File

@ -65,7 +65,7 @@ bool Generator::Process()
{ {
AudacityProject *p = GetActiveProject(); AudacityProject *p = GetActiveProject();
// Create a temporary track // Create a temporary track
std::auto_ptr<WaveTrack> tmp( std::unique_ptr<WaveTrack> tmp(
mFactory->NewWaveTrack(track->GetSampleFormat(), mFactory->NewWaveTrack(track->GetSampleFormat(),
track->GetRate()) track->GetRate())
); );

View File

@ -456,7 +456,7 @@ bool EffectNoiseReduction::PromptUser(wxWindow *parent)
// from an automation dialog, the only case in which we can // from an automation dialog, the only case in which we can
// get here without any wavetracks. // get here without any wavetracks.
return mSettings->PromptUser(this, parent, return mSettings->PromptUser(this, parent,
(mStatistics.get() != 0), (GetNumWaveTracks() == 0)); bool(mStatistics), (GetNumWaveTracks() == 0));
} }
bool EffectNoiseReduction::Settings::PromptUser bool EffectNoiseReduction::Settings::PromptUser
@ -1291,7 +1291,7 @@ bool EffectNoiseReduction::Worker::ProcessOne
StartNewTrack(); StartNewTrack();
std::auto_ptr<WaveTrack> outputTrack( std::unique_ptr<WaveTrack> outputTrack(
mDoProfile ? NULL mDoProfile ? NULL
: factory.NewWaveTrack(track->GetSampleFormat(), track->GetRate())); : factory.NewWaveTrack(track->GetSampleFormat(), track->GetRate()));

View File

@ -54,8 +54,8 @@ private:
class Worker; class Worker;
friend class Dialog; friend class Dialog;
std::auto_ptr<Settings> mSettings; std::unique_ptr<Settings> mSettings;
std::auto_ptr<Statistics> mStatistics; std::unique_ptr<Statistics> mStatistics;
}; };
#endif #endif

View File

@ -700,7 +700,7 @@ AButton * ToolBar::MakeButton(teBmps eUp,
int xoff = (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2; int xoff = (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2;
int yoff = (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2; int yoff = (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2;
typedef std::auto_ptr<wxImage> wxImagePtr; typedef std::unique_ptr<wxImage> wxImagePtr;
wxImagePtr up2 (OverlayImage(eUp, eStandardUp, xoff, yoff)); wxImagePtr up2 (OverlayImage(eUp, eStandardUp, xoff, yoff));
wxImagePtr hilite2 (OverlayImage(eHilite, eStandardUp, xoff, yoff)); wxImagePtr hilite2 (OverlayImage(eHilite, eStandardUp, xoff, yoff));
wxImagePtr down2 (OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1)); wxImagePtr down2 (OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1));
@ -726,7 +726,7 @@ void ToolBar::MakeAlternateImages(AButton &button, int idx,
int xoff = (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2; int xoff = (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2;
int yoff = (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2; int yoff = (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2;
typedef std::auto_ptr<wxImage> wxImagePtr; typedef std::unique_ptr<wxImage> wxImagePtr;
wxImagePtr up (OverlayImage(eUp, eStandardUp, xoff, yoff)); wxImagePtr up (OverlayImage(eUp, eStandardUp, xoff, yoff));
wxImagePtr hilite (OverlayImage(eHilite, eStandardUp, xoff, yoff)); wxImagePtr hilite (OverlayImage(eHilite, eStandardUp, xoff, yoff));
wxImagePtr down (OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1)); wxImagePtr down (OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1));

View File

@ -280,7 +280,7 @@ void AButton::SetAlternateIdx(unsigned idx)
void AButton::FollowModifierKeys() void AButton::FollowModifierKeys()
{ {
if(!mListener.get()) if(!mListener)
mListener.reset(new Listener(this)); mListener.reset(new Listener(this));
} }

View File

@ -164,7 +164,7 @@ class AButton: public wxWindow {
wxRect mFocusRect; wxRect mFocusRect;
bool mForceFocusRect; bool mForceFocusRect;
std::auto_ptr<Listener> mListener; std::unique_ptr<Listener> mListener;
public: public: