[Libreoffice-commits] online.git: loolwsd/Storage.cpp
Miklos Vajna
vmiklos at collabora.co.uk
Fri Apr 15 06:51:59 UTC 2016
loolwsd/Storage.cpp | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
New commits:
commit 0a92e811dc33459a37facc25a6d7ca35a39e5fb9
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Apr 15 08:49:35 2016 +0200
Storage: const auto -> const auto& where it would create a tmp copy
Change-Id: I0ec42200e19654ee2e1c9b0fc293668847a5b965
diff --git a/loolwsd/Storage.cpp b/loolwsd/Storage.cpp
index b0439c9..3929df6 100644
--- a/loolwsd/Storage.cpp
+++ b/loolwsd/Storage.cpp
@@ -84,7 +84,7 @@ std::unique_ptr<StorageBase> StorageBase::create(const std::string& jailRoot, co
/////////////////////
StorageBase::FileInfo LocalStorage::getFileInfo(const Poco::URI& uri)
{
- const auto path = uri.getPath();
+ const auto& path = uri.getPath();
Log::debug("Getting info for local uri [" + uri.toString() + "], path [" + path + "].");
const auto filename = Poco::Path(path).getFileName();
const auto lastModified = Poco::File(path).getLastModified();
@@ -158,13 +158,12 @@ StorageBase::FileInfo WopiStorage::getFileInfo(const Poco::URI& uri)
{
Log::debug("Getting info for wopi uri [" + uri.toString() + "].");
- Poco::URI uriObject(uri);
#if ENABLE_SSL
- Poco::Net::HTTPSClientSession session(uriObject.getHost(), uriObject.getPort(), Poco::Net::SSLManager::instance().defaultClientContext());
+ Poco::Net::HTTPSClientSession session(uri.getHost(), uri.getPort(), Poco::Net::SSLManager::instance().defaultClientContext());
#else
- Poco::Net::HTTPClientSession session(uriObject.getHost(), uriObject.getPort());
+ Poco::Net::HTTPClientSession session(uri.getHost(), uri.getPort());
#endif
- Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, uriObject.getPathAndQuery(), Poco::Net::HTTPMessage::HTTP_1_1);
+ Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, uri.getPathAndQuery(), Poco::Net::HTTPMessage::HTTP_1_1);
request.set("User-Agent", "LOOLWSD WOPI Agent");
session.sendRequest(request);
@@ -186,13 +185,13 @@ StorageBase::FileInfo WopiStorage::getFileInfo(const Poco::URI& uri)
std::string resMsg;
Poco::StreamCopier::copyToString(rs, resMsg);
Log::debug("WOPI::CheckFileInfo returned: " + resMsg);
- const auto index = resMsg.find_first_of("{");
+ const auto index = resMsg.find_first_of('{');
if (index != std::string::npos)
{
const std::string stringJSON = resMsg.substr(index);
Poco::JSON::Parser parser;
const auto result = parser.parse(stringJSON);
- const auto object = result.extract<Poco::JSON::Object::Ptr>();
+ const auto& object = result.extract<Poco::JSON::Object::Ptr>();
filename = object->get("BaseFileName").toString();
size = std::stoul (object->get("Size").toString(), nullptr, 0);
}
More information about the Libreoffice-commits
mailing list