From 8db0e7da6daa6e03287d8386cd19e82da7d7ddfb Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 29 Apr 2016 11:25:51 -0400 Subject: [PATCH] Cleared compile errors under Visual Studio .Net compilers --- filters.h | 2 +- hkdf.h | 4 +++- zinflate.cpp | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/filters.h b/filters.h index 5f835b18..8337bde4 100644 --- a/filters.h +++ b/filters.h @@ -1150,7 +1150,7 @@ public: //! \details Internally, Pump() calls Pump2(). //! \note pumpMax is a \p lword, which is a 64-bit value that typically uses \p LWORD_MAX. The default //! argument is a \p size_t that uses \p SIZE_MAX, and it can be 32-bits or 64-bits. - lword Pump(lword pumpMax=size_t(SIZE_MAX)) + lword Pump(lword pumpMax=(size_t)SIZE_MAX) {Pump2(pumpMax); return pumpMax;} //! \brief Pump messages to attached transformation diff --git a/hkdf.h b/hkdf.h index 40d71974..cd64fb39 100644 --- a/hkdf.h +++ b/hkdf.h @@ -29,6 +29,8 @@ template class HKDF : public KeyDerivationFunction { public: + CRYPTOPP_CONSTANT(DIGESTSIZE = T::DIGESTSIZE); + CRYPTOPP_CONSTANT(SALTSIZE = T::DIGESTSIZE); static const char* StaticAlgorithmName () { static const std::string name(std::string("HKDF(") + std::string(T::StaticAlgorithmName()) + std::string(")")); return name.c_str(); @@ -40,7 +42,7 @@ public: protected: // If salt is missing (NULL), then use the NULL vector. Missing is different than EMPTY (0 length). The length // of s_NullVector used depends on the Hash function. SHA-256 will use 32 bytes of s_NullVector. - typedef byte NullVectorType[T::DIGESTSIZE]; + typedef byte NullVectorType[SALTSIZE]; static const NullVectorType& GetNullVector() { static const NullVectorType s_NullVector = {0}; return s_NullVector; diff --git a/zinflate.cpp b/zinflate.cpp index 9ce7fbe9..86bc2ed7 100644 --- a/zinflate.cpp +++ b/zinflate.cpp @@ -114,7 +114,7 @@ void HuffmanDecoder::Initialize(const unsigned int *codeBits, unsigned int nCode } // MAX_CODE_BITS is 32, m_maxCodeBits may be smaller. - const unsigned long long shiftedMaxCode = (1ULL << m_maxCodeBits); + const word64 shiftedMaxCode = ((word64)1 << m_maxCodeBits); if (code > shiftedMaxCode - blCount[m_maxCodeBits]) throw Err("codes oversubscribed"); else if (m_maxCodeBits != 1 && code < shiftedMaxCode - blCount[m_maxCodeBits]) @@ -143,7 +143,7 @@ void HuffmanDecoder::Initialize(const unsigned int *codeBits, unsigned int nCode m_normalizedCacheMask = NormalizeCode(m_cacheMask, m_cacheBits); assert(m_normalizedCacheMask == BitReverse(m_cacheMask)); - const unsigned long long shiftedCache = (1ULL << m_cacheBits); + const word64 shiftedCache = ((word64)1 << m_cacheBits); assert(shiftedCache <= SIZE_MAX); if (m_cache.size() != shiftedCache) m_cache.resize((size_t)shiftedCache);