summaryrefslogtreecommitdiff
path: root/cmdline/apt-cache.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline/apt-cache.cc')
-rw-r--r--cmdline/apt-cache.cc55
1 files changed, 28 insertions, 27 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 0d7425c48..0f120a4b0 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -13,17 +13,22 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#include<config.h>
+#include <config.h>
#include <apt-pkg/algorithms.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/depcache.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/indexfile.h>
#include <apt-pkg/init.h>
+#include <apt-pkg/macros.h>
#include <apt-pkg/metaindex.h>
+#include <apt-pkg/mmap.h>
+#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/policy.h>
@@ -34,26 +39,15 @@
#include <apt-pkg/strutl.h>
#include <apt-pkg/tagfile.h>
#include <apt-pkg/version.h>
-#include <apt-pkg/cacheiterators.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/depcache.h>
-#include <apt-pkg/macros.h>
-#include <apt-pkg/mmap.h>
-#include <apt-pkg/pkgcache.h>
#include <apt-private/private-cacheset.h>
#include <apt-private/private-cmndline.h>
#include <apt-private/private-depends.h>
-#include <apt-private/private-show.h>
+#include <apt-private/private-main.h>
#include <apt-private/private-search.h>
+#include <apt-private/private-show.h>
#include <apt-private/private-unmet.h>
-#include <apt-private/private-main.h>
-#include <regex.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <algorithm>
#include <cstring>
#include <iomanip>
@@ -63,6 +57,11 @@
#include <set>
#include <string>
#include <vector>
+#include <regex.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <apti18n.h>
/*}}}*/
@@ -404,7 +403,7 @@ static bool DumpAvail(CommandLine &)
if (unlikely(Cache == NULL || CacheFile.BuildPolicy() == false))
return false;
- unsigned long Count = Cache->HeaderP->PackageCount+1;
+ auto const Count = Cache->HeaderP->PackageCount+1;
pkgCache::VerFile **VFList = new pkgCache::VerFile *[Count];
memset(VFList,0,sizeof(*VFList)*Count);
@@ -565,18 +564,19 @@ static bool XVcg(CommandLine &CmdL)
0 = None */
enum States {None=0, ToShow, ToShowNR, DoneNR, Done};
enum TheFlags {ForceNR=(1<<0)};
- unsigned char *Show = new unsigned char[Cache->Head().PackageCount];
- unsigned char *Flags = new unsigned char[Cache->Head().PackageCount];
- unsigned char *ShapeMap = new unsigned char[Cache->Head().PackageCount];
+ auto PackageCount = Cache->Head().PackageCount;
+ unsigned char *Show = new unsigned char[PackageCount];
+ unsigned char *Flags = new unsigned char[PackageCount];
+ unsigned char *ShapeMap = new unsigned char[PackageCount];
// Show everything if no arguments given
if (CmdL.FileList[1] == 0)
- for (unsigned long I = 0; I != Cache->Head().PackageCount; I++)
+ for (decltype(PackageCount) I = 0; I != PackageCount; ++I)
Show[I] = ToShow;
else
- for (unsigned long I = 0; I != Cache->Head().PackageCount; I++)
+ for (decltype(PackageCount) I = 0; I != PackageCount; ++I)
Show[I] = None;
- memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
+ memset(Flags,0,sizeof(*Flags)*PackageCount);
// Map the shapes
for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
@@ -777,18 +777,19 @@ static bool Dotty(CommandLine &CmdL)
0 = None */
enum States {None=0, ToShow, ToShowNR, DoneNR, Done};
enum TheFlags {ForceNR=(1<<0)};
- unsigned char *Show = new unsigned char[Cache->Head().PackageCount];
- unsigned char *Flags = new unsigned char[Cache->Head().PackageCount];
- unsigned char *ShapeMap = new unsigned char[Cache->Head().PackageCount];
+ auto PackageCount = Cache->Head().PackageCount;
+ unsigned char *Show = new unsigned char[PackageCount];
+ unsigned char *Flags = new unsigned char[PackageCount];
+ unsigned char *ShapeMap = new unsigned char[PackageCount];
// Show everything if no arguments given
if (CmdL.FileList[1] == 0)
- for (unsigned long I = 0; I != Cache->Head().PackageCount; I++)
+ for (decltype(PackageCount) I = 0; I != PackageCount; ++I)
Show[I] = ToShow;
else
- for (unsigned long I = 0; I != Cache->Head().PackageCount; I++)
+ for (decltype(PackageCount) I = 0; I != PackageCount; ++I)
Show[I] = None;
- memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
+ memset(Flags,0,sizeof(*Flags)*PackageCount);
// Map the shapes
for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)