aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-08 13:42:48 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitf3ee9e3272c76236a5f234d00cb9ba1afa81ef60 (patch)
tree00b9fd42ae47aef854391619d02c8f8ce55cc173
parentb69cc3effbbe2cccefc29eb2db097945d78cf89b (diff)
downloadscummvm-rg350-f3ee9e3272c76236a5f234d00cb9ba1afa81ef60.tar.gz
scummvm-rg350-f3ee9e3272c76236a5f234d00cb9ba1afa81ef60.tar.bz2
scummvm-rg350-f3ee9e3272c76236a5f234d00cb9ba1afa81ef60.zip
CLOUD: Fix minor Reader-related bugs
-rw-r--r--backends/module.mk3
-rw-r--r--backends/networking/sdl_net/client.cpp3
-rw-r--r--backends/networking/sdl_net/reader.cpp6
-rw-r--r--backends/networking/sdl_net/reader.h4
4 files changed, 9 insertions, 7 deletions
diff --git a/backends/module.mk b/backends/module.mk
index b1aced43a8..3c6f5e5c39 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -65,7 +65,8 @@ MODULE_OBJS += \
networking/sdl_net/handlers/filespagehandler.o \
networking/sdl_net/handlers/indexpagehandler.o \
networking/sdl_net/handlers/resourcehandler.o \
- networking/sdl_net/localwebserver.o
+ networking/sdl_net/localwebserver.o \
+ networking/sdl_net/reader.o
endif
ifdef USE_ELF_LOADER
diff --git a/backends/networking/sdl_net/client.cpp b/backends/networking/sdl_net/client.cpp
index 3edf9c32f5..32aa1e4bef 100644
--- a/backends/networking/sdl_net/client.cpp
+++ b/backends/networking/sdl_net/client.cpp
@@ -44,7 +44,8 @@ void Client::open(SDLNet_SocketSet set, TCPsocket socket) {
_state = READING_HEADERS;
_socket = socket;
_set = set;
- _reader = Reader();
+ Reader cleanReader;
+ _reader = cleanReader;
_handler = nullptr;
if (set) {
int numused = SDLNet_TCP_AddSocket(set, socket);
diff --git a/backends/networking/sdl_net/reader.cpp b/backends/networking/sdl_net/reader.cpp
index 7fe9d7b15a..698c20919e 100644
--- a/backends/networking/sdl_net/reader.cpp
+++ b/backends/networking/sdl_net/reader.cpp
@@ -157,7 +157,7 @@ bool Reader::readRequest() {
bts += readOne();
if (bts == "--") break;
if (bts == "\r\n") continue;
- warning("strange bytes: \"%s\"", bts);
+ warning("strange bytes: \"%s\"", bts.c_str());
} else {
warning("strange ending");
break;
@@ -327,7 +327,7 @@ void Reader::parseQueryParameters() {
} else key += _query[i];
} else {
if (_query[i] == '&') {
- if (_queryParameters.contains(key)) warning("Query parameter \"%s\" is already set!");
+ if (_queryParameters.contains(key)) warning("Query parameter \"%s\" is already set!", key.c_str());
else _queryParameters[key] = LocalWebserver::urlDecode(value);
readingKey = true;
key = "";
@@ -336,7 +336,7 @@ void Reader::parseQueryParameters() {
}
if (!key.empty()) {
- if (_queryParameters.contains(key)) warning("Query parameter \"%s\" is already set!");
+ if (_queryParameters.contains(key)) warning("Query parameter \"%s\" is already set!", key.c_str());
else _queryParameters[key] = LocalWebserver::urlDecode(value);
}
}
diff --git a/backends/networking/sdl_net/reader.h b/backends/networking/sdl_net/reader.h
index 09550e09c9..de0f3b668f 100644
--- a/backends/networking/sdl_net/reader.h
+++ b/backends/networking/sdl_net/reader.h
@@ -79,8 +79,8 @@ class Reader {
void makeWindow(uint32 size);
void freeWindow();
- bool Reader::readOneByteInStream(Common::WriteStream *stream, const Common::String &boundary);
- bool Reader::readOneByteInString(Common::String &buffer, const Common::String &boundary);
+ bool readOneByteInStream(Common::WriteStream *stream, const Common::String &boundary);
+ bool readOneByteInString(Common::String &buffer, const Common::String &boundary);
byte readOne();
uint32 bytesLeft();