Jan Breuer
2015-10-16 a28ccd18f24b50dc62e37f1a5d8be641578343d9
Resolve issue with strBaseToInt64 on 32bit platforms
2个文件已修改
10 ■■■■ 已修改文件
libscpi/src/utils.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/test/test_parser.c 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
}
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);
}