diff options
author | Harshavardhana <harsha@harshavardhana.net> | 2013-10-20 21:45:45 -0700 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-10-21 18:31:58 -0700 |
commit | 34990cf1838fe85d995c15ea25bc0f77bfd66ed6 (patch) | |
tree | 356d908ebc5401a586881b8db58bf558b48f1875 /libglusterfs/src/dict.c | |
parent | 9228618f9d566d1af29b6a4946426df09b7737bc (diff) |
libglusterfs: Propositions should be logical
Mutually exclusive tests shouldn't be
non-contradictory
-- (A is B) && (A is not B) is not valid
Change-Id: Icf97d1704fedca4b8eeeb67da8b7d4c8d4b578d5
BUG: 769692
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/6115
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/dict.c')
-rw-r--r-- | libglusterfs/src/dict.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c index b017f87e5e8..3b7ddce5e0d 100644 --- a/libglusterfs/src/dict.c +++ b/libglusterfs/src/dict.c @@ -896,7 +896,7 @@ data_to_int32 (data_t *data) int16_t data_to_int16 (data_t *data) { - int16_t value = 0; + int16_t value = 0; if (!data) { gf_log_callingfn ("dict", GF_LOG_WARNING, "data is NULL"); @@ -910,16 +910,16 @@ data_to_int16 (data_t *data) memcpy (str, data->data, data->len); str[data->len] = '\0'; - errno = 0; - value = strtol (str, NULL, 0); + errno = 0; + value = strtol (str, NULL, 0); - if ((SHRT_MAX > value) || (SHRT_MIN < value)) { - errno = ERANGE; + if ((value > SHRT_MAX) || (value < SHRT_MIN)) { + errno = ERANGE; gf_log_callingfn ("dict", GF_LOG_WARNING, - "Error in data conversion: " - "detected overflow"); + "Error in data conversion: " + "detected overflow"); return -1; - } + } return (int16_t)value; } @@ -928,7 +928,7 @@ data_to_int16 (data_t *data) int8_t data_to_int8 (data_t *data) { - int32_t value = 0; + int8_t value = 0; if (!data) { gf_log_callingfn ("dict", GF_LOG_WARNING, "data is NULL"); @@ -942,16 +942,16 @@ data_to_int8 (data_t *data) memcpy (str, data->data, data->len); str[data->len] = '\0'; - errno = 0; - value = strtol (str, NULL, 0); + errno = 0; + value = strtol (str, NULL, 0); - if ((SCHAR_MAX > value) || (SCHAR_MIN < value)) { - errno = ERANGE; + if ((value > SCHAR_MAX) || (value < SCHAR_MIN)) { + errno = ERANGE; gf_log_callingfn ("dict", GF_LOG_WARNING, - "Error in data conversion: " - "detected overflow"); + "Error in data conversion: " + "detected overflow"); return -1; - } + } return (int8_t)value; } |