Skip to contentSkip to conversation

use "%lld" instead of "%I64d" for qobject_from_jsonf in monitor.c and migration.c

PATCH In review TeLeMan 3 participants 3 messages Feb 8, 2010

lore
Share & tools
lore

TeLeMan

author
#0 lore raw

PATCH 1/1 use "%lld" instead of "%I64d" for qobject_from_jsonf in monitor.c and migration.c

The json parser does not support "%I64d", so we have to use "%lld" instead of "%I64d".

---
 migration.c |    6 +++---
 monitor.c   |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
migration.c +0 -0
index f20315f..f44b857 100644
@@ -180,9 +180,9 @@ static void migrate_put_status(QDict *qdict, const

char *name,

 {
     QObject *obj;

- obj = qobject_from_jsonf("{ 'transferred': %" PRId64 ", "
- "'remaining': %" PRId64 ", "
- "'total': %" PRId64 " }", trans, rem, total);
+ obj = qobject_from_jsonf("{ 'transferred': %lld, "
+ "'remaining': %lld, "

+                               "'total': %lld }", trans, rem, total);
     assert(obj != NULL);

     qdict_put_obj(qdict, name, obj);
monitor.c +2 -2
index a86454b..1738d2a 100644
@@ -342,8 +342,8 @@ static void timestamp_put(QDict *qdict)
     if (err < 0)
         return;
 
-    obj = qobject_from_jsonf("{ 'seconds': %" PRId64 ", "
-                                "'microseconds': %" PRId64 " }",
+    obj = qobject_from_jsonf("{ 'seconds': %lld, "
+                                "'microseconds': %lld }",
                                 (int64_t) tv.tv_sec, (int64_t) tv.tv_usec);
     assert(obj != NULL);
 
Signature · 4 lines
1.6.5.1.1367.gcd48

--
SUN OF A BEACH
#1 lore raw

2010/2/8 TeLeMan <[email protected]>:

Quoted 3 lines

The json parser does not support "%I64d", so we have to use "%lld" instead of "%I64d".

We use PRId64 with json in more places besides migration.c and monitor.c, adding %I64d support in json lexer/parser is a better choice IMO.

Quoted 47 lines
---
 migration.c |    6 +++---
 monitor.c   |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
migration.c +3 -3
index f20315f..f44b857 100644
@@ -180,9 +180,9 @@ static void migrate_put_status(QDict *qdict, const
 char *name,
 {
    QObject *obj;
 
-    obj = qobject_from_jsonf("{ 'transferred': %" PRId64 ", "
-                               "'remaining': %" PRId64 ", "
-                               "'total': %" PRId64 " }", trans, rem, total);
+    obj = qobject_from_jsonf("{ 'transferred': %lld, "
+                               "'remaining': %lld, "
+                               "'total': %lld }", trans, rem, total);
    assert(obj != NULL);
 
    qdict_put_obj(qdict, name, obj);
monitor.c +2 -3
index a86454b..1738d2a 100644
@@ -342,8 +342,8 @@ static void timestamp_put(QDict *qdict)
    if (err < 0)
        return;
 
-    obj = qobject_from_jsonf("{ 'seconds': %" PRId64 ", "
-                                "'microseconds': %" PRId64 " }",
+    obj = qobject_from_jsonf("{ 'seconds': %lld, "
+                                "'microseconds': %lld }",
                                (int64_t) tv.tv_sec, (int64_t) tv.tv_usec);
    assert(obj != NULL);
 
--

1.6.5.1.1367.gcd48

--
SUN OF A BEACH

#2 lore raw
Quoted 8 lines · On Mon, 8 Feb 2010 15:42:30 +0800 Roy Tam <[email protected]> wrote:

2010/2/8 TeLeMan <[email protected]>:

Quoted 3 lines

The json parser does not support "%I64d", so we have to use "%lld" instead of "%I64d".

We use PRId64 with json in more places besides migration.c and monitor.c, adding %I64d support in json lexer/parser is a better choice IMO.

Yes, Anthony didn't merge patches posted to the list yet, I hope
he will merge yours.