protocol/ArgParser: overload as ParseCommandArg(), pass references
This commit is contained in:
parent
0f92d021a1
commit
9231f420c1
@ -309,7 +309,7 @@ CommandResult
|
|||||||
handle_setvol(Client &client, Request args)
|
handle_setvol(Client &client, Request args)
|
||||||
{
|
{
|
||||||
unsigned level;
|
unsigned level;
|
||||||
if (!check_unsigned(client, &level, args.front()))
|
if (!ParseCommandArg(client, level, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
if (level > 100) {
|
if (level > 100) {
|
||||||
@ -330,7 +330,7 @@ CommandResult
|
|||||||
handle_volume(Client &client, Request args)
|
handle_volume(Client &client, Request args)
|
||||||
{
|
{
|
||||||
int relative;
|
int relative;
|
||||||
if (!check_int(client, &relative, args.front()))
|
if (!ParseCommandArg(client, relative, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
if (relative < -100 || relative > 100) {
|
if (relative < -100 || relative > 100) {
|
||||||
|
@ -34,7 +34,7 @@ handle_enableoutput(Client &client, Request args)
|
|||||||
assert(args.size == 1);
|
assert(args.size == 1);
|
||||||
|
|
||||||
unsigned device;
|
unsigned device;
|
||||||
if (!check_unsigned(client, &device, args.front()))
|
if (!ParseCommandArg(client, device, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
if (!audio_output_enable_index(client.partition.outputs, device)) {
|
if (!audio_output_enable_index(client.partition.outputs, device)) {
|
||||||
@ -52,7 +52,7 @@ handle_disableoutput(Client &client, Request args)
|
|||||||
assert(args.size == 1);
|
assert(args.size == 1);
|
||||||
|
|
||||||
unsigned device;
|
unsigned device;
|
||||||
if (!check_unsigned(client, &device, args.front()))
|
if (!ParseCommandArg(client, device, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
if (!audio_output_disable_index(client.partition.outputs, device)) {
|
if (!audio_output_disable_index(client.partition.outputs, device)) {
|
||||||
@ -70,7 +70,7 @@ handle_toggleoutput(Client &client, Request args)
|
|||||||
assert(args.size == 1);
|
assert(args.size == 1);
|
||||||
|
|
||||||
unsigned device;
|
unsigned device;
|
||||||
if (!check_unsigned(client, &device, args.front()))
|
if (!ParseCommandArg(client, device, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
if (!audio_output_toggle_index(client.partition.outputs, device)) {
|
if (!audio_output_toggle_index(client.partition.outputs, device)) {
|
||||||
|
@ -61,9 +61,9 @@ CommandResult
|
|||||||
handle_play(Client &client, Request args)
|
handle_play(Client &client, Request args)
|
||||||
{
|
{
|
||||||
int song = -1;
|
int song = -1;
|
||||||
|
if (!args.IsEmpty() && !ParseCommandArg(client, song, args.front()))
|
||||||
if (!args.IsEmpty() && !check_int(client, &song, args.front()))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
PlaylistResult result = client.partition.PlayPosition(song);
|
PlaylistResult result = client.partition.PlayPosition(song);
|
||||||
return print_playlist_result(client, result);
|
return print_playlist_result(client, result);
|
||||||
}
|
}
|
||||||
@ -72,8 +72,7 @@ CommandResult
|
|||||||
handle_playid(Client &client, Request args)
|
handle_playid(Client &client, Request args)
|
||||||
{
|
{
|
||||||
int id = -1;
|
int id = -1;
|
||||||
|
if (!args.IsEmpty() && !ParseCommandArg(client, id, args.front()))
|
||||||
if (!args.IsEmpty() && !check_int(client, &id, args.front()))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
PlaylistResult result = client.partition.PlayId(id);
|
PlaylistResult result = client.partition.PlayId(id);
|
||||||
@ -99,7 +98,7 @@ handle_pause(Client &client, Request args)
|
|||||||
{
|
{
|
||||||
if (!args.IsEmpty()) {
|
if (!args.IsEmpty()) {
|
||||||
bool pause_flag;
|
bool pause_flag;
|
||||||
if (!check_bool(client, &pause_flag, args.front()))
|
if (!ParseCommandArg(client, pause_flag, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
client.player_control.SetPause(pause_flag);
|
client.player_control.SetPause(pause_flag);
|
||||||
@ -250,7 +249,7 @@ CommandResult
|
|||||||
handle_repeat(Client &client, Request args)
|
handle_repeat(Client &client, Request args)
|
||||||
{
|
{
|
||||||
bool status;
|
bool status;
|
||||||
if (!check_bool(client, &status, args.front()))
|
if (!ParseCommandArg(client, status, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
client.partition.SetRepeat(status);
|
client.partition.SetRepeat(status);
|
||||||
@ -261,7 +260,7 @@ CommandResult
|
|||||||
handle_single(Client &client, Request args)
|
handle_single(Client &client, Request args)
|
||||||
{
|
{
|
||||||
bool status;
|
bool status;
|
||||||
if (!check_bool(client, &status, args.front()))
|
if (!ParseCommandArg(client, status, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
client.partition.SetSingle(status);
|
client.partition.SetSingle(status);
|
||||||
@ -272,7 +271,7 @@ CommandResult
|
|||||||
handle_consume(Client &client, Request args)
|
handle_consume(Client &client, Request args)
|
||||||
{
|
{
|
||||||
bool status;
|
bool status;
|
||||||
if (!check_bool(client, &status, args.front()))
|
if (!ParseCommandArg(client, status, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
client.partition.SetConsume(status);
|
client.partition.SetConsume(status);
|
||||||
@ -283,7 +282,7 @@ CommandResult
|
|||||||
handle_random(Client &client, Request args)
|
handle_random(Client &client, Request args)
|
||||||
{
|
{
|
||||||
bool status;
|
bool status;
|
||||||
if (!check_bool(client, &status, args.front()))
|
if (!ParseCommandArg(client, status, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
client.partition.SetRandom(status);
|
client.partition.SetRandom(status);
|
||||||
@ -304,7 +303,7 @@ handle_seek(Client &client, Request args)
|
|||||||
unsigned song;
|
unsigned song;
|
||||||
SongTime seek_time;
|
SongTime seek_time;
|
||||||
|
|
||||||
if (!check_unsigned(client, &song, args[0]))
|
if (!ParseCommandArg(client, song, args[0]))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
if (!ParseCommandArg(client, seek_time, args[1]))
|
if (!ParseCommandArg(client, seek_time, args[1]))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
@ -319,8 +318,7 @@ handle_seekid(Client &client, Request args)
|
|||||||
{
|
{
|
||||||
unsigned id;
|
unsigned id;
|
||||||
SongTime seek_time;
|
SongTime seek_time;
|
||||||
|
if (!ParseCommandArg(client, id, args[0]))
|
||||||
if (!check_unsigned(client, &id, args[0]))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
if (!ParseCommandArg(client, seek_time, args[1]))
|
if (!ParseCommandArg(client, seek_time, args[1]))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
@ -348,11 +346,10 @@ CommandResult
|
|||||||
handle_crossfade(Client &client, Request args)
|
handle_crossfade(Client &client, Request args)
|
||||||
{
|
{
|
||||||
unsigned xfade_time;
|
unsigned xfade_time;
|
||||||
|
if (!ParseCommandArg(client, xfade_time, args.front()))
|
||||||
if (!check_unsigned(client, &xfade_time, args.front()))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
client.player_control.SetCrossFade(xfade_time);
|
|
||||||
|
|
||||||
|
client.player_control.SetCrossFade(xfade_time);
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,11 +357,10 @@ CommandResult
|
|||||||
handle_mixrampdb(Client &client, Request args)
|
handle_mixrampdb(Client &client, Request args)
|
||||||
{
|
{
|
||||||
float db;
|
float db;
|
||||||
|
if (!ParseCommandArg(client, db, args.front()))
|
||||||
if (!check_float(client, &db, args.front()))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
client.player_control.SetMixRampDb(db);
|
|
||||||
|
|
||||||
|
client.player_control.SetMixRampDb(db);
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,9 +368,9 @@ CommandResult
|
|||||||
handle_mixrampdelay(Client &client, Request args)
|
handle_mixrampdelay(Client &client, Request args)
|
||||||
{
|
{
|
||||||
float delay_secs;
|
float delay_secs;
|
||||||
|
if (!ParseCommandArg(client, delay_secs, args.front()))
|
||||||
if (!check_float(client, &delay_secs, args.front()))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
client.player_control.SetMixRampDelay(delay_secs);
|
client.player_control.SetMixRampDelay(delay_secs);
|
||||||
|
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
|
@ -146,8 +146,7 @@ handle_playlistdelete(Client &client, Request args)
|
|||||||
{
|
{
|
||||||
const char *const name = args[0];
|
const char *const name = args[0];
|
||||||
unsigned from;
|
unsigned from;
|
||||||
|
if (!ParseCommandArg(client, from, args[1]))
|
||||||
if (!check_unsigned(client, &from, args[1]))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
Error error;
|
Error error;
|
||||||
@ -161,10 +160,9 @@ handle_playlistmove(Client &client, Request args)
|
|||||||
{
|
{
|
||||||
const char *const name = args.front();
|
const char *const name = args.front();
|
||||||
unsigned from, to;
|
unsigned from, to;
|
||||||
|
if (!ParseCommandArg(client, from, args[1]))
|
||||||
if (!check_unsigned(client, &from, args[1]))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
if (!check_unsigned(client, &to, args[2]))
|
if (!ParseCommandArg(client, to, args[2]))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
Error error;
|
Error error;
|
||||||
|
@ -105,7 +105,7 @@ handle_addid(Client &client, Request args)
|
|||||||
|
|
||||||
if (args.size == 2) {
|
if (args.size == 2) {
|
||||||
unsigned to;
|
unsigned to;
|
||||||
if (!check_unsigned(client, &to, args[1]))
|
if (!ParseCommandArg(client, to, args[1]))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
PlaylistResult result = client.partition.MoveId(added_id, to);
|
PlaylistResult result = client.partition.MoveId(added_id, to);
|
||||||
if (result != PlaylistResult::SUCCESS) {
|
if (result != PlaylistResult::SUCCESS) {
|
||||||
@ -155,7 +155,7 @@ CommandResult
|
|||||||
handle_rangeid(Client &client, Request args)
|
handle_rangeid(Client &client, Request args)
|
||||||
{
|
{
|
||||||
unsigned id;
|
unsigned id;
|
||||||
if (!check_unsigned(client, &id, args.front()))
|
if (!ParseCommandArg(client, id, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
SongTime start, end;
|
SongTime start, end;
|
||||||
@ -188,8 +188,7 @@ CommandResult
|
|||||||
handle_deleteid(Client &client, Request args)
|
handle_deleteid(Client &client, Request args)
|
||||||
{
|
{
|
||||||
unsigned id;
|
unsigned id;
|
||||||
|
if (!ParseCommandArg(client, id, args.front()))
|
||||||
if (!check_unsigned(client, &id, args.front()))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
PlaylistResult result = client.partition.DeleteId(id);
|
PlaylistResult result = client.partition.DeleteId(id);
|
||||||
@ -269,7 +268,7 @@ handle_playlistid(Client &client, Request args)
|
|||||||
{
|
{
|
||||||
if (!args.IsEmpty()) {
|
if (!args.IsEmpty()) {
|
||||||
unsigned id;
|
unsigned id;
|
||||||
if (!check_unsigned(client, &id, args.front()))
|
if (!ParseCommandArg(client, id, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
bool ret = playlist_print_id(client, client.playlist, id);
|
bool ret = playlist_print_id(client, client.playlist, id);
|
||||||
@ -315,8 +314,7 @@ handle_prio(Client &client, Request args)
|
|||||||
{
|
{
|
||||||
const char *const priority_string = args.shift();
|
const char *const priority_string = args.shift();
|
||||||
unsigned priority;
|
unsigned priority;
|
||||||
|
if (!ParseCommandArg(client, priority, priority_string))
|
||||||
if (!check_unsigned(client, &priority, priority_string))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
if (priority > 0xff) {
|
if (priority > 0xff) {
|
||||||
@ -346,8 +344,7 @@ handle_prioid(Client &client, Request args)
|
|||||||
{
|
{
|
||||||
const char *const priority_string = args.shift();
|
const char *const priority_string = args.shift();
|
||||||
unsigned priority;
|
unsigned priority;
|
||||||
|
if (!ParseCommandArg(client, priority, priority_string))
|
||||||
if (!check_unsigned(client, &priority, priority_string))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
if (priority > 0xff) {
|
if (priority > 0xff) {
|
||||||
@ -358,7 +355,7 @@ handle_prioid(Client &client, Request args)
|
|||||||
|
|
||||||
for (const char *i : args) {
|
for (const char *i : args) {
|
||||||
unsigned song_id;
|
unsigned song_id;
|
||||||
if (!check_unsigned(client, &song_id, i))
|
if (!ParseCommandArg(client, song_id, i))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
PlaylistResult result =
|
PlaylistResult result =
|
||||||
@ -376,9 +373,8 @@ handle_move(Client &client, Request args)
|
|||||||
RangeArg range;
|
RangeArg range;
|
||||||
int to;
|
int to;
|
||||||
|
|
||||||
if (!ParseCommandArg(client, range, args[0]))
|
if (!ParseCommandArg(client, range, args[0]) ||
|
||||||
return CommandResult::ERROR;
|
!ParseCommandArg(client, to, args[1]))
|
||||||
if (!check_int(client, &to, args[1]))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
PlaylistResult result =
|
PlaylistResult result =
|
||||||
@ -391,11 +387,10 @@ handle_moveid(Client &client, Request args)
|
|||||||
{
|
{
|
||||||
unsigned id;
|
unsigned id;
|
||||||
int to;
|
int to;
|
||||||
|
if (!ParseCommandArg(client, id, args[0]) ||
|
||||||
|
!ParseCommandArg(client, to, args[1]))
|
||||||
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
if (!check_unsigned(client, &id, args[0]))
|
|
||||||
return CommandResult::ERROR;
|
|
||||||
if (!check_int(client, &to, args[1]))
|
|
||||||
return CommandResult::ERROR;
|
|
||||||
PlaylistResult result = client.partition.MoveId(id, to);
|
PlaylistResult result = client.partition.MoveId(id, to);
|
||||||
return print_playlist_result(client, result);
|
return print_playlist_result(client, result);
|
||||||
}
|
}
|
||||||
@ -404,10 +399,8 @@ CommandResult
|
|||||||
handle_swap(Client &client, Request args)
|
handle_swap(Client &client, Request args)
|
||||||
{
|
{
|
||||||
unsigned song1, song2;
|
unsigned song1, song2;
|
||||||
|
if (!ParseCommandArg(client, song1, args[0]) ||
|
||||||
if (!check_unsigned(client, &song1, args[0]))
|
!ParseCommandArg(client, song2, args[1]))
|
||||||
return CommandResult::ERROR;
|
|
||||||
if (!check_unsigned(client, &song2, args[1]))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
PlaylistResult result =
|
PlaylistResult result =
|
||||||
@ -419,10 +412,8 @@ CommandResult
|
|||||||
handle_swapid(Client &client, Request args)
|
handle_swapid(Client &client, Request args)
|
||||||
{
|
{
|
||||||
unsigned id1, id2;
|
unsigned id1, id2;
|
||||||
|
if (!ParseCommandArg(client, id1, args[0]) ||
|
||||||
if (!check_unsigned(client, &id1, args[0]))
|
!ParseCommandArg(client, id2, args[1]))
|
||||||
return CommandResult::ERROR;
|
|
||||||
if (!check_unsigned(client, &id2, args[1]))
|
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
PlaylistResult result = client.partition.SwapIds(id1, id2);
|
PlaylistResult result = client.partition.SwapIds(id1, id2);
|
||||||
|
@ -32,7 +32,7 @@ CommandResult
|
|||||||
handle_addtagid(Client &client, Request args)
|
handle_addtagid(Client &client, Request args)
|
||||||
{
|
{
|
||||||
unsigned song_id;
|
unsigned song_id;
|
||||||
if (!check_unsigned(client, &song_id, args.front()))
|
if (!ParseCommandArg(client, song_id, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
const char *const tag_name = args[1];
|
const char *const tag_name = args[1];
|
||||||
@ -57,7 +57,7 @@ CommandResult
|
|||||||
handle_cleartagid(Client &client, Request args)
|
handle_cleartagid(Client &client, Request args)
|
||||||
{
|
{
|
||||||
unsigned song_id;
|
unsigned song_id;
|
||||||
if (!check_unsigned(client, &song_id, args.front()))
|
if (!ParseCommandArg(client, song_id, args.front()))
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
TagType tag_type = TAG_NUM_OF_ITEM_TYPES;
|
TagType tag_type = TAG_NUM_OF_ITEM_TYPES;
|
||||||
|
@ -41,7 +41,7 @@ check_uint32(Client &client, uint32_t *dst, const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
check_int(Client &client, int *value_r, const char *s)
|
ParseCommandArg(Client &client, int &value_r, const char *s)
|
||||||
{
|
{
|
||||||
char *test;
|
char *test;
|
||||||
long value;
|
long value;
|
||||||
@ -60,7 +60,7 @@ check_int(Client &client, int *value_r, const char *s)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*value_r = (int)value;
|
value_r = (int)value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ ParseCommandArg(Client &client, RangeArg &value_r, const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
check_unsigned(Client &client, unsigned *value_r, const char *s)
|
ParseCommandArg(Client &client, unsigned &value_r, const char *s)
|
||||||
{
|
{
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
@ -149,12 +149,12 @@ check_unsigned(Client &client, unsigned *value_r, const char *s)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*value_r = (unsigned)value;
|
value_r = (unsigned)value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
check_bool(Client &client, bool *value_r, const char *s)
|
ParseCommandArg(Client &client, bool &value_r, const char *s)
|
||||||
{
|
{
|
||||||
long value;
|
long value;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
@ -166,12 +166,12 @@ check_bool(Client &client, bool *value_r, const char *s)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*value_r = !!value;
|
value_r = !!value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
check_float(Client &client, float *value_r, const char *s)
|
ParseCommandArg(Client &client, float &value_r, const char *s)
|
||||||
{
|
{
|
||||||
float value;
|
float value;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
@ -183,7 +183,7 @@ check_float(Client &client, float *value_r, const char *s)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*value_r = value;
|
value_r = value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ bool
|
|||||||
ParseCommandArg(Client &client, SongTime &value_r, const char *s)
|
ParseCommandArg(Client &client, SongTime &value_r, const char *s)
|
||||||
{
|
{
|
||||||
float value;
|
float value;
|
||||||
bool success = check_float(client, &value, s) && value >= 0;
|
bool success = ParseCommandArg(client, value, s) && value >= 0;
|
||||||
if (success)
|
if (success)
|
||||||
value_r = SongTime::FromS(value);
|
value_r = SongTime::FromS(value);
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ bool
|
|||||||
ParseCommandArg(Client &client, SignedSongTime &value_r, const char *s)
|
ParseCommandArg(Client &client, SignedSongTime &value_r, const char *s)
|
||||||
{
|
{
|
||||||
float value;
|
float value;
|
||||||
bool success = check_float(client, &value, s);
|
bool success = ParseCommandArg(client, value, s);
|
||||||
if (success)
|
if (success)
|
||||||
value_r = SignedSongTime::FromS(value);
|
value_r = SignedSongTime::FromS(value);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ bool
|
|||||||
check_uint32(Client &client, uint32_t *dst, const char *s);
|
check_uint32(Client &client, uint32_t *dst, const char *s);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
check_int(Client &client, int *value_r, const char *s);
|
ParseCommandArg(Client &client, int &value_r, const char *s);
|
||||||
|
|
||||||
struct RangeArg {
|
struct RangeArg {
|
||||||
unsigned start, end;
|
unsigned start, end;
|
||||||
@ -47,13 +47,13 @@ bool
|
|||||||
ParseCommandArg(Client &client, RangeArg &value_r, const char *s);
|
ParseCommandArg(Client &client, RangeArg &value_r, const char *s);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
check_unsigned(Client &client, unsigned *value_r, const char *s);
|
ParseCommandArg(Client &client, unsigned &value_r, const char *s);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
check_bool(Client &client, bool *value_r, const char *s);
|
ParseCommandArg(Client &client, bool &value_r, const char *s);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
check_float(Client &client, float *value_r, const char *s);
|
ParseCommandArg(Client &client, float &value_r, const char *s);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ParseCommandArg(Client &client, SongTime &value_r, const char *s);
|
ParseCommandArg(Client &client, SongTime &value_r, const char *s);
|
||||||
|
Loading…
Reference in New Issue
Block a user