Clear unreachable code warnings with early MSVC compilers

This commit is contained in:
Jeffrey Walton 2019-10-03 06:41:46 -04:00
parent fd2cbd3952
commit 2b3349590f
7 changed files with 24 additions and 3 deletions

View File

@ -114,7 +114,7 @@ size_t DEREncodeOctetString(BufferedTransformation &bt, const byte *str, size_t
size_t DEREncodeOctetString(BufferedTransformation &bt, const SecByteBlock &str) size_t DEREncodeOctetString(BufferedTransformation &bt, const SecByteBlock &str)
{ {
return DEREncodeOctetString(bt, str.begin(), str.size()); return DEREncodeOctetString(bt, ConstBytePtr(str), BytePtrSize(str));
} }
size_t BERDecodeOctetString(BufferedTransformation &bt, SecByteBlock &str) size_t BERDecodeOctetString(BufferedTransformation &bt, SecByteBlock &str)
@ -161,7 +161,7 @@ size_t DEREncodeTextString(BufferedTransformation &bt, const byte* str, size_t s
size_t DEREncodeTextString(BufferedTransformation &bt, const SecByteBlock &str, byte asnTag) size_t DEREncodeTextString(BufferedTransformation &bt, const SecByteBlock &str, byte asnTag)
{ {
return DEREncodeTextString(bt, str, str.size(), asnTag); return DEREncodeTextString(bt, ConstBytePtr(str), BytePtrSize(str), asnTag);
} }
size_t DEREncodeTextString(BufferedTransformation &bt, const std::string &str, byte asnTag) size_t DEREncodeTextString(BufferedTransformation &bt, const std::string &str, byte asnTag)
@ -211,7 +211,7 @@ size_t DEREncodeDate(BufferedTransformation &bt, const SecByteBlock &str, byte a
{ {
bt.Put(asnTag); bt.Put(asnTag);
size_t lengthBytes = DERLengthEncode(bt, str.size()); size_t lengthBytes = DERLengthEncode(bt, str.size());
bt.Put(str, str.size()); bt.Put(ConstBytePtr(str), BytePtrSize(str));
return 1+lengthBytes+str.size(); return 1+lengthBytes+str.size();
} }

View File

@ -34,6 +34,10 @@
# pragma GCC diagnostic ignored "-Wunused-function" # pragma GCC diagnostic ignored "-Wunused-function"
#endif #endif
#if CRYPTOPP_MSC_VERSION
# pragma warning(disable: 4244)
#endif
// Squash MS LNK4221 and libtool warnings // Squash MS LNK4221 and libtool warnings
extern const char DONNA32_FNAME[] = __FILE__; extern const char DONNA32_FNAME[] = __FILE__;

View File

@ -34,6 +34,10 @@
# pragma GCC diagnostic ignored "-Wunused-function" # pragma GCC diagnostic ignored "-Wunused-function"
#endif #endif
#if CRYPTOPP_MSC_VERSION
# pragma warning(disable: 4244)
#endif
// Squash MS LNK4221 and libtool warnings // Squash MS LNK4221 and libtool warnings
extern const char DONNA64_FNAME[] = __FILE__; extern const char DONNA64_FNAME[] = __FILE__;

View File

@ -27,6 +27,10 @@
# pragma GCC diagnostic ignored "-Wunused-function" # pragma GCC diagnostic ignored "-Wunused-function"
#endif #endif
#if CRYPTOPP_MSC_VERSION
# pragma warning(disable: 4244)
#endif
// Squash MS LNK4221 and libtool warnings // Squash MS LNK4221 and libtool warnings
extern const char DONNA_SSE_FNAME[] = __FILE__; extern const char DONNA_SSE_FNAME[] = __FILE__;

View File

@ -17,6 +17,7 @@
#include "words.h" #include "words.h"
#include "stdcpp.h" #include "stdcpp.h"
#include "integer.h" #include "integer.h"
#include "secblock.h"
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)

View File

@ -24,6 +24,10 @@
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
#if CRYPTOPP_MSC_VERSION
# pragma warning(disable: 4702)
#endif
#if defined(CRYPTOPP_RDRAND_AVAILABLE) #if defined(CRYPTOPP_RDRAND_AVAILABLE)
# if defined(CRYPTOPP_MSC_VERSION) # if defined(CRYPTOPP_MSC_VERSION)
# define MASM_RDRAND_ASM_AVAILABLE 1 # define MASM_RDRAND_ASM_AVAILABLE 1

View File

@ -11,6 +11,10 @@
#include "misc.h" #include "misc.h"
#include "cpu.h" #include "cpu.h"
#if CRYPTOPP_MSC_VERSION
# pragma warning(disable: 4307)
#endif
ANONYMOUS_NAMESPACE_BEGIN ANONYMOUS_NAMESPACE_BEGIN
using CryptoPP::byte; using CryptoPP::byte;