From a5ca8bee4d56df1588b21d667135be351d6c0e75 Mon Sep 17 00:00:00 2001 From: ll-antn <42381407+ll-antn@users.noreply.github.com> Date: Fri, 26 Jul 2019 19:14:05 +0300 Subject: [PATCH] Fix numeric_limits::max() to avoid conflict with windows.h header (#5462) --- include/flatbuffers/util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/flatbuffers/util.h b/include/flatbuffers/util.h index f41fca0a5..072fe9e10 100644 --- a/include/flatbuffers/util.h +++ b/include/flatbuffers/util.h @@ -327,7 +327,7 @@ template inline bool StringToNumber(const char *s, T *val) { int64_t i64; // The errno check isn't needed, will return MAX/MIN on overflow. if (StringToIntegerImpl(&i64, s, 0, false)) { - const int64_t max = flatbuffers::numeric_limits::max(); + const int64_t max = (flatbuffers::numeric_limits::max)(); const int64_t min = flatbuffers::numeric_limits::lowest(); if (i64 > max) { *val = static_cast(max); @@ -365,7 +365,7 @@ inline bool StringToNumber(const char *str, uint64_t *val) { if (*s == '-') { // For unsigned types return the max to distinguish from // "no conversion can be performed". - *val = flatbuffers::numeric_limits::max(); + *val = (flatbuffers::numeric_limits::max)(); return false; } }