[OpenSRF-GIT] OpenSRF branch master updated. 72e4f650e64328d153962c9da08305c54741be37

Evergreen Git git at git.evergreen-ils.org
Tue May 22 01:56:49 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".

The branch, master has been updated
       via  72e4f650e64328d153962c9da08305c54741be37 (commit)
       via  bc8e92948bc15854d393e16bcf995b2ad99ccfb4 (commit)
       via  f56b12a2026fd02b5770fe8c9a39ad2b6eecf34c (commit)
      from  9b8cc2292969a3c4413df764b735166c723128e3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 72e4f650e64328d153962c9da08305c54741be37
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Mon May 21 17:29:05 2012 -0400

    fix up index/position type for calls of various osrfList* functions
    
    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 at esilibrary.com>

diff --git a/src/gateway/osrf_http_translator.c b/src/gateway/osrf_http_translator.c
index e945689..83855e9 100644
--- a/src/gateway/osrf_http_translator.c
+++ b/src/gateway/osrf_http_translator.c
@@ -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
diff --git a/src/libopensrf/osrf_json_tools.c b/src/libopensrf/osrf_json_tools.c
index d88c827..2e6893d 100644
--- a/src/libopensrf/osrf_json_tools.c
+++ b/src/libopensrf/osrf_json_tools.c
@@ -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 ));
diff --git a/src/libopensrf/osrf_list.c b/src/libopensrf/osrf_list.c
index 4d4bb11..77cda67 100644
--- a/src/libopensrf/osrf_list.c
+++ b/src/libopensrf/osrf_list.c
@@ -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 );
diff --git a/src/libopensrf/string_array.c b/src/libopensrf/string_array.c
index be0b7d4..b473331 100644
--- a/src/libopensrf/string_array.c
+++ b/src/libopensrf/string_array.c
@@ -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
 
diff --git a/src/router/osrf_router.c b/src/router/osrf_router.c
index c1f4134..359d98a 100644
--- a/src/router/osrf_router.c
+++ b/src/router/osrf_router.c
@@ -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 );

commit bc8e92948bc15854d393e16bcf995b2ad99ccfb4
Author: Dan Scott <dan at coffeecode.net>
Date:   Sat May 5 01:58:22 2012 -0400

    Remove comparisons that can never evaluate to true
    
    Using clang as the compiler results in 4 warnings like the following:
    
    osrf_list.c:106:23: warning: comparison of unsigned expression < 0 is
    always false [-Wtautological-compare]
            if(!list || position < 0) return NULL;
                        ~~~~~~~~ ^ ~
    
    (Explanation: "position" is an unsigned int; thus the comparison to < 0
    can never evaluate to true).
    
    Signed-off-by: Dan Scott <dan at coffeecode.net>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/src/libopensrf/osrf_list.c b/src/libopensrf/osrf_list.c
index 7ea3e97..4d4bb11 100644
--- a/src/libopensrf/osrf_list.c
+++ b/src/libopensrf/osrf_list.c
@@ -103,7 +103,7 @@ int osrfListPushFirst( osrfList* list, void* item ) {
 	calling code.
 */
 void* osrfListSet( osrfList* list, void* item, unsigned int position ) {
-	if(!list || position < 0) return NULL;
+	if(!list) return NULL;
 
 	int newsize = list->arrsize;
 
@@ -144,7 +144,7 @@ void* osrfListSet( osrfList* list, void* item, unsigned int position ) {
 	If either parameter is invalid, the return value is NULL.
 */
 void* osrfListGetIndex( const osrfList* list, unsigned int position ) {
-	if(!list || position >= list->size || position < 0) return NULL;
+	if(!list || position >= list->size) return NULL;
 	return list->arrlist[position];
 }
 
@@ -226,7 +226,7 @@ void osrfListSwap( osrfList* one, osrfList* two ) {
 	shift other pointers down to fill in the hole left by the removal.
 */
 void* osrfListRemove( osrfList* list, unsigned int position ) {
-	if(!list || position >= list->size || position < 0) return NULL;
+	if(!list || position >= list->size) return NULL;
 
 	void* olditem = list->arrlist[position];
 	list->arrlist[position] = NULL;
@@ -249,7 +249,7 @@ void* osrfListRemove( osrfList* list, unsigned int position ) {
 	to which the pointer points, even if an item-freeing function has been designated.
 */
 void* osrfListExtract( osrfList* list, unsigned int position ) {
-	if(!list || position >= list->size || position < 0) return NULL;
+	if(!list || position >= list->size) return NULL;
 
 	void* olditem = list->arrlist[position];
 	list->arrlist[position] = NULL;

commit f56b12a2026fd02b5770fe8c9a39ad2b6eecf34c
Author: Dan Scott <dan at coffeecode.net>
Date:   Sat May 5 01:32:25 2012 -0400

    LP954059: Silence uninitialized var warning
    
    Compiling osrf_utf8.c generates the following warning:
    
    osrf_utf8.c:510:29: warning: utf8_char may be used uninitialized in this
    function [-Wuninitialized]
    
    So... initialize utf8_char when we declare it, and make the compiler
    happy.
    
    Signed-off-by: Dan Scott <dan at coffeecode.net>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/src/libopensrf/osrf_utf8.c b/src/libopensrf/osrf_utf8.c
index fe468d7..e83be28 100644
--- a/src/libopensrf/osrf_utf8.c
+++ b/src/libopensrf/osrf_utf8.c
@@ -346,7 +346,7 @@ typedef enum {
 */
 int buffer_append_utf8( growing_buffer* buf, const char* string ) {
 	utf8_state state = S_BEGIN;
-	unsigned long utf8_char;
+	unsigned long utf8_char = 0;
 	const unsigned char* s = (unsigned char *) string;
 	int i = 0;
 	int rc = 0;

-----------------------------------------------------------------------

Summary of changes:
 src/gateway/osrf_http_translator.c |    2 +-
 src/libopensrf/osrf_json_tools.c   |    4 ++--
 src/libopensrf/osrf_list.c         |   10 +++++-----
 src/libopensrf/osrf_utf8.c         |    2 +-
 src/libopensrf/string_array.c      |    2 +-
 src/router/osrf_router.c           |    2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
OpenSRF


More information about the opensrf-commits mailing list