diff options
Diffstat (limited to 'ftparchive')
-rw-r--r-- | ftparchive/apt-ftparchive.cc | 37 | ||||
-rw-r--r-- | ftparchive/cachedb.cc | 6 | ||||
-rw-r--r-- | ftparchive/cachedb.h | 6 | ||||
-rw-r--r-- | ftparchive/contents.cc | 8 | ||||
-rw-r--r-- | ftparchive/contents.h | 6 | ||||
-rw-r--r-- | ftparchive/multicompress.cc | 26 | ||||
-rw-r--r-- | ftparchive/multicompress.h | 2 | ||||
-rw-r--r-- | ftparchive/override.cc | 28 | ||||
-rw-r--r-- | ftparchive/writer.cc | 32 | ||||
-rw-r--r-- | ftparchive/writer.h | 6 |
10 files changed, 83 insertions, 74 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index 0762a2b28..f289eb00d 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -10,24 +10,25 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "apt-ftparchive.h" - +#include <config.h> + #include <apt-pkg/error.h> #include <apt-pkg/configuration.h> #include <apt-pkg/cmndline.h> #include <apt-pkg/strutl.h> #include <apt-pkg/init.h> -#include <config.h> -#include <apti18n.h> #include <algorithm> #include <climits> #include <sys/time.h> #include <regex.h> +#include "apt-ftparchive.h" #include "contents.h" #include "multicompress.h" -#include "writer.h" +#include "writer.h" + +#include <apti18n.h> /*}}}*/ using namespace std; @@ -205,7 +206,7 @@ bool PackageMap::GenPackages(Configuration &Setup,struct CacheDB::Stats &Stats) Packages.Output = 0; // Just in case // Finish compressing - unsigned long Size; + unsigned long long Size; if (Comp.Finalize(Size) == false) { c0out << endl; @@ -291,7 +292,7 @@ bool PackageMap::GenSources(Configuration &Setup,struct CacheDB::Stats &Stats) Sources.Output = 0; // Just in case // Finish compressing - unsigned long Size; + unsigned long long Size; if (Comp.Finalize(Size) == false) { c0out << endl; @@ -362,11 +363,11 @@ bool PackageMap::GenContents(Configuration &Setup, if (_error->PendingError() == true) return false; - unsigned long Size = Head.Size(); + unsigned long long Size = Head.Size(); unsigned char Buf[4096]; while (Size != 0) { - unsigned long ToRead = Size; + unsigned long long ToRead = Size; if (Size > sizeof(Buf)) ToRead = sizeof(Buf); @@ -384,7 +385,7 @@ bool PackageMap::GenContents(Configuration &Setup, files associated with this contents file into one great big honking memory structure, then dump the sorted version */ c0out << ' ' << this->Contents << ":" << flush; - for (vector<PackageMap>::iterator I = Begin; I != End; I++) + for (vector<PackageMap>::iterator I = Begin; I != End; ++I) { if (I->Contents != this->Contents) continue; @@ -400,7 +401,7 @@ bool PackageMap::GenContents(Configuration &Setup, Contents.Finish(); // Finish compressing - unsigned long Size; + unsigned long long Size; if (Comp.Finalize(Size) == false || _error->PendingError() == true) { c0out << endl; @@ -770,10 +771,10 @@ bool Generate(CommandLine &CmdL) // Generate packages if (CmdL.FileSize() <= 2) { - for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++) + for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I) if (I->GenPackages(Setup,Stats) == false) _error->DumpErrors(); - for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++) + for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I) if (I->GenSources(Setup,SrcStats) == false) _error->DumpErrors(); } @@ -782,7 +783,7 @@ bool Generate(CommandLine &CmdL) // Make a choice list out of the package list.. RxChoiceList *List = new RxChoiceList[2*PkgList.size()+1]; RxChoiceList *End = List; - for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++) + for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I) { End->UserData = &(*I); End->Str = I->BaseDir.c_str(); @@ -832,7 +833,7 @@ bool Generate(CommandLine &CmdL) } // close the Translation master files - for (vector<PackageMap>::reverse_iterator I = PkgList.rbegin(); I != PkgList.rend(); I++) + for (vector<PackageMap>::reverse_iterator I = PkgList.rbegin(); I != PkgList.rend(); ++I) if (I->TransWriter != NULL && I->TransWriter->DecreaseRefCounter() == 0) delete I->TransWriter; @@ -843,7 +844,7 @@ bool Generate(CommandLine &CmdL) // Sort the contents file list by date string ArchiveDir = Setup.FindDir("Dir::ArchiveDir"); - for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++) + for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I) { struct stat A; if (MultiCompress::GetStat(flCombine(ArchiveDir,I->Contents), @@ -860,7 +861,7 @@ bool Generate(CommandLine &CmdL) hashes of the .debs this means they have not changed either so the contents must be up to date. */ unsigned long MaxContentsChange = Setup.FindI("Default::MaxContentsChange",UINT_MAX)*1024; - for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++) + for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I) { // This record is not relevent if (I->ContentsDone == true || @@ -936,7 +937,7 @@ bool Clean(CommandLine &CmdL) _error->DumpErrors(); string CacheDB = I->BinCacheDB; - for (; I != PkgList.end() && I->BinCacheDB == CacheDB; I++); + for (; I != PkgList.end() && I->BinCacheDB == CacheDB; ++I); } return true; diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc index 24e3a1af8..6eccb8d4a 100644 --- a/ftparchive/cachedb.cc +++ b/ftparchive/cachedb.cc @@ -10,9 +10,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "cachedb.h" +#include <config.h> -#include <apti18n.h> #include <apt-pkg/error.h> #include <apt-pkg/md5.h> #include <apt-pkg/sha1.h> @@ -21,6 +20,9 @@ #include <apt-pkg/configuration.h> #include <netinet/in.h> // htonl, etc + +#include <apti18n.h> +#include "cachedb.h" /*}}}*/ // CacheDB::ReadyDB - Ready the DB2 /*{{{*/ diff --git a/ftparchive/cachedb.h b/ftparchive/cachedb.h index 15e796325..6bd5aa36c 100644 --- a/ftparchive/cachedb.h +++ b/ftparchive/cachedb.h @@ -81,7 +81,7 @@ class CacheDB { uint32_t Flags; uint32_t mtime; - uint32_t FileSize; + uint64_t FileSize; uint8_t MD5[16]; uint8_t SHA1[20]; uint8_t SHA256[32]; @@ -114,7 +114,7 @@ class CacheDB double SHA512Bytes; unsigned long Packages; unsigned long Misses; - unsigned long DeLinkBytes; + unsigned long long DeLinkBytes; inline void Add(const Stats &S) { Bytes += S.Bytes; @@ -133,7 +133,7 @@ class CacheDB inline bool DBFailed() {return Dbp != 0 && DBLoaded == false;}; inline bool Loaded() {return DBLoaded == true;}; - inline off_t GetFileSize(void) {return CurStat.FileSize;} + inline unsigned long long GetFileSize(void) {return CurStat.FileSize;} bool SetFile(string const &FileName,struct stat St,FileFd *Fd); bool GetFileInfo(string const &FileName, bool const &DoControl, bool const &DoContents, bool const &GenContentsOnly, diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc index eadced626..65d8dd1ce 100644 --- a/ftparchive/contents.cc +++ b/ftparchive/contents.cc @@ -33,9 +33,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "contents.h" +#include <config.h> -#include <apti18n.h> #include <apt-pkg/debfile.h> #include <apt-pkg/extracttar.h> #include <apt-pkg/error.h> @@ -43,6 +42,9 @@ #include <stdlib.h> #include <string.h> #include <malloc.h> + +#include <apti18n.h> +#include "contents.h" /*}}}*/ // GenContents::~GenContents - Free allocated memory /*{{{*/ @@ -347,7 +349,7 @@ bool ContentsExtract::DoItem(Item &Itm,int &Fd) // ContentsExtract::TakeContents - Load the contents data /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ContentsExtract::TakeContents(const void *NewData,unsigned long Length) +bool ContentsExtract::TakeContents(const void *NewData,unsigned long long Length) { if (Length == 0) { diff --git a/ftparchive/contents.h b/ftparchive/contents.h index 5b5092b66..f549ce17f 100644 --- a/ftparchive/contents.h +++ b/ftparchive/contents.h @@ -71,15 +71,15 @@ class ContentsExtract : public pkgDirStream // The Data Block char *Data; - unsigned long MaxSize; - unsigned long CurSize; + unsigned long long MaxSize; + unsigned long long CurSize; void AddData(const char *Text); bool Read(debDebFile &Deb); virtual bool DoItem(Item &Itm,int &Fd); void Reset() {CurSize = 0;}; - bool TakeContents(const void *Data,unsigned long Length); + bool TakeContents(const void *Data,unsigned long long Length); void Add(GenContents &Contents,string const &Package); ContentsExtract() : Data(0), MaxSize(0), CurSize(0) {}; diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc index f82879015..bf0f858d9 100644 --- a/ftparchive/multicompress.cc +++ b/ftparchive/multicompress.cc @@ -14,18 +14,20 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "multicompress.h" - -#include <apti18n.h> +#include <config.h> + #include <apt-pkg/strutl.h> #include <apt-pkg/error.h> #include <apt-pkg/md5.h> - + #include <sys/types.h> #include <sys/stat.h> #include <utime.h> #include <unistd.h> -#include <iostream> +#include <iostream> + +#include "multicompress.h" +#include <apti18n.h> /*}}}*/ using namespace std; @@ -48,11 +50,11 @@ MultiCompress::MultiCompress(string const &Output,string const &Compress, string::const_iterator I = Compress.begin(); for (; I != Compress.end();) { - for (; I != Compress.end() && isspace(*I); I++); + for (; I != Compress.end() && isspace(*I); ++I); // Grab a word string::const_iterator Start = I; - for (; I != Compress.end() && !isspace(*I); I++); + for (; I != Compress.end() && !isspace(*I); ++I); // Find the matching compressor std::vector<APT::Configuration::Compressor> Compressors = APT::Configuration::getCompressors(); @@ -129,11 +131,11 @@ bool MultiCompress::GetStat(string const &Output,string const &Compress,struct s bool DidStat = false; for (; I != Compress.end();) { - for (; I != Compress.end() && isspace(*I); I++); + for (; I != Compress.end() && isspace(*I); ++I); // Grab a word string::const_iterator Start = I; - for (; I != Compress.end() && !isspace(*I); I++); + for (; I != Compress.end() && !isspace(*I); ++I); // Find the matching compressor std::vector<APT::Configuration::Compressor> Compressors = APT::Configuration::getCompressors(); @@ -213,7 +215,7 @@ bool MultiCompress::Die() // MultiCompress::Finalize - Finish up writing /*{{{*/ // --------------------------------------------------------------------- /* This is only necessary for statistics reporting. */ -bool MultiCompress::Finalize(unsigned long &OutSize) +bool MultiCompress::Finalize(unsigned long long &OutSize) { OutSize = 0; if (Input == 0 || Die() == false) @@ -381,7 +383,7 @@ bool MultiCompress::Child(int const &FD) stash a hash of the data to use later. */ SetNonBlock(FD,false); unsigned char Buffer[32*1024]; - unsigned long FileSize = 0; + unsigned long long FileSize = 0; MD5Summation MD5; while (1) { @@ -443,7 +445,7 @@ bool MultiCompress::Child(int const &FD) // Compute the hash MD5Summation OldMD5; - unsigned long NewFileSize = 0; + unsigned long long NewFileSize = 0; while (1) { int Res = read(CompFd,Buffer,sizeof(Buffer)); diff --git a/ftparchive/multicompress.h b/ftparchive/multicompress.h index 19dede174..4839af47d 100644 --- a/ftparchive/multicompress.h +++ b/ftparchive/multicompress.h @@ -54,7 +54,7 @@ class MultiCompress FILE *Input; unsigned long UpdateMTime; - bool Finalize(unsigned long &OutSize); + bool Finalize(unsigned long long &OutSize); bool OpenOld(int &Fd,pid_t &Proc); bool CloseOld(int Fd,pid_t Proc); static bool GetStat(string const &Output,string const &Compress,struct stat &St); diff --git a/ftparchive/override.cc b/ftparchive/override.cc index 3cf10b89b..d363fd0fe 100644 --- a/ftparchive/override.cc +++ b/ftparchive/override.cc @@ -10,14 +10,14 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "override.h" - +#include <config.h> + #include <apti18n.h> #include <apt-pkg/strutl.h> #include <apt-pkg/error.h> #include <stdio.h> - + #include "override.h" /*}}}*/ @@ -34,7 +34,7 @@ bool Override::ReadOverride(string const &File,bool const &Source) return _error->Errno("fopen",_("Unable to open %s"),File.c_str()); char Line[500]; - unsigned long Counter = 0; + unsigned long long Counter = 0; while (fgets(Line,sizeof(Line),F) != 0) { Counter++; @@ -57,7 +57,7 @@ bool Override::ReadOverride(string const &File,bool const &Source) for (; isspace(*End) == 0 && *End != 0; End++); if (*End == 0) { - _error->Warning(_("Malformed override %s line %lu #1"),File.c_str(), + _error->Warning(_("Malformed override %s line %llu #1"),File.c_str(), Counter); continue; } @@ -71,7 +71,7 @@ bool Override::ReadOverride(string const &File,bool const &Source) for (; isspace(*End) == 0 && *End != 0; End++); if (*End == 0) { - _error->Warning(_("Malformed override %s line %lu #2"),File.c_str(), + _error->Warning(_("Malformed override %s line %llu #2"),File.c_str(), Counter); continue; } @@ -85,7 +85,7 @@ bool Override::ReadOverride(string const &File,bool const &Source) for (; isspace(*End) == 0 && *End != 0; End++); if (*End == 0) { - _error->Warning(_("Malformed override %s line %lu #3"),File.c_str(), + _error->Warning(_("Malformed override %s line %llu #3"),File.c_str(), Counter); continue; } @@ -142,7 +142,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source) return _error->Errno("fopen",_("Unable to open %s"),File.c_str()); char Line[500]; - unsigned long Counter = 0; + unsigned long long Counter = 0; while (fgets(Line,sizeof(Line),F) != 0) { Counter++; @@ -163,7 +163,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source) for (; isspace(*End) == 0 && *End != 0; End++); if (*End == 0) { - _error->Warning(_("Malformed override %s line %lu #1"),File.c_str(), + _error->Warning(_("Malformed override %s line %llu #1"),File.c_str(), Counter); continue; } @@ -175,7 +175,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source) for (; isspace(*End) == 0 && *End != 0; End++); if (*End == 0) { - _error->Warning(_("Malformed override %s line %lu #2"),File.c_str(), + _error->Warning(_("Malformed override %s line %llu #2"),File.c_str(), Counter); continue; } @@ -188,7 +188,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source) for (; isspace(*(End-1)) && End > Value; End--); if (End == Value) { - _error->Warning(_("Malformed override %s line %lu #3"),File.c_str(), + _error->Warning(_("Malformed override %s line %llu #3"),File.c_str(), Counter); continue; } @@ -231,7 +231,7 @@ Override::Item* Override::GetItem(string const &Package, string const &Architect if (R->OldMaint != "") result->OldMaint = R->OldMaint; if (R->NewMaint != "") result->NewMaint = R->NewMaint; for (map<string,string>::const_iterator foI = R->FieldOverride.begin(); - foI != R->FieldOverride.end(); foI++) + foI != R->FieldOverride.end(); ++foI) { result->FieldOverride[foI->first] = foI->second; } @@ -268,7 +268,7 @@ string Override::Item::SwapMaint(string const &Orig,bool &Failed) string::const_iterator Start = End; for (; End < OldMaint.end() && (End + 3 >= OldMaint.end() || End[0] != ' ' || - End[1] != '/' || End[2] != '/'); End++); + End[1] != '/' || End[2] != '/'); ++End); if (stringcasecmp(Start,End,Orig.begin(),Orig.end()) == 0) return NewMaint; @@ -276,7 +276,7 @@ string Override::Item::SwapMaint(string const &Orig,bool &Failed) break; // Skip the divider and white space - for (; End < OldMaint.end() && (*End == '/' || *End == ' '); End++); + for (; End < OldMaint.end() && (*End == '/' || *End == ' '); ++End); } #else if (stringcasecmp(OldMaint.begin(),OldMaint.end(),Orig.begin(),Orig.end()) == 0) diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 60db8b990..27e53faf8 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -11,9 +11,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "writer.h" - -#include <apti18n.h> +#include <config.h> + #include <apt-pkg/strutl.h> #include <apt-pkg/error.h> #include <apt-pkg/configuration.h> @@ -30,10 +29,13 @@ #include <iostream> #include <sstream> #include <memory> - + +#include "writer.h" #include "cachedb.h" #include "apt-ftparchive.h" #include "multicompress.h" + +#include <apti18n.h> /*}}}*/ using namespace std; FTWScanner *FTWScanner::Owner; @@ -246,8 +248,8 @@ bool FTWScanner::LoadFileList(string const &Dir, string const &File) // --------------------------------------------------------------------- /* */ bool FTWScanner::Delink(string &FileName,const char *OriginalPath, - unsigned long &DeLinkBytes, - off_t const &FileSize) + unsigned long long &DeLinkBytes, + unsigned long long const &FileSize) { // See if this isn't an internaly prefix'd file name. if (InternalPrefix.empty() == false && @@ -377,7 +379,7 @@ bool PackagesWriter::DoPackage(string FileName) return false; } - off_t FileSize = Db.GetFileSize(); + unsigned long long FileSize = Db.GetFileSize(); if (Delink(FileName,OriginalPath,Stats.DeLinkBytes,FileSize) == false) return false; @@ -413,7 +415,7 @@ bool PackagesWriter::DoPackage(string FileName) } char Size[40]; - sprintf(Size,"%lu", (unsigned long) FileSize); + sprintf(Size,"%llu", (unsigned long long) FileSize); // Strip the DirStrip prefix from the FileName and add the PathPrefix string NewFileName; @@ -494,7 +496,7 @@ bool PackagesWriter::DoPackage(string FileName) } for (map<string,string>::const_iterator I = OverItem->FieldOverride.begin(); - I != OverItem->FieldOverride.end(); I++) + I != OverItem->FieldOverride.end(); ++I) SetTFRewriteData(Changes[End++],I->first.c_str(),I->second.c_str()); SetTFRewriteData(Changes[End++], 0, 0); @@ -610,7 +612,7 @@ bool SourcesWriter::DoPackage(string FileName) if (St.st_size > 128*1024) return _error->Error("DSC file '%s' is too large!",FileName.c_str()); - if (BufSize < (unsigned)St.st_size+1) + if (BufSize < (unsigned long long)St.st_size+1) { BufSize = St.st_size+1; Buffer = (char *)realloc(Buffer,St.st_size+1); @@ -830,7 +832,7 @@ bool SourcesWriter::DoPackage(string FileName) SetTFRewriteData(Changes[End++], "Maintainer", NewMaint.c_str()); for (map<string,string>::const_iterator I = SOverItem->FieldOverride.begin(); - I != SOverItem->FieldOverride.end(); I++) + I != SOverItem->FieldOverride.end(); ++I) SetTFRewriteData(Changes[End++],I->first.c_str(),I->second.c_str()); SetTFRewriteData(Changes[End++], 0, 0); @@ -1065,7 +1067,7 @@ void ReleaseWriter::Finish() for(map<string,struct CheckSum>::const_iterator I = CheckSums.begin(); I != CheckSums.end(); ++I) { - fprintf(Output, " %s %16ld %s\n", + fprintf(Output, " %s %16llu %s\n", (*I).second.MD5.c_str(), (*I).second.size, (*I).first.c_str()); @@ -1077,7 +1079,7 @@ void ReleaseWriter::Finish() for(map<string,struct CheckSum>::const_iterator I = CheckSums.begin(); I != CheckSums.end(); ++I) { - fprintf(Output, " %s %16ld %s\n", + fprintf(Output, " %s %16llu %s\n", (*I).second.SHA1.c_str(), (*I).second.size, (*I).first.c_str()); @@ -1089,7 +1091,7 @@ void ReleaseWriter::Finish() for(map<string,struct CheckSum>::const_iterator I = CheckSums.begin(); I != CheckSums.end(); ++I) { - fprintf(Output, " %s %16ld %s\n", + fprintf(Output, " %s %16llu %s\n", (*I).second.SHA256.c_str(), (*I).second.size, (*I).first.c_str()); @@ -1101,7 +1103,7 @@ void ReleaseWriter::Finish() I != CheckSums.end(); ++I) { - fprintf(Output, " %s %32ld %s\n", + fprintf(Output, " %s %16llu %s\n", (*I).second.SHA512.c_str(), (*I).second.size, (*I).first.c_str()); diff --git a/ftparchive/writer.h b/ftparchive/writer.h index c6026e954..a43b83876 100644 --- a/ftparchive/writer.h +++ b/ftparchive/writer.h @@ -48,7 +48,7 @@ class FTWScanner static int ScannerFile(const char *File, bool const &ReadLink); bool Delink(string &FileName,const char *OriginalPath, - unsigned long &Bytes,off_t const &FileSize); + unsigned long long &Bytes,unsigned long long const &FileSize); inline void NewLine(unsigned const &Priority) { @@ -159,7 +159,7 @@ class SourcesWriter : public FTWScanner Override BOver; Override SOver; char *Buffer; - unsigned long BufSize; + unsigned long long BufSize; public: @@ -198,7 +198,7 @@ protected: string SHA256; string SHA512; // Limited by FileFd::Size() - unsigned long size; + unsigned long long size; ~CheckSum() {}; }; map<string,struct CheckSum> CheckSums; |