~ubuntu-branches/ubuntu/trusty/apt/trusty

« back to all changes in this revision

Viewing changes to apt-pkg/contrib/hashsum.cc

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2014-02-07 21:03:22 UTC
  • mfrom: (1.4.80 sid)
  • Revision ID: package-import@ubuntu.com-20140207210322-s7f833aga98ibdkm
Tags: 0.9.15.1ubuntu1
mergedĀ fromĀ debian/sid

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
/* */
10
10
bool SummationImplementation::AddFD(int const Fd, unsigned long long Size) {
11
11
   unsigned char Buf[64 * 64];
12
 
   ssize_t Res = 0;
13
 
   int ToEOF = (Size == 0);
 
12
   bool const ToEOF = (Size == 0);
14
13
   while (Size != 0 || ToEOF)
15
14
   {
16
15
      unsigned long long n = sizeof(Buf);
17
16
      if (!ToEOF) n = std::min(Size, n);
18
 
      Res = read(Fd, Buf, n);
 
17
      ssize_t const Res = read(Fd, Buf, n);
19
18
      if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
20
19
         return false;
21
20
      if (ToEOF && Res == 0) // EOF
27
26
}
28
27
bool SummationImplementation::AddFD(FileFd &Fd, unsigned long long Size) {
29
28
   unsigned char Buf[64 * 64];
30
 
   bool ToEOF = (Size == 0);
 
29
   bool const ToEOF = (Size == 0);
31
30
   while (Size != 0 || ToEOF)
32
31
   {
33
32
      unsigned long long n = sizeof(Buf);