X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/b2e465d6d32d2dc884f58b94acb7e35f671a87fe..4b30c1dc053278a6b9bdb50f0d91b3f934e8613d:/apt-inst/filelist.cc diff --git a/apt-inst/filelist.cc b/apt-inst/filelist.cc index 211fc935e..4dbc4a2d7 100644 --- a/apt-inst/filelist.cc +++ b/apt-inst/filelist.cc @@ -1,18 +1,18 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: filelist.cc,v 1.2 2001/02/20 07:03:16 jgg Exp $ +// $Id: filelist.cc,v 1.4.2.1 2004/01/16 18:58:50 mdz Exp $ /* ###################################################################### File Listing - Manages a Cache of File -> Package names. - Diversions add some signficant complexity to the system. To keep + Diversions add some significant complexity to the system. To keep storage space down in the very special case of a diverted file no extra bytes are allocated in the Node structure. Instead a diversion is inserted directly into the hash table and its flag bit set. Every lookup for that filename will always return the diversion. The hash buckets are stored in sorted form, with diversions having - the higest sort order. Identical files are assigned the same file + the highest sort order. Identical files are assigned the same file pointer, thus after a search all of the nodes owning that file can be found by iterating down the bucket. @@ -32,21 +32,20 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#ifdef __GNUG__ -#pragma implementation "apt-pkg/filelist.h" -#endif +#include #include #include #include #include -#include -#include #include #include +#include /*}}}*/ +using namespace std; + // FlCache::Header::Header - Constructor /*{{{*/ // --------------------------------------------------------------------- /* Initialize the header variables. These are the defaults used when @@ -86,7 +85,7 @@ pkgFLCache::Header::Header() // FLCache::Header::CheckSizes - Check if the two headers have same *sz /*{{{*/ // --------------------------------------------------------------------- /* Compare to make sure we are matching versions */ -bool pkgFLCache::Header::CheckSizes(Header &Against) const +APT_PURE bool pkgFLCache::Header::CheckSizes(Header &Against) const { if (HeaderSz == Against.HeaderSz && NodeSz == Against.NodeSz && @@ -354,7 +353,7 @@ pkgFLCache::NodeIterator pkgFLCache::GetNode(const char *Name, // --------------------------------------------------------------------- /* This is one of two hashing functions. The other is inlined into the GetNode routine. */ -pkgFLCache::Node *pkgFLCache::HashNode(NodeIterator const &Nde) +APT_PURE pkgFLCache::Node *pkgFLCache::HashNode(NodeIterator const &Nde) { // Hash the node unsigned long HashPos = 0; @@ -378,7 +377,7 @@ void pkgFLCache::DropNode(map_ptrloc N) NodeIterator Nde(*this,NodeP + N); if (Nde->NextPkg != 0) - _error->Warning("DropNode called on still linked node"); + _error->Warning(_("DropNode called on still linked node")); // Locate it in the hash table Node *Last = 0; @@ -410,7 +409,7 @@ void pkgFLCache::DropNode(map_ptrloc N) break; } - _error->Error("Failed to locate the hash element!"); + _error->Error(_("Failed to locate the hash element!")); } /*}}}*/ // FLCache::BeginDiverLoad - Start reading new diversions /*{{{*/ @@ -457,12 +456,12 @@ bool pkgFLCache::AddDiversion(PkgIterator const &Owner, NodeIterator FromN = GetNode(From,From+strlen(From),0,true,true); NodeIterator ToN = GetNode(To,To+strlen(To),0,true,true); if (FromN.end() == true || ToN.end() == true) - return _error->Error("Failed to allocate diversion"); + return _error->Error(_("Failed to allocate diversion")); // Should never happen if ((FromN->Flags & Node::Diversion) != Node::Diversion || (ToN->Flags & Node::Diversion) != Node::Diversion) - return _error->Error("Internal Error in AddDiversion"); + return _error->Error(_("Internal error in AddDiversion")); // Now, try to reclaim an existing diversion.. map_ptrloc Diver = 0; @@ -475,7 +474,7 @@ bool pkgFLCache::AddDiversion(PkgIterator const &Owner, { // It could be that the other diversion is no longer in use if ((DiverP[ToN->Pointer].Flags & Diversion::Touched) == Diversion::Touched) - return _error->Error("Trying to overwrite a diversion, %s -> %s and %s/%s", + return _error->Error(_("Trying to overwrite a diversion, %s -> %s and %s/%s"), From,To,ToN.File(),ToN.Dir().Name()); // We can erase it. @@ -504,7 +503,7 @@ bool pkgFLCache::AddDiversion(PkgIterator const &Owner, // Can only have one diversion of the same files Diversion *Div = DiverP + Diver; if ((Div->Flags & Diversion::Touched) == Diversion::Touched) - return _error->Error("Double add of diversion %s -> %s",From,To); + return _error->Error(_("Double add of diversion %s -> %s"),From,To); // Setup the From/To links if (Div->DivertFrom != FromN.Offset() && Div->DivertFrom != ToN.Offset()) @@ -547,7 +546,7 @@ bool pkgFLCache::AddConfFile(const char *Name,const char *NameEnd, continue; if ((Nde->Flags & Node::ConfFile) == Node::ConfFile) - return _error->Error("Duplicate conf file %s/%s",Nde.DirN(),Nde.File()); + return _error->Error(_("Duplicate conf file %s/%s"),Nde.DirN(),Nde.File()); // Allocate a new conf file structure map_ptrloc Conf = Map.Allocate(sizeof(ConfFile)); @@ -571,7 +570,7 @@ bool pkgFLCache::AddConfFile(const char *Name,const char *NameEnd, // --------------------------------------------------------------------- /* Since the package pointer is indirected in all sorts of interesting ways this is used to get a pointer to the owning package */ -pkgFLCache::Package *pkgFLCache::NodeIterator::RealPackage() const +APT_PURE pkgFLCache::Package *pkgFLCache::NodeIterator::RealPackage() const { if (Nde->Pointer == 0) return 0;