X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/a249b3e6fd798935a02b769149c9791a6fa6ef16..4adc750a2a8d0c6b2c03353b5538bc7446020f68:/apt-pkg/deb/debindexfile.cc diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 84dabc06b..6a23b2c00 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -121,12 +121,18 @@ std::string debTranslationsIndex::GetArchitecture() const pkgCacheListParser * debTranslationsIndex::CreateListParser(FileFd &Pkg) { if (Pkg.IsOpen() == false) - return NULL; + return nullptr; _error->PushToStack(); pkgCacheListParser * const Parser = new debTranslationsParser(&Pkg); bool const newError = _error->PendingError(); _error->MergeWithStack(); - return newError ? NULL : Parser; + if (newError) + { + delete Parser; + return nullptr; + } + else + return Parser; } /*}}}*/ // dpkg/status Index /*{{{*/ @@ -149,12 +155,18 @@ uint8_t debStatusIndex::GetIndexFlags() const pkgCacheListParser * debStatusIndex::CreateListParser(FileFd &Pkg) { if (Pkg.IsOpen() == false) - return NULL; + return nullptr; _error->PushToStack(); pkgCacheListParser * const Parser = new debStatusListParser(&Pkg); bool const newError = _error->PendingError(); _error->MergeWithStack(); - return newError ? NULL : Parser; + if (newError) + { + delete Parser; + return nullptr; + } + else + return Parser; } /*}}}*/ // DebPkgFile Index - a single .deb file as an index /*{{{*/ @@ -182,7 +194,7 @@ bool debDebPkgFileIndex::GetContent(std::ostream &content, std::string const &de return _error->Error("Popen failed"); content << "Filename: " << debfile << "\n"; - content << "Size: " << Buf.st_size << "\n"; + content << "Size: " << std::to_string(Buf.st_size) << "\n"; bool first_line_seen = false; char buffer[1024]; do { @@ -225,12 +237,18 @@ bool debDebPkgFileIndex::OpenListFile(FileFd &Pkg, std::string const &FileName) pkgCacheListParser * debDebPkgFileIndex::CreateListParser(FileFd &Pkg) { if (Pkg.IsOpen() == false) - return NULL; + return nullptr; _error->PushToStack(); pkgCacheListParser * const Parser = new debDebFileParser(&Pkg, DebFile); bool const newError = _error->PendingError(); _error->MergeWithStack(); - return newError ? NULL : Parser; + if (newError) + { + delete Parser; + return nullptr; + } + else + return Parser; } uint8_t debDebPkgFileIndex::GetIndexFlags() const {