summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/hashes.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-09-19 13:31:29 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-09-19 13:31:29 +0200
commit8f3ba4e8708cb72be19dacc2af4f601ee5fea292 (patch)
treef624675aa3d4add287f253e19eb28c0dce5669f1 /apt-pkg/contrib/hashes.cc
parentc333ea435b67d7d7d7d10e867298ecac4da0f7b8 (diff)
do not pollute namespace in the headers with using (Closes: #500198)
Diffstat (limited to 'apt-pkg/contrib/hashes.cc')
-rw-r--r--apt-pkg/contrib/hashes.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index fd76bf229..05001f042 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/apt-pkg/contrib/hashes.cc
@@ -32,20 +32,20 @@ HashString::HashString()
{
}
-HashString::HashString(string Type, string Hash) : Type(Type), Hash(Hash)
+HashString::HashString(std::string Type, std::string Hash) : Type(Type), Hash(Hash)
{
}
-HashString::HashString(string StringedHash) /*{{{*/
+HashString::HashString(std::string StringedHash) /*{{{*/
{
// legacy: md5sum without "MD5Sum:" prefix
- if (StringedHash.find(":") == string::npos && StringedHash.size() == 32)
+ if (StringedHash.find(":") == std::string::npos && StringedHash.size() == 32)
{
Type = "MD5Sum";
Hash = StringedHash;
return;
}
- string::size_type pos = StringedHash.find(":");
+ std::string::size_type pos = StringedHash.find(":");
Type = StringedHash.substr(0,pos);
Hash = StringedHash.substr(pos+1, StringedHash.size() - pos);
@@ -53,34 +53,34 @@ HashString::HashString(string StringedHash) /*{{{*/
std::clog << "HashString(string): " << Type << " : " << Hash << std::endl;
}
/*}}}*/
-bool HashString::VerifyFile(string filename) const /*{{{*/
+bool HashString::VerifyFile(std::string filename) const /*{{{*/
{
- string fileHash;
+ std::string fileHash;
FileFd Fd(filename, FileFd::ReadOnly);
if(Type == "MD5Sum")
{
MD5Summation MD5;
MD5.AddFD(Fd.Fd(), Fd.Size());
- fileHash = (string)MD5.Result();
+ fileHash = (std::string)MD5.Result();
}
else if (Type == "SHA1")
{
SHA1Summation SHA1;
SHA1.AddFD(Fd.Fd(), Fd.Size());
- fileHash = (string)SHA1.Result();
+ fileHash = (std::string)SHA1.Result();
}
else if (Type == "SHA256")
{
SHA256Summation SHA256;
SHA256.AddFD(Fd.Fd(), Fd.Size());
- fileHash = (string)SHA256.Result();
+ fileHash = (std::string)SHA256.Result();
}
else if (Type == "SHA512")
{
SHA512Summation SHA512;
SHA512.AddFD(Fd.Fd(), Fd.Size());
- fileHash = (string)SHA512.Result();
+ fileHash = (std::string)SHA512.Result();
}
Fd.Close();
@@ -100,9 +100,9 @@ bool HashString::empty() const
return (Type.empty() || Hash.empty());
}
-string HashString::toStr() const
+std::string HashString::toStr() const
{
- return Type+string(":")+Hash;
+ return Type + std::string(":") + Hash;
}
// Hashes::AddFD - Add the contents of the FD /*{{{*/
@@ -117,7 +117,7 @@ bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5,
while (Size != 0 || ToEOF)
{
unsigned long long n = sizeof(Buf);
- if (!ToEOF) n = min(Size, n);
+ if (!ToEOF) n = std::min(Size, n);
Res = read(Fd,Buf,n);
if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
return false;