[Opensrf-commits] r1040 - in branches/new-json2: include/opensrf src/libopensrf

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Jul 16 11:08:15 EDT 2007


Author: erickson
Date: 2007-07-16 11:02:51 -0400 (Mon, 16 Jul 2007)
New Revision: 1040

Modified:
   branches/new-json2/include/opensrf/osrf_json.h
   branches/new-json2/include/opensrf/osrf_json_utils.h
   branches/new-json2/src/libopensrf/osrf_json_object.c
   branches/new-json2/src/libopensrf/osrf_json_parser.c
Log:
changed referenced from "long double" back to "double" for backwards compatibility

Modified: branches/new-json2/include/opensrf/osrf_json.h
===================================================================
--- branches/new-json2/include/opensrf/osrf_json.h	2007-07-16 13:08:55 UTC (rev 1039)
+++ branches/new-json2/include/opensrf/osrf_json.h	2007-07-16 15:02:51 UTC (rev 1040)
@@ -94,7 +94,7 @@
 	void (*handleNull)			(void* userData);
 	void (*handleString)			(void* userData, char* string);
 	void (*handleBool)			(void* userData, int boolval);
-	void (*handleNumber)			(void* userData, long double num);
+	void (*handleNumber)			(void* userData, double num);
 	void (*handleError)			(void* userData, char* err, ...);
 };
 typedef struct jsonParserHandlerStruct jsonParserHandler;
@@ -109,7 +109,8 @@
 		osrfList*	l;		/* array container */
 		char* 		s;		/* string */
 		int 			b;		/* bool */
-		long double	n;		/* number */
+//		double	n;		/* number */
+		double	n;		/* number */
 	} value;
 };
 typedef struct _jsonObjectStruct jsonObject;
@@ -186,7 +187,7 @@
 /**
  * Creates a new number object
  */
-jsonObject* jsonNewNumberObject( long double num );
+jsonObject* jsonNewNumberObject( double num );
 
 
 /**
@@ -284,7 +285,7 @@
 	is a string.  Otherwise returns NULL*/
 char* jsonObjectGetString(const jsonObject*);
 
-long double jsonObjectGetNumber( const jsonObject* obj );
+double jsonObjectGetNumber( const jsonObject* obj );
 
 /* sets the string data */
 void jsonObjectSetString(jsonObject* dest, const char* string);

Modified: branches/new-json2/include/opensrf/osrf_json_utils.h
===================================================================
--- branches/new-json2/include/opensrf/osrf_json_utils.h	2007-07-16 13:08:55 UTC (rev 1039)
+++ branches/new-json2/include/opensrf/osrf_json_utils.h	2007-07-16 15:02:51 UTC (rev 1040)
@@ -70,7 +70,7 @@
 void _jsonHandleNull(void*);
 void _jsonHandleString(void*, char* string);
 void _jsonHandleBool(void*, int boolval);
-void _jsonHandleNumber(void*, long double num);
+void _jsonHandleNumber(void*, double num);
 void _jsonHandleError(void*, char* str, ...);
 
 struct jsonInternalParserStruct {

Modified: branches/new-json2/src/libopensrf/osrf_json_object.c
===================================================================
--- branches/new-json2/src/libopensrf/osrf_json_object.c	2007-07-16 13:08:55 UTC (rev 1039)
+++ branches/new-json2/src/libopensrf/osrf_json_object.c	2007-07-16 15:02:51 UTC (rev 1040)
@@ -45,7 +45,7 @@
 	return o;
 }
 
-jsonObject* jsonNewNumberObject( long double num ) {
+jsonObject* jsonNewNumberObject( double num ) {
 	jsonObject* o = jsonNewObject(NULL);
 	o->type = JSON_NUMBER;
 	o->value.n = num;
@@ -151,14 +151,14 @@
 			break;
 
 		case JSON_NUMBER: {
-			long double x = obj->value.n;
+			double x = obj->value.n;
 			if( x == (long) x ) {
 				LONG_TO_STRING((long)x);	
 				OSRF_BUFFER_ADD(buf, LONGSTR);
 
 			} else {
-				LONG_DOUBLE_TO_STRING(x);
-				OSRF_BUFFER_ADD(buf, LONGDOUBLESTR);
+				DOUBLE_TO_STRING(x);
+				OSRF_BUFFER_ADD(buf, DOUBLESTR);
 			}
 			break;
 		}
@@ -288,7 +288,7 @@
 	return (obj && obj->type == JSON_STRING) ? obj->value.s : NULL;
 }
 
-long double jsonObjectGetNumber( const jsonObject* obj ) {
+double jsonObjectGetNumber( const jsonObject* obj ) {
 	return (obj && obj->type == JSON_NUMBER) ? obj->value.n : 0;
 }
 
@@ -379,8 +379,8 @@
 				value = strdup(LONGSTR);
 
 			} else {
-				LONG_DOUBLE_TO_STRING(o->value.n);
-				value = strdup(LONGDOUBLESTR);
+				DOUBLE_TO_STRING(o->value.n);
+				value = strdup(DOUBLESTR);
 			}
 
 			break;

Modified: branches/new-json2/src/libopensrf/osrf_json_parser.c
===================================================================
--- branches/new-json2/src/libopensrf/osrf_json_parser.c	2007-07-16 13:08:55 UTC (rev 1039)
+++ branches/new-json2/src/libopensrf/osrf_json_parser.c	2007-07-16 15:02:51 UTC (rev 1040)
@@ -319,7 +319,7 @@
 
 	/* make me more strict */
 	char* err = NULL;
-	long double d = strtod(ctx->buffer->buf, &err);
+	double d = strtod(ctx->buffer->buf, &err);
 	if(err && err[0] != '\0') 
 		return _jsonParserError(ctx, "Invalid number sequence");
 	JSON_STATE_REMOVE(ctx, JSON_STATE_IN_NUMBER);
@@ -586,7 +586,7 @@
 	_jsonInsertParserItem(p, obj);
 }
 
-void _jsonHandleNumber(void* ctx, long double num) {
+void _jsonHandleNumber(void* ctx, double num) {
 	jsonInternalParser* p = (jsonInternalParser*) ctx;
 	_jsonInsertParserItem(p, jsonNewNumberObject(num));
 }



More information about the opensrf-commits mailing list