From cb9bff92107d168ff6dd0c12dc34bc7bacc8eb7d Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 23:33:05 +0200 Subject: remove "using namespace std" from cpp headers --- src/include/dkimbase.h | 16 +++++++--------- src/include/dkimsign.h | 36 ++++++++++++++++++------------------ src/include/dkimverify.h | 43 ++++++++++++++++++++++--------------------- 3 files changed, 47 insertions(+), 48 deletions(-) (limited to 'src/include') diff --git a/src/include/dkimbase.h b/src/include/dkimbase.h index ddded67..320deb9 100644 --- a/src/include/dkimbase.h +++ b/src/include/dkimbase.h @@ -22,17 +22,15 @@ #ifndef DKIMBASE_H #define DKIMBASE_H +#include +#include + #include #include #include #define BUFFER_ALLOC_INCREMENT 256 -#include -#include - -using namespace std; - class CDKIMBase { public: CDKIMBase(); @@ -49,12 +47,12 @@ public: static void RemoveSWSP(char *szBuffer); static void RemoveSWSP(char *pBuffer, int& nBufLength); - static void RemoveSWSP(string& sBuffer); + static void RemoveSWSP(std::string& sBuffer); static void CompressSWSP(char *pBuffer, int& nBufLength); - static void CompressSWSP(string& sBuffer); + static void CompressSWSP(std::string& sBuffer); - static string RelaxHeader(const string& sHeader); + static std::string RelaxHeader(const std::string& sHeader); virtual int ProcessHeaders(void); virtual int ProcessBody(char *szBuffer, int nBufLength, bool bEOF); @@ -70,7 +68,7 @@ protected: int m_LinePos; bool m_InHeaders; - list HeaderList; + std::list HeaderList; }; diff --git a/src/include/dkimsign.h b/src/include/dkimsign.h index 49259ba..ad3c9d7 100644 --- a/src/include/dkimsign.h +++ b/src/include/dkimsign.h @@ -44,18 +44,18 @@ public: void Hash(const char *szBuffer, int nBufLength, bool bHdr); protected: - bool SignThisTag(const string& sTag); - void GetHeaderParams(const string& sHdr); - void ProcessHeader(const string& sHdr); + bool SignThisTag(const std::string& sTag); + void GetHeaderParams(const std::string& sHdr); + void ProcessHeader(const std::string& sHdr); bool ParseFromAddress(void); void InitSig(void); - void AddTagToSig(const char *const Tag, const string& sValue, char cbrk, bool bFold); + void AddTagToSig(const char *const Tag, const std::string& sValue, char cbrk, bool bFold); void AddTagToSig(const char *const Tag, unsigned long nValue); void AddInterTagSpace(int nSizeOfNextTag); - void AddFoldedValueToSig(const string& sValue, char cbrk); + void AddFoldedValueToSig(const std::string& sValue, char cbrk); - bool IsRequiredHeader(const string& sTag); + bool IsRequiredHeader(const std::string& sTag); int ConstructSignature(char *szSignKey, int nSigAlg); int AssembleReturnedSig(char *szRSAPrivKey, char *szECCPrivKey); @@ -82,14 +82,14 @@ protected: int m_EmptyLineCount; - string hParam; - string sFrom; - string sSender; - string sSelector; - string eSelector; // Used for Ed25519 signatures - string sDomain; - string sIdentity; // for i= tag, if empty tag will not be included in sig - string sRequiredHeaders; + std::string hParam; + std::string sFrom; + std::string sSender; + std::string sSelector; + std::string eSelector; // Used for Ed25519 signatures + std::string sDomain; + std::string sIdentity; // for i= tag, if empty tag will not be included in sig + std::string sRequiredHeaders; bool m_IncludeBodyLengthTag; int m_nBodyLength; @@ -101,15 +101,15 @@ protected: DKIMHEADERCALLBACK m_pfnHdrCallback; - string m_sSig; // DKIM-Signature .... + std::string m_sSig; // DKIM-Signature .... int m_nSigPos; - string m_sReturnedSig; + std::string m_sReturnedSig; bool m_bReturnedSigAssembled; - string m_sCopiedHeaders; + std::string m_sCopiedHeaders; - string SigHdrs; + std::string SigHdrs; int m_SigHdrs; }; diff --git a/src/include/dkimverify.h b/src/include/dkimverify.h index 8347957..e1d0a92 100644 --- a/src/include/dkimverify.h +++ b/src/include/dkimverify.h @@ -22,6 +22,7 @@ #ifndef DKIMVERIFY_H #define DKIMVERIFY_H +#include #include #include "dkim.h" @@ -39,18 +40,18 @@ #define DKIM_POLICY_INVALID -53 // internal error /* dito -#define DKIM_SIG_VERSION_PRE_02 0 -#define DKIM_SIG_VERSION_02_PLUS 1 +#define DKIM_SIG_VERSION_PRE_02 0 +#define DKIM_SIG_VERSION_02_PLUS 1 */ class SelectorInfo { public: - SelectorInfo(const string& sSelector, const string& sDomain); + SelectorInfo(const std::string& sSelector, const std::string& sDomain); ~SelectorInfo(); - string Domain; - string Selector; - string Granularity; + std::string Domain; + std::string Selector; + std::string Granularity; bool AllowSHA1; bool AllowSHA256; EVP_PKEY *PublicKey; /* the public key */ @@ -69,16 +70,16 @@ public: void Hash(const char *szBuffer, unsigned nBufLength, bool IsBody = false); - string Header; + std::string Header; unsigned Version; - string Domain; - string Selector; - string SignatureData; - string BodyHashData; - string IdentityLocalPart; - string IdentityDomain; - string CanonicalizedData; - vector SignedHeaders; + std::string Domain; + std::string Selector; + std::string SignatureData; + std::string BodyHashData; + std::string IdentityLocalPart; + std::string IdentityDomain; + std::string CanonicalizedData; + std::vector SignedHeaders; unsigned BodyLength; unsigned HeaderCanonicalization; unsigned BodyCanonicalization; @@ -129,14 +130,14 @@ public: } protected: - int ParseDKIMSignature(const string& sHeader, SignatureInfo& sig); + int ParseDKIMSignature(const std::string& sHeader, SignatureInfo& sig); - SelectorInfo& GetSelector(const string& sSelector, const string& sDomain); + SelectorInfo& GetSelector(const std::string& sSelector, const std::string& sDomain); // int GetADSP(const std::string& sDomain, int& iADSP); - list Signatures; - list Selectors; + std::list Signatures; + std::list Selectors; DKIMDNSCALLBACK m_pfnSelectorCallback; // selector record callback // DKIMDNSCALLBACK m_pfnPracticesCallback; // ADSP record callback @@ -147,8 +148,8 @@ protected: bool m_SaveCanonicalizedData; bool m_AllowUnsignedFromHeaders; - vector Details; - string Practices; + std::vector Details; + std::string Practices; }; #endif //DKIMVERIFY_H -- cgit v1.2.3