[Libreoffice-commits] core.git: vcl/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Apr 16 20:47:45 UTC 2017


 vcl/source/uitest/uiobject.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 2951fea8236f7455e5dde36b5e799c1e1448cf40
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Mar 7 11:49:39 2017 +0100

    uitest: escape the " for the json string conversion
    
    Change-Id: I989b8add4bba0b10dedb126e5014be59879ed898
    Reviewed-on: https://gerrit.libreoffice.org/36585
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 24fac7a4dd31..74d75b7a2fad 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -442,6 +442,15 @@ OUString WindowUIObject::get_name() const
     return OUString("WindowUIObject");
 }
 
+namespace {
+
+OUString escape(const OUString& rStr)
+{
+    return rStr.replaceAll("\"", "\\\"");
+}
+
+}
+
 OUString WindowUIObject::dumpState() const
 {
     OUStringBuffer aStateString = "{\"name\":\"" + mxWindow->get_id() + "\"";
@@ -449,7 +458,7 @@ OUString WindowUIObject::dumpState() const
     StringMap aState = const_cast<WindowUIObject*>(this)->get_state();
     for (auto itr = aState.begin(), itrEnd = aState.end(); itr != itrEnd; ++itr)
     {
-        OUString property = ",\"" + itr->first + "\":\"" + itr->second + "\"";
+        OUString property = ",\"" + itr->first + "\":\"" + escape(itr->second) + "\"";
         aStateString.append(property);
     }
 


More information about the Libreoffice-commits mailing list