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