diff --git a/hypervisor/include/lib/rtl.h b/hypervisor/include/lib/rtl.h index a5d5abb3c..2c0cef6b5 100644 --- a/hypervisor/include/lib/rtl.h +++ b/hypervisor/include/lib/rtl.h @@ -29,7 +29,7 @@ size_t strnlen_s(const char *str_arg, size_t maxlen_arg); void *memset(void *base, uint8_t v, size_t n); void *memcpy_s(void *d, size_t dmax, const void *s, size_t slen); int32_t atoi(const char *str); -long strtol_deci(const char *nptr); +int64_t strtol_deci(const char *nptr); uint64_t strtoul_hex(const char *nptr); char *strstr_s(const char *str1, size_t maxlen1, const char *str2, size_t maxlen2); diff --git a/hypervisor/lib/string.c b/hypervisor/lib/string.c index c8436c8ed..37b69a007 100644 --- a/hypervisor/lib/string.c +++ b/hypervisor/lib/string.c @@ -17,11 +17,11 @@ static inline bool is_space(char c) static inline char hex_digit_value (char ch) { char c; - if ('0' <= ch && ch <= '9') { + if (('0' <= ch) && (ch <= '9')) { c = ch - '0'; - } else if ('a' <= ch && ch <= 'f') { + } else if (('a' <= ch) && (ch <= 'f')) { c = ch - 'a' + 10; - } else if ('A' <= ch && ch <= 'F') { + } else if (('A' <= ch) && (ch <= 'F')) { c = ch - 'A' + 10; } else { c = -1; @@ -32,7 +32,7 @@ static inline char hex_digit_value (char ch) /* * Convert a string to a long integer - decimal support only. */ -long strtol_deci(const char *nptr) +int64_t strtol_deci(const char *nptr) { const char *s = nptr; char c; @@ -105,7 +105,7 @@ long strtol_deci(const char *nptr) /* There is no overflow and no leading '-' exists. In such case * acc already holds the right number. No action required. */ } - return (long)acc; + return (int64_t)acc; } /*