summaryrefslogtreecommitdiff
blob: 87059614ff030dfeace266fba46dcfaee1597809 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Fix strtol_l missing on musl. On musl libc use strtol
# Taken from Alpine Linux, please refer:
# https://git.alpinelinux.org/aports/tree/community/opencolorio/0002-fix-strtol.patch?id=dd7ba461824ab0618f0493cbb450b221fdc2513c
# Please refer: https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/1624
--- a/src/utils/NumberUtils.h
+++ b/src/utils/NumberUtils.h
@@ -68,7 +68,7 @@ really_inline from_chars_result from_chars(const char *first, const char *last,
     tempval = ::strtod_l(first, &endptr, loc.local);
 #endif

-    if (errno != 0)
+    if (errno != 0 && errno != EINVAL)
     {
         return {first + (endptr - first), std::errc::result_out_of_range};
     }
@@ -139,8 +139,10 @@ really_inline from_chars_result from_chars(const char *first, const char *last,
     long int
 #ifdef _WIN32
     tempval = _strtol_l(first, &endptr, 0, loc.local);
-#else
+#elif defined(__GLIBC__)
     tempval = ::strtol_l(first, &endptr, 0, loc.local);
+#else
+    tempval = ::strtol(first, &endptr, 0);
 #endif

     if (errno != 0)