From c31c1dded85ee1e88231a041aac7e507f2ed426c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 13 Jul 2011 16:37:15 +0200 Subject: move implementation of checksums around by abstracting even more --- apt-pkg/contrib/hashsum_template.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'apt-pkg/contrib/hashsum_template.h') diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h index 7667baf92..2847f3308 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -84,4 +84,24 @@ class HashSumValue } }; +class SummationImplementation +{ + public: + virtual bool Add(const unsigned char *inbuf, unsigned long inlen) = 0; + inline bool Add(const char *inbuf, unsigned long const inlen) + { return Add((unsigned char *)inbuf, inlen); }; + + inline bool Add(const unsigned char *Data) + { return Add(Data, strlen((const char *)Data)); }; + inline bool Add(const char *Data) + { return Add((const unsigned char *)Data, strlen((const char *)Data)); }; + + inline bool Add(const unsigned char *Beg, const unsigned char *End) + { return Add(Beg, End - Beg); }; + inline bool Add(const char *Beg, const char *End) + { return Add((const unsigned char *)Beg, End - Beg); }; + + bool AddFD(int Fd, unsigned long Size); +}; + #endif -- cgit v1.2.3 From 1dab797ca6dc0357474675a0f132c962dee4a2c2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 13 Jul 2011 23:10:38 +0200 Subject: enable Hashes::AddFD() to skip creation of certain hashes --- apt-pkg/contrib/hashsum_template.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/contrib/hashsum_template.h') diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h index 2847f3308..85d94c2af 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -101,7 +101,7 @@ class SummationImplementation inline bool Add(const char *Beg, const char *End) { return Add((const unsigned char *)Beg, End - Beg); }; - bool AddFD(int Fd, unsigned long Size); + bool AddFD(int Fd, unsigned long Size = 0); }; #endif -- cgit v1.2.3