From 77da2c4bcf843980fe27d4878a468741bdad3a38 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Sun, 27 Mar 2011 21:35:03 +0300 Subject: alsa-mixer: Get rid of a compiler warning. On 64-bit systems LONG_MAX is greater than the largest possible value of a uint32_t variable, which caused the compiler to warn about a comparison that is always false. On 32-bit systems pa_atou() can return a value that will overflow when assigned to e->volume_limit, which has type long, so the comparison was necessary. This dilemma is resolved by using pa_atol() instead of pa_atou(). --- src/modules/alsa/alsa-mixer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules') diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index 286931f4..3b13879d 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -1920,14 +1920,14 @@ static int element_parse_volume_limit( pa_alsa_path *p = userdata; pa_alsa_element *e; - uint32_t volume_limit; + long volume_limit; if (!(e = element_get(p, section, TRUE))) { pa_log("[%s:%u] volume-limit makes no sense in '%s'", filename, line, section); return -1; } - if (pa_atou(rvalue, &volume_limit) < 0 || volume_limit > LONG_MAX) { + if (pa_atol(rvalue, &volume_limit) < 0 || volume_limit < 0) { pa_log("[%s:%u] Invalid value for volume-limit", filename, line); return -1; } -- cgit