openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1516122 - in /openoffice/trunk/main/svgio: inc/svgio/svgreader/ source/svgreader/
Date Wed, 21 Aug 2013 09:39:22 GMT
Author: orw
Date: Wed Aug 21 09:39:21 2013
New Revision: 1516122

URL: http://svn.apache.org/r1516122
Log:
122600: solve access memory problem of <SvgSvgNode::getCurrentViewPort()>


Modified:
    openoffice/trunk/main/svgio/inc/svgio/svgreader/svgmarkernode.hxx
    openoffice/trunk/main/svgio/inc/svgio/svgreader/svgnode.hxx
    openoffice/trunk/main/svgio/inc/svgio/svgreader/svgpatternnode.hxx
    openoffice/trunk/main/svgio/inc/svgio/svgreader/svgsvgnode.hxx
    openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtools.hxx
    openoffice/trunk/main/svgio/source/svgreader/svgmarkernode.cxx
    openoffice/trunk/main/svgio/source/svgreader/svgnode.cxx
    openoffice/trunk/main/svgio/source/svgreader/svgpatternnode.cxx
    openoffice/trunk/main/svgio/source/svgreader/svgsvgnode.cxx
    openoffice/trunk/main/svgio/source/svgreader/svgtools.cxx

Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgmarkernode.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/inc/svgio/svgreader/svgmarkernode.hxx?rev=1516122&r1=1516121&r2=1516122&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/inc/svgio/svgreader/svgmarkernode.hxx (original)
+++ openoffice/trunk/main/svgio/inc/svgio/svgreader/svgmarkernode.hxx Wed Aug 21 09:39:21
2013
@@ -74,7 +74,7 @@ namespace svgio
             const drawinglayer::primitive2d::Primitive2DSequence& getMarkerPrimitives()
const;
 
             /// InfoProvider support for % values
-            virtual const basegfx::B2DRange* getCurrentViewPort() const;
+            virtual const basegfx::B2DRange getCurrentViewPort() const;
 
             /// viewBox content
             const basegfx::B2DRange* getViewBox() const { return mpViewBox; }

Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgnode.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/inc/svgio/svgreader/svgnode.hxx?rev=1516122&r1=1516121&r2=1516122&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/inc/svgio/svgreader/svgnode.hxx (original)
+++ openoffice/trunk/main/svgio/inc/svgio/svgreader/svgnode.hxx Wed Aug 21 09:39:21 2013
@@ -62,19 +62,19 @@ namespace svgio
         // display property (see SVG 1.1. 11.5), not inheritable
         enum Display // #121656#
         {
-            Display_inline, // the default
-            Display_block,
-            Display_list_item,
-            Display_run_in,
-            Display_compact,
-            Display_marker,
-            Display_table,
-            Display_inline_table,
-            Display_table_row_group,
-            Display_table_header_group,
-            Display_table_footer_group,
-            Display_table_row,
-            Display_table_column_group,
+            Display_inline, // the default
+            Display_block,
+            Display_list_item,
+            Display_run_in,
+            Display_compact,
+            Display_marker,
+            Display_table,
+            Display_inline_table,
+            Display_table_row_group,
+            Display_table_header_group,
+            Display_table_footer_group,
+            Display_table_row,
+            Display_table_column_group,
             Display_table_column,
             Display_table_cell,
             Display_table_caption,
@@ -137,7 +137,7 @@ namespace svgio
             const SvgNodeVector& getChildren() const { return maChildren; }
 
             /// InfoProvider support for %, em and ex values
-            virtual const basegfx::B2DRange* getCurrentViewPort() const;
+            virtual const basegfx::B2DRange getCurrentViewPort() const;
             virtual double getCurrentFontSize() const;
             virtual double getCurrentXHeight() const;
 

Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgpatternnode.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/inc/svgio/svgreader/svgpatternnode.hxx?rev=1516122&r1=1516121&r2=1516122&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/inc/svgio/svgreader/svgpatternnode.hxx (original)
+++ openoffice/trunk/main/svgio/inc/svgio/svgreader/svgpatternnode.hxx Wed Aug 21 09:39:21
2013
@@ -77,7 +77,7 @@ namespace svgio
             const drawinglayer::primitive2d::Primitive2DSequence& getPatternPrimitives()
const;
 
             /// InfoProvider support for % values
-            virtual const basegfx::B2DRange* getCurrentViewPort() const;
+            virtual const basegfx::B2DRange getCurrentViewPort() const;
 
             /// viewBox content
             const basegfx::B2DRange* getViewBox() const;

Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgsvgnode.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/inc/svgio/svgreader/svgsvgnode.hxx?rev=1516122&r1=1516121&r2=1516122&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/inc/svgio/svgreader/svgsvgnode.hxx (original)
+++ openoffice/trunk/main/svgio/inc/svgio/svgreader/svgsvgnode.hxx Wed Aug 21 09:39:21 2013
@@ -65,7 +65,7 @@ namespace svgio
             // The returned 'CurrentViewPort' is the viewport as it is set by this svg element
             // and as it is needed to resolve relative values in childs
             // The method does not check for invalid width and height
-            virtual const basegfx::B2DRange* getCurrentViewPort() const;
+            virtual const basegfx::B2DRange getCurrentViewPort() const;
 
             /// viewBox content
             const basegfx::B2DRange* getViewBox() const { return mpViewBox; }

Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtools.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtools.hxx?rev=1516122&r1=1516121&r2=1516122&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtools.hxx (original)
+++ openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtools.hxx Wed Aug 21 09:39:21 2013
@@ -68,7 +68,7 @@ namespace svgio
         class InfoProvider
         {
         public:
-            virtual const basegfx::B2DRange* getCurrentViewPort() const = 0;
+            virtual const basegfx::B2DRange getCurrentViewPort() const = 0;
             virtual double getCurrentFontSize() const = 0;
             virtual double getCurrentXHeight() const = 0;
         };

Modified: openoffice/trunk/main/svgio/source/svgreader/svgmarkernode.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgmarkernode.cxx?rev=1516122&r1=1516121&r2=1516122&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/source/svgreader/svgmarkernode.cxx (original)
+++ openoffice/trunk/main/svgio/source/svgreader/svgmarkernode.cxx Wed Aug 21 09:39:21 2013
@@ -196,11 +196,11 @@ namespace svgio
             return aPrimitives;
         }
 
-        const basegfx::B2DRange* SvgMarkerNode::getCurrentViewPort() const
+        const basegfx::B2DRange SvgMarkerNode::getCurrentViewPort() const
         {
             if(getViewBox())
             {
-                return getViewBox();
+                return *(getViewBox());
             }
             else
             {

Modified: openoffice/trunk/main/svgio/source/svgreader/svgnode.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgnode.cxx?rev=1516122&r1=1516121&r2=1516122&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/source/svgreader/svgnode.cxx (original)
+++ openoffice/trunk/main/svgio/source/svgreader/svgnode.cxx Wed Aug 21 09:39:21 2013
@@ -229,20 +229,20 @@ namespace svgio
         {
             if(aContent.getLength())
             {
-                static rtl::OUString aStrInline(rtl::OUString::createFromAscii("inline"));
-                static rtl::OUString aStrBlock(rtl::OUString::createFromAscii("block"));
-                static rtl::OUString aStrList_item(rtl::OUString::createFromAscii("list-item"));
-                static rtl::OUString aStrRun_in(rtl::OUString::createFromAscii("run-in"));
-                static rtl::OUString aStrCompact(rtl::OUString::createFromAscii("compact"));
-                static rtl::OUString aStrMarker(rtl::OUString::createFromAscii("marker"));
-                static rtl::OUString aStrTable(rtl::OUString::createFromAscii("table"));
-                static rtl::OUString aStrInline_table(rtl::OUString::createFromAscii("inline-table"));
-                static rtl::OUString aStrTable_row_group(rtl::OUString::createFromAscii("table-row-group"));
-                static rtl::OUString aStrTable_header_group(rtl::OUString::createFromAscii("table-header-group"));
-                static rtl::OUString aStrTable_footer_group(rtl::OUString::createFromAscii("table-footer-group"));
-                static rtl::OUString aStrTable_row(rtl::OUString::createFromAscii("table-row"));
-                static rtl::OUString aStrTable_column_group(rtl::OUString::createFromAscii("table-column-group"));
-                static rtl::OUString aStrTable_column(rtl::OUString::createFromAscii("table-column"));
+                static rtl::OUString aStrInline(rtl::OUString::createFromAscii("inline"));
+                static rtl::OUString aStrBlock(rtl::OUString::createFromAscii("block"));
+                static rtl::OUString aStrList_item(rtl::OUString::createFromAscii("list-item"));
+                static rtl::OUString aStrRun_in(rtl::OUString::createFromAscii("run-in"));
+                static rtl::OUString aStrCompact(rtl::OUString::createFromAscii("compact"));
+                static rtl::OUString aStrMarker(rtl::OUString::createFromAscii("marker"));
+                static rtl::OUString aStrTable(rtl::OUString::createFromAscii("table"));
+                static rtl::OUString aStrInline_table(rtl::OUString::createFromAscii("inline-table"));
+                static rtl::OUString aStrTable_row_group(rtl::OUString::createFromAscii("table-row-group"));
+                static rtl::OUString aStrTable_header_group(rtl::OUString::createFromAscii("table-header-group"));
+                static rtl::OUString aStrTable_footer_group(rtl::OUString::createFromAscii("table-footer-group"));
+                static rtl::OUString aStrTable_row(rtl::OUString::createFromAscii("table-row"));
+                static rtl::OUString aStrTable_column_group(rtl::OUString::createFromAscii("table-column-group"));
+                static rtl::OUString aStrTable_column(rtl::OUString::createFromAscii("table-column"));
                 static rtl::OUString aStrTable_cell(rtl::OUString::createFromAscii("table-cell"));
                 static rtl::OUString aStrTable_caption(rtl::OUString::createFromAscii("table-caption"));
                 static rtl::OUString aStrNone(rtl::OUString::createFromAscii("none"));
@@ -260,55 +260,55 @@ namespace svgio
                 {
                     return Display_inherit;
                 }
-                else if(aContent.match(aStrBlock))
+                else if(aContent.match(aStrBlock))
                 {
                     return Display_block;
                 }
-                else if(aContent.match(aStrList_item))
+                else if(aContent.match(aStrList_item))
                 {
                     return Display_list_item;
                 }
-                else if(aContent.match(aStrRun_in))
+                else if(aContent.match(aStrRun_in))
                 {
                     return Display_run_in;
                 }
-                else if(aContent.match(aStrCompact))
+                else if(aContent.match(aStrCompact))
                 {
                     return Display_compact;
                 }
-                else if(aContent.match(aStrMarker))
+                else if(aContent.match(aStrMarker))
                 {
                     return Display_marker;
                 }
-                else if(aContent.match(aStrTable))
+                else if(aContent.match(aStrTable))
                 {
                     return Display_table;
                 }
-                else if(aContent.match(aStrInline_table))
+                else if(aContent.match(aStrInline_table))
                 {
                     return Display_inline_table;
                 }
-                else if(aContent.match(aStrTable_row_group))
+                else if(aContent.match(aStrTable_row_group))
                 {
                     return Display_table_row_group;
                 }
-                else if(aContent.match(aStrTable_header_group))
+                else if(aContent.match(aStrTable_header_group))
                 {
                     return Display_table_header_group;
                 }
-                else if(aContent.match(aStrTable_footer_group))
+                else if(aContent.match(aStrTable_footer_group))
                 {
                     return Display_table_footer_group;
                 }
-                else if(aContent.match(aStrTable_row))
+                else if(aContent.match(aStrTable_row))
                 {
                     return Display_table_row;
                 }
-                else if(aContent.match(aStrTable_column_group))
+                else if(aContent.match(aStrTable_column_group))
                 {
                     return Display_table_column_group;
                 }
-                else if(aContent.match(aStrTable_column))
+                else if(aContent.match(aStrTable_column))
                 {
                     return Display_table_column;
                 }
@@ -485,7 +485,7 @@ namespace svgio
             }
         }
 
-        const basegfx::B2DRange* SvgNode::getCurrentViewPort() const
+        const basegfx::B2DRange SvgNode::getCurrentViewPort() const
         {
             if(getParent())
             {
@@ -493,7 +493,7 @@ namespace svgio
             }
             else
             {
-                return 0;
+                return basegfx::B2DRange(); // return empty B2DRange
             }
         }
 

Modified: openoffice/trunk/main/svgio/source/svgreader/svgpatternnode.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgpatternnode.cxx?rev=1516122&r1=1516121&r2=1516122&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/source/svgreader/svgpatternnode.cxx (original)
+++ openoffice/trunk/main/svgio/source/svgreader/svgpatternnode.cxx Wed Aug 21 09:39:21 2013
@@ -293,11 +293,11 @@ namespace svgio
             return aPrimitives;
         }
 
-        const basegfx::B2DRange* SvgPatternNode::getCurrentViewPort() const
+        const basegfx::B2DRange SvgPatternNode::getCurrentViewPort() const
         {
             if(getViewBox())
             {
-                return getViewBox();
+                return *(getViewBox());
             }
             else
             {

Modified: openoffice/trunk/main/svgio/source/svgreader/svgsvgnode.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgsvgnode.cxx?rev=1516122&r1=1516121&r2=1516122&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/source/svgreader/svgsvgnode.cxx (original)
+++ openoffice/trunk/main/svgio/source/svgreader/svgsvgnode.cxx Wed Aug 21 09:39:21 2013
@@ -605,11 +605,11 @@ namespace svgio
             }
         }
 
-        const basegfx::B2DRange* SvgSvgNode::getCurrentViewPort() const
+        const basegfx::B2DRange SvgSvgNode::getCurrentViewPort() const
         {
             if(getViewBox())
             {
-                return getViewBox();
+                return *(getViewBox());
             }
             else // viewport should be given by x, y, width, and height
             {
@@ -633,7 +633,7 @@ namespace svgio
 
                     if (bXIsAbsolute && bYIsAbsolute && bWidthIsAbsolute
&& bHeightIsAbsolute)
                     {
-                        return &basegfx::B2DRange(fX, fY, fX+fW, fY+fH);
+                        return basegfx::B2DRange(fX, fY, fX+fW, fY+fH);
                     }
                     else // try to resolve relative values
                     {
@@ -676,7 +676,7 @@ namespace svgio
 
                         if (bXIsAbsolute && bYIsAbsolute && bWidthIsAbsolute
&& bHeightIsAbsolute)
                         {
-                            return &basegfx::B2DRange(fX, fY, fX+fW, fY+fH);
+                            return basegfx::B2DRange(fX, fY, fX+fW, fY+fH);
                         }
                         else // relative values could not be resolved, there exists no fallback
                         {
@@ -695,7 +695,7 @@ namespace svgio
                     double fH( bHeightIsAbsolute ? getHeight().solveNonPercentage(*this)
: 0.0);
                     if (bWidthIsAbsolute && bHeightIsAbsolute)
                     {
-                        return &basegfx::B2DRange(0.0, 0.0, fW, fH);
+                        return basegfx::B2DRange(0.0, 0.0, fW, fH);
                     }
                     else // no fallback exists
                     {

Modified: openoffice/trunk/main/svgio/source/svgreader/svgtools.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgtools.cxx?rev=1516122&r1=1516121&r2=1516122&view=diff
==============================================================================
--- openoffice/trunk/main/svgio/source/svgreader/svgtools.cxx (original)
+++ openoffice/trunk/main/svgio/source/svgreader/svgtools.cxx Wed Aug 21 09:39:21 2013
@@ -237,40 +237,39 @@ namespace svgio
                     case Unit_percent:
                     {
                         double fRetval(mfNumber * 0.01);
-                        const basegfx::B2DRange* pViewPort = rInfoProvider.getCurrentViewPort();
+                        basegfx::B2DRange aViewPort = rInfoProvider.getCurrentViewPort();
                         
-                        if(!pViewPort)
+                        if ( aViewPort.isEmpty() )
                         {
 #ifdef DBG_UTIL
                             myAssert(rtl::OUString::createFromAscii("Design error, this case
should have been handled in the caller"));
 #endif
                             // no viewPort, assume a normal page size (A4)
-                            static basegfx::B2DRange aDinA4Range(
+                            aViewPort = basegfx::B2DRange(
                                 0.0,
                                 0.0,
                                 210.0 * F_SVG_PIXEL_PER_INCH / 2.54,
                                 297.0 * F_SVG_PIXEL_PER_INCH / 2.54);
 
-                            pViewPort = &aDinA4Range;
                         }
 
-                        if(pViewPort)
+                        if ( !aViewPort.isEmpty() )
                         {
                             if(xcoordinate == aNumberType)
                             {
                                 // it's a x-coordinate, relative to current width (w)
-                                fRetval *= pViewPort->getWidth();
+                                fRetval *= aViewPort.getWidth();
                             }
                             else if(ycoordinate == aNumberType)
                             {
                                 // it's a y-coordinate, relative to current height (h)
-                                fRetval *= pViewPort->getHeight();
+                                fRetval *= aViewPort.getHeight();
                             }
                             else // length
                             {
                                 // it's a length, relative to sqrt(w*w + h*h)/sqrt(2)
-                                const double fCurrentWidth(pViewPort->getWidth());
-                                const double fCurrentHeight(pViewPort->getHeight());
+                                const double fCurrentWidth(aViewPort.getWidth());
+                                const double fCurrentHeight(aViewPort.getHeight());
                                 const double fCurrentLength(
                                     sqrt(fCurrentWidth * fCurrentWidth + fCurrentHeight *
fCurrentHeight)/sqrt(2.0));
 



Mime
View raw message