From 6d5cddca12d90574fda25bceec6c993d737b1c6f Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 29 Jul 2020 17:49:04 +0200 Subject: [PATCH] Fix android compilation Android clang complains about the fact it cannot move the `std::unique_ptr` into a `std::unique_ptr&&` (for the implicit `std::unique_ptr` constructor). Let's help him a bit. --- src/server/internalServer.cpp | 14 +++++++------- src/server/response.cpp | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp index d28ff55e1..a202d5670 100644 --- a/src/server/internalServer.cpp +++ b/src/server/internalServer.cpp @@ -371,7 +371,7 @@ std::unique_ptr InternalServer::handle_meta(const RequestContext& requ auto response = ContentResponse::build(*this, content, mimeType); response->set_cacheable(); - return response; + return std::move(response); } std::unique_ptr InternalServer::handle_suggest(const RequestContext& request) @@ -433,7 +433,7 @@ std::unique_ptr InternalServer::handle_suggest(const RequestContext& r data.set("suggestions", results); auto response = ContentResponse::build(*this, RESOURCE::templates::suggestion_json, data, "application/json; charset=utf-8"); - return response; + return std::move(response); } std::unique_ptr InternalServer::handle_skin(const RequestContext& request) @@ -449,7 +449,7 @@ std::unique_ptr InternalServer::handle_skin(const RequestContext& requ getResource(resourceName), getMimeTypeForFile(resourceName)); response->set_cacheable(); - return response; + return std::move(response); } catch (const ResourceNotFound& e) { return Response::build_404(*this, request, ""); } @@ -523,7 +523,7 @@ std::unique_ptr InternalServer::handle_search(const RequestContext& re 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_code(MHD_HTTP_NOT_FOUND); - return response; + return std::move(response); } Searcher searcher; @@ -579,7 +579,7 @@ std::unique_ptr InternalServer::handle_search(const RequestContext& re response->set_code(MHD_HTTP_NO_CONTENT); } - return response; + return std::move(response); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; return Response::build_500(*this, e.what()); @@ -651,7 +651,7 @@ std::unique_ptr InternalServer::handle_catalog(const RequestContext& r if (url == "searchdescription.xml") { auto response = ContentResponse::build(*this, RESOURCE::opensearchdescription_xml, get_default_data(), "application/opensearchdescription+xml"); - return response; + return std::move(response); } zim::Uuid uuid; @@ -710,7 +710,7 @@ std::unique_ptr InternalServer::handle_catalog(const RequestContext& r *this, opdsDumper.dumpOPDSFeed(bookIdsToDump), "application/atom+xml; profile=opds-catalog; kind=acquisition; charset=utf-8"); - return response; + return std::move(response); } namespace diff --git a/src/server/response.cpp b/src/server/response.cpp index 006f539ad..591fd2582 100644 --- a/src/server/response.cpp +++ b/src/server/response.cpp @@ -71,7 +71,7 @@ std::unique_ptr Response::build_304(const InternalServer& server, cons auto response = ContentResponse::build(server, "", ""); response->set_code(MHD_HTTP_NOT_MODIFIED); response->m_etag = etag; - return response; + return std::move(response); } std::unique_ptr Response::build_404(const InternalServer& server, const RequestContext& request, const std::string& bookName) @@ -83,7 +83,7 @@ std::unique_ptr Response::build_404(const InternalServer& server, cons response->set_code(MHD_HTTP_NOT_FOUND); response->set_taskbar(bookName, ""); - return response; + return std::move(response); } std::unique_ptr Response::build_500(const InternalServer& server, const std::string& msg) @@ -377,7 +377,7 @@ std::unique_ptr EntryResponse::build(const InternalServer& server, con auto response = ContentResponse::build(server, content, mimetype); response->set_cacheable(); response->m_byteRange = byteRange; - return response; + return std::move(response); } if (byteRange.kind() == ByteRange::RESOLVED_UNSATISFIABLE) {