diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-06-12 12:22:45 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-06-18 12:41:11 +0200 |
commit | 4ad8619bb1f0bf777d17c568bb7a6cf7f30aac34 (patch) | |
tree | 67e95fc21a0d147bc823fe75e8b9e3b34013ebb3 /apt-pkg/pkgcachegen.h | |
parent | e8a7b0b28ca01cd8c2c1bee0d83e5997b40de689 (diff) |
cleanup datatypes mix used in binary cache
We had a wild mixture of (unsigned) int, long and long long here without
much sense, so this commit adds a few typedefs to get some sense in the
typesystem and ensures that a ID isn't sometimes computed as int, stored
as long and compared with a long long… as this could potentially bite us
later on as the size of the archive only increases over time.
Diffstat (limited to 'apt-pkg/pkgcachegen.h')
-rw-r--r-- | apt-pkg/pkgcachegen.h | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index d275c1e42..42da7b12d 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -38,10 +38,10 @@ class pkgCacheGenerator /*{{{*/ private: pkgCache::StringItem *UniqHash[26]; - APT_HIDDEN map_ptrloc WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); }; - APT_HIDDEN map_ptrloc WriteStringInMap(const char *String); - APT_HIDDEN map_ptrloc WriteStringInMap(const char *String, const unsigned long &Len); - APT_HIDDEN map_ptrloc AllocateInMap(const unsigned long &size); + APT_HIDDEN map_stringitem_t WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); }; + APT_HIDDEN map_stringitem_t WriteStringInMap(const char *String); + APT_HIDDEN map_stringitem_t WriteStringInMap(const char *String, const unsigned long &Len); + APT_HIDDEN map_pointer_t AllocateInMap(const unsigned long &size); public: @@ -78,21 +78,21 @@ class pkgCacheGenerator /*{{{*/ bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List); bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver, std::string const &Version, unsigned int const &Op, - unsigned int const &Type, map_ptrloc* &OldDepLast); + unsigned int const &Type, map_pointer_t* &OldDepLast); bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver, - map_ptrloc const Version, unsigned int const &Op, - unsigned int const &Type, map_ptrloc* &OldDepLast); - unsigned long NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr,unsigned long Next) APT_DEPRECATED + map_pointer_t const Version, unsigned int const &Op, + unsigned int const &Type, map_pointer_t* &OldDepLast); + map_pointer_t NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr,map_pointer_t const Next) APT_DEPRECATED { return NewVersion(Ver, VerStr, 0, 0, Next); } - unsigned long NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr, - map_ptrloc const ParentPkg, unsigned long const Hash, - unsigned long Next); - map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const std::string &Lang,const MD5SumValue &md5sum,map_ptrloc Next); + map_pointer_t NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr, + map_pointer_t const ParentPkg, unsigned short const Hash, + map_pointer_t const Next); + map_pointer_t NewDescription(pkgCache::DescIterator &Desc,const std::string &Lang,const MD5SumValue &md5sum,map_stringitem_t const idxmd5str); public: - unsigned long WriteUniqString(const char *S,unsigned int Size); - inline unsigned long WriteUniqString(const std::string &S) {return WriteUniqString(S.c_str(),S.length());}; + map_stringitem_t WriteUniqString(const char *S,unsigned int const Size); + inline map_stringitem_t WriteUniqString(const std::string &S) {return WriteUniqString(S.c_str(),S.length());}; void DropProgress() {Progress = 0;}; bool SelectFile(const std::string &File,const std::string &Site,pkgIndexFile const &Index, @@ -127,7 +127,7 @@ class pkgCacheGenerator /*{{{*/ APT_HIDDEN bool AddImplicitDepends(pkgCache::VerIterator &V, pkgCache::PkgIterator &D); APT_HIDDEN bool AddNewDescription(ListParser &List, pkgCache::VerIterator &Ver, - std::string const &lang, MD5SumValue const &CurMd5, map_ptrloc &md5idx); + std::string const &lang, MD5SumValue const &CurMd5, map_stringitem_t &md5idx); }; /*}}}*/ // This is the abstract package list parser class. /*{{{*/ @@ -138,17 +138,17 @@ class pkgCacheGenerator::ListParser // Some cache items pkgCache::VerIterator OldDepVer; - map_ptrloc *OldDepLast; + map_pointer_t *OldDepLast; // Flag file dependencies bool FoundFileDeps; protected: - inline unsigned long WriteUniqString(std::string S) {return Owner->WriteUniqString(S);}; - inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);}; - inline unsigned long WriteString(const std::string &S) {return Owner->WriteStringInMap(S);}; - inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->WriteStringInMap(S,Size);}; + inline map_stringitem_t WriteUniqString(std::string S) {return Owner->WriteUniqString(S);}; + inline map_stringitem_t WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);}; + inline map_stringitem_t WriteString(const std::string &S) {return Owner->WriteStringInMap(S);}; + inline map_stringitem_t WriteString(const char *S,unsigned int Size) {return Owner->WriteStringInMap(S,Size);}; bool NewDepends(pkgCache::VerIterator &Ver,const std::string &Package, const std::string &Arch, const std::string &Version,unsigned int Op, unsigned int Type); @@ -178,8 +178,8 @@ class pkgCacheGenerator::ListParser APT_PURE bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver); virtual bool UsePackage(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver) = 0; - virtual unsigned long Offset() = 0; - virtual unsigned long Size() = 0; + virtual map_filesize_t Offset() = 0; + virtual map_filesize_t Size() = 0; virtual bool Step() = 0; |