From 485a1961e8f899e8ef178cd191cd4a4b7845445f Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 15 Apr 2024 18:12:54 +0200 Subject: [PATCH] clang: implicit conversion from 'long' to 'double' implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808. So rather compare same integer types. --- tools/lvmcmdline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index d35a144f6..4520b893b 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -683,10 +683,10 @@ static int _size_arg(struct cmd_context *cmd __attribute__((unused)), return 0; } - av->i_value = (v < INT32_MAX) ? (int32_t) v : INT32_MAX; - av->ui_value = (v < UINT32_MAX) ? (uint32_t) v : UINT32_MAX; - av->i64_value = (v < INT64_MAX) ? (int64_t) v : INT64_MAX; - av->ui64_value = (v < UINT64_MAX) ? (uint64_t) v : UINT64_MAX; + av->i_value = ((int32_t) v < INT32_MAX) ? (int32_t) v : INT32_MAX; + av->ui_value = ((uint32_t) v < UINT32_MAX) ? (uint32_t) v : UINT32_MAX; + av->i64_value = ((int64_t) v < INT64_MAX) ? (int64_t) v : INT64_MAX; + av->ui64_value = ((uint64_t) v < UINT64_MAX) ? (uint64_t) v : UINT64_MAX; return 1; }