diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-09-13 17:46:48 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-09-13 17:46:48 +0200 |
commit | 650faab01603caac04494d54cf6b10a65c00ea13 (patch) | |
tree | d89d9ec876c195d8f757e1351858ea7c200dd269 /apt-pkg/contrib/hashes.cc | |
parent | ea54214002c09eeb4dd498d97a564471ec9993c5 (diff) |
Support large files in the complete toolset. Indexes of this
size are pretty unlikely for now, but we need it for deb
packages which could become bigger than 4GB now (LP: #815895)
Diffstat (limited to 'apt-pkg/contrib/hashes.cc')
-rw-r--r-- | apt-pkg/contrib/hashes.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc index 9c251e89f..fd76bf229 100644 --- a/apt-pkg/contrib/hashes.cc +++ b/apt-pkg/contrib/hashes.cc @@ -108,18 +108,18 @@ string HashString::toStr() const // Hashes::AddFD - Add the contents of the FD /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Hashes::AddFD(int const Fd,unsigned long Size, bool const addMD5, +bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5, bool const addSHA1, bool const addSHA256, bool const addSHA512) { unsigned char Buf[64*64]; - int Res = 0; + ssize_t Res = 0; int ToEOF = (Size == 0); while (Size != 0 || ToEOF) { - unsigned n = sizeof(Buf); - if (!ToEOF) n = min(Size,(unsigned long)n); + unsigned long long n = sizeof(Buf); + if (!ToEOF) n = min(Size, n); Res = read(Fd,Buf,n); - if (Res < 0 || (!ToEOF && (unsigned) Res != n)) // error, or short read + if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read return false; if (ToEOF && Res == 0) // EOF break; |