From cf4ff3b78dc347188949370db914fe6329be6c99 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 01:54:10 +0100 Subject: warning: cast from type A to type B casts away qualifiers [-Wcast-qual] Git-Dch: Ignore Reported-By: gcc -Wcast-qual --- apt-pkg/contrib/hashsum_template.h | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (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 9bf160b2b..97b6a4ad9 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -28,18 +28,18 @@ template class HashSumValue { unsigned char Sum[N/8]; - + public: // Accessors bool operator ==(const HashSumValue &rhs) const { return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0; - }; + } bool operator !=(const HashSumValue &rhs) const { return memcmp(Sum,rhs.Sum,sizeof(Sum)) != 0; - }; + } std::string Value() const { @@ -49,7 +49,7 @@ class HashSumValue }; char Result[((N/8)*2)+1]; Result[(N/8)*2] = 0; - + // Convert each char into two letters int J = 0; int I = 0; @@ -59,31 +59,31 @@ class HashSumValue Result[I + 1] = Conv[Sum[J] & 0xF]; } return std::string(Result); - }; - + } + inline void Value(unsigned char S[N/8]) { - for (int I = 0; I != sizeof(Sum); I++) + for (int I = 0; I != sizeof(Sum); ++I) S[I] = Sum[I]; - }; + } - inline operator std::string() const + inline operator std::string() const { return Value(); - }; + } - bool Set(std::string Str) + bool Set(std::string Str) { return Hex2Num(Str,Sum,sizeof(Sum)); - }; + } - inline void Set(unsigned char S[N/8]) + inline void Set(unsigned char S[N/8]) { - for (int I = 0; I != sizeof(Sum); I++) + for (int I = 0; I != sizeof(Sum); ++I) Sum[I] = S[I]; - }; + } - HashSumValue(std::string Str) + HashSumValue(std::string Str) { memset(Sum,0,sizeof(Sum)); Set(Str); @@ -99,17 +99,17 @@ class SummationImplementation public: virtual bool Add(const unsigned char *inbuf, unsigned long long inlen) = 0; inline bool Add(const char *inbuf, unsigned long long const inlen) - { return Add((unsigned char *)inbuf, inlen); }; + { return Add((const unsigned char *)inbuf, inlen); } inline bool Add(const unsigned char *Data) - { return Add(Data, strlen((const 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)); }; + { 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); }; + { return Add(Beg, End - Beg); } inline bool Add(const char *Beg, const char *End) - { return Add((const unsigned char *)Beg, End - Beg); }; + { return Add((const unsigned char *)Beg, End - Beg); } bool AddFD(int Fd, unsigned long long Size = 0); bool AddFD(FileFd &Fd, unsigned long long Size = 0); -- cgit v1.2.3 From e788a834ce421042e727b72e43177edaa47e53a7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 02:18:11 +0100 Subject: warning: useless cast to type A [-Wuseless-cast] Git-Dch: Ignore Reported-By: gcc -Wuseless-cast --- 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 97b6a4ad9..f96188eb8 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -104,7 +104,7 @@ class SummationImplementation 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)); } + { return Add((const unsigned char *)Data, strlen(Data)); } inline bool Add(const unsigned char *Beg, const unsigned char *End) { return Add(Beg, End - Beg); } -- cgit v1.2.3 From 453b82a388013e522b3a1b9fcd6ed0810dab1f4f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Mar 2014 22:11:25 +0100 Subject: cleanup headers and especially #includes everywhere Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use) --- apt-pkg/contrib/hashsum_template.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (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 f96188eb8..869dc5cb7 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -10,20 +10,24 @@ #ifndef APTPKG_HASHSUM_TEMPLATE_H #define APTPKG_HASHSUM_TEMPLATE_H -#include #include #include -#include -#include #include +#ifndef APT_10_CLEANER_HEADERS +#include +#include +#include +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::min; #endif +class FileFd; + template class HashSumValue { -- cgit v1.2.3