From a28ccd18f24b50dc62e37f1a5d8be641578343d9 Mon Sep 17 00:00:00 2001
From: Jan Breuer <jan.breuer@jaybee.cz>
Date: 周五, 16 10月 2015 21:04:54 +0800
Subject: [PATCH] Resolve issue with strBaseToInt64 on 32bit platforms

---
 libscpi/test/test_parser.c |    8 ++++----
 libscpi/src/utils.c        |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libscpi/src/utils.c b/libscpi/src/utils.c
index 301712b..1e26e17 100644
--- a/libscpi/src/utils.c
+++ b/libscpi/src/utils.c
@@ -298,7 +298,7 @@
  */
 size_t strBaseToInt64(const char * str, int64_t * val, int8_t base) {
     char * endptr;
-    *val = strtol(str, &endptr, base);
+    *val = strtoll(str, &endptr, base);
     return endptr - str;
 }
 
diff --git a/libscpi/test/test_parser.c b/libscpi/test/test_parser.c
index 8114266..990ea62 100644
--- a/libscpi/test/test_parser.c
+++ b/libscpi/test/test_parser.c
@@ -392,8 +392,8 @@
     TEST_ParamUInt32("10V", TRUE, 0, FALSE, -138);
 
     // test range
-    TEST_ParamUInt32("2147483647", TRUE, 2147483647, TRUE, 0);
-    TEST_ParamUInt32("4294967295", TRUE, 4294967295, TRUE, 0);
+    TEST_ParamUInt32("2147483647", TRUE, 2147483647ULL, TRUE, 0);
+    TEST_ParamUInt32("4294967295", TRUE, 4294967295ULL, TRUE, 0);
 }
 
 #define TEST_ParamInt64(data, mandatory, expected_value, expected_result, expected_error_code) \
@@ -472,8 +472,8 @@
     TEST_ParamUInt64("10V", TRUE, 0, FALSE, -138);
 
     // test range
-    TEST_ParamUInt64("2147483647", TRUE, 2147483647, TRUE, 0);
-    TEST_ParamUInt64("4294967295", TRUE, 4294967295, TRUE, 0);
+    TEST_ParamUInt64("2147483647", TRUE, 2147483647ULL, TRUE, 0);
+    TEST_ParamUInt64("4294967295", TRUE, 4294967295ULL, TRUE, 0);
     TEST_ParamUInt64("9223372036854775807", TRUE, 9223372036854775807ULL, TRUE, 0);
     TEST_ParamUInt64("18446744073709551615", TRUE, 18446744073709551615ULL, TRUE, 0);
 }

--
Gitblit v1.9.1