summaryrefslogtreecommitdiff
path: root/src/web_service
diff options
context:
space:
mode:
authorGravatar Lioncash2020-04-15 15:59:23 -0400
committerGravatar Lioncash2020-04-15 21:33:46 -0400
commit1c340c6efad903580904297730d708ce8b947eb6 (patch)
treea79ad11775373ecf31912a7a50fcfbcc08d6e8b3 /src/web_service
parentMerge pull request #3612 from ReinUsesLisp/red (diff)
downloadyuzu-1c340c6efad903580904297730d708ce8b947eb6.tar.gz
yuzu-1c340c6efad903580904297730d708ce8b947eb6.tar.xz
yuzu-1c340c6efad903580904297730d708ce8b947eb6.zip
CMakeLists: Specify -Wextra on linux builds
Allows reporting more cases where logic errors may exist, such as implicit fallthrough cases, etc. We currently ignore unused parameters, since we currently have many cases where this is intentional (virtual interfaces). While we're at it, we can also tidy up any existing code that causes warnings. This also uncovered a few bugs as well.
Diffstat (limited to 'src/web_service')
-rw-r--r--src/web_service/web_backend.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp
index 737ffe409..09d1651ac 100644
--- a/src/web_service/web_backend.cpp
+++ b/src/web_service/web_backend.cpp
@@ -43,7 +43,7 @@ struct Client::Impl {
43 if (jwt.empty() && !allow_anonymous) { 43 if (jwt.empty() && !allow_anonymous) {
44 LOG_ERROR(WebService, "Credentials must be provided for authenticated requests"); 44 LOG_ERROR(WebService, "Credentials must be provided for authenticated requests");
45 return Common::WebResult{Common::WebResult::Code::CredentialsMissing, 45 return Common::WebResult{Common::WebResult::Code::CredentialsMissing,
46 "Credentials needed"}; 46 "Credentials needed", ""};
47 } 47 }
48 48
49 auto result = GenericRequest(method, path, data, accept, jwt); 49 auto result = GenericRequest(method, path, data, accept, jwt);
@@ -81,12 +81,12 @@ struct Client::Impl {
81 cli = std::make_unique<httplib::SSLClient>(parsedUrl.m_Host.c_str(), port); 81 cli = std::make_unique<httplib::SSLClient>(parsedUrl.m_Host.c_str(), port);
82 } else { 82 } else {
83 LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme); 83 LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme);
84 return Common::WebResult{Common::WebResult::Code::InvalidURL, "Bad URL scheme"}; 84 return Common::WebResult{Common::WebResult::Code::InvalidURL, "Bad URL scheme", ""};
85 } 85 }
86 } 86 }
87 if (cli == nullptr) { 87 if (cli == nullptr) {
88 LOG_ERROR(WebService, "Invalid URL {}", host + path); 88 LOG_ERROR(WebService, "Invalid URL {}", host + path);
89 return Common::WebResult{Common::WebResult::Code::InvalidURL, "Invalid URL"}; 89 return Common::WebResult{Common::WebResult::Code::InvalidURL, "Invalid URL", ""};
90 } 90 }
91 cli->set_timeout_sec(TIMEOUT_SECONDS); 91 cli->set_timeout_sec(TIMEOUT_SECONDS);
92 92
@@ -118,27 +118,27 @@ struct Client::Impl {
118 118
119 if (!cli->send(request, response)) { 119 if (!cli->send(request, response)) {
120 LOG_ERROR(WebService, "{} to {} returned null", method, host + path); 120 LOG_ERROR(WebService, "{} to {} returned null", method, host + path);
121 return Common::WebResult{Common::WebResult::Code::LibError, "Null response"}; 121 return Common::WebResult{Common::WebResult::Code::LibError, "Null response", ""};
122 } 122 }
123 123
124 if (response.status >= 400) { 124 if (response.status >= 400) {
125 LOG_ERROR(WebService, "{} to {} returned error status code: {}", method, host + path, 125 LOG_ERROR(WebService, "{} to {} returned error status code: {}", method, host + path,
126 response.status); 126 response.status);
127 return Common::WebResult{Common::WebResult::Code::HttpError, 127 return Common::WebResult{Common::WebResult::Code::HttpError,
128 std::to_string(response.status)}; 128 std::to_string(response.status), ""};
129 } 129 }
130 130
131 auto content_type = response.headers.find("content-type"); 131 auto content_type = response.headers.find("content-type");
132 132
133 if (content_type == response.headers.end()) { 133 if (content_type == response.headers.end()) {
134 LOG_ERROR(WebService, "{} to {} returned no content", method, host + path); 134 LOG_ERROR(WebService, "{} to {} returned no content", method, host + path);
135 return Common::WebResult{Common::WebResult::Code::WrongContent, ""}; 135 return Common::WebResult{Common::WebResult::Code::WrongContent, "", ""};
136 } 136 }
137 137
138 if (content_type->second.find(accept) == std::string::npos) { 138 if (content_type->second.find(accept) == std::string::npos) {
139 LOG_ERROR(WebService, "{} to {} returned wrong content: {}", method, host + path, 139 LOG_ERROR(WebService, "{} to {} returned wrong content: {}", method, host + path,
140 content_type->second); 140 content_type->second);
141 return Common::WebResult{Common::WebResult::Code::WrongContent, "Wrong content"}; 141 return Common::WebResult{Common::WebResult::Code::WrongContent, "Wrong content", ""};
142 } 142 }
143 return Common::WebResult{Common::WebResult::Code::Success, "", response.body}; 143 return Common::WebResult{Common::WebResult::Code::Success, "", response.body};
144 } 144 }