aboutsummaryrefslogtreecommitdiffstats
path: root/src/AllCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-04-08 23:51:39 +0200
committerMax Kellermann <max@duempel.org>2013-04-08 23:51:39 +0200
commit450c26c4713a2de440296260e8d0be8e6b283d75 (patch)
tree21ad06ced3adbe9c79e47c7b759a9d6f64f6dd02 /src/AllCommands.cxx
parent7ec1121cc832086f533dd0adfcb581e16c1e312d (diff)
downloadmpd-450c26c4713a2de440296260e8d0be8e6b283d75.tar.gz
mpd-450c26c4713a2de440296260e8d0be8e6b283d75.tar.xz
mpd-450c26c4713a2de440296260e8d0be8e6b283d75.zip
tokenizer: convert to C++
Diffstat (limited to 'src/AllCommands.cxx')
-rw-r--r--src/AllCommands.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/AllCommands.cxx b/src/AllCommands.cxx
index 58dcf4dba..f3243915b 100644
--- a/src/AllCommands.cxx
+++ b/src/AllCommands.cxx
@@ -31,10 +31,7 @@
#include "tag.h"
#include "protocol/Result.hxx"
#include "Client.hxx"
-
-extern "C" {
-#include "tokenizer.h"
-}
+#include "util/Tokenizer.hxx"
#ifdef ENABLE_SQLITE
#include "StickerCommands.hxx"
@@ -329,10 +326,11 @@ command_process(Client *client, unsigned num, char *line)
/* get the command name (first word on the line) */
- argv[0] = tokenizer_next_word(&line, &error);
+ Tokenizer tokenizer(line);
+ argv[0] = tokenizer.NextWord(&error);
if (argv[0] == NULL) {
current_command = "";
- if (*line == 0)
+ if (tokenizer.IsEnd())
command_error(client, ACK_ERROR_UNKNOWN,
"No command given");
else {
@@ -351,7 +349,7 @@ command_process(Client *client, unsigned num, char *line)
while (argc < (int)G_N_ELEMENTS(argv) &&
(argv[argc] =
- tokenizer_next_param(&line, &error)) != NULL)
+ tokenizer.NextParam(&error)) != NULL)
++argc;
/* some error checks; we have to set current_command because
@@ -365,7 +363,7 @@ command_process(Client *client, unsigned num, char *line)
return COMMAND_RETURN_ERROR;
}
- if (*line != 0) {
+ if (!tokenizer.IsEnd()) {
command_error(client, ACK_ERROR_ARG,
"%s", error->message);
current_command = NULL;