// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcachegen.cc,v 1.47 2001/03/04 00:12:41 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.50 2001/07/01 22:28:24 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
#include <apt-pkg/pkgsystem.h>
#include <apti18n.h>
-
+
+#include <vector>
+
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <system.h>
/*}}}*/
+typedef vector<pkgIndexFile *>::iterator FileIterator;
// CacheGenerator::pkgCacheGenerator - Constructor /*{{{*/
// ---------------------------------------------------------------------
int Res = 1;
for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
{
- Res = Cache.VS->DoCmpVersion(Version.begin(),Version.end(),Ver.VerStr(),
- Ver.VerStr() + strlen(Ver.VerStr()));
+ Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
if (Res >= 0)
break;
}
{
for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
{
- Res = Cache.VS->DoCmpVersion(Version.begin(),Version.end(),Ver.VerStr(),
- Ver.VerStr() + strlen(Ver.VerStr()));
+ Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
if (Res != 0)
break;
}
}
}
+ if (Cache.HeaderP->PackageCount >= (1ULL<<sizeof(Cache.PkgP->ID)*8)-1)
+ return _error->Error(_("Wow, you exceeded the number of package "
+ "names this APT is capable of."));
+ if (Cache.HeaderP->VersionCount >= (1ULL<<(sizeof(Cache.VerP->ID)*8))-1)
+ return _error->Error(_("Wow, you exceeded the number of versions "
+ "this APT is capable of."));
+ if (Cache.HeaderP->DependsCount >= (1ULL<<(sizeof(Cache.DepP->ID)*8))-1ULL)
+ return _error->Error(_("Wow, you exceeded the number of dependencies "
+ "this APT is capable of."));
return true;
}
/*}}}*/
/* This just verifies that each file in the list of index files exists,
has matching attributes with the cache and the cache does not have
any extra files. */
-static bool CheckValidity(string CacheFile,pkgIndexFile **Start,
- pkgIndexFile **End,MMap **OutMap = 0)
+static bool CheckValidity(string CacheFile, FileIterator Start,
+ FileIterator End,MMap **OutMap = 0)
{
// No file, certainly invalid
if (CacheFile.empty() == true || FileExists(CacheFile) == false)
// ---------------------------------------------------------------------
/* Size is kind of an abstract notion that is only used for the progress
meter */
-static unsigned long ComputeSize(pkgIndexFile **Start,pkgIndexFile **End)
+static unsigned long ComputeSize(FileIterator Start,FileIterator End)
{
unsigned long TotalSize = 0;
for (; Start != End; Start++)
static bool BuildCache(pkgCacheGenerator &Gen,
OpProgress &Progress,
unsigned long &CurrentSize,unsigned long TotalSize,
- pkgIndexFile **Start,pkgIndexFile **End)
+ FileIterator Start, FileIterator End)
{
for (; Start != End; Start++)
{