fix gcc 4.8.2 build problems

pull/536/head
Thomas Fussell 2021-01-03 09:33:43 -05:00
parent f99cf3bde0
commit 0039eab40d
4 changed files with 9 additions and 6 deletions

View File

@ -38,7 +38,8 @@ namespace xlnt {
template <typename T>
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__)

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}