From: <svn...@op...> - 2010-10-12 10:18:19
|
Author: bellmich Date: Tue Oct 12 12:18:09 2010 New Revision: 229 URL: http://libwbxml.opensync.org/changeset/229 Log: Fixed MS VisualStudio 2008 issue with variable definitions (committed changes from ticket #42) Modified: wbxml2/trunk/ChangeLog wbxml2/trunk/src/wbxml_encoder.c wbxml2/trunk/src/wbxml_parser.c wbxml2/trunk/src/wbxml_tree_clb_xml.c Modified: wbxml2/trunk/ChangeLog ============================================================================== --- wbxml2/trunk/ChangeLog Mon Mar 29 11:10:04 2010 (r228) +++ wbxml2/trunk/ChangeLog Tue Oct 12 12:18:09 2010 (r229) @@ -1,3 +1,6 @@ + * Fixed MS VisualStudio 2008 issue with variable definitions + (committed changes from ticket #42) + 2010-03-29 Michael Bell <mic...@we...> * Released 0.10.8 * Removed OMA DM tests because the OMA did not grant a permission Modified: wbxml2/trunk/src/wbxml_encoder.c ============================================================================== --- wbxml2/trunk/src/wbxml_encoder.c Mon Mar 29 11:10:04 2010 (r228) +++ wbxml2/trunk/src/wbxml_encoder.c Tue Oct 12 12:18:09 2010 (r229) @@ -3133,6 +3133,10 @@ WB_UTINY octets[6]; WBXMLBuffer *component = NULL; + /* definitions first ... or some compilers don't like it */ + unsigned int year; + unsigned int month; + len = WBXML_STRLEN(buffer); /* Create temp Buffer */ @@ -3217,7 +3221,7 @@ goto error; } wbxml_buffer_delete(component, 4, 10); - unsigned int year = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); + year = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); octets[0] = (WB_UTINY) ((year & 0xfc0) >> 6); /* 6 bits */ octets[1] = (WB_UTINY) (year & 0x3f); /* 6 bits */ @@ -3230,7 +3234,7 @@ } wbxml_buffer_delete(component, 0, 4); wbxml_buffer_delete(component, 2, 8); - unsigned int month = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); + month = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); octets[1] <<= 2; octets[1] += (WB_UTINY) ((month & 0xc) >> 2); /* 2 bits */ Modified: wbxml2/trunk/src/wbxml_parser.c ============================================================================== --- wbxml2/trunk/src/wbxml_parser.c Mon Mar 29 11:10:04 2010 (r228) +++ wbxml2/trunk/src/wbxml_parser.c Tue Oct 12 12:18:09 2010 (r229) @@ -714,6 +714,9 @@ */ static WBXMLError parse_charset(WBXMLParser *parser) { + /* definitions first ... or some compilers don't like it */ + const char *charset_name = NULL; + #if defined( WBXML_LIB_VERBOSE ) WB_ULONG startpos = parser->pos; #endif /* WBXML_LIB_VERBOSE */ @@ -726,7 +729,6 @@ return ret; } - const char *charset_name = NULL; if (!wbxml_charset_get_name(charset, &charset_name)) { return WBXML_ERROR_NO_CHARSET_CONV; } Modified: wbxml2/trunk/src/wbxml_tree_clb_xml.c ============================================================================== --- wbxml2/trunk/src/wbxml_tree_clb_xml.c Mon Mar 29 11:10:04 2010 (r228) +++ wbxml2/trunk/src/wbxml_tree_clb_xml.c Tue Oct 12 12:18:09 2010 (r229) @@ -202,6 +202,9 @@ #if defined( WBXML_SUPPORT_SYNCML ) if (WBXML_STRCMP(localName, "syncml:devinf:DevInf") == 0 || WBXML_STRCMP(localName, "syncml:dmddf1.2:MgmtTree") == 0) { + /* definitions first ... or some compilers don't like it */ + const WBXMLLangEntry *lang; + /* Get embedded DevInf or DM DDF Document */ embed_doc = wbxml_buffer_create(tree_ctx->input_buff + tree_ctx->skip_start, XML_GetCurrentByteIndex(tree_ctx->xml_parser) - tree_ctx->skip_start, @@ -229,7 +232,6 @@ } /* Add doctype to give the XML parser a chance */ - const WBXMLLangEntry *lang; if (WBXML_STRCMP(localName, "syncml:dmddf1.2:MgmtTree") == 0 && tree_ctx->tree->lang->langID != WBXML_LANG_SYNCML_SYNCML12) { |