From 6070a3461841d4398d731fcb33792d55779111f1 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 16 Apr 2011 01:10:09 +0200 Subject: fix a bunch of cppcheck warnings/errors based on a patch by Niels Thykier, thanks! (Closes: #622805) --- cmdline/apt-get.cc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'cmdline/apt-get.cc') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index e2d9bb7d4..38003e430 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2386,8 +2386,10 @@ bool DoSource(CommandLine &CmdL) string Src; pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,*Cache); - if (Last == 0) + if (Last == 0) { + delete[] Dsc; return _error->Error(_("Unable to find a source package for %s"),Src.c_str()); + } string srec = Last->AsStr(); string::size_type pos = srec.find("\nVcs-"); @@ -2418,8 +2420,10 @@ bool DoSource(CommandLine &CmdL) // Back track vector Lst; - if (Last->Files(Lst) == false) + if (Last->Files(Lst) == false) { + delete[] Dsc; return false; + } // Load them into the fetcher for (vector::const_iterator I = Lst.begin(); @@ -2480,6 +2484,7 @@ bool DoSource(CommandLine &CmdL) struct statvfs Buf; string OutputDir = "."; if (statvfs(OutputDir.c_str(),&Buf) != 0) { + delete[] Dsc; if (errno == EOVERFLOW) return _error->WarningE("statvfs",_("Couldn't determine free space in %s"), OutputDir.c_str()); @@ -2493,10 +2498,12 @@ bool DoSource(CommandLine &CmdL) #if HAVE_STRUCT_STATFS_F_TYPE || unsigned(Stat.f_type) != RAMFS_MAGIC #endif - ) + ) { + delete[] Dsc; return _error->Error(_("You don't have enough free space in %s"), OutputDir.c_str()); - } + } + } // Number of bytes if (DebBytes != FetchBytes) @@ -2531,7 +2538,10 @@ bool DoSource(CommandLine &CmdL) // Run it if (Fetcher.Run() == pkgAcquire::Failed) + { + delete[] Dsc; return false; + } // Print error messages bool Failed = false; @@ -2546,8 +2556,11 @@ bool DoSource(CommandLine &CmdL) Failed = true; } if (Failed == true) + { + delete[] Dsc; return _error->Error(_("Failed to fetch some archives.")); - + } + if (_config->FindB("APT::Get::Download-only",false) == true) { c1out << _("Download complete and in download only mode") << endl; -- cgit v1.2.3 From 182a6a557492ddbb4320b0c620e19071bd1014c3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 21 Apr 2011 17:00:37 +0200 Subject: * cmdline/apt-get.cc: - deprecate mostly undocumented 'markauto' in favor of 'apt-mark' * cmdline/apt-cache.cc: - deprecate mostly undocumented 'showauto' in favor of 'apt-mark' --- cmdline/apt-get.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cmdline/apt-get.cc') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 38003e430..845c92026 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2050,8 +2050,8 @@ bool DoInstall(CommandLine &CmdL) return InstallPackages(Cache,false); } - -/* mark packages as automatically/manually installed. */ + /*}}}*/ +/* mark packages as automatically/manually installed. {{{*/ bool DoMarkAuto(CommandLine &CmdL) { bool Action = true; @@ -2086,6 +2086,9 @@ bool DoMarkAuto(CommandLine &CmdL) AutoMarkChanged++; } } + + _error->Notice(_("This command is deprecated. Please use 'apt-mark auto' and 'apt-mark manual' instead.")); + if (AutoMarkChanged && ! _config->FindB("APT::Get::Simulate",false)) return Cache->writeStateFile(NULL); return false; @@ -3184,8 +3187,6 @@ bool ShowHelp(CommandLine &CmdL) " clean - Erase downloaded archive files\n" " autoclean - Erase old downloaded archive files\n" " check - Verify that there are no broken dependencies\n" - " markauto - Mark the given packages as automatically installed\n" - " unmarkauto - Mark the given packages as manually installed\n" " changelog - Download and display the changelog for the given package\n" " download - Download the binary package into the current directory\n" "\n" -- cgit v1.2.3