Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
d0537973
Commit
d0537973
authored
Aug 14, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
protocol/Result: move command_list_num to class Response
parent
c8d0f947
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
10 deletions
+12
-10
Response.cxx
src/client/Response.cxx
+2
-2
Response.hxx
src/client/Response.hxx
+8
-1
AllCommands.cxx
src/command/AllCommands.cxx
+1
-4
Result.cxx
src/protocol/Result.cxx
+0
-1
Result.hxx
src/protocol/Result.hxx
+0
-1
test_protocol.cxx
test/test_protocol.cxx
+1
-1
No files found.
src/client/Response.cxx
View file @
d0537973
...
...
@@ -65,8 +65,8 @@ Response::Error(enum ack code, const char *msg)
void
Response
::
FormatError
(
enum
ack
code
,
const
char
*
fmt
,
...)
{
Format
(
"ACK [%i@%
i
] {%s} "
,
(
int
)
code
,
command_list_num
,
current_command
);
Format
(
"ACK [%i@%
u
] {%s} "
,
(
int
)
code
,
list_index
,
current_command
);
va_list
args
;
va_start
(
args
,
fmt
);
...
...
src/client/Response.hxx
View file @
d0537973
...
...
@@ -31,8 +31,15 @@ class Client;
class
Response
{
Client
&
client
;
/**
* This command's index in the command list. Used to generate
* error messages.
*/
const
unsigned
list_index
;
public
:
explicit
Response
(
Client
&
_client
)
:
client
(
_client
)
{}
Response
(
Client
&
_client
,
unsigned
_list_index
)
:
client
(
_client
),
list_index
(
_list_index
)
{}
Response
(
const
Response
&
)
=
delete
;
Response
&
operator
=
(
const
Response
&
)
=
delete
;
...
...
src/command/AllCommands.cxx
View file @
d0537973
...
...
@@ -363,11 +363,9 @@ command_checked_lookup(Response &r, unsigned permission,
CommandResult
command_process
(
Client
&
client
,
unsigned
num
,
char
*
line
)
{
Response
r
(
client
);
Response
r
(
client
,
num
);
Error
error
;
command_list_num
=
num
;
/* get the command name (first word on the line) */
/* we have to set current_command because Response::Error()
expects it to be set */
...
...
@@ -427,7 +425,6 @@ command_process(Client &client, unsigned num, char *line)
:
CommandResult
::
ERROR
;
current_command
=
nullptr
;
command_list_num
=
0
;
return
ret
;
}
src/protocol/Result.cxx
View file @
d0537973
...
...
@@ -22,7 +22,6 @@
#include "client/Client.hxx"
const
char
*
current_command
;
int
command_list_num
;
void
command_success
(
Client
&
client
)
...
...
src/protocol/Result.hxx
View file @
d0537973
...
...
@@ -25,7 +25,6 @@
class
Client
;
extern
const
char
*
current_command
;
extern
int
command_list_num
;
void
command_success
(
Client
&
client
);
...
...
test/test_protocol.cxx
View file @
d0537973
...
...
@@ -37,7 +37,7 @@ void
ArgParserTest
::
TestRange
()
{
Client
&
client
=
*
(
Client
*
)
nullptr
;
Response
r
(
client
);
Response
r
(
client
,
0
);
RangeArg
range
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment