From 594cd9a9074a6f634f7ac71f7d0f964f5af14a30 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 20 Nov 2007 18:57:16 +0000 Subject: [PATCH] for-loop initial declaration issue; realigned some const-ification git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1132 9efc2488-bf62-4759-914b-345cdb29e865 --- include/opensrf/osrf_json.h | 2 +- include/opensrf/osrf_json_xml.h | 2 +- src/libopensrf/osrf_json_xml.c | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/opensrf/osrf_json.h b/include/opensrf/osrf_json.h index 64844fd..0f4f8cb 100644 --- a/include/opensrf/osrf_json.h +++ b/include/opensrf/osrf_json.h @@ -369,7 +369,7 @@ jsonObject* jsonObjectEncodeClass( const jsonObject* obj ); /** * Generates an XML representation of a JSON object */ -char* jsonObjectToXML(jsonObject*); +char* jsonObjectToXML(const jsonObject*); /* diff --git a/include/opensrf/osrf_json_xml.h b/include/opensrf/osrf_json_xml.h index c01b1ac..2381da0 100644 --- a/include/opensrf/osrf_json_xml.h +++ b/include/opensrf/osrf_json_xml.h @@ -15,7 +15,7 @@ /** * Generates an XML representation of a JSON object */ -char* jsonObjectToXML(jsonObject*); +char* jsonObjectToXML( const jsonObject*); /* diff --git a/src/libopensrf/osrf_json_xml.c b/src/libopensrf/osrf_json_xml.c index a15b1e2..ecca429 100644 --- a/src/libopensrf/osrf_json_xml.c +++ b/src/libopensrf/osrf_json_xml.c @@ -229,7 +229,7 @@ jsonObject* jsonXMLToJSONObject(const char* xml) { static char* _escape_xml (const char*); -static int _recurse_jsonObjectToXML(jsonObject*, growing_buffer*); +static int _recurse_jsonObjectToXML(const jsonObject*, growing_buffer*); char* jsonObjectToXML(const jsonObject* obj) { @@ -304,8 +304,9 @@ int _recurse_jsonObjectToXML(const jsonObject* obj, growing_buffer* res_xml) { else buffer_add(res_xml,""); - for ( int i = 0; i!= obj->size; i++ ) - _recurse_jsonObjectToXML(jsonObjectGetIndex(obj,i), res_xml); + int i; + for ( i = 0; i!= obj->size; i++ ) + _recurse_jsonObjectToXML(jsonObjectGetIndex(obj,i), res_xml); buffer_add(res_xml,""); -- 2.43.2