aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-10-18 01:24:45 +0200
committerMax Kellermann <max@duempel.org>2009-10-18 01:24:45 +0200
commite7c267db4fb7d7e48b0dbdcfb39ef21724070033 (patch)
tree4873dccd86902557c71f4188680b29f0e2b21009 /src/command.c
parent6a5e7c118b8277ccbc8fbcbb98c1ffa048284c48 (diff)
downloadmpd-e7c267db4fb7d7e48b0dbdcfb39ef21724070033.tar.gz
mpd-e7c267db4fb7d7e48b0dbdcfb39ef21724070033.tar.xz
mpd-e7c267db4fb7d7e48b0dbdcfb39ef21724070033.zip
command: use GLib limit macros in check_range()
These are portable and don't require limits.h.
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/command.c b/src/command.c
index 0c6538ca9..2abdf47fa 100644
--- a/src/command.c
+++ b/src/command.c
@@ -167,8 +167,8 @@ check_int(struct client *client, int *value_r,
return false;
}
-#if LONG_MAX > INT_MAX
- if (value < INT_MIN || value > INT_MAX) {
+#if G_MAXLONG > G_MAXINT
+ if (value < G_MININT || value > G_MAXINT) {
command_error(client, ACK_ERROR_ARG,
"Number too large: %s", s);
return false;
@@ -199,7 +199,7 @@ check_range(struct client *client, unsigned *value_r1, unsigned *value_r2,
/* compatibility with older MPD versions: specifying
"-1" makes MPD display the whole list */
*value_r1 = 0;
- *value_r2 = UINT_MAX;
+ *value_r2 = G_MAXUINT;
return true;
}
@@ -209,8 +209,8 @@ check_range(struct client *client, unsigned *value_r1, unsigned *value_r2,
return false;
}
-#if LONG_MAX > UINT_MAX
- if (value > UINT_MAX) {
+#if G_MAXLONG > G_MAXUINT
+ if (value > G_MAXUINT) {
command_error(client, ACK_ERROR_ARG,
"Number too large: %s", s);
return false;
@@ -235,8 +235,8 @@ check_range(struct client *client, unsigned *value_r1, unsigned *value_r2,
return false;
}
-#if LONG_MAX > UINT_MAX
- if (value > UINT_MAX) {
+#if G_MAXLONG > G_MAXUINT
+ if (value > G_MAXUINT) {
command_error(client, ACK_ERROR_ARG,
"Number too large: %s", s);
return false;
@@ -263,7 +263,7 @@ check_unsigned(struct client *client, unsigned *value_r, const char *s)
return false;
}
- if (value > UINT_MAX) {
+ if (value > G_MAXUINT) {
command_error(client, ACK_ERROR_ARG,
"Number too large: %s", s);
return false;
@@ -823,7 +823,7 @@ handle_plchangesposid(struct client *client, G_GNUC_UNUSED int argc, char *argv[
static enum command_return
handle_playlistinfo(struct client *client, int argc, char *argv[])
{
- unsigned start = 0, end = UINT_MAX;
+ unsigned start = 0, end = G_MAXUINT;
bool ret;
if (argc == 2 && !check_range(client, &start, &end,
@@ -852,7 +852,7 @@ handle_playlistid(struct client *client, int argc, char *argv[])
return print_playlist_result(client,
PLAYLIST_RESULT_NO_SUCH_SONG);
} else {
- playlist_print_info(client, &g_playlist, 0, UINT_MAX);
+ playlist_print_info(client, &g_playlist, 0, G_MAXUINT);
}
return COMMAND_RETURN_OK;