[Opensrf-commits] r1042 - branches/new-json2/src/libopensrf

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jul 17 10:54:30 EDT 2007


Author: erickson
Date: 2007-07-17 10:48:57 -0400 (Tue, 17 Jul 2007)
New Revision: 1042

Modified:
   branches/new-json2/src/libopensrf/osrf_json_object.c
Log:
returning json NULL object (instead of raw NULL) when cloningNULL items.  this ensures lists/hashes with raw NULL items are fully fleshed on clone, since jsonObjectSetIndex requires a non-NULL item

Modified: branches/new-json2/src/libopensrf/osrf_json_object.c
===================================================================
--- branches/new-json2/src/libopensrf/osrf_json_object.c	2007-07-17 14:07:43 UTC (rev 1041)
+++ branches/new-json2/src/libopensrf/osrf_json_object.c	2007-07-17 14:48:57 UTC (rev 1042)
@@ -152,9 +152,9 @@
 
 		case JSON_NUMBER: {
 			double x = obj->value.n;
-			if( x == (long) x ) {
-				LONG_TO_STRING((long)x);	
-				OSRF_BUFFER_ADD(buf, LONGSTR);
+			if( x == (int) x ) {
+				INT_TO_STRING((int)x);	
+				OSRF_BUFFER_ADD(buf, INTSTR);
 
 			} else {
 				DOUBLE_TO_STRING(x);
@@ -316,7 +316,7 @@
 }
 
 jsonObject* jsonObjectClone( const jsonObject* o ) {
-    if(!o) return NULL;
+    if(!o) return jsonNewObject(NULL);
 
     int i;
     jsonObject* arr; 
@@ -375,8 +375,8 @@
 		case JSON_NUMBER: {
 
 			if( o->value.n == (int) o->value.n ) {
-				LONG_TO_STRING((long) o->value.n);	
-				value = strdup(LONGSTR);
+				INT_TO_STRING((int) o->value.n);	
+				value = strdup(INTSTR);
 
 			} else {
 				DOUBLE_TO_STRING(o->value.n);



More information about the opensrf-commits mailing list