Patchwork [3/6] qjson: Handle "\f"

login
register
mail settings
Submitter Luiz Capitulino
Date May 19, 2010, 9:15 p.m.
Message ID <1274303733-3700-4-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/53027/
State New
Headers show

Comments

Luiz Capitulino - May 19, 2010, 9:15 p.m.
It's valid JSON and should be handled.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 json-parser.c |    4 ++++
 qjson.c       |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)

Patch

diff --git a/json-parser.c b/json-parser.c
index b55d763..83212bc 100644
--- a/json-parser.c
+++ b/json-parser.c
@@ -206,6 +206,10 @@  static QString *qstring_from_escaped_str(JSONParserContext *ctxt, QObject *token
                 qstring_append(str, "\b");
                 ptr++;
                 break;
+            case 'f':
+                qstring_append(str, "\f");
+                ptr++;
+                break;
             case 'n':
                 qstring_append(str, "\n");
                 ptr++;
diff --git a/qjson.c b/qjson.c
index 483c667..e4ee433 100644
--- a/qjson.c
+++ b/qjson.c
@@ -158,6 +158,9 @@  static void to_json(const QObject *obj, QString *str)
                 case '\b':
                     qstring_append(str, "\\b");
                     break;
+                case '\f':
+                    qstring_append(str, "\\f");
+                    break;
                 case '\n':
                     qstring_append(str, "\\n");
                     break;