From 63d911297746e84b8996348e85f15db5c82f2cee Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 14 Apr 2016 08:36:56 +0200 Subject: [PATCH] MasterProcessSession: const auto -> const auto& where it would create a tmp copy Change-Id: I5bbffb9be562b52f868bfca3f825e8d81dae4eef --- loolwsd/MasterProcessSession.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp index e67b3323f..9f3763a0e 100644 --- a/loolwsd/MasterProcessSession.cpp +++ b/loolwsd/MasterProcessSession.cpp @@ -134,13 +134,13 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length) { const std::string stringMsg(buffer, length); Log::info(getName() + "Command: " + stringMsg); - const auto index = stringMsg.find_first_of("{"); + const auto index = stringMsg.find_first_of('{'); if (index != std::string::npos) { const std::string stringJSON = stringMsg.substr(index); Poco::JSON::Parser parser; const auto result = parser.parse(stringJSON); - const auto object = result.extract(); + const auto& object = result.extract(); if (object->get("commandName").toString() == ".uno:Save" && object->get("success").toString() == "true") { @@ -233,13 +233,13 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length) else if (tokens[0] == "commandvalues:") { const std::string stringMsg(buffer, length); - const auto index = stringMsg.find_first_of("{"); + const auto index = stringMsg.find_first_of('{'); if (index != std::string::npos) { const std::string stringJSON = stringMsg.substr(index); Poco::JSON::Parser parser; const auto result = parser.parse(stringJSON); - const auto object = result.extract(); + const auto& object = result.extract(); const std::string commandName = object->get("commandName").toString(); if (commandName.find(".uno:CharFontName") != std::string::npos || commandName.find(".uno:StyleApply") != std::string::npos)