summaryrefslogtreecommitdiff
path: root/ftparchive
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-09-13 17:46:48 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-09-13 17:46:48 +0200
commit650faab01603caac04494d54cf6b10a65c00ea13 (patch)
treed89d9ec876c195d8f757e1351858ea7c200dd269 /ftparchive
parentea54214002c09eeb4dd498d97a564471ec9993c5 (diff)
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)
Diffstat (limited to 'ftparchive')
-rw-r--r--ftparchive/apt-ftparchive.cc10
-rw-r--r--ftparchive/cachedb.h6
-rw-r--r--ftparchive/contents.cc2
-rw-r--r--ftparchive/contents.h6
-rw-r--r--ftparchive/multicompress.cc6
-rw-r--r--ftparchive/multicompress.h2
-rw-r--r--ftparchive/override.cc16
-rw-r--r--ftparchive/writer.cc18
-rw-r--r--ftparchive/writer.h6
9 files changed, 36 insertions, 36 deletions
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<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());
@@ -1079,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());
@@ -1091,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());
@@ -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<string,struct CheckSum> CheckSums;