wsd: better empty string operations

Change-Id: Ic14efcaa8a1c345b875c27446b16f51740c55efa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
pull/8563/head
Ashod Nakashian 2024-03-11 08:20:03 -04:00 committed by Michael Meeks
parent 0dfd863fd3
commit 21b0394828
9 changed files with 12 additions and 12 deletions

View File

@ -64,7 +64,7 @@ static std::atomic<bool> ForwardSigUsr2Flag(false); //< Flags to forward SIG_USR
#endif
static size_t ActivityStringIndex = 0;
static std::string ActivityHeader = "";
static std::string ActivityHeader;
static std::array<std::string, 16> ActivityStrings;
static bool UnattendedRun = false;
#if !MOBILEAPP

View File

@ -2725,7 +2725,7 @@ bool ChildSession::updateBlockingCommandStatus(const StringVector& tokens)
sendTextFrameAndLogError("error: cmd=lockstatus kind=failure");
return false;
}
std::string blockedCommands = "";
std::string blockedCommands;
if (restrictedStatus == "true")
blockedCommands += CommandControl::RestrictionManager::getRestrictedCommandListString();
if (lockStatus == "true")

View File

@ -328,7 +328,7 @@ public:
std::string out = msg;
if (tokens.equals(0, "tileprocessed"))
out = ""; // we do this accurately below
out.clear(); // we do this accurately below
else if (tokens.equals(0, "load")) {
std::string url = tokens[1];

View File

@ -370,7 +370,7 @@ static void dumpDiff(const AddrSpace &space,
(str != "[anon]") &&
(str != "[stack]");
if (!haveAnnots)
str = "";
str.clear();
else
map->bumpPointerCountInUnshared();
}

View File

@ -844,7 +844,7 @@ std::string Admin::getLogLines()
lineCount = (int)lines.size();
}
line = ""; // Use the same variable to include result.
line.clear(); // Use the same variable to include result.
// Newest will be on top.
for (int i = lineCount - 1; i >= 0; i--)
{

View File

@ -219,7 +219,7 @@ std::string AdminModel::getAllHistory() const
separator1 = ",";
}
oss << "], \"expiredDocuments\" : [";
separator1 = "";
separator1.clear();
for (const auto& ed : _expiredDocuments)
{
oss << separator1;

View File

@ -1923,7 +1923,7 @@ private:
fonts.clear();
// Clear the saved ETag of the remote font configuration file so that it will be
// re-downloaded, and all fonts mentioned in it re-downloaded and fed to ForKit.
_eTagValue = "";
_eTagValue.clear();
COOLWSD::sendMessageToForKit("exit");
}
@ -2743,7 +2743,7 @@ void COOLWSD::innerInitialize(Application& self)
LOG_INF("Your support key is valid for " << validDays << " days");
COOLWSD::MaxConnections = 1000;
COOLWSD::MaxDocuments = 200;
COOLWSD::OverrideWatermark = "";
COOLWSD::OverrideWatermark.clear();
}
}
}

View File

@ -592,7 +592,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
}
else if (tokens.equals(0, "load"))
{
if (getDocURL() != "")
if (!getDocURL().empty())
{
sendTextFrameAndLogError("error: cmd=load kind=docalreadyloaded");
return false;
@ -1189,14 +1189,14 @@ bool ClientSession::loadDocument(const char* /*buffer*/, int /*length*/,
std::string encodedUserId;
Poco::URI::encode(getUserId(), "", encodedUserId);
oss << " authorid=" << encodedUserId;
encodedUserId = "";
encodedUserId.clear();
Poco::URI::encode(COOLWSD::anonymizeUsername(getUserId()), "", encodedUserId);
oss << " xauthorid=" << encodedUserId;
std::string encodedUserName;
Poco::URI::encode(getUserName(), "", encodedUserName);
oss << " author=" << encodedUserName;
encodedUserName = "";
encodedUserName.clear();
Poco::URI::encode(COOLWSD::anonymizeUsername(getUserName()), "", encodedUserName);
oss << " xauthor=" << encodedUserName;
}

View File

@ -202,7 +202,7 @@ std::string FileServerRequestHandler::uiDefaultsToJSON(const std::string& uiDefa
Poco::JSON::Object presentationDefs;
Poco::JSON::Object drawingDefs;
uiMode = "";
uiMode.clear();
uiTheme = "light";
savedUIState = "true";
StringVector tokens(StringVector::tokenize(uiDefaults, ';'));