ClientRead: always ignore whitespace at the end of the line

This commit is contained in:
Max Kellermann 2013-11-04 18:11:15 +01:00
parent 84f5e0c0de
commit eab1a77683
2 changed files with 9 additions and 2 deletions

2
NEWS
View File

@ -1,4 +1,6 @@
ver 0.18.1 (2013/11/??)
* protocol:
- always ignore whitespace at the end of the line
* filter:
- autoconvert: fix "volume_normalization" with mp3 files
* add missing files to source tarball

View File

@ -21,6 +21,7 @@
#include "ClientInternal.hxx"
#include "Main.hxx"
#include "event/Loop.hxx"
#include "util/CharUtil.hxx"
#include <assert.h>
#include <string.h>
@ -35,11 +36,15 @@ Client::OnSocketInput(void *data, size_t length)
TimeoutMonitor::ScheduleSeconds(client_timeout);
BufferedSocket::ConsumeInput(newline + 1 - p);
/* skip whitespace at the end of the line */
while (newline > p && IsWhitespaceOrNull(newline[-1]))
--newline;
/* terminate the string at the end of the line */
*newline = 0;
BufferedSocket::ConsumeInput(newline + 1 - p);
CommandResult result = client_process_line(*this, p);
switch (result) {
case CommandResult::OK: