summaryrefslogtreecommitdiff
path: root/ftparchive
diff options
context:
space:
mode:
Diffstat (limited to 'ftparchive')
-rw-r--r--ftparchive/cachedb.cc13
-rw-r--r--ftparchive/cachedb.h30
-rw-r--r--ftparchive/contents.cc2
-rw-r--r--ftparchive/contents.h5
-rw-r--r--ftparchive/multicompress.h11
-rw-r--r--ftparchive/writer.h5
6 files changed, 34 insertions, 32 deletions
diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc
index 6eccb8d4a..f0bfa2a6d 100644
--- a/ftparchive/cachedb.cc
+++ b/ftparchive/cachedb.cc
@@ -18,6 +18,7 @@
#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
@@ -28,7 +29,7 @@
// 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;
@@ -48,7 +49,7 @@ bool CacheDB::ReadyDB(string const &DB)
DBLoaded = false;
Dbp = 0;
- DBFile = string();
+ DBFile = std::string();
if (DB.empty())
return true;
@@ -162,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)
@@ -298,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++) {
@@ -500,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 6bd5aa36c..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)
@@ -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
@@ -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 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 65d8dd1ce..bbc5a1e2b 100644
--- a/ftparchive/contents.cc
+++ b/ftparchive/contents.cc
@@ -380,7 +380,7 @@ bool ContentsExtract::TakeContents(const void *NewData,unsigned long 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 f549ce17f..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
@@ -80,7 +81,7 @@ class ContentsExtract : public pkgDirStream
virtual bool DoItem(Item &Itm,int &Fd);
void Reset() {CurSize = 0;};
bool TakeContents(const void *Data,unsigned long long Length);
- void Add(GenContents &Contents,string const &Package);
+ void Add(GenContents &Contents,std::string const &Package);
ContentsExtract() : Data(0), MaxSize(0), CurSize(0) {};
virtual ~ContentsExtract() {delete [] Data;};
diff --git a/ftparchive/multicompress.h b/ftparchive/multicompress.h
index 4839af47d..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;
@@ -57,9 +56,9 @@ class MultiCompress
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/writer.h b/ftparchive/writer.h
index a43b83876..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:
@@ -81,6 +80,8 @@ class FTWScanner
virtual ~FTWScanner() {};
};
+class MultiCompress;
+
class TranslationWriter
{
MultiCompress *Comp;