volume: moved range check to handle_setvol()
Converted the range checks in volume_level_change() to assertions. Changed all volume types to "unsigned", expect for those which must be able to indicate error (-1).
This commit is contained in:
@@ -1061,6 +1061,11 @@ handle_setvol(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
|
||||
if (!check_int(client, &level, argv[1], need_integer))
|
||||
return COMMAND_RETURN_ERROR;
|
||||
|
||||
if (level < 0 || level > 100) {
|
||||
command_error(client, ACK_ERROR_ARG, "Invalid volume value");
|
||||
return COMMAND_RETURN_ERROR;
|
||||
}
|
||||
|
||||
success = volume_level_change(level);
|
||||
if (!success) {
|
||||
command_error(client, ACK_ERROR_SYSTEM,
|
||||
|
||||
Reference in New Issue
Block a user