[json-glib] reader: Do not do strict type validation on numeric types



commit 9eebf9c886ae7e1e172e3a1efd64f7aa7c79c758
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Jul 15 13:25:53 2012 +0100

    reader: Do not do strict type validation on numeric types
    
    JsonNode will do an implicit conversion for us.

 json-glib/json-reader.c |   21 ---------------------
 1 files changed, 0 insertions(+), 21 deletions(-)
---
diff --git a/json-glib/json-reader.c b/json-glib/json-reader.c
index ddce658..441dffc 100644
--- a/json-glib/json-reader.c
+++ b/json-glib/json-reader.c
@@ -867,13 +867,6 @@ json_reader_get_int_value (JsonReader *reader)
       return 0;
     }
 
-  if (json_node_get_value_type (node) != G_TYPE_INT64)
-    {
-      json_reader_set_error (reader, JSON_READER_ERROR_INVALID_TYPE,
-                             _("The current position does not hold an integer type"));
-      return 0;
-    }
-
   return json_node_get_int (reader->priv->current_node);
 }
 
@@ -912,13 +905,6 @@ json_reader_get_double_value (JsonReader *reader)
       return 0.0;
     }
 
-  if (json_node_get_value_type (node) != G_TYPE_DOUBLE)
-    {
-      json_reader_set_error (reader, JSON_READER_ERROR_INVALID_TYPE,
-                             _("The current position does not hold a floating point type"));
-      return 0.0;
-    }
-
   return json_node_get_double (reader->priv->current_node);
 }
 
@@ -1002,13 +988,6 @@ json_reader_get_boolean_value (JsonReader *reader)
       return FALSE;
     }
 
-  if (json_node_get_value_type (node) != G_TYPE_BOOLEAN)
-    {
-      json_reader_set_error (reader, JSON_READER_ERROR_INVALID_TYPE,
-                             _("The current position does not hold a boolean type"));
-      return FALSE;
-    }
-
   return json_node_get_boolean (node);
 }
 



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