From e4883accebc208e7bcad53b4efcf57a91b1f6a59 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 28 Mar 2020 03:28:44 +0800 Subject: [PATCH] Formatting style --- code/.clang-format | 2 +- code/nel/include/nel/misc/sha1.h | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/code/.clang-format b/code/.clang-format index 90f4ab553..e407c68c5 100644 --- a/code/.clang-format +++ b/code/.clang-format @@ -6,7 +6,7 @@ BraceWrapping: AfterControlStatement: true AfterEnum: true AfterFunction: true - AfterNamespace: true + AfterNamespace: false AfterObjCDeclaration: true AfterStruct: true AfterUnion: true diff --git a/code/nel/include/nel/misc/sha1.h b/code/nel/include/nel/misc/sha1.h index 92670921b..d458c6f8f 100644 --- a/code/nel/include/nel/misc/sha1.h +++ b/code/nel/include/nel/misc/sha1.h @@ -30,19 +30,19 @@ namespace NLMISC { struct CHashKey { - CHashKey () { HashKeyString.resize(20); } + CHashKey() { HashKeyString.resize(20); } - CHashKey (const unsigned char Message_Digest[20]) + CHashKey(const unsigned char Message_Digest[20]) { HashKeyString.clear(); - for(sint i = 0; i < 20 ; ++i) + for (sint i = 0; i < 20; ++i) { HashKeyString += Message_Digest[i]; } } // Init the hash key with a binary key format or a text key format - CHashKey (const std::string &str) + CHashKey(const std::string &str) { if (str.size() == 20) { @@ -69,7 +69,7 @@ struct CHashKey } else { - nlwarning ("SHA: Bad hash key format"); + nlwarning("SHA: Bad hash key format"); } } @@ -85,23 +85,28 @@ struct CHashKey } // serial the hash key in binary format - void serial (NLMISC::IStream &stream) + void serial(NLMISC::IStream &stream) { - stream.serial (HashKeyString); + stream.serial(HashKeyString); } - bool operator==(const CHashKey &v) const + bool operator==(const CHashKey &v) const { return HashKeyString == v.HashKeyString; } + bool operator!=(const CHashKey &v) const + { + return !(*this == v); + } + // this string is always 20 bytes long and is the code in binary format (can't print it directly) std::string HashKeyString; }; -inline bool operator <(const struct CHashKey &a,const struct CHashKey &b) +inline bool operator<(const struct CHashKey &a, const struct CHashKey &b) { - return a.HashKeyString