xmloff/source/transform/AttrTransformerAction.hxx | 6 ------ xmloff/source/transform/ElemTransformerAction.hxx | 6 ++++++ xmloff/source/transform/MergeElemTContext.cxx | 4 ++-- xmloff/source/transform/Oasis2OOo.cxx | 14 +++++++------- 4 files changed, 15 insertions(+), 15 deletions(-)
New commits: commit 76dce95eed6892d729fbea2b990911edd82ded82 Author: Michael Stahl <mst...@redhat.com> Date: Mon Nov 3 21:20:56 2014 +0100 coverity#705391: xmloff: XMLMergeElemTransformerContext misuse of enum The enum types XMLElemTransformerAction and XMLAttrTransformerAction use the same integer values so a mixture of values from these 2 in one switch is very suspicious. In the various *ActionTable arrays in OOo2Oasis/Oasis2OOo there is just one such array that mixes values from the 2 enums, and that is just the values that coverity complains about. The XML_ETACTION_EXTRACT_CHARACTERS was added at a later date in commits 8d374c039e7d349141befe3c9ef97f82f42bfa7 2685b93a6a23867baa4df265bb0cc35abaf76c0e 7d2405a54d13f68a35dfc5f619ad4bdb0b761856 c276550e07f8078fe9345985f70e8384d930a83f ...but it turns out that the XMLAttrTransformerAction ones are handled in StartElement() and ProcessAttrs() methods but the XMLElemTransformerAction ones are handled in CreateChildContext() methods so probably the XML_ATACTION_MOVE_FROM_ELEM* values are in the wrong enum. Change-Id: Ib1791f6eafac4fb1e99334f41c17a90cfb076359 diff --git a/xmloff/source/transform/AttrTransformerAction.hxx b/xmloff/source/transform/AttrTransformerAction.hxx index 7800af5..81b2d93 100644 --- a/xmloff/source/transform/AttrTransformerAction.hxx +++ b/xmloff/source/transform/AttrTransformerAction.hxx @@ -69,9 +69,6 @@ enum XMLAttrTransformerAction XML_ATACTION_MOVE_TO_ELEM, // turn attr into an elem // - param1: namespace + // token of local name - XML_ATACTION_MOVE_FROM_ELEM, // turn elem into an attr: - // - param1: namespace + - // token of local name XML_ATACTION_NEG_PERCENT, // replace % val with 100-% XML_ATACTION_RENAME_NEG_PERCENT, // replace % val with 100-%, rename attr // - param1: namespace + @@ -113,9 +110,6 @@ enum XMLAttrTransformerAction XML_ATACTION_RENAME_RNG2ISO_DATETIME,// converts . into , in datetimes and renames the attribute // - param1: namespace + // token of local name - XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME, // turn elem into an attr and convert . to , in datetimes - // - param1: namespace + - // token of local name XML_ATACTION_SVG_WIDTH_HEIGHT_OOO, // replace "inch" with "in" and subtracts 1/100th mm XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS, // replace "in" with "inch" and adds 1/100th mm XML_ATACTION_DRAW_MIRROR_OOO, // renames draw:mirror to style:mirror and adapts values diff --git a/xmloff/source/transform/ElemTransformerAction.hxx b/xmloff/source/transform/ElemTransformerAction.hxx index 04f7dda..68deafd 100644 --- a/xmloff/source/transform/ElemTransformerAction.hxx +++ b/xmloff/source/transform/ElemTransformerAction.hxx @@ -81,6 +81,12 @@ enum XMLElemTransformerAction // and put them together into the // current element // the child elements are removed + XML_ETACTION_MOVE_TO_ATTR, // turn elem into an attr: + // - param1: namespace + + // token of local name + XML_ETACTION_MOVE_TO_ATTR_RNG2ISO_DATETIME, // turn elem into an attr and convert . to , in datetimes + // - param1: namespace + + // token of local name XML_ETACTION_USER_DEFINED=0x40000000,// user defined actions start here XML_ETACTION_END=XML_TACTION_END }; diff --git a/xmloff/source/transform/MergeElemTContext.cxx b/xmloff/source/transform/MergeElemTContext.cxx index d14a1be..da066a7 100644 --- a/xmloff/source/transform/MergeElemTContext.cxx +++ b/xmloff/source/transform/MergeElemTContext.cxx @@ -232,7 +232,7 @@ XMLTransformerContext *XMLMergeElemTransformerContext::CreateChildContext( { switch( (*aIter).second.m_nActionType ) { - case XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME: + case XML_ETACTION_MOVE_TO_ATTR_RNG2ISO_DATETIME: { XMLPersTextContentTContext *pTC = new XMLPersTextContentRNGTransformTContext( @@ -244,7 +244,7 @@ XMLTransformerContext *XMLMergeElemTransformerContext::CreateChildContext( pContext = pTC; } break; - case XML_ATACTION_MOVE_FROM_ELEM: + case XML_ETACTION_MOVE_TO_ATTR: { XMLPersTextContentTContext *pTC = new XMLPersTextContentTContext( diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx index 139e3ec..3b2ee5f 100644 --- a/xmloff/source/transform/Oasis2OOo.cxx +++ b/xmloff/source/transform/Oasis2OOo.cxx @@ -926,24 +926,24 @@ static XMLTransformerActionInit aTableValueTypeActionTable[] = // action table for OASIS_ANNOTATION_ACTIONS static XMLTransformerActionInit aAnnotationActionTable[] = { - ENTRY1Q( DC, CREATOR, XML_ATACTION_MOVE_FROM_ELEM, + ENTRY1Q( DC, CREATOR, XML_ETACTION_MOVE_TO_ATTR, XML_NAMESPACE_OFFICE, XML_AUTHOR ), - ENTRY1Q( DC, DATE, XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME, + ENTRY1Q( DC, DATE, XML_ETACTION_MOVE_TO_ATTR_RNG2ISO_DATETIME, XML_NAMESPACE_OFFICE, XML_CREATE_DATE ), - ENTRY1Q( META, DATE_STRING, XML_ATACTION_MOVE_FROM_ELEM, + ENTRY1Q( META, DATE_STRING, XML_ETACTION_MOVE_TO_ATTR, XML_NAMESPACE_OFFICE, XML_CREATE_DATE_STRING ), ENTRY0( TEXT, P, XML_ETACTION_EXTRACT_CHARACTERS ), - ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) + ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT ) }; // action table for OASIS_CHANGE_INFO_ACTIONS static XMLTransformerActionInit aChangeInfoActionTable[] = { - ENTRY1Q( DC, CREATOR, XML_ATACTION_MOVE_FROM_ELEM, + ENTRY1Q( DC, CREATOR, XML_ETACTION_MOVE_TO_ATTR, XML_NAMESPACE_OFFICE, XML_CHG_AUTHOR ), - ENTRY1Q( DC, DATE, XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME, + ENTRY1Q( DC, DATE, XML_ETACTION_MOVE_TO_ATTR_RNG2ISO_DATETIME, XML_NAMESPACE_OFFICE, XML_CHG_DATE_TIME ), - ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) + ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT ) }; // OASIS_BACKGROUND_IMAGE_ACTIONS _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits