Skip to content

Commit

Permalink
cid#410830 COPY_INSTEAD_OF_MOVE
Browse files Browse the repository at this point in the history
and

cid#410829 COPY_INSTEAD_OF_MOVE
cid#410827 COPY_INSTEAD_OF_MOVE
cid#410825 COPY_INSTEAD_OF_MOVE
cid#410822 COPY_INSTEAD_OF_MOVE
cid#410820 COPY_INSTEAD_OF_MOVE
cid#410817 COPY_INSTEAD_OF_MOVE
cid#398543 COPY_INSTEAD_OF_MOVE
cid#398539 COPY_INSTEAD_OF_MOVE
cid#398538 COPY_INSTEAD_OF_MOVE
cid#398531 COPY_INSTEAD_OF_MOVE
cid#398525 COPY_INSTEAD_OF_MOVE
cid#398522 COPY_INSTEAD_OF_MOVE
cid#398516 COPY_INSTEAD_OF_MOVE
cid#398515 COPY_INSTEAD_OF_MOVE
cid#398514 COPY_INSTEAD_OF_MOVE
cid#398509 COPY_INSTEAD_OF_MOVE
cid#398507 COPY_INSTEAD_OF_MOVE
cid#398500 COPY_INSTEAD_OF_MOVE
cid#398495 COPY_INSTEAD_OF_MOVE
cid#398494 COPY_INSTEAD_OF_MOVE
cid#398487 COPY_INSTEAD_OF_MOVE
cid#398484 COPY_INSTEAD_OF_MOVE
cid#398482 COPY_INSTEAD_OF_MOVE
cid#398478 COPY_INSTEAD_OF_MOVE
cid#398477 COPY_INSTEAD_OF_MOVE
cid#398450 COPY_INSTEAD_OF_MOVE
cid#398434 COPY_INSTEAD_OF_MOVE
cid#398423 COPY_INSTEAD_OF_MOVE
cid#398421 COPY_INSTEAD_OF_MOVE
cid#398399 COPY_INSTEAD_OF_MOVE
cid#398388 COPY_INSTEAD_OF_MOVE

Signed-off-by: Caolán McNamara <[email protected]>
Change-Id: Ic5bbd1d1c44abe022f5442ca710199f1ef8fa34b
  • Loading branch information
caolanm authored and vmiklos committed Aug 15, 2024
1 parent 868d8ef commit f965450
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 42 deletions.
2 changes: 1 addition & 1 deletion common/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ namespace Log

try
{
auto& logger = GenericLogger::create(Static.getName(), channel, Poco::Message::PRIO_TRACE);
auto& logger = GenericLogger::create(Static.getName(), std::move(channel), Poco::Message::PRIO_TRACE);
Static.setLogger(&logger);
}
catch (ExistsException&)
Expand Down
30 changes: 15 additions & 15 deletions common/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ void Session::parseDocOptions(const StringVector& tokens, int& part, std::string

if (name == "url")
{
_docURL = value;
_docURL = std::move(value);
++offset;
}
else if (name == "jail")
{
_jailedFilePath = value;
_jailedFilePath = std::move(value);
++offset;
}
else if (name == "xjail")
{
_jailedFilePathAnonym = value;
_jailedFilePathAnonym = std::move(value);
++offset;
}
else if (name == "authorid")
Expand Down Expand Up @@ -150,7 +150,7 @@ void Session::parseDocOptions(const StringVector& tokens, int& part, std::string
}
else if (name == "password")
{
_docPassword = value;
_docPassword = std::move(value);
_haveDocPassword = true;
++offset;
}
Expand All @@ -159,12 +159,12 @@ void Session::parseDocOptions(const StringVector& tokens, int& part, std::string
if (value == "en")
_lang = "en-US";
else
_lang = value;
_lang = std::move(value);
++offset;
}
else if (name == "timezone")
{
_timezone= value;
_timezone= std::move(value);
++offset;
}
else if (name == "watermarkText")
Expand All @@ -179,47 +179,47 @@ void Session::parseDocOptions(const StringVector& tokens, int& part, std::string
}
else if (name == "timestamp")
{
timestamp = value;
timestamp = std::move(value);
++offset;
}
else if (name == "template")
{
doctemplate = value;
doctemplate = std::move(value);
++offset;
}
else if (name == "deviceFormFactor")
{
_deviceFormFactor = value;
_deviceFormFactor = std::move(value);
++offset;
}
else if (name == "spellOnline")
{
_spellOnline = value;
_spellOnline = std::move(value);
++offset;
}
else if (name == "darkTheme")
{
_darkTheme = value;
_darkTheme = std::move(value);
++offset;
}
else if (name == "darkBackground")
{
_darkBackground = value;
_darkBackground = std::move(value);
++offset;
}
else if (name == "batch")
{
_batch = value;
_batch = std::move(value);
++offset;
}
else if (name == "enableMacrosExecution")
{
_enableMacrosExecution = value;
_enableMacrosExecution = std::move(value);
++offset;
}
else if (name == "macroSecurityLevel")
{
_macroSecurityLevel = value;
_macroSecurityLevel = std::move(value);
++offset;
}
else if (name == "accessibilityState")
Expand Down
2 changes: 1 addition & 1 deletion common/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ namespace Util
r = s.substr(0, n-1);
else
r = s;
return replace(r, "\n", " / ");
return replace(std::move(r), "\n", " / ");
}

#if defined __linux__
Expand Down
2 changes: 1 addition & 1 deletion kit/ChildSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2774,7 +2774,7 @@ bool ChildSession::exportAs(const StringVector& tokens)
std::string encodedWopiFilename;
Poco::URI::encode(wopiFilename, "", encodedWopiFilename);

_exportAsWopiUrl = encodedWopiFilename;
_exportAsWopiUrl = std::move(encodedWopiFilename);

const std::string arguments = "{"
"\"SynchronMode\":{"
Expand Down
8 changes: 4 additions & 4 deletions kit/Kit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2803,12 +2803,12 @@ bool KitSocketPoll::pushToMainThread(LibreOfficeKitCallback callback, int type,
if (mainPoll && mainPoll->getThreadOwner() != std::this_thread::get_id())
{
LOG_TRC("Unusual push callback to main thread");
std::shared_ptr<std::string> pCopy;
std::shared_ptr<std::string> copy;
if (p)
pCopy = std::make_shared<std::string>(p, strlen(p));
mainPoll->addCallback([=] {
copy = std::make_shared<std::string>(p, strlen(p));
mainPoll->addCallback([callback, type, data, copy = std::move(copy)] {
LOG_TRC("Unusual process callback in main thread");
callback(type, pCopy ? pCopy->c_str() : nullptr, data);
callback(type, copy ? copy->c_str() : nullptr, data);
});
return true;
}
Expand Down
6 changes: 4 additions & 2 deletions net/HttpRequest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,8 @@ class Session final : public ProtocolHandlerInterface
catch (std::invalid_argument&) {}
catch (std::out_of_range&) {}

return asyncUpload(fromFile, mimeType, start, end, startIsSuffix, http::StatusCode::PartialContent);
return asyncUpload(std::move(fromFile), std::move(mimeType), start, end,
startIsSuffix, http::StatusCode::PartialContent);
}

try {
Expand All @@ -1793,7 +1794,8 @@ class Session final : public ProtocolHandlerInterface

// FIXME: does not support ranges that specify multiple comma-separated values

return asyncUpload(fromFile, mimeType, start, end, startIsSuffix, http::StatusCode::PartialContent);
return asyncUpload(std::move(fromFile), std::move(mimeType), start, end,
startIsSuffix, http::StatusCode::PartialContent);
}

int getStart() {
Expand Down
2 changes: 1 addition & 1 deletion net/NetUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ bool parseUri(std::string uri, std::string& scheme, std::string& host, std::stri
else
{
// No port, just hostname.
host = uri;
host = std::move(uri);
port.clear();
}

Expand Down
2 changes: 1 addition & 1 deletion test/UnitPerf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class UnitPerf : public UnitWSD
void UnitPerf::testPerf(std::string testType, std::string fileType, std::string traceStr)
{
stats = std::make_shared<Stats>();
stats->setTypeOfTest(testType);
stats->setTypeOfTest(std::move(testType));

TerminatingPoll poll("performance test");

Expand Down
14 changes: 7 additions & 7 deletions tools/Replay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct Histogram {
}
}

std::vector<PerfMetricInfo> GetLatencyStats(std::string typeOfLatency, std::string testPhase)
std::vector<PerfMetricInfo> GetLatencyStats(std::string typeOfLatency, const std::string& testPhase)
{
size_t totalTiles = _items;
size_t subTenCount = _buckets[0];
Expand Down Expand Up @@ -305,19 +305,19 @@ struct Stats {
}
}

PerfMetricInfo GetStressStats(size_t runMs, std::string testPhase)
PerfMetricInfo GetStressStats(size_t runMs, const std::string& testPhase)
{
PerfMetricInfo stressStats = {testPhase, "Stress run (ms)", runMs};
return stressStats;
}

PerfMetricInfo GetCPUUSageStats(size_t cpuUsage, std::string testPhase)
PerfMetricInfo GetCPUUSageStats(size_t cpuUsage, const std::string testPhase)
{
PerfMetricInfo cpuStats = {testPhase, "CPU Usage (us)", cpuUsage};
return cpuStats;
}

std::vector<PerfMetricInfo> GetNetworkStats(size_t recievedKb, size_t sentKb, std::string testPhase)
std::vector<PerfMetricInfo> GetNetworkStats(size_t recievedKb, size_t sentKb, const std::string& testPhase)
{
std::vector<PerfMetricInfo> networkStatsList;

Expand All @@ -327,7 +327,7 @@ struct Stats {
return networkStatsList;
}

PerfMetricInfo GetPeakMemoryUsageStats(size_t peakMemory, std::string testPhase)
PerfMetricInfo GetPeakMemoryUsageStats(size_t peakMemory, const std::string& testPhase)
{
PerfMetricInfo peakMemoryStats = {testPhase, "Peak memory usage (kB)", peakMemory};
return peakMemoryStats;
Expand Down Expand Up @@ -359,7 +359,7 @@ struct Stats {
}
}

void setTypeOfTest(std::string testType)
void setTypeOfTest(const std::string& testType)
{
_testType = testType;
}
Expand Down Expand Up @@ -627,4 +627,4 @@ class StressSocketHandler : public WebSocketHandler
}
};

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
2 changes: 1 addition & 1 deletion tools/Tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ int Tool::main(const std::vector<std::string>& origArgs)
std::vector< std::string > files( toCopy );
std::copy( args.begin() + offset, args.begin() + offset + toCopy, files.begin() );
offset += toCopy;
clients.emplace_back([this, files]{Worker(*this, files).run();});
clients.emplace_back([this, files=std::move(files)]{Worker(*this, files).run();});
}
}

Expand Down
2 changes: 1 addition & 1 deletion wsd/COOLWSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3210,7 +3210,7 @@ void COOLWSD::handleOption(const std::string& optionName,
std::string optName;
std::string optValue;
COOLProtocol::parseNameValuePair(value, optName, optValue);
_overrideSettings[optName] = optValue;
_overrideSettings[optName] = std::move(optValue);
}
else if (optionName == "config-file")
ConfigFile = value;
Expand Down
2 changes: 1 addition & 1 deletion wsd/ClientRequestDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ void ClientRequestDispatcher::handleIncomingMessage(SocketDisposition& dispositi
response->add("X-Content-Type-Options", "nosniff");

disposition.setTransfer(Admin::instance(),
[response](const std::shared_ptr<Socket>& moveSocket)
[response=std::move(response)](const std::shared_ptr<Socket>& moveSocket)
{
const std::shared_ptr<StreamSocket> streamSocket =
std::static_pointer_cast<StreamSocket>(moveSocket);
Expand Down
4 changes: 2 additions & 2 deletions wsd/ClientSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ void ClientSession::handleClipboardRequest(DocumentBroker::ClipboardRequest
std::string commandName;
JsonUtil::findJSONValue(json, "commandName", commandName);
http::Session::FinishedCallback finishedCallback =
[this, docBroker,
commandName](const std::shared_ptr<http::Session>& session)
[this, commandName=std::move(commandName),
docBroker](const std::shared_ptr<http::Session>& session)
{
const std::shared_ptr<const http::Response> httpResponse =
session->response();
Expand Down
2 changes: 1 addition & 1 deletion wsd/FileServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ void FileServerRequestHandler::handleRequest(const HTTPRequest& request,
else
mimeType = "text/plain";

response.setContentType(mimeType);
response.setContentType(std::move(mimeType));

auto it = request.find("If-None-Match");
if (it != request.end())
Expand Down
2 changes: 1 addition & 1 deletion wsd/RequestDetails.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void RequestDetails::dehexify()

res += _uriString.substr(end); // Concatinate the remainder.

_uriString = res; // Replace the original uri with the decoded one.
_uriString = std::move(res); // Replace the original uri with the decoded one.
}
}

Expand Down
2 changes: 1 addition & 1 deletion wsd/Storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void LocalStorage::uploadLocalFileToStorageAsync(const Authorization& /*auth*/,
}

if (asyncUploadCallback)
asyncUploadCallback(AsyncUpload(AsyncUpload::State::Complete, res));
asyncUploadCallback(AsyncUpload(AsyncUpload::State::Complete, std::move(res)));
}

void LockContext::initSupportsLocks()
Expand Down
2 changes: 1 addition & 1 deletion wsd/TileCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ void TileCache::saveDataToStreamCache(StreamType type, const std::string &fileNa

Blob blob = std::make_shared<BlobData>(size);
std::memcpy(blob->data(), data, size);
_streamCache[type][fileName] = blob;
_streamCache[type][fileName] = std::move(blob);
}

void TileCache::TileBeingRendered::dumpState(std::ostream& os)
Expand Down

0 comments on commit f965450

Please sign in to comment.