From 47c37a1bfc2f2f372bf057bf68bde0b3b6f0ec8f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 13 Aug 2015 10:43:49 +0200 Subject: C++11: Switch from auto_ptr to unique_ptr This is nicer --- ftparchive/writer.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'ftparchive') diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 1bc926d21..7f09a3758 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -420,7 +420,7 @@ bool PackagesWriter::DoPackage(string FileName) Architecture = Arch; else Architecture = Tags.FindS("Architecture"); - auto_ptr OverItem(Over.GetItem(Package,Architecture)); + unique_ptr OverItem(Over.GetItem(Package,Architecture)); if (Package.empty() == true) return _error->Error(_("Archive had no package field")); @@ -434,7 +434,7 @@ bool PackagesWriter::DoPackage(string FileName) ioprintf(c1out, _(" %s has no override entry\n"), Package.c_str()); } - OverItem = auto_ptr(new Override::Item); + OverItem = unique_ptr(new Override::Item); OverItem->FieldOverride["Section"] = Tags.FindS("Section"); OverItem->Priority = Tags.FindS("Priority"); } @@ -660,7 +660,7 @@ bool SourcesWriter::DoPackage(string FileName) string BestPrio; string Bins = Tags.FindS("Binary"); char Buffer[Bins.length() + 1]; - auto_ptr OverItem(0); + unique_ptr OverItem(nullptr); if (Bins.empty() == false) { strcpy(Buffer,Bins.c_str()); @@ -673,7 +673,7 @@ bool SourcesWriter::DoPackage(string FileName) unsigned char BestPrioV = pkgCache::State::Extra; for (unsigned I = 0; BinList[I] != 0; I++) { - auto_ptr Itm(BOver.GetItem(BinList[I])); + unique_ptr Itm(BOver.GetItem(BinList[I])); if (Itm.get() == 0) continue; @@ -685,7 +685,7 @@ bool SourcesWriter::DoPackage(string FileName) } if (OverItem.get() == 0) - OverItem = Itm; + OverItem = std::move(Itm); } } @@ -698,23 +698,23 @@ bool SourcesWriter::DoPackage(string FileName) ioprintf(c1out, _(" %s has no override entry\n"), Tags.FindS("Source").c_str()); } - OverItem = auto_ptr(new Override::Item); + OverItem.reset(new Override::Item); } struct stat St; if (stat(FileName.c_str(), &St) != 0) return _error->Errno("fstat","Failed to stat %s",FileName.c_str()); - auto_ptr SOverItem(SOver.GetItem(Tags.FindS("Source"))); - // const auto_ptr autoSOverItem(SOverItem); + unique_ptr SOverItem(SOver.GetItem(Tags.FindS("Source"))); + // const unique_ptr autoSOverItem(SOverItem); if (SOverItem.get() == 0) { ioprintf(c1out, _(" %s has no source override entry\n"), Tags.FindS("Source").c_str()); - SOverItem = auto_ptr(BOver.GetItem(Tags.FindS("Source"))); + SOverItem = unique_ptr(BOver.GetItem(Tags.FindS("Source"))); if (SOverItem.get() == 0) { ioprintf(c1out, _(" %s has no binary override entry either\n"), Tags.FindS("Source").c_str()); - SOverItem = auto_ptr(new Override::Item); + SOverItem = unique_ptr(new Override::Item); *SOverItem = *OverItem; } } -- cgit v1.2.3