Fix android compilation

Android clang complains about the fact it cannot move the
`std::unique_ptr<ContentResponse>` into a `std::unique_ptr<Response>&&`
(for the implicit `std::unique_ptr<Response>` constructor).
Let's help him a bit.
This commit is contained in:
Matthieu Gautier 2020-07-29 17:49:04 +02:00
parent a3939e9a05
commit 6d5cddca12
2 changed files with 10 additions and 10 deletions

View File

@ -371,7 +371,7 @@ std::unique_ptr<Response> InternalServer::handle_meta(const RequestContext& requ
auto response = ContentResponse::build(*this, content, mimeType); auto response = ContentResponse::build(*this, content, mimeType);
response->set_cacheable(); response->set_cacheable();
return response; return std::move(response);
} }
std::unique_ptr<Response> InternalServer::handle_suggest(const RequestContext& request) std::unique_ptr<Response> InternalServer::handle_suggest(const RequestContext& request)
@ -433,7 +433,7 @@ std::unique_ptr<Response> InternalServer::handle_suggest(const RequestContext& r
data.set("suggestions", results); data.set("suggestions", results);
auto response = ContentResponse::build(*this, RESOURCE::templates::suggestion_json, data, "application/json; charset=utf-8"); auto response = ContentResponse::build(*this, RESOURCE::templates::suggestion_json, data, "application/json; charset=utf-8");
return response; return std::move(response);
} }
std::unique_ptr<Response> InternalServer::handle_skin(const RequestContext& request) std::unique_ptr<Response> InternalServer::handle_skin(const RequestContext& request)
@ -449,7 +449,7 @@ std::unique_ptr<Response> InternalServer::handle_skin(const RequestContext& requ
getResource(resourceName), getResource(resourceName),
getMimeTypeForFile(resourceName)); getMimeTypeForFile(resourceName));
response->set_cacheable(); response->set_cacheable();
return response; return std::move(response);
} catch (const ResourceNotFound& e) { } catch (const ResourceNotFound& e) {
return Response::build_404(*this, request, ""); return Response::build_404(*this, request, "");
} }
@ -523,7 +523,7 @@ std::unique_ptr<Response> InternalServer::handle_search(const RequestContext& re
auto response = ContentResponse::build(*this, RESOURCE::templates::no_search_result_html, data, "text/html; charset=utf-8"); auto response = ContentResponse::build(*this, RESOURCE::templates::no_search_result_html, data, "text/html; charset=utf-8");
response->set_taskbar(bookName, reader ? reader->getTitle() : ""); response->set_taskbar(bookName, reader ? reader->getTitle() : "");
response->set_code(MHD_HTTP_NOT_FOUND); response->set_code(MHD_HTTP_NOT_FOUND);
return response; return std::move(response);
} }
Searcher searcher; Searcher searcher;
@ -579,7 +579,7 @@ std::unique_ptr<Response> InternalServer::handle_search(const RequestContext& re
response->set_code(MHD_HTTP_NO_CONTENT); response->set_code(MHD_HTTP_NO_CONTENT);
} }
return response; return std::move(response);
} catch (const std::exception& e) { } catch (const std::exception& e) {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
return Response::build_500(*this, e.what()); return Response::build_500(*this, e.what());
@ -651,7 +651,7 @@ std::unique_ptr<Response> InternalServer::handle_catalog(const RequestContext& r
if (url == "searchdescription.xml") { if (url == "searchdescription.xml") {
auto response = ContentResponse::build(*this, RESOURCE::opensearchdescription_xml, get_default_data(), "application/opensearchdescription+xml"); auto response = ContentResponse::build(*this, RESOURCE::opensearchdescription_xml, get_default_data(), "application/opensearchdescription+xml");
return response; return std::move(response);
} }
zim::Uuid uuid; zim::Uuid uuid;
@ -710,7 +710,7 @@ std::unique_ptr<Response> InternalServer::handle_catalog(const RequestContext& r
*this, *this,
opdsDumper.dumpOPDSFeed(bookIdsToDump), opdsDumper.dumpOPDSFeed(bookIdsToDump),
"application/atom+xml; profile=opds-catalog; kind=acquisition; charset=utf-8"); "application/atom+xml; profile=opds-catalog; kind=acquisition; charset=utf-8");
return response; return std::move(response);
} }
namespace namespace

View File

@ -71,7 +71,7 @@ std::unique_ptr<Response> Response::build_304(const InternalServer& server, cons
auto response = ContentResponse::build(server, "", ""); auto response = ContentResponse::build(server, "", "");
response->set_code(MHD_HTTP_NOT_MODIFIED); response->set_code(MHD_HTTP_NOT_MODIFIED);
response->m_etag = etag; response->m_etag = etag;
return response; return std::move(response);
} }
std::unique_ptr<Response> Response::build_404(const InternalServer& server, const RequestContext& request, const std::string& bookName) std::unique_ptr<Response> Response::build_404(const InternalServer& server, const RequestContext& request, const std::string& bookName)
@ -83,7 +83,7 @@ std::unique_ptr<Response> Response::build_404(const InternalServer& server, cons
response->set_code(MHD_HTTP_NOT_FOUND); response->set_code(MHD_HTTP_NOT_FOUND);
response->set_taskbar(bookName, ""); response->set_taskbar(bookName, "");
return response; return std::move(response);
} }
std::unique_ptr<Response> Response::build_500(const InternalServer& server, const std::string& msg) std::unique_ptr<Response> Response::build_500(const InternalServer& server, const std::string& msg)
@ -377,7 +377,7 @@ std::unique_ptr<Response> EntryResponse::build(const InternalServer& server, con
auto response = ContentResponse::build(server, content, mimetype); auto response = ContentResponse::build(server, content, mimetype);
response->set_cacheable(); response->set_cacheable();
response->m_byteRange = byteRange; response->m_byteRange = byteRange;
return response; return std::move(response);
} }
if (byteRange.kind() == ByteRange::RESOLVED_UNSATISFIABLE) { if (byteRange.kind() == ByteRange::RESOLVED_UNSATISFIABLE) {