From ea54214002c09eeb4dd498d97a564471ec9993c5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 13 Sep 2011 10:09:00 +0200 Subject: reorder includes: add if needed and include it at first --- ftparchive/apt-ftparchive.cc | 11 ++++++----- ftparchive/cachedb.cc | 6 ++++-- ftparchive/contents.cc | 6 ++++-- ftparchive/multicompress.cc | 12 +++++++----- ftparchive/override.cc | 6 +++--- ftparchive/writer.cc | 10 ++++++---- 6 files changed, 30 insertions(+), 21 deletions(-) (limited to 'ftparchive') diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index 0762a2b28..6ad8ac572 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -10,24 +10,25 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "apt-ftparchive.h" - +#include + #include #include #include #include #include -#include -#include #include #include #include #include +#include "apt-ftparchive.h" #include "contents.h" #include "multicompress.h" -#include "writer.h" +#include "writer.h" + +#include /*}}}*/ using namespace std; diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc index 7e4c2e9fe..a1d70f912 100644 --- a/ftparchive/cachedb.cc +++ b/ftparchive/cachedb.cc @@ -10,9 +10,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "cachedb.h" +#include -#include #include #include #include @@ -21,6 +20,9 @@ #include #include // htonl, etc + +#include +#include "cachedb.h" /*}}}*/ // CacheDB::ReadyDB - Ready the DB2 /*{{{*/ diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc index eadced626..adb590ed1 100644 --- a/ftparchive/contents.cc +++ b/ftparchive/contents.cc @@ -33,9 +33,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "contents.h" +#include -#include #include #include #include @@ -43,6 +42,9 @@ #include #include #include + +#include +#include "contents.h" /*}}}*/ // GenContents::~GenContents - Free allocated memory /*{{{*/ diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc index f82879015..04560f4ab 100644 --- a/ftparchive/multicompress.cc +++ b/ftparchive/multicompress.cc @@ -14,18 +14,20 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "multicompress.h" - -#include +#include + #include #include #include - + #include #include #include #include -#include +#include + +#include "multicompress.h" +#include /*}}}*/ using namespace std; diff --git a/ftparchive/override.cc b/ftparchive/override.cc index 3cf10b89b..045a8b113 100644 --- a/ftparchive/override.cc +++ b/ftparchive/override.cc @@ -10,14 +10,14 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "override.h" - +#include + #include #include #include #include - + #include "override.h" /*}}}*/ diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 60db8b990..65269c6ae 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -11,9 +11,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "writer.h" - -#include +#include + #include #include #include @@ -30,10 +29,13 @@ #include #include #include - + +#include "writer.h" #include "cachedb.h" #include "apt-ftparchive.h" #include "multicompress.h" + +#include /*}}}*/ using namespace std; FTWScanner *FTWScanner::Owner; -- cgit v1.2.3 From 650faab01603caac04494d54cf6b10a65c00ea13 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 13 Sep 2011 17:46:48 +0200 Subject: Support large files in the complete toolset. Indexes of this size are pretty unlikely for now, but we need it for deb packages which could become bigger than 4GB now (LP: #815895) --- ftparchive/apt-ftparchive.cc | 10 +++++----- ftparchive/cachedb.h | 6 +++--- ftparchive/contents.cc | 2 +- ftparchive/contents.h | 6 +++--- ftparchive/multicompress.cc | 6 +++--- ftparchive/multicompress.h | 2 +- ftparchive/override.cc | 16 ++++++++-------- ftparchive/writer.cc | 18 +++++++++--------- ftparchive/writer.h | 6 +++--- 9 files changed, 36 insertions(+), 36 deletions(-) (limited to 'ftparchive') diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index 6ad8ac572..5721fe409 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -206,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; @@ -292,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; @@ -363,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); @@ -401,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; 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 adb590ed1..65d8dd1ce 100644 --- a/ftparchive/contents.cc +++ b/ftparchive/contents.cc @@ -349,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 04560f4ab..a80d6a34d 100644 --- a/ftparchive/multicompress.cc +++ b/ftparchive/multicompress.cc @@ -215,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) @@ -383,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) { @@ -445,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 045a8b113..a101fa6d1 100644 --- a/ftparchive/override.cc +++ b/ftparchive/override.cc @@ -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; } diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 65269c6ae..c4e700b59 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -248,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 && @@ -379,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; @@ -415,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; @@ -612,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); @@ -1067,7 +1067,7 @@ void ReleaseWriter::Finish() for(map::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()); @@ -1079,7 +1079,7 @@ void ReleaseWriter::Finish() for(map::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()); @@ -1091,7 +1091,7 @@ void ReleaseWriter::Finish() for(map::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()); @@ -1103,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 CheckSums; -- cgit v1.2.3