From 259a53f80032ba0e641589085ce0636acc4f1ab3 Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 5 Jul 2007 17:58:49 +0000 Subject: [PATCH] removing signedness warnings coming from libxml2 git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@999 9efc2488-bf62-4759-914b-345cdb29e865 --- src/jserver/osrf_chat.c | 9 +++++--- src/libopensrf/transport_message.c | 6 +++--- src/libopensrf/transport_session.c | 42 +++++++++++++++++++------------------- src/libopensrf/xml_utils.c | 2 +- src/objson/json_parser.c | 6 +++--- 5 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/jserver/osrf_chat.c b/src/jserver/osrf_chat.c index 2585719..9a20bd6 100644 --- a/src/jserver/osrf_chat.c +++ b/src/jserver/osrf_chat.c @@ -19,7 +19,10 @@ GNU General Public License for more details. #include static int osrfChatXMLErrorOcurred = 0; -static int osrfChatClientSentDisconnect = 0; + +/* This is used by code in osrfChatPushData, but that code is + currently commented out. Uncomment the next line if needed. */ +//static int osrfChatClientSentDisconnect = 0; /* shorter version of strcmp */ static int eq(const char* a, const char* b) { return (a && b && !strcmp(a,b)); } @@ -613,7 +616,7 @@ int osrfChatHandleConnected( osrfChatNode* node, const char* name, const xmlChar if(eq(name,"message")) { /* drop the old message and start with a new one */ - xmlNodePtr root = xmlNewNode(NULL, name); + xmlNodePtr root = xmlNewNode(NULL, BAD_CAST name); xmlAddAttrs(root, atts); xmlNodePtr oldRoot = xmlDocSetRootElement(node->msgDoc, root); free(node->to); @@ -628,7 +631,7 @@ int osrfChatHandleConnected( osrfChatNode* node, const char* name, const xmlChar } else { /* all non "message" nodes are simply added to the message */ - xmlNodePtr nodep = xmlNewNode(NULL, name); + xmlNodePtr nodep = xmlNewNode(NULL, BAD_CAST name); xmlAddAttrs(nodep, atts); xmlAddChild(xmlDocGetRootElement(node->msgDoc), nodep); } diff --git a/src/libopensrf/transport_message.c b/src/libopensrf/transport_message.c index 5c6862b..6488115 100644 --- a/src/libopensrf/transport_message.c +++ b/src/libopensrf/transport_message.c @@ -95,7 +95,7 @@ transport_message* new_message_from_xml( const char* msg_xml ) { xmlFree(router_class); } if(broadcast) { - if(strcmp(broadcast,"0") ) + if(strcmp((char*) broadcast,"0") ) new_msg->broadcast = 1; xmlFree(broadcast); } @@ -211,9 +211,9 @@ int message_free( transport_message* msg ){ // --------------------------------------------------------------------------------- char* message_to_xml( const transport_message* msg ) { - int bufsize; + //int bufsize; //xmlChar* xmlbuf; - char* encoded_body; + //char* encoded_body; xmlNodePtr message_node; xmlNodePtr body_node; diff --git a/src/libopensrf/transport_session.c b/src/libopensrf/transport_session.c index 43483f0..4fb0290 100644 --- a/src/libopensrf/transport_session.c +++ b/src/libopensrf/transport_session.c @@ -332,7 +332,7 @@ void startElementHandler( if( ! ses ) { return; } - if( strcmp( name, "message" ) == 0 ) { + if( strcmp( (char*) name, "message" ) == 0 ) { ses->state_machine->in_message = 1; buffer_add( ses->from_buffer, get_xml_attr( atts, "from" ) ); buffer_add( ses->recipient_buffer, get_xml_attr( atts, "to" ) ); @@ -350,37 +350,37 @@ void startElementHandler( if( ses->state_machine->in_message ) { - if( strcmp( name, "body" ) == 0 ) { + if( strcmp( (char*) name, "body" ) == 0 ) { ses->state_machine->in_message_body = 1; return; } - if( strcmp( name, "subject" ) == 0 ) { + if( strcmp( (char*) name, "subject" ) == 0 ) { ses->state_machine->in_subject = 1; return; } - if( strcmp( name, "thread" ) == 0 ) { + if( strcmp( (char*) name, "thread" ) == 0 ) { ses->state_machine->in_thread = 1; return; } } - if( strcmp( name, "presence" ) == 0 ) { + if( strcmp( (char*) name, "presence" ) == 0 ) { ses->state_machine->in_presence = 1; buffer_add( ses->from_buffer, get_xml_attr( atts, "from" ) ); buffer_add( ses->recipient_buffer, get_xml_attr( atts, "to" ) ); return; } - if( strcmp( name, "status" ) == 0 ) { + if( strcmp( (char*) name, "status" ) == 0 ) { ses->state_machine->in_status = 1; return; } - if( strcmp( name, "stream:error" ) == 0 ) { + if( strcmp( (char*) name, "stream:error" ) == 0 ) { ses->state_machine->in_error = 1; ses->state_machine->connected = 0; osrfLogWarning( OSRF_LOG_MARK, "Received message from Jabber server" ); @@ -389,21 +389,21 @@ void startElementHandler( /* first server response from a connect attempt */ - if( strcmp( name, "stream:stream" ) == 0 ) { + if( strcmp( (char*) name, "stream:stream" ) == 0 ) { if( ses->state_machine->connecting == CONNECTING_1 ) { ses->state_machine->connecting = CONNECTING_2; buffer_add( ses->session_id, get_xml_attr(atts, "id") ); } } - if( strcmp( name, "handshake" ) == 0 ) { + if( strcmp( (char*) name, "handshake" ) == 0 ) { ses->state_machine->connected = 1; ses->state_machine->connecting = 0; return; } - if( strcmp( name, "error" ) == 0 ) { + if( strcmp( (char*) name, "error" ) == 0 ) { ses->state_machine->in_message_error = 1; buffer_add( ses->message_error_type, get_xml_attr( atts, "type" ) ); ses->message_error_code = atoi( get_xml_attr( atts, "code" ) ); @@ -412,7 +412,7 @@ void startElementHandler( return; } - if( strcmp( name, "iq" ) == 0 ) { + if( strcmp( (char*) name, "iq" ) == 0 ) { ses->state_machine->in_iq = 1; if( strcmp( get_xml_attr(atts, "type"), "result") == 0 @@ -433,7 +433,7 @@ char* get_xml_attr( const xmlChar** atts, char* attr_name ) { int i; if (atts != NULL) { for(i = 0;(atts[i] != NULL);i++) { - if( strcmp( atts[i++], attr_name ) == 0 ) { + if( strcmp( (char*) atts[i++], attr_name ) == 0 ) { if( atts[i] != NULL ) { return (char*) atts[i]; } @@ -451,7 +451,7 @@ void endElementHandler( void *session, const xmlChar *name) { transport_session* ses = (transport_session*) session; if( ! ses ) { return; } - if( strcmp( name, "message" ) == 0 ) { + if( strcmp( (char*) name, "message" ) == 0 ) { /* pass off the message info the callback */ @@ -489,22 +489,22 @@ void endElementHandler( void *session, const xmlChar *name) { return; } - if( strcmp( name, "body" ) == 0 ) { + if( strcmp( (char*) name, "body" ) == 0 ) { ses->state_machine->in_message_body = 0; return; } - if( strcmp( name, "subject" ) == 0 ) { + if( strcmp( (char*) name, "subject" ) == 0 ) { ses->state_machine->in_subject = 0; return; } - if( strcmp( name, "thread" ) == 0 ) { + if( strcmp( (char*) name, "thread" ) == 0 ) { ses->state_machine->in_thread = 0; return; } - if( strcmp( name, "iq" ) == 0 ) { + if( strcmp( (char*) name, "iq" ) == 0 ) { ses->state_machine->in_iq = 0; if( ses->message_error_code > 0 ) { osrfLogWarning( OSRF_LOG_MARK, "Error in IQ packet: code %d", ses->message_error_code ); @@ -514,7 +514,7 @@ void endElementHandler( void *session, const xmlChar *name) { return; } - if( strcmp( name, "presence" ) == 0 ) { + if( strcmp( (char*) name, "presence" ) == 0 ) { ses->state_machine->in_presence = 0; /* if( ses->presence_callback ) { @@ -525,17 +525,17 @@ void endElementHandler( void *session, const xmlChar *name) { return; } - if( strcmp( name, "status" ) == 0 ) { + if( strcmp( (char*) name, "status" ) == 0 ) { ses->state_machine->in_status = 0; return; } - if( strcmp( name, "error" ) == 0 ) { + if( strcmp( (char*) name, "error" ) == 0 ) { ses->state_machine->in_message_error = 0; return; } - if( strcmp( name, "error:error" ) == 0 ) { + if( strcmp( (char*) name, "error:error" ) == 0 ) { ses->state_machine->in_error = 0; return; } diff --git a/src/libopensrf/xml_utils.c b/src/libopensrf/xml_utils.c index e3ef206..ec9e5c3 100644 --- a/src/libopensrf/xml_utils.c +++ b/src/libopensrf/xml_utils.c @@ -97,7 +97,7 @@ char* xmlSaxAttr( const xmlChar** atts, char* name ) { if( atts && name ) { int i; for(i = 0; (atts[i] != NULL); i++) { - if(!strcmp(atts[i], name)) { + if(!strcmp((char*) atts[i], name)) { if(atts[++i]) return (char*) atts[i]; } } diff --git a/src/objson/json_parser.c b/src/objson/json_parser.c index 8313872..bf4eb27 100644 --- a/src/objson/json_parser.c +++ b/src/objson/json_parser.c @@ -503,18 +503,18 @@ int json_parse_json_string(char* string, unsigned long* index, jsonObject* obj, if (ucs_char < 0x80) { utf_out[0] = ucs_char; - buffer_add(buf, utf_out); + buffer_add(buf, (char*) utf_out); } else if (ucs_char < 0x800) { utf_out[0] = 0xc0 | (ucs_char >> 6); utf_out[1] = 0x80 | (ucs_char & 0x3f); - buffer_add(buf, utf_out); + buffer_add(buf, (char*) utf_out); } else { utf_out[0] = 0xe0 | (ucs_char >> 12); utf_out[1] = 0x80 | ((ucs_char >> 6) & 0x3f); utf_out[2] = 0x80 | (ucs_char & 0x3f); - buffer_add(buf, utf_out); + buffer_add(buf, (char*) utf_out); } /* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */ -- 2.11.0