[Libreoffice-commits] core.git: 3 commits - sw/inc sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Sat May 31 12:29:37 PDT 2014


 sw/inc/fmtornt.hxx                       |   24 ++--
 sw/source/core/docnode/swbaslnk.cxx      |    2 
 sw/source/core/layout/atrfrm.cxx         |   28 ++---
 writerfilter/source/ooxml/checkmodel.xsl |  155 -------------------------------
 4 files changed, 27 insertions(+), 182 deletions(-)

New commits:
commit 35a01cb86ae0e91fb4aea1f99ed9158af2b2b202
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat May 31 21:18:12 2014 +0200

    coverity#1078573 Unchecked dynamic_cast
    
    Change-Id: I59d179b2b9ad19de1be2bae517201be038f32c33

diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx
index 8c2bafe..df2476c 100644
--- a/sw/source/core/docnode/swbaslnk.cxx
+++ b/sw/source/core/docnode/swbaslnk.cxx
@@ -130,7 +130,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
 
     if( pCntntNode->IsGrfNode() )
     {
-        SwGrfNode* pSwGrfNode = dynamic_cast< SwGrfNode* >(pCntntNode);
+        SwGrfNode* pSwGrfNode = pCntntNode->GetGrfNode();
         OSL_ENSURE(pSwGrfNode, "Error, pSwGrfNode expected when node answers IsGrfNode() with true (!)");
         const GraphicObject& rGrfObj = pSwGrfNode->GetGrfObj();
 
commit 6dcc46af5a47cef1f6e52835f3e8ebd17a0be234
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat May 31 21:16:26 2014 +0200

    SwFmtVertOrient: rename member variables missing their prefixes
    
    Change-Id: I83922fa1abe7830b12fcd811c9391ae8fff853c9

diff --git a/sw/inc/fmtornt.hxx b/sw/inc/fmtornt.hxx
index 2e7e01b..bd97bad 100644
--- a/sw/inc/fmtornt.hxx
+++ b/sw/inc/fmtornt.hxx
@@ -32,9 +32,9 @@ class IntlWrapper;
 
 class SW_DLLPUBLIC SwFmtVertOrient: public SfxPoolItem
 {
-    SwTwips         nYPos;  ///< Contains *always* the current RelPos.
-    sal_Int16       eOrient;
-    sal_Int16       eRelation;
+    SwTwips         m_nYPos;  ///< Contains *always* the current RelPos.
+    sal_Int16       m_eOrient;
+    sal_Int16       m_eRelation;
 public:
     TYPEINFO_OVERRIDE();
     SwFmtVertOrient( SwTwips nY = 0, sal_Int16 eVert = com::sun::star::text::VertOrientation::NONE,
@@ -55,13 +55,13 @@ public:
     SvStream& Store(SvStream &rStream, sal_uInt16 itemVersion) const SAL_OVERRIDE;
     SfxPoolItem* Create(SvStream &rStream, sal_uInt16 itemVersion) const SAL_OVERRIDE;
 
-    sal_Int16 GetVertOrient() const { return eOrient; }
-    sal_Int16 GetRelationOrient() const { return eRelation; }
-    void   SetVertOrient( sal_Int16 eNew ) { eOrient = eNew; }
-    void   SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
+    sal_Int16 GetVertOrient() const { return m_eOrient; }
+    sal_Int16 GetRelationOrient() const { return m_eRelation; }
+    void   SetVertOrient( sal_Int16 eNew ) { m_eOrient = eNew; }
+    void   SetRelationOrient( sal_Int16 eNew ) { m_eRelation = eNew; }
 
-    SwTwips GetPos() const { return nYPos; }
-    void    SetPos( SwTwips nNew ) { nYPos = nNew; }
+    SwTwips GetPos() const { return m_nYPos; }
+    void    SetPos( SwTwips nNew ) { m_nYPos = nNew; }
 };
 
 class SW_DLLPUBLIC SwFmtHoriOrient: public SfxPoolItem
@@ -101,9 +101,9 @@ public:
 
 inline SwFmtVertOrient &SwFmtVertOrient::operator=( const SwFmtVertOrient &rCpy )
 {
-    nYPos = rCpy.GetPos();
-    eOrient = rCpy.GetVertOrient();
-    eRelation = rCpy.GetRelationOrient();
+    m_nYPos = rCpy.GetPos();
+    m_eOrient = rCpy.GetVertOrient();
+    m_eRelation = rCpy.GetRelationOrient();
     return *this;
 }
 inline SwFmtHoriOrient &SwFmtHoriOrient::operator=( const SwFmtHoriOrient &rCpy )
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index aa40d45..fa5a4d0 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1199,11 +1199,11 @@ bool SwFmtSurround::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
 SvStream& SwFmtVertOrient::Store(SvStream &rStream, sal_uInt16 /*version*/) const
 {
 #if SAL_TYPES_SIZEOFLONG == 8
-    rStream.WriteInt64(nYPos);
+    rStream.WriteInt64(m_nYPos);
 #else
-    rStream.WriteInt32(nYPos);
+    rStream.WriteInt32(m_nYPos);
 #endif
-    rStream.WriteInt16( eOrient ).WriteInt16( eRelation );
+    rStream.WriteInt16( m_eOrient ).WriteInt16( m_eRelation );
     return rStream;
 }
 
@@ -1230,22 +1230,22 @@ SfxPoolItem* SwFmtVertOrient::Create(SvStream &rStream, sal_uInt16 /*itemVersion
 SwFmtVertOrient::SwFmtVertOrient( SwTwips nY, sal_Int16 eVert,
                                   sal_Int16 eRel )
     : SfxPoolItem( RES_VERT_ORIENT ),
-    nYPos( nY ),
-    eOrient( eVert ),
-    eRelation( eRel )
+    m_nYPos( nY ),
+    m_eOrient( eVert ),
+    m_eRelation( eRel )
 {}
 
 bool SwFmtVertOrient::operator==( const SfxPoolItem& rAttr ) const
 {
     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "not the same attributes" );
-    return ( nYPos     == ((SwFmtVertOrient&)rAttr).nYPos &&
-             eOrient   == ((SwFmtVertOrient&)rAttr).eOrient &&
-             eRelation == ((SwFmtVertOrient&)rAttr).eRelation );
+    return ( m_nYPos     == ((SwFmtVertOrient&)rAttr).m_nYPos &&
+             m_eOrient   == ((SwFmtVertOrient&)rAttr).m_eOrient &&
+             m_eRelation == ((SwFmtVertOrient&)rAttr).m_eRelation );
 }
 
 SfxPoolItem*  SwFmtVertOrient::Clone( SfxItemPool* ) const
 {
-    return new SwFmtVertOrient( nYPos, eOrient, eRelation );
+    return new SwFmtVertOrient( m_nYPos, m_eOrient, m_eRelation );
 }
 
 bool SwFmtVertOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -1257,11 +1257,11 @@ bool SwFmtVertOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
     {
         case MID_VERTORIENT_ORIENT:
         {
-            rVal <<= (sal_Int16)eOrient;
+            rVal <<= (sal_Int16)m_eOrient;
         }
         break;
         case MID_VERTORIENT_RELATION:
-                rVal <<= (sal_Int16)eRelation;
+                rVal <<= (sal_Int16)m_eRelation;
         break;
         case MID_VERTORIENT_POSITION:
                 rVal <<= (sal_Int32)convertTwipToMm100(GetPos());
@@ -1284,12 +1284,12 @@ bool SwFmtVertOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
         {
             sal_uInt16 nVal = text::VertOrientation::NONE;
             rVal >>= nVal;
-            eOrient = nVal;
+            m_eOrient = nVal;
         }
         break;
         case MID_VERTORIENT_RELATION:
         {
-            eRelation = lcl_IntToRelation(rVal);
+            m_eRelation = lcl_IntToRelation(rVal);
         }
         break;
         case MID_VERTORIENT_POSITION:
commit 886a7b6d66e2e1c60f7163e959a537ecc73e9927
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat May 31 21:00:27 2014 +0200

    writerfilter: unused checkmodel.xsl
    
    This could be useful actually, except that it raises so many warnings
    for ~any version of model.xml (and we assume the current version is more
    or less working), that I think in its current form it's useless.
    
    Change-Id: Ia9923256f1db0fd15930833fc843a7348613821d

diff --git a/writerfilter/source/ooxml/checkmodel.xsl b/writerfilter/source/ooxml/checkmodel.xsl
deleted file mode 100644
index 4dd133f..0000000
--- a/writerfilter/source/ooxml/checkmodel.xsl
+++ /dev/null
@@ -1,155 +0,0 @@
-<!--
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
--->
-
-<xsl:stylesheet
-    version="1.0"
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:rng="http://relaxng.org/ns/structure/1.0"
-    xml:space="default" xml:indent="true">
-  <xsl:output method="text" />
-
-  <xsl:template name="noannotation">
-    <xsl:for-each select="//namespace">
-      <xsl:variable name="nsname" select="@name"/>
-      <xsl:value-of select="./rng:grammar/@ns"/>
-      <xsl:text>&#xa;</xsl:text>
-      <xsl:for-each select=".//rng:define">
-        <xsl:variable name="name" select="@name"/>
-        <xsl:if test="not(ancestor::namespace//resource[@name=$name])">
-          <xsl:text>noannotation: </xsl:text>
-          <xsl:value-of select="$nsname"/>
-          <xsl:text>::</xsl:text>
-          <xsl:value-of select="$name"/>
-          <xsl:text>&#xa;</xsl:text>
-        </xsl:if>
-      </xsl:for-each>
-    </xsl:for-each>
-  </xsl:template>
-
-  <xsl:template name="checkmodel">
-    <xsl:for-each select="//namespace">
-      <xsl:variable name="nsname" select="@name"/>
-      <xsl:for-each select=".//rng:define">
-        <xsl:call-template name="orphanedprops"/>
-        <xsl:variable name="definename" select="@name"/>
-        <xsl:if test="not(ancestor::namespace//resource[@name=$definename])">
-          <xsl:text>no annotation: </xsl:text>
-          <xsl:value-of select="$nsname"/>
-          <xsl:text>::</xsl:text>
-          <xsl:value-of select="$definename"/>
-          <xsl:text>&#xa;</xsl:text>
-        </xsl:if>
-        <xsl:for-each select=".//rng:element">
-          <xsl:variable name="elementname" select="@name"/>
-          <xsl:for-each select="ancestor::namespace//resource[@name=$definename and @resource='Properties']">
-            <xsl:if test="not(.//element[@name=$elementname])">
-              <xsl:text>missing element: </xsl:text>
-              <xsl:value-of select="$nsname"/>
-              <xsl:text>::</xsl:text>
-              <xsl:value-of select="$definename"/>
-              <xsl:text>::</xsl:text>
-              <xsl:value-of select="$elementname"/>
-              <xsl:text>&#xa;</xsl:text>
-            </xsl:if>
-            <xsl:call-template name="orphanedprops"/>
-          </xsl:for-each>
-        </xsl:for-each>
-        <xsl:for-each select=".//rng:attribute">
-          <xsl:variable name="attributename" select="@name"/>
-          <xsl:for-each select="ancestor::namespace//resource[@name=$definename and @resource='Properties']">
-            <xsl:if test="not(.//attribute[@name=$attributename])">
-              <xsl:text>missing attribute: </xsl:text>
-              <xsl:value-of select="$nsname"/>
-              <xsl:text>::</xsl:text>
-              <xsl:value-of select="$definename"/>
-              <xsl:text>::</xsl:text>
-              <xsl:value-of select="$attributename"/>
-              <xsl:text>&#xa;</xsl:text>
-            </xsl:if>
-            <xsl:call-template name="orphanedprops"/>
-          </xsl:for-each>
-        </xsl:for-each>
-      </xsl:for-each>
-    </xsl:for-each>
-  </xsl:template>
-
-  <xsl:key name="defines-with-name" match="rng:define" use="@name"/>
-
-  <xsl:template name="defineforref">
-    <xsl:variable name="grammarid" select="generate-id(ancestor::grammar)"/>
-    <xsl:variable name="defineingrammar" select="key('defines-with-name', @name)[generate-id(ancestor::grammar) = $grammarid]"/>
-    <xsl:choose>
-      <xsl:when test="$defineingrammar">
-        <xsl:value-of select="$defineingrammar"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:value-of select="key('defines-with-name', @name)"/>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template name="contextresource">
-    <xsl:variable name="name" select="@name"/>
-    <xsl:value-of select="ancestor::namespace//resource[@name=$name]/@resource"/>
-  </xsl:template>
-
-  <xsl:template name="orphanedprops">
-    <xsl:variable name="nsname" select="ancestor::namespace/@name"/>
-    <xsl:for-each select=".//rng:ref[not (ancestor::rng:element or ancestor::rng:attribute)]">
-      <xsl:variable name="defineresource">
-        <xsl:for-each select="ancestor::rng:define">
-          <xsl:call-template name="contextresource"/>
-        </xsl:for-each>
-      </xsl:variable>
-      <xsl:variable name="definename" select="ancestor::rng:define/@name"/>
-      <xsl:variable name="mydefine">
-        <xsl:copy>
-          <xsl:call-template name="defineforref"/>
-        </xsl:copy>
-      </xsl:variable>
-      <xsl:variable name="myresource">
-        <xsl:call-template name="contextresource"/>
-      </xsl:variable>
-      <xsl:if test="$myresource = 'Properties'">
-        <xsl:choose>
-          <xsl:when test="$defineresource = 'Properties'"/>
-          <xsl:when test="$defineresource = 'Stream'"/>
-          <xsl:otherwise>
-            <xsl:text>orphaned properties: </xsl:text>
-            <xsl:value-of select="$nsname"/>
-            <xsl:text>:</xsl:text>
-            <xsl:value-of select="$definename"/>
-            <xsl:text>(</xsl:text>
-            <xsl:value-of select="$defineresource"/>
-            <xsl:text>)-></xsl:text>
-            <xsl:value-of select="@name"/>
-            <xsl:text>(</xsl:text>
-            <xsl:value-of select="$myresource"/>
-            <xsl:text>)&#xa;</xsl:text>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:if>
-    </xsl:for-each>
-  </xsl:template>
-
-  <xsl:template match="/">
-    <out>
-      <xsl:call-template name="checkmodel"/>
-    </out>
-  </xsl:template>
-</xsl:stylesheet>
\ No newline at end of file


More information about the Libreoffice-commits mailing list