fix up index/position type for calls of various osrfList* functions
authorGalen Charlton <gmc@esilibrary.com>
Mon, 21 May 2012 21:29:05 +0000 (17:29 -0400)
committerDan Scott <dan@coffeecode.net>
Tue, 22 May 2012 05:54:47 +0000 (01:54 -0400)
osrfListSet, osrfListRemove, osrfListGetIndex, and osrfListExtract
all expect unsigned ints for the index/position parameter.

src/jserver is ignored by this commit as its removal is pending.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
src/gateway/osrf_http_translator.c
src/libopensrf/osrf_json_tools.c
src/libopensrf/osrf_list.c
src/libopensrf/string_array.c
src/router/osrf_router.c

index e945689..83855e9 100644 (file)
@@ -451,7 +451,7 @@ static int osrfHttpTranslatorProcess(osrfHttpTranslator* trans) {
 
             if(trans->complete || trans->connectOnly) {
                 growing_buffer* buf = buffer_init(128);
-                int i;
+                unsigned int i;
                 OSRF_BUFFER_ADD(buf, osrfListGetIndex(trans->messages, 0));
                 for(i = 1; i < trans->messages->size; i++) {
                     buffer_chomp(buf); // chomp off the closing array bracket
index d88c827..2e6893d 100644 (file)
@@ -123,7 +123,7 @@ jsonObject* jsonObjectDecodeClass( const jsonObject* obj ) {
        jsonObject* newObj                       = NULL; 
        const jsonObject* classObj       = NULL;
        const jsonObject* payloadObj = NULL;
-       int i;
+       unsigned int i;
 
        if( obj->type == JSON_HASH ) {
 
@@ -206,7 +206,7 @@ static jsonObject* _jsonObjectEncodeClass( const jsonObject* obj, int ignoreClas
        } else if( obj->type == JSON_ARRAY ) {
 
                newObj = jsonNewObjectType(JSON_ARRAY);
-               int i;
+               unsigned int i;
                for( i = 0; i != obj->size; i++ ) {
                        jsonObjectSetIndex( newObj, i, 
                                _jsonObjectEncodeClass(jsonObjectGetIndex( obj, i ), 0 ));
index 4d4bb11..77cda67 100644 (file)
@@ -77,7 +77,7 @@ int osrfListPush( osrfList* list, void* item ) {
 */
 int osrfListPushFirst( osrfList* list, void* item ) {
        if(!(list && item)) return -1;
-       int i;
+       unsigned int i;
        for( i = 0; i < list->size; i++ )
                if(!list->arrlist[i]) break;
        osrfListSet( list, item, i );
index be0b7d4..b473331 100644 (file)
@@ -160,7 +160,7 @@ int osrfStringArrayContains(
 */
 void osrfStringArrayRemove( osrfStringArray* arr, const char* tstr ) {
        if(!(arr && tstr)) return;
-       int i;
+       unsigned int i;
     char* str;
        int removed = 0;  // boolean
 
index c1f4134..359d98a 100644 (file)
@@ -797,7 +797,7 @@ static void osrfRouterHandleAppRequest( osrfRouter* router, const transport_mess
        const osrfMessage* omsg = NULL;
 
        // Process each osrfMessage
-       int i;
+       unsigned int i;
        for( i = 0; i < router->message_list->size; ++i ) {
 
                omsg = osrfListGetIndex( router->message_list, i );