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).
This commit is contained in:
Arun Raghavan 2010-10-09 22:30:20 +05:30
parent 4d84a00b49
commit 1d2ef7923d
9 changed files with 30 additions and 27 deletions

View file

@ -378,7 +378,7 @@ static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessag
}
for (i = 0; i < n_volume_entries; ++i) {
if (volume[i] > PA_VOLUME_MAX) {
if (PA_VOLUME_IS_VALID(volume[i])) {
pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS, "Too large volume value: %u", volume[i]);
return;
}