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

« back to all changes in this revision

Viewing changes to apt-pkg/contrib/hashes.h

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2014-04-01 17:48:58 UTC
  • mfrom: (1.4.87 sid)
  • Revision ID: package-import@ubuntu.com-20140401174858-4mv29mm29zu22fn1
Tags: 1.0.1ubuntu1
merge with the debian/sid 1.0.1 version
(LP: #1302033)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#include <apt-pkg/md5.h>
18
18
#include <apt-pkg/sha1.h>
19
19
#include <apt-pkg/sha2.h>
20
 
#include <apt-pkg/fileutl.h>
21
20
 
22
 
#include <algorithm>
23
 
#include <vector>
24
21
#include <cstring>
25
 
 
 
22
#include <string>
26
23
 
27
24
#ifndef APT_8_CLEANER_HEADERS
28
25
using std::min;
29
26
using std::vector;
30
27
#endif
 
28
#ifndef APT_10_CLEANER_HEADERS
 
29
#include <apt-pkg/fileutl.h>
 
30
#include <algorithm>
 
31
#include <vector>
 
32
#endif
 
33
 
 
34
 
 
35
class FileFd;
31
36
 
32
37
// helper class that contains hash function name
33
38
// and hash
61
66
   bool empty() const;
62
67
 
63
68
   // return the list of hashes we support
64
 
   static const char** SupportedHashes();
 
69
   static APT_CONST const char** SupportedHashes();
65
70
};
66
71
 
67
72
class Hashes
77
82
   {
78
83
      return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,Size) && SHA512.Add(Data,Size);
79
84
   };
80
 
   inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));};
 
85
   inline bool Add(const char *Data) {return Add((unsigned char const *)Data,strlen(Data));};
81
86
   inline bool AddFD(int const Fd,unsigned long long Size = 0)
82
87
   { return AddFD(Fd, Size, true, true, true, true); };
83
88
   bool AddFD(int const Fd, unsigned long long Size, bool const addMD5,