summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/hashsum.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-07-13 23:10:38 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-07-13 23:10:38 +0200
commit1dab797ca6dc0357474675a0f132c962dee4a2c2 (patch)
treef2b6a5fbef520da33a48b9f769511e0c85082c04 /apt-pkg/contrib/hashsum.cc
parent96c9fb174df24fadcde516f26f89d1a64f42eea7 (diff)
enable Hashes::AddFD() to skip creation of certain hashes
Diffstat (limited to 'apt-pkg/contrib/hashsum.cc')
-rw-r--r--apt-pkg/contrib/hashsum.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/apt-pkg/contrib/hashsum.cc b/apt-pkg/contrib/hashsum.cc
index b97eaf831..728747d7a 100644
--- a/apt-pkg/contrib/hashsum.cc
+++ b/apt-pkg/contrib/hashsum.cc
@@ -10,11 +10,10 @@ bool SummationImplementation::AddFD(int const Fd, unsigned long Size) {
unsigned char Buf[64 * 64];
int Res = 0;
int ToEOF = (Size == 0);
- unsigned long n = sizeof(Buf);
- if (!ToEOF)
- n = std::min(Size, n);
while (Size != 0 || ToEOF)
{
+ unsigned n = sizeof(Buf);
+ if (!ToEOF) n = min(Size,(unsigned long)n);
Res = read(Fd, Buf, n);
if (Res < 0 || (!ToEOF && (unsigned) Res != n)) // error, or short read
return false;