e_info_client, e_utils: change long to unsigned long to avoid sign extension 32/262632/1
authorJunseok, Kim <juns.kim@samsung.com>
Tue, 17 Aug 2021 04:40:51 +0000 (13:40 +0900)
committerJunseok, Kim <juns.kim@samsung.com>
Tue, 17 Aug 2021 04:40:51 +0000 (13:40 +0900)
Change-Id: I85188a167e8a6f0b539a185873b7a82bc1bfa0d1

src/bin/e_info_client.c
src/bin/e_utils.c

index 434c7f908bc2d1e874a346c996f0247beb6210ef..f4e6c1557132115de3541b4883b6e9dfacfdd477 100644 (file)
@@ -195,14 +195,14 @@ _util_string_to_ulong(const char *str, unsigned long *num, int base)
    EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(num, EINA_FALSE);
 
-   const long sul = strtoul(str, &end, base);
+   const unsigned long sul = strtoul(str, &end, base);
    errsv = errno;
 
    EINA_SAFETY_ON_TRUE_RETURN_VAL((end == str), EINA_FALSE); /* given string is not a decimal number */
    EINA_SAFETY_ON_TRUE_RETURN_VAL(('\0' != *end), EINA_FALSE); /* given string has extra characters */
    EINA_SAFETY_ON_TRUE_RETURN_VAL(((ULONG_MAX == sul) && (ERANGE == errsv)), EINA_FALSE); /* out of range of type unsigned long */
 
-   *num = (int)sul;
+   *num = sul;
 
    return EINA_TRUE;
 }
index 719b9e52566556aca23fd0cd70a7df49dc6cbf1b..de662e44a863b37c7a850fc0c67a902098b46084 100644 (file)
@@ -1098,14 +1098,14 @@ e_util_string_to_ulong(const char *str, unsigned long *num, int base)
    EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(num, EINA_FALSE);
 
-   const long sul = strtoul(str, &end, base);
+   const unsigned long sul = strtoul(str, &end, base);
    errsv = errno;
 
    EINA_SAFETY_ON_TRUE_RETURN_VAL((end == str), EINA_FALSE); /* given string is not a decimal number */
    EINA_SAFETY_ON_TRUE_RETURN_VAL(('\0' != *end), EINA_FALSE); /* given string has extra characters */
    EINA_SAFETY_ON_TRUE_RETURN_VAL(((ULONG_MAX == sul) && (ERANGE == errsv)), EINA_FALSE); /* out of range of type unsigned long */
 
-   *num = (int)sul;
+   *num = sul;
 
    return EINA_TRUE;
 }