summaryrefslogtreecommitdiff
path: root/ftparchive
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:32:52 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:32:52 +0100
commit71ecaad29d8066a494f516efc5efd80860653fe2 (patch)
treeb0769df88e2b6496f23e3d899aeb1c240a3488d9 /ftparchive
parenta865ed25fa54514224cf4d6f83dd9cf48b7ed02b (diff)
parent37adedc9d0b66eeae7efb88aebd08dfbc6e06f77 (diff)
merged from http://bzr.debian.org/bzr/apt/apt/debian-experimental2
Diffstat (limited to 'ftparchive')
-rw-r--r--ftparchive/apt-ftparchive.cc37
-rw-r--r--ftparchive/cachedb.cc19
-rw-r--r--ftparchive/cachedb.h36
-rw-r--r--ftparchive/contents.cc10
-rw-r--r--ftparchive/contents.h11
-rw-r--r--ftparchive/multicompress.cc26
-rw-r--r--ftparchive/multicompress.h13
-rw-r--r--ftparchive/override.cc28
-rw-r--r--ftparchive/writer.cc32
-rw-r--r--ftparchive/writer.h11
10 files changed, 117 insertions, 106 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..f0bfa2a6d 100644
--- a/ftparchive/cachedb.cc
+++ b/ftparchive/cachedb.cc
@@ -10,23 +10,26 @@
##################################################################### */
/*}}}*/
// 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>
#include <apt-pkg/sha2.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/fileutl.h>
#include <netinet/in.h> // htonl, etc
+
+#include <apti18n.h>
+#include "cachedb.h"
/*}}}*/
// CacheDB::ReadyDB - Ready the DB2 /*{{{*/
// ---------------------------------------------------------------------
/* This opens the DB2 file for caching package information */
-bool CacheDB::ReadyDB(string const &DB)
+bool CacheDB::ReadyDB(std::string const &DB)
{
int err;
@@ -46,7 +49,7 @@ bool CacheDB::ReadyDB(string const &DB)
DBLoaded = false;
Dbp = 0;
- DBFile = string();
+ DBFile = std::string();
if (DB.empty())
return true;
@@ -160,7 +163,7 @@ bool CacheDB::GetCurStat()
/*}}}*/
// CacheDB::GetFileInfo - Get all the info about the file /*{{{*/
// ---------------------------------------------------------------------
-bool CacheDB::GetFileInfo(string const &FileName, bool const &DoControl, bool const &DoContents,
+bool CacheDB::GetFileInfo(std::string const &FileName, bool const &DoControl, bool const &DoContents,
bool const &GenContentsOnly, bool const &DoMD5, bool const &DoSHA1,
bool const &DoSHA256, bool const &DoSHA512,
bool const &checkMtime)
@@ -296,9 +299,9 @@ bool CacheDB::LoadContents(bool const &GenOnly)
}
/*}}}*/
-static string bytes2hex(uint8_t *bytes, size_t length) {
+static std::string bytes2hex(uint8_t *bytes, size_t length) {
char buf[3];
- string space;
+ std::string space;
space.reserve(length*2 + 1);
for (size_t i = 0; i < length; i++) {
@@ -498,7 +501,7 @@ bool CacheDB::Clean()
stringcmp(Colon + 1, (char *)Key.data+Key.size,"cl") == 0 ||
stringcmp(Colon + 1, (char *)Key.data+Key.size,"cn") == 0)
{
- if (FileExists(string((const char *)Key.data,Colon)) == true)
+ if (FileExists(std::string((const char *)Key.data,Colon)) == true)
continue;
}
}
diff --git a/ftparchive/cachedb.h b/ftparchive/cachedb.h
index 15e796325..377c41607 100644
--- a/ftparchive/cachedb.h
+++ b/ftparchive/cachedb.h
@@ -13,16 +13,16 @@
#define CACHEDB_H
+#include <apt-pkg/debfile.h>
#include <db.h>
-#include <string>
-#include <apt-pkg/debfile.h>
#include <inttypes.h>
#include <sys/stat.h>
#include <errno.h>
-
+#include <string>
+
#include "contents.h"
-
+
class CacheDB
{
protected:
@@ -34,7 +34,7 @@ class CacheDB
DB *Dbp;
bool DBLoaded;
bool ReadOnly;
- string DBFile;
+ std::string DBFile;
// Generate a key for the DB of a given type
inline void InitQuery(const char *Type)
@@ -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];
@@ -90,7 +90,7 @@ class CacheDB
struct StatStore OldStat;
// 'set' state
- string FileName;
+ std::string FileName;
FileFd *Fd;
debDebFile *DebFile;
@@ -99,10 +99,10 @@ class CacheDB
// Data collection helpers
debDebFile::MemControlExtract Control;
ContentsExtract Contents;
- string MD5Res;
- string SHA1Res;
- string SHA256Res;
- string SHA512Res;
+ std::string MD5Res;
+ std::string SHA1Res;
+ std::string SHA256Res;
+ std::string SHA512Res;
// Runtime statistics
struct Stats
@@ -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;
@@ -129,21 +129,21 @@ class CacheDB
Stats() : Bytes(0), MD5Bytes(0), SHA1Bytes(0), SHA256Bytes(0), Packages(0), Misses(0), DeLinkBytes(0) {};
} Stats;
- bool ReadyDB(string const &DB);
+ bool ReadyDB(std::string const &DB);
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,
+ bool SetFile(std::string const &FileName,struct stat St,FileFd *Fd);
+ bool GetFileInfo(std::string const &FileName, bool const &DoControl, bool const &DoContents, bool const &GenContentsOnly,
bool const &DoMD5, bool const &DoSHA1, bool const &DoSHA256, bool const &DoSHA512, bool const &checkMtime = false);
bool Finish();
bool Clean();
- CacheDB(string const &DB) : Dbp(0), Fd(NULL), DebFile(0) {ReadyDB(DB);};
- ~CacheDB() {ReadyDB(string()); delete DebFile;};
+ CacheDB(std::string const &DB) : Dbp(0), Fd(NULL), DebFile(0) {ReadyDB(DB);};
+ ~CacheDB() {ReadyDB(std::string()); delete DebFile;};
};
#endif
diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc
index eadced626..bbc5a1e2b 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)
{
@@ -378,7 +380,7 @@ bool ContentsExtract::TakeContents(const void *NewData,unsigned long Length)
// ContentsExtract::Add - Read the contents data into the sorter /*{{{*/
// ---------------------------------------------------------------------
/* */
-void ContentsExtract::Add(GenContents &Contents,string const &Package)
+void ContentsExtract::Add(GenContents &Contents,std::string const &Package)
{
const char *Start = Data;
char *Pkg = Contents.Mystrdup(Package.c_str());
diff --git a/ftparchive/contents.h b/ftparchive/contents.h
index 5b5092b66..4af9db574 100644
--- a/ftparchive/contents.h
+++ b/ftparchive/contents.h
@@ -12,9 +12,10 @@
#include <stdlib.h>
#include <stdio.h>
-#include <apt-pkg/debfile.h>
#include <apt-pkg/dirstream.h>
+class debDebFile;
+
class GenContents
{
struct Node
@@ -71,16 +72,16 @@ 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);
- void Add(GenContents &Contents,string const &Package);
+ bool TakeContents(const void *Data,unsigned long long Length);
+ void Add(GenContents &Contents,std::string const &Package);
ContentsExtract() : Data(0), MaxSize(0), CurSize(0) {};
virtual ~ContentsExtract() {delete [] Data;};
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..5496b06d0 100644
--- a/ftparchive/multicompress.h
+++ b/ftparchive/multicompress.h
@@ -16,11 +16,10 @@
#ifndef MULTICOMPRESS_H
#define MULTICOMPRESS_H
-
-
-#include <string>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/aptconfiguration.h>
+
+#include <string>
#include <stdio.h>
#include <sys/types.h>
@@ -29,7 +28,7 @@ class MultiCompress
// An output file
struct Files
{
- string Output;
+ std::string Output;
APT::Configuration::Compressor CompressProg;
Files *Next;
FileFd TmpFile;
@@ -54,12 +53,12 @@ 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);
+ static bool GetStat(std::string const &Output,std::string const &Compress,struct stat &St);
- MultiCompress(string const &Output,string const &Compress,
+ MultiCompress(std::string const &Output,std::string const &Compress,
mode_t const &Permissions, bool const &Write = true);
~MultiCompress();
};
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..76a3dfd1e 100644
--- a/ftparchive/writer.h
+++ b/ftparchive/writer.h
@@ -22,7 +22,6 @@
#include <set>
#include "cachedb.h"
-#include "multicompress.h"
#include "override.h"
#include "apt-ftparchive.h"
@@ -31,7 +30,7 @@ using std::cout;
using std::endl;
using std::vector;
using std::map;
-
+
class FTWScanner
{
protected:
@@ -48,7 +47,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)
{
@@ -81,6 +80,8 @@ class FTWScanner
virtual ~FTWScanner() {};
};
+class MultiCompress;
+
class TranslationWriter
{
MultiCompress *Comp;
@@ -159,7 +160,7 @@ class SourcesWriter : public FTWScanner
Override BOver;
Override SOver;
char *Buffer;
- unsigned long BufSize;
+ unsigned long long BufSize;
public:
@@ -198,7 +199,7 @@ protected:
string SHA256;
string SHA512;
// Limited by FileFd::Size()
- unsigned long size;
+ unsigned long long size;
~CheckSum() {};
};
map<string,struct CheckSum> CheckSums;