1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-24 00:18:07 +02:00

Remove seeming naked new and deletes in comments and uncompiled code

This commit is contained in:
Paul Licameli 2016-08-09 23:44:00 -04:00
parent 8572b425c1
commit 6e4e710d3b
5 changed files with 12 additions and 15 deletions

View File

@ -154,7 +154,7 @@ void LabelTrack::SetOffset(double dOffset)
bool LabelTrack::Clear(double b, double e) bool LabelTrack::Clear(double b, double e)
{ {
// May delete labels, so use subscripts to iterate // May DELETE labels, so use subscripts to iterate
for (size_t i = 0; i < mLabels.size(); ++i) { for (size_t i = 0; i < mLabels.size(); ++i) {
auto &labelStruct = mLabels[i]; auto &labelStruct = mLabels[i];
LabelStruct::TimeRelations relation = LabelStruct::TimeRelations relation =
@ -182,7 +182,7 @@ bool LabelTrack::Clear(double b, double e)
//used when we want to use clear only on the labels //used when we want to use clear only on the labels
bool LabelTrack::SplitDelete(double b, double e) bool LabelTrack::SplitDelete(double b, double e)
{ {
// May delete labels, so use subscripts to iterate // May DELETE labels, so use subscripts to iterate
for (size_t i = 0, len = mLabels.size(); i < len; ++i) { for (size_t i = 0, len = mLabels.size(); i < len; ++i) {
auto &labelStruct = mLabels[i]; auto &labelStruct = mLabels[i];
LabelStruct::TimeRelations relation = LabelStruct::TimeRelations relation =
@ -2292,23 +2292,18 @@ bool LabelTrack::Load(wxTextFile * in, DirManager * dirManager)
if (!(in->GetNextLine().ToULong(&len))) if (!(in->GetNextLine().ToULong(&len)))
return false; return false;
for (auto pLabel : mLabels)
delete pLabel;
mLabels.clear(); mLabels.clear();
mLabels.reserve(len); mLabels.reserve(len);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
LabelStruct *l = new LabelStruct();
double t0; double t0;
if (!Internat::CompatibleToDouble(in->GetNextLine(), &t0)) if (!Internat::CompatibleToDouble(in->GetNextLine(), &t0))
return false; return false;
l->selectedRegion.setT0(t0, false);
// Legacy file format does not include label end-times. // Legacy file format does not include label end-times.
l->selectedRegion.collapseToT0();
// PRL: nothing NEW to do, legacy file support // PRL: nothing NEW to do, legacy file support
l->title = in->GetNextLine(); mLabels.push_back(LabelStruct {
mLabels.Add(l); SelectedRegion{ t0, t0 }, in->GetNextLine()
});
} }
if (in->GetNextLine() != wxT("MLabelsEnd")) if (in->GetNextLine() != wxT("MLabelsEnd"))

View File

@ -568,7 +568,7 @@ public:
{ {
// Lose any old value // Lose any old value
reset(); reset();
// Create new value // Create NEW value
pp = safenew(address()) X(std::forward<Args>(args)...); pp = safenew(address()) X(std::forward<Args>(args)...);
} }

View File

@ -163,8 +163,10 @@ public:
// //this array is sorted by start/end points and has no overlaps. If we've passed all possible intersections, insert. The array will remain sorted. // //this array is sorted by start/end points and has no overlaps. If we've passed all possible intersections, insert. The array will remain sorted.
// if(region.end < invalStart) // if(region.end < invalStart)
// { // {
// InvalidRegion* newRegion = new InvalidRegion(invalStart,invalEnd); // mRegions.insert(
// mRegions.insert(mRegions.begin()+i,newRegion); // mRegions.begin() + i,
// InvalidRegion{ invalStart, invalEnd }
// );
// break; // break;
// } // }
} }

View File

@ -202,7 +202,7 @@ void WaveTrack::SetOffset(double o)
WaveTrack::WaveTrackDisplay WaveTrack::FindDefaultViewMode() WaveTrack::WaveTrackDisplay WaveTrack::FindDefaultViewMode()
{ {
// PRL: Bugs 1043, 1044 // PRL: Bugs 1043, 1044
// 2.1.1 writes a NEW key for this preference, which got new values, // 2.1.1 writes a NEW key for this preference, which got NEW values,
// to avoid confusing version 2.1.0 if it reads the preference file afterwards. // to avoid confusing version 2.1.0 if it reads the preference file afterwards.
// Prefer the NEW preference key if it is present // Prefer the NEW preference key if it is present

View File

@ -27,7 +27,7 @@ effect that uses SoundTouch to do its processing (ChangeTempo
bool EffectSoundTouch::ProcessLabelTrack(Track *track) bool EffectSoundTouch::ProcessLabelTrack(Track *track)
{ {
// SetTimeWarper(new RegionTimeWarper(mCurT0, mCurT1, // SetTimeWarper(std::make_unique<RegionTimeWarper>(mCurT0, mCurT1,
// std::make_unique<LinearTimeWarper>(mCurT0, mCurT0, // std::make_unique<LinearTimeWarper>(mCurT0, mCurT0,
// mCurT1, mCurT0 + (mCurT1-mCurT0)*mFactor))); // mCurT1, mCurT0 + (mCurT1-mCurT0)*mFactor)));
LabelTrack *lt = (LabelTrack*)track; LabelTrack *lt = (LabelTrack*)track;