Support large files in the complete toolset. Indexes of this
[ntk/apt.git] / apt-pkg / contrib / hashes.cc
index 9c251e8..fd76bf2 100644 (file)
@@ -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;