summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/hashsum.cc
diff options
context:
space:
mode:
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;