diff --git a/include/xlnt/utils/optional.hpp b/include/xlnt/utils/optional.hpp index 934a9aea..2201b68b 100644 --- a/include/xlnt/utils/optional.hpp +++ b/include/xlnt/utils/optional.hpp @@ -38,7 +38,8 @@ namespace xlnt { template class optional { -#if defined(_MSC_VER) && _MSC_VER <= 1900 // v14, visual studio 2015 +#if ((defined(_MSC_VER) && _MSC_VER <= 1900) || (defined(__GNUC__) && __GNUC__ < 5)) +// Disable enhanced type checking on Visual Studio <= 2015 and GCC <5 #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (false) #else #define XLNT_NOEXCEPT_VALUE_COMPAT(...) (__VA_ARGS__) diff --git a/source/detail/cryptography/sha1.c b/source/detail/cryptography/sha1.c index f5412dc8..00a67818 100644 --- a/source/detail/cryptography/sha1.c +++ b/source/detail/cryptography/sha1.c @@ -174,7 +174,8 @@ void sha1_hash(const uint8_t *message, size_t len, uint32_t hash[5]) { block[BLOCK_SIZE - 1] = (uint8_t)((len & 0x1FU) << 3); len >>= 5; - for (int i = 1; i < LENGTH_SIZE; i++, len >>= 8) + int i; + for (i = 1; i < LENGTH_SIZE; i++, len >>= 8) block[BLOCK_SIZE - 1 - i] = (uint8_t)(len & 0xFFU); sha1_compress(hash, block); } diff --git a/source/detail/cryptography/sha512.c b/source/detail/cryptography/sha512.c index 0d59e2c8..d5328684 100644 --- a/source/detail/cryptography/sha512.c +++ b/source/detail/cryptography/sha512.c @@ -261,7 +261,8 @@ void sha512_hash(const uint8_t *message, size_t len, uint64_t hash[8]) { block[BLOCK_SIZE - 1] = (uint8_t)((len & 0x1FU) << 3); len >>= 5; - for (int i = 1; i < LENGTH_SIZE; i++, len >>= 8) + int i; + for (i = 1; i < LENGTH_SIZE; i++, len >>= 8) block[BLOCK_SIZE - 1 - i] = (uint8_t)(len & 0xFFU); sha512_compress(hash, block); } diff --git a/source/detail/serialization/custom_value_traits.hpp b/source/detail/serialization/custom_value_traits.hpp index f013815c..ba477f29 100644 --- a/source/detail/serialization/custom_value_traits.hpp +++ b/source/detail/serialization/custom_value_traits.hpp @@ -199,8 +199,8 @@ pattern_fill_type from_string(const std::string &string) #pragma clang diagnostic pop auto toLower = [](std::string str) { - auto bg{ std::begin (str) }; - auto en{ std::end (str) }; + auto bg = std::begin (str); + auto en = std::end (str); std::transform(bg, en, bg, [](char c) { // static cast to avoid int -> char narrowing warning @@ -211,7 +211,7 @@ pattern_fill_type from_string(const std::string &string) }; auto patternLookup = [](const std::string& key) { - auto entry { patternFill.find (key) }; + auto entry = patternFill.find (key); if (entry != std::end (patternFill)) { return entry->second; }