From 1d2ef7923d28a74e08a4309b6fa3d36481d2df3b Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Sat, 9 Oct 2010 22:30:20 +0530 Subject: volume: Use a macro to check if a volume is valid This adds a PA_VOLUME_IS_VALID() macro for checking if a given pa_volume_t is valid. This makes changes to the volume ranges simpler (just change PA_VOLUME_MAX, for example, without needing to modify any other code). --- src/modules/dbus/iface-sample.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules/dbus/iface-sample.c') diff --git a/src/modules/dbus/iface-sample.c b/src/modules/dbus/iface-sample.c index c1fa193c..23810792 100644 --- a/src/modules/dbus/iface-sample.c +++ b/src/modules/dbus/iface-sample.c @@ -366,7 +366,7 @@ static void handle_play(DBusConnection *conn, DBusMessage *msg, void *userdata) if (!(property_list = pa_dbus_get_proplist_arg(conn, msg, &msg_iter))) return; - if (volume > PA_VOLUME_MAX) { + if (PA_VOLUME_IS_VALID(volume)) { pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS, "Invalid volume."); goto finish; } @@ -416,7 +416,7 @@ static void handle_play_to_sink(DBusConnection *conn, DBusMessage *msg, void *us goto finish; } - if (volume > PA_VOLUME_MAX) { + if (PA_VOLUME_IS_VALID(volume)) { pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS, "Invalid volume."); goto finish; } -- cgit