Skip to content

Commit

Permalink
CLOUD: Fix Various Variable Shadowing Compiler Warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
digitall committed Jan 16, 2017
1 parent f2e03d2 commit 85a3dad
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions backends/networking/sdl_net/handlers/indexpagehandler.cpp
Expand Up @@ -37,9 +37,9 @@ IndexPageHandler::~IndexPageHandler() {}
Common::String IndexPageHandler::code() const { return _code; }

void IndexPageHandler::handle(Client &client) {
Common::String code = client.queryParameter("code");
Common::String queryCode = client.queryParameter("code");

if (code == "") {
if (queryCode == "") {
// redirect to "/filesAJAX"
HandlerUtils::setMessageHandler(
client,
Expand All @@ -53,7 +53,7 @@ void IndexPageHandler::handle(Client &client) {
return;
}

_code = code;
_code = queryCode;
sendCommand(GUI::kStorageCodePassedCmd, 0);
HandlerUtils::setMessageHandler(client, _("ScummVM got the code and already connects to your cloud storage!"));
}
Expand Down
36 changes: 18 additions & 18 deletions backends/networking/sdl_net/reader.cpp
Expand Up @@ -169,25 +169,25 @@ void Reader::handleFirstHeaders(Common::MemoryReadWriteStream *headersStream) {
_availableBytes = _contentLength;
}

void Reader::parseFirstLine(const Common::String &headers) {
uint32 headersSize = headers.size();
void Reader::parseFirstLine(const Common::String &headersToParse) {
uint32 headersSize = headersToParse.size();
bool bad = false;

if (headersSize > 0) {
const char *cstr = headers.c_str();
const char *cstr = headersToParse.c_str();
const char *position = strstr(cstr, "\r\n");
if (position) { //we have at least one line - and we want the first one
//"<METHOD> <path> HTTP/<VERSION>\r\n"
Common::String method, path, http, buf;
Common::String methodParsed, path, http, buf;
uint32 length = position - cstr;
if (headersSize > length)
headersSize = length;
for (uint32 i = 0; i < headersSize; ++i) {
if (headers[i] != ' ')
buf += headers[i];
if (headers[i] == ' ' || i == headersSize - 1) {
if (method == "") {
method = buf;
if (headersToParse[i] != ' ')
buf += headersToParse[i];
if (headersToParse[i] == ' ' || i == headersSize - 1) {
if (methodParsed == "") {
methodParsed = buf;
} else if (path == "") {
path = buf;
} else if (http == "") {
Expand All @@ -201,44 +201,44 @@ void Reader::parseFirstLine(const Common::String &headers) {
}

//check that method is supported
if (method != "GET" && method != "PUT" && method != "POST")
if (methodParsed != "GET" && methodParsed != "PUT" && methodParsed != "POST")
bad = true;

//check that HTTP/<VERSION> is OK
if (!http.hasPrefix("HTTP/"))
bad = true;

_method = method;
_method = methodParsed;
parsePathQueryAndAnchor(path);
}
}

if (bad) _isBadRequest = true;
}

void Reader::parsePathQueryAndAnchor(Common::String path) {
void Reader::parsePathQueryAndAnchor(Common::String parseToParse) {
//<path>[?query][#anchor]
bool readingPath = true;
bool readingQuery = false;
_path = "";
_query = "";
_anchor = "";
for (uint32 i = 0; i < path.size(); ++i) {
for (uint32 i = 0; i < pathToParse.size(); ++i) {
if (readingPath) {
if (path[i] == '?') {
if (pathToParse[i] == '?') {
readingPath = false;
readingQuery = true;
} else {
_path += path[i];
_path += pathToParse[i];
}
} else if (readingQuery) {
if (path[i] == '#') {
if (pathToParse[i] == '#') {
readingQuery = false;
} else {
_query += path[i];
_query += pathToParse[i];
}
} else {
_anchor += path[i];
_anchor += pathToParse[i];
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/networking/sdl_net/reader.h
Expand Up @@ -100,7 +100,7 @@ class Reader {

void handleFirstHeaders(Common::MemoryReadWriteStream *headers);
void parseFirstLine(const Common::String &headers);
void parsePathQueryAndAnchor(Common::String path);
void parsePathQueryAndAnchor(Common::String pathToParse);
void parseQueryParameters();

void makeWindow(uint32 size);
Expand Down

0 comments on commit 85a3dad

Please sign in to comment.