cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [4/7] git commit: cplugin: fix escaping of QVariantMap
Date Mon, 18 Nov 2013 23:40:44 GMT
cplugin: fix escaping of QVariantMap


Project: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/commit/143d6a60
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/tree/143d6a60
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/diff/143d6a60

Branch: refs/heads/master
Commit: 143d6a6048d5affe9b08aaf286c3defc42e01040
Parents: 97f1955
Author: Maxim Ermilov <maxim.ermilov@canonical.com>
Authored: Wed Nov 13 09:57:06 2013 +0400
Committer: Maxim Ermilov <maxim.ermilov@canonical.com>
Committed: Wed Nov 13 09:57:06 2013 +0400

----------------------------------------------------------------------
 src/cplugin.cpp | 11 +++++------
 src/cplugin.h   |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/143d6a60/src/cplugin.cpp
----------------------------------------------------------------------
diff --git a/src/cplugin.cpp b/src/cplugin.cpp
index b03164a..c13a19c 100644
--- a/src/cplugin.cpp
+++ b/src/cplugin.cpp
@@ -125,13 +125,13 @@ namespace CordovaInternal {
         case QMetaType::Bool:
             return format(t.toBool());
         case QMetaType::QVariantMap:
-            return format(t.toMap(), true);
+            return format(t.toMap());
         default:
             throw std::exception();
         }
     }
 
-    QString format(const QVariantMap &t, bool clean) {
+    QString format(const QVariantMap &t) {
       // QString(QJsonDocument(QJsonObject::fromVariantMap(t)).toJson()) is not good enough
       // e.g. QVariant(qlonglong, 1374944677139) ) -> 1.37494e+12
 
@@ -142,10 +142,9 @@ namespace CordovaInternal {
               res += ", ";
           res += QString("%1: %2").arg(format(p.first)).arg(format(p.second));
       }
-      if (clean)
-          res = QString("{%1}").arg(res);
-      else
-          res = QString("JSON.parse('{%1}')").arg(res);
+
+      res = QString("{%1}").arg(res);
+
       return res;
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/143d6a60/src/cplugin.h
----------------------------------------------------------------------
diff --git a/src/cplugin.h b/src/cplugin.h
index 92d62bc..58179ec 100644
--- a/src/cplugin.h
+++ b/src/cplugin.h
@@ -63,7 +63,7 @@ namespace CordovaInternal {
     QString format(const double &t);
     QString format(const float &t);
     QString format(const QVariant &t);
-    QString format(const QVariantMap &t, bool clean = false);
+    QString format(const QVariantMap &t);
     QString format(bool t);
 
     template<class Head = QString>


Mime
View raw message