[seed] libseed: seed_value_to_(int)(uint)(long)(ulong)(int64)(uint64) should not choke on boolean



commit ad46d5dfd1d429d58c4b3848d01fa124b911498e
Author: Robert Carr <racarr svn gnome org>
Date:   Wed May 27 04:01:46 2009 -0400

    libseed: seed_value_to_(int)(uint)(long)(ulong)(int64)(uint64) should not choke on boolean
---
 libseed/seed-types.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 7b55a01..4a68b43 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -1326,7 +1326,7 @@ seed_value_from_boolean (JSContextRef ctx,
 guint
 seed_value_to_uint (JSContextRef ctx, JSValueRef val, JSValueRef * exception)
 {
-  if (!JSValueIsNumber (ctx, val))
+  if (!JSValueIsNumber (ctx, val) && !JSValueIsBoolean (ctx, val))
     {
       if (!JSValueIsNull (ctx, val))
 	{
@@ -1371,7 +1371,7 @@ seed_value_from_uint (JSContextRef ctx, guint val, JSValueRef * exception)
 gint
 seed_value_to_int (JSContextRef ctx, JSValueRef val, JSValueRef * exception)
 {
-  if (!JSValueIsNumber (ctx, val))
+  if (!JSValueIsNumber (ctx, val) && !JSValueIsBoolean (ctx, val))
     {
       if (!JSValueIsNull (ctx, val))
 	seed_make_exception (ctx, exception, "ConversionError",
@@ -1519,7 +1519,7 @@ seed_value_from_uchar (JSContextRef ctx, guchar val, JSValueRef * exception)
 glong
 seed_value_to_long (JSContextRef ctx, JSValueRef val, JSValueRef * exception)
 {
-  if (!JSValueIsNumber (ctx, val))
+  if (!JSValueIsNumber (ctx, val) && !JSValueIsBoolean (ctx, val))
     {
       if (!JSValueIsNull (ctx, val))
 	seed_make_exception (ctx, exception, "ConversionError",
@@ -1604,7 +1604,7 @@ seed_value_from_ulong (JSContextRef ctx, gulong val, JSValueRef * exception)
 gint64
 seed_value_to_int64 (JSContextRef ctx, JSValueRef val, JSValueRef * exception)
 {
-  if (!JSValueIsNumber (ctx, val))
+  if (!JSValueIsNumber (ctx, val) && !JSValueIsBoolean (ctx, val))
     {
       if (!JSValueIsNull (ctx, val))
 	seed_make_exception (ctx, exception, "ConversionError",
@@ -1648,7 +1648,7 @@ guint64
 seed_value_to_uint64 (JSContextRef ctx,
 		      JSValueRef val, JSValueRef * exception)
 {
-  if (!JSValueIsNumber (ctx, val))
+  if (!JSValueIsNumber (ctx, val) && !JSValueIsBoolean (ctx, val))
     {
       if (!JSValueIsNull (ctx, val))
 	seed_make_exception (ctx, exception, "ConversionError",



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