[Libreoffice-commits] online.git: wsd/PrisonerSession.cpp

Tor Lillqvist tml at collabora.com
Tue Jan 3 14:02:01 UTC 2017


 wsd/PrisonerSession.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b01ed94710a44c4d2489df73a56fffbf4b63a3ea
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Jan 3 15:57:50 2017 +0200

    Fix std::string::find() anti-pattern
    
    We want to check for exact match here, so just do it.
    
    Change-Id: I12b0efbc8a0c20c38e2308a4af49681d64c94079

diff --git a/wsd/PrisonerSession.cpp b/wsd/PrisonerSession.cpp
index 749ba79..1848413 100644
--- a/wsd/PrisonerSession.cpp
+++ b/wsd/PrisonerSession.cpp
@@ -186,8 +186,8 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
                 const auto result = parser.parse(stringJSON);
                 const auto& object = result.extract<Poco::JSON::Object::Ptr>();
                 const std::string commandName = object->has("commandName") ? object->get("commandName").toString() : "";
-                if (commandName.find(".uno:CharFontName") != std::string::npos ||
-                    commandName.find(".uno:StyleApply") != std::string::npos)
+                if (commandName == ".uno:CharFontName" ||
+                    commandName == ".uno:StyleApply")
                 {
                     // other commands should not be cached
                     _docBroker->tileCache().saveTextFile(stringMsg, "cmdValues" + commandName + ".txt");


More information about the Libreoffice-commits mailing list