From: <svn...@op...> - 2009-03-31 14:32:07
|
Author: bellmich Date: Tue Mar 31 16:31:54 2009 New Revision: 199 URL: http://libwbxml.opensync.org/changeset/199 Log: fixed warnings from Sun Studio CC Modified: wbxml2/trunk/src/wbxml_encoder.c wbxml2/trunk/src/wbxml_parser.c Modified: wbxml2/trunk/src/wbxml_encoder.c ============================================================================== --- wbxml2/trunk/src/wbxml_encoder.c Mon Mar 30 11:54:06 2009 (r198) +++ wbxml2/trunk/src/wbxml_encoder.c Tue Mar 31 16:31:54 2009 (r199) @@ -2149,8 +2149,7 @@ * * Assumption: The buffer is already normalized. */ - // if (wbxml_buffer_search_cstr(elt->u.str, (WB_UTINY *) encoder->lang->extValueTable[j].xmlName, 0, &index)) - if (wbxml_buffer_compare_cstr(elt->u.str, (WB_UTINY *) encoder->lang->extValueTable[j].xmlName) == 0) + if (wbxml_buffer_compare_cstr(elt->u.str, (WB_TINY *) encoder->lang->extValueTable[j].xmlName) == 0) { /* Create new Value Element */ if ((new_elt = wbxml_value_element_create()) == NULL) { @@ -3131,7 +3130,6 @@ WB_ULONG i = 0, len = 0; WB_UTINY ch = 0; WBXMLError ret = WBXML_OK; - WB_BOOL is_utc = FALSE; WB_UTINY octets[6]; WBXMLBuffer *component = NULL; @@ -3322,11 +3320,11 @@ WB_ULONG len = WBXML_STRLEN(buffer); /* long version of ISO 8601 should be inline encoded */ - if (index(buffer, '-')) + if (strchr((WB_TINY *) buffer, '-')) use_inline = TRUE; - if (index(buffer, '+')) + if (strchr((WB_TINY *) buffer, '+')) use_inline = TRUE; - if (index(buffer, ':')) + if (strchr((WB_TINY *) buffer, ':')) use_inline = TRUE; /* timezone Z should be inline encoded */ Modified: wbxml2/trunk/src/wbxml_parser.c ============================================================================== --- wbxml2/trunk/src/wbxml_parser.c Mon Mar 30 11:54:06 2009 (r198) +++ wbxml2/trunk/src/wbxml_parser.c Tue Mar 31 16:31:54 2009 (r199) @@ -718,11 +718,23 @@ WB_ULONG startpos = parser->pos; #endif /* WBXML_LIB_VERBOSE */ - WBXMLError ret = parse_mb_uint32(parser, &parser->charset); + unsigned int charset = 0; + WBXMLError ret = parse_mb_uint32(parser, &charset); + + if (ret != WBXML_OK) { + WBXML_DEBUG((WBXML_PARSER, "(%d) failed to parse character set", startpos)); + return ret; + } + + const char *charset_name = NULL; + if (!wbxml_charset_get_name(charset, &charset_name)) { + return WBXML_ERROR_NO_CHARSET_CONV; + } + parser->charset = (WBXMLCharsetMIBEnum) charset; WBXML_DEBUG((WBXML_PARSER, "(%d) Parsed charset: '0x%X'", startpos, parser->charset)); - return ret; + return WBXML_OK; } @@ -1696,8 +1708,8 @@ } else { - WB_TINY masks[5] = {0xFC, 0xF8, 0xF0, 0xE0, 0xC0}; - WB_TINY entity[7] = {0, 0, 0, 0, 0, 0, 0}; + WB_UTINY masks[5] = {0xFC, 0xF8, 0xF0, 0xE0, 0xC0}; + WB_UTINY entity[7] = {0, 0, 0, 0, 0, 0, 0}; int index = 5; while (code >= 0x40) @@ -1708,7 +1720,7 @@ entity[index] = masks[index] | code; /* Create result buffer */ - if ( (*result = wbxml_buffer_create_from_cstr(entity + index)) == NULL ) { + if ( (*result = wbxml_buffer_create_from_cstr((WB_TINY *) entity + index)) == NULL ) { return WBXML_ERROR_NOT_ENOUGH_MEMORY; } |