diff options
author | Jeffrey Walton <noloader@gmail.com> | 2016-09-21 12:47:26 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2016-09-21 12:47:26 -0400 |
commit | 08a206f3eb2713a17eda636ebb96ed8142a4036d (patch) | |
tree | 044e409267a5e37ae196f02360dfd29af9e8e293 /seckey.h | |
parent | caf8aef8fe91229d9df370596519e8e80eba6eb7 (diff) | |
download | cryptopp-git-08a206f3eb2713a17eda636ebb96ed8142a4036d.tar.gz |
Rewrite 'keylength < MIN_KEYLENGTH' to avoid -Wtautological-compare
The warning surfaces under earlier Clnag's and GCC's
Diffstat (limited to 'seckey.h')
-rw-r--r-- | seckey.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -215,7 +215,8 @@ public: // TODO: Figure out how to make this CRYPTOPP_CONSTEXPR
static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t keylength)
{
- if (keylength < (size_t)MIN_KEYLENGTH)
+ // Rewrite 'keylength < MIN_KEYLENGTH' to avoid -Wtautological-compare
+ if ((int)keylength - MIN_KEYLENGTH < 0)
return MIN_KEYLENGTH;
else if (keylength > (size_t)MAX_KEYLENGTH)
return (size_t)MAX_KEYLENGTH;
|