[json-glib] Actually use the int64 support in the Scanner



commit 9a647104ca77d4c4272845fed4bfae028098afd3
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Aug 12 15:56:00 2009 +0100

    Actually use the int64 support in the Scanner
    
    We switched everything to 64 bit integers but then I forgot to
    enable the support for actually making the tokenizer store the
    parsed integers into a 64 bit value.
    
    Bad Emmanuele, no cookie for you.

 json-glib/json-parser.c  |   12 ++++++------
 json-glib/json-scanner.c |    1 +
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c
index 1da6951..accf876 100644
--- a/json-glib/json-parser.c
+++ b/json-glib/json-parser.c
@@ -470,8 +470,8 @@ json_parse_array (JsonParser *parser,
         {
         case G_TOKEN_INT:
           node = json_node_new (JSON_NODE_VALUE);
-          json_node_set_int (node, negative ? scanner->value.v_int * -1
-                                            : scanner->value.v_int);
+          json_node_set_int (node, negative ? scanner->value.v_int64 * -1
+                                            : scanner->value.v_int64);
           break;
 
         case G_TOKEN_FLOAT:
@@ -699,8 +699,8 @@ json_parse_object (JsonParser *parser,
         {
         case G_TOKEN_INT:
           node = json_node_new (JSON_NODE_VALUE);
-          json_node_set_int (node, negative ? scanner->value.v_int * -1
-                                            : scanner->value.v_int);
+          json_node_set_int (node, negative ? scanner->value.v_int64 * -1
+                                            : scanner->value.v_int64);
           break;
 
         case G_TOKEN_FLOAT:
@@ -843,7 +843,7 @@ json_parse_statement (JsonParser  *parser,
               {
               case G_TOKEN_INT:
                 json_node_set_int (priv->current_node,
-                                   scanner->value.v_int * -1);
+                                   scanner->value.v_int64 * -1);
                 break;
               case G_TOKEN_FLOAT:
                 json_node_set_double (priv->current_node,
@@ -867,7 +867,7 @@ json_parse_statement (JsonParser  *parser,
       priv->root = priv->current_node = json_node_new (JSON_NODE_VALUE);
 
       if (token == G_TOKEN_INT)
-        json_node_set_int (priv->current_node, scanner->value.v_int);
+        json_node_set_int (priv->current_node, scanner->value.v_int64);
       else if (token == G_TOKEN_FLOAT)
         json_node_set_double (priv->current_node, scanner->value.v_float);
       else
diff --git a/json-glib/json-scanner.c b/json-glib/json-scanner.c
index 19e4b30..9cd0938 100644
--- a/json-glib/json-scanner.c
+++ b/json-glib/json-scanner.c
@@ -119,6 +119,7 @@ static JsonScannerConfig json_scanner_config_template =
   TRUE			/* char_2_token */,
   TRUE			/* symbol_2_token */,
   FALSE			/* scope_0_fallback */,
+  TRUE                  /* store_int64 */
 };
 
 /* --- defines --- */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]