aboutsummaryrefslogtreecommitdiffstats
path: root/src/protocol
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-08-11 22:34:22 +0200
committerMax Kellermann <max@duempel.org>2015-08-11 22:43:10 +0200
commit9231f420c199a7c12cb8aad17bcca80a0aaca6ad (patch)
tree474755c86ced85b966a03bd79dfffbce48c17f43 /src/protocol
parent0f92d021a1dc2992352b635846428229d2c9ffbb (diff)
downloadmpd-9231f420c199a7c12cb8aad17bcca80a0aaca6ad.tar.gz
mpd-9231f420c199a7c12cb8aad17bcca80a0aaca6ad.tar.xz
mpd-9231f420c199a7c12cb8aad17bcca80a0aaca6ad.zip
protocol/ArgParser: overload as ParseCommandArg(), pass references
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/ArgParser.cxx20
-rw-r--r--src/protocol/ArgParser.hxx8
2 files changed, 14 insertions, 14 deletions
diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx
index b290b7138..2c3e21f79 100644
--- a/src/protocol/ArgParser.cxx
+++ b/src/protocol/ArgParser.cxx
@@ -41,7 +41,7 @@ check_uint32(Client &client, uint32_t *dst, const char *s)
}
bool
-check_int(Client &client, int *value_r, const char *s)
+ParseCommandArg(Client &client, int &value_r, const char *s)
{
char *test;
long value;
@@ -60,7 +60,7 @@ check_int(Client &client, int *value_r, const char *s)
return false;
}
- *value_r = (int)value;
+ value_r = (int)value;
return true;
}
@@ -131,7 +131,7 @@ ParseCommandArg(Client &client, RangeArg &value_r, const char *s)
}
bool
-check_unsigned(Client &client, unsigned *value_r, const char *s)
+ParseCommandArg(Client &client, unsigned &value_r, const char *s)
{
unsigned long value;
char *endptr;
@@ -149,12 +149,12 @@ check_unsigned(Client &client, unsigned *value_r, const char *s)
return false;
}
- *value_r = (unsigned)value;
+ value_r = (unsigned)value;
return true;
}
bool
-check_bool(Client &client, bool *value_r, const char *s)
+ParseCommandArg(Client &client, bool &value_r, const char *s)
{
long value;
char *endptr;
@@ -166,12 +166,12 @@ check_bool(Client &client, bool *value_r, const char *s)
return false;
}
- *value_r = !!value;
+ value_r = !!value;
return true;
}
bool
-check_float(Client &client, float *value_r, const char *s)
+ParseCommandArg(Client &client, float &value_r, const char *s)
{
float value;
char *endptr;
@@ -183,7 +183,7 @@ check_float(Client &client, float *value_r, const char *s)
return false;
}
- *value_r = value;
+ value_r = value;
return true;
}
@@ -191,7 +191,7 @@ bool
ParseCommandArg(Client &client, SongTime &value_r, const char *s)
{
float value;
- bool success = check_float(client, &value, s) && value >= 0;
+ bool success = ParseCommandArg(client, value, s) && value >= 0;
if (success)
value_r = SongTime::FromS(value);
@@ -202,7 +202,7 @@ bool
ParseCommandArg(Client &client, SignedSongTime &value_r, const char *s)
{
float value;
- bool success = check_float(client, &value, s);
+ bool success = ParseCommandArg(client, value, s);
if (success)
value_r = SignedSongTime::FromS(value);
diff --git a/src/protocol/ArgParser.hxx b/src/protocol/ArgParser.hxx
index 7866b88d5..d71894771 100644
--- a/src/protocol/ArgParser.hxx
+++ b/src/protocol/ArgParser.hxx
@@ -32,7 +32,7 @@ bool
check_uint32(Client &client, uint32_t *dst, const char *s);
bool
-check_int(Client &client, int *value_r, const char *s);
+ParseCommandArg(Client &client, int &value_r, const char *s);
struct RangeArg {
unsigned start, end;
@@ -47,13 +47,13 @@ bool
ParseCommandArg(Client &client, RangeArg &value_r, const char *s);
bool
-check_unsigned(Client &client, unsigned *value_r, const char *s);
+ParseCommandArg(Client &client, unsigned &value_r, const char *s);
bool
-check_bool(Client &client, bool *value_r, const char *s);
+ParseCommandArg(Client &client, bool &value_r, const char *s);
bool
-check_float(Client &client, float *value_r, const char *s);
+ParseCommandArg(Client &client, float &value_r, const char *s);
bool
ParseCommandArg(Client &client, SongTime &value_r, const char *s);