From: <dg...@su...> - 2009-01-20 12:19:50
|
Author: bellmich Date: Tue Jan 20 13:18:27 2009 New Revision: 174 URL: http://libwbxml.opensync.org/changeset/174 Log: - fixed ticket #26 (extension tokens must not be replaced within normal text) - fixed copyright (new year) 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 Jan 19 18:39:33 2009 (r173) +++ wbxml2/trunk/src/wbxml_encoder.c Tue Jan 20 13:18:27 2009 (r174) @@ -1,7 +1,7 @@ /* * libwbxml, the WBXML Library. * Copyright (C) 2002-2008 Aymerick Jehanne <aym...@je...> - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -2136,8 +2136,17 @@ if (WBXML_STRLEN(encoder->lang->extValueTable[j].xmlName) < 2) continue; - /* Is this Extension Token contained in this Buffer ? */ - if (wbxml_buffer_search_cstr(elt->u.str, (WB_UTINY *) encoder->lang->extValueTable[j].xmlName, 0, &index)) + /* Is this Extension Token contained in this Buffer ? + * + * The Extension Token must start at the beginning of + * the buffer. Otherwise we can damage normal text + * entities like 'My IM-application.' If 'IM' is an + * Extension Token. + * + * 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) { /* Create new Value Element */ if ((new_elt = wbxml_value_element_create()) == NULL) { Modified: wbxml2/trunk/src/wbxml_parser.c ============================================================================== --- wbxml2/trunk/src/wbxml_parser.c Mon Jan 19 18:39:33 2009 (r173) +++ wbxml2/trunk/src/wbxml_parser.c Tue Jan 20 13:18:27 2009 (r174) @@ -1,6 +1,7 @@ /* * libwbxml, the WBXML Library. * Copyright (C) 2002-2008 Aymerick Jehanne <aym...@je...> + * Copyright (C) 2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public |