[Libreoffice-commits] online.git: common/MessageQueue.cpp test/UnitCopyPaste.cpp wsd/Admin.cpp wsd/ClientSession.cpp wsd/LOOLWSD.cpp

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 23 04:42:17 UTC 2020


 common/MessageQueue.cpp |    2 +-
 test/UnitCopyPaste.cpp  |    2 +-
 wsd/Admin.cpp           |    2 +-
 wsd/ClientSession.cpp   |    2 +-
 wsd/LOOLWSD.cpp         |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 4a57654d884539406f6b87f937f7d3b79e780545
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Jun 2 23:17:04 2020 -0400
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Tue Jun 23 06:41:58 2020 +0200

    wsd: avoid unnecessary string ops
    
    Change-Id: Ia5a6f2d7a260edaf8bb294693be12a434a2c30fe
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96376
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/common/MessageQueue.cpp b/common/MessageQueue.cpp
index a57525984..064a27717 100644
--- a/common/MessageQueue.cpp
+++ b/common/MessageQueue.cpp
@@ -162,7 +162,7 @@ bool extractRectangle(const StringVector& tokens, int& x, int& y, int& w, int& h
     if (tokens.size() < 5)
         return false;
 
-    if (tokens[3] == "EMPTY,")
+    if (tokens.equals(3, "EMPTY,"))
     {
         part = std::atoi(tokens[4].c_str());
         return true;
diff --git a/test/UnitCopyPaste.cpp b/test/UnitCopyPaste.cpp
index 17f7ba381..8b8e6af70 100644
--- a/test/UnitCopyPaste.cpp
+++ b/test/UnitCopyPaste.cpp
@@ -108,7 +108,7 @@ public:
         std::string value;
 
         // allow empty clipboards
-        if (clipboard && mimeType == "" && content == "")
+        if (clipboard && mimeType.empty() && content.empty())
             return true;
 
         if (!clipboard || !clipboard->findType(mimeType, value))
diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index c1aec45da..8d0c9373d 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -606,7 +606,7 @@ unsigned Admin::getNetStatsInterval()
 
 std::string Admin::getChannelLogLevels()
 {
-    std::string result = "";
+    std::string result;
     // Get the list of channels..
     std::vector<std::string> nameList;
     Log::logger().names(nameList);
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 904867b18..614a75fed 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -452,7 +452,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
         sendTextFrameAndLogError("error: cmd=" + tokens[0] + " kind=unknown");
         return false;
     }
-    else if (getDocURL() == "")
+    else if (getDocURL().empty())
     {
         sendTextFrameAndLogError("error: cmd=" + tokens[0] + " kind=nodocloaded");
         return false;
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 587c22160..96be14b4e 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2769,7 +2769,7 @@ private:
             ConvertToPartHandler handler(/*convertTo =*/ true);
             HTMLForm form(request, message, handler);
 
-            std::string sOptions("");
+            std::string sOptions;
             std::string format = (form.has("format") ? form.get("format") : "");
             std::string sFullSheetPreview = (form.has("FullSheetPreview") ? form.get("FullSheetPreview") : "");
             bool bFullSheetPreview = sFullSheetPreview == "true" ? true : false;


More information about the Libreoffice-commits mailing list