aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyoyo Fujita <syoyo@lighttransport.com>2021-08-20 17:30:54 +0900
committerGitHub <noreply@github.com>2021-08-20 17:30:54 +0900
commitb86c49fb1319a97c7960083affc74c7bdc571749 (patch)
tree0c3920c960037ad14a8b62a6886a72847e98a550
parent51908fb967baad5b98973796b32c57989915d910 (diff)
downloadtinyobjloader-b86c49fb1319a97c7960083affc74c7bdc571749.tar.gz
To avoid annoying compilation error caused by MSVC's min/max define, use (#316)
hard-coded int max value insted of std::numeric_limits<int>::max().
-rw-r--r--tiny_obj_loader.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/tiny_obj_loader.h b/tiny_obj_loader.h
index 77f86b2..c4bb454 100644
--- a/tiny_obj_loader.h
+++ b/tiny_obj_loader.h
@@ -970,7 +970,9 @@ static bool tryParseDouble(const char *s, const char *s_end, double *result) {
read = 0;
end_not_reached = (curr != s_end);
while (end_not_reached && IS_DIGIT(*curr)) {
- if (exponent > std::numeric_limits<int>::max()/10) {
+ // To avoid annoying MSVC's min/max macro definiton,
+ // Use hardcoded int max value
+ if (exponent > (2147483647/10)) { // 2147483647 = std::numeric_limits<int>::max()
// Integer overflow
goto fail;
}