take a reference instead of a pointer in Visio::Render::PrintOuterShape
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 1 Apr 2021 01:36:37 +0000 (18:36 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 7 Apr 2021 04:30:38 +0000 (21:30 -0700)
This function assumes its input pointer is non-null, so we may as well use the
more convenient C++ syntax for this. This will also ease some upcoming changes
to convert the underlying raw pointers to smart pointers.

plugin/visio/VisioRender.cpp
plugin/visio/VisioRender.h

index 5d2e8df485c5416e9611fea54530daf9005f6d5a..70dca710dae6ba7191a83ec6d8b4d1c47448e900 100644 (file)
@@ -115,7 +115,7 @@ namespace Visio
                        break;
                case 1:
                        /* single graphic to render, output as top level shape */
-                       PrintOuterShape(job, _graphics[0]);
+                       PrintOuterShape(job, *_graphics[0]);
                        outerShapeId = _shapeId;
                        break;
                default:
@@ -198,7 +198,7 @@ namespace Visio
                                        EDGE_TYPE(agroot(edge))))
                                        firstConnector = false;
                                else
-                                       PrintOuterShape(job, *nextGraphic);
+                                       PrintOuterShape(job, **nextGraphic);
 
                }
                ClearGraphicsAndTexts();
@@ -259,7 +259,7 @@ namespace Visio
                        _graphics.push_back(graphic);
                else
                        /* if outside, output immediately */
-                       PrintOuterShape(job, graphic);          
+                       PrintOuterShape(job, *graphic);         
        }
 
        void Render::AddText(GVJ_t* job, const Text* text)
@@ -276,9 +276,9 @@ namespace Visio
                        _hyperlinks.push_back(hyperlink);
        }
        
-       void Render::PrintOuterShape(GVJ_t* job, const Graphicgraphic)
+       void Render::PrintOuterShape(GVJ_t* job, const Graphic &graphic)
        {
-               boxf bounds = graphic->GetBounds();
+               boxf bounds = graphic.GetBounds();
                
                gvprintf(job, "<Shape ID='%d' Type='Shape'>\n", ++_shapeId);
                
@@ -300,7 +300,7 @@ namespace Visio
                PrintTexts(job);
                
                /* output Line, Fill, Geom */
-               graphic->Print(job, bounds.LL, bounds.UR, true);
+               graphic.Print(job, bounds.LL, bounds.UR, true);
                
                gvputs(job, "</Shape>\n");
        }
index 9ef5ee6efda785e629b5cda55967f51e2fb53f00..6cf5abdcd6fc67536f836f437e5ddd645388af6f 100644 (file)
@@ -58,7 +58,7 @@ namespace Visio
                void AddHyperlink(GVJ_t* job, const Hyperlink* hyperlink);
                
                /* output the graphic as top level shape */
-               void PrintOuterShape(GVJ_t* job, const Graphicgraphic);
+               void PrintOuterShape(GVJ_t* job, const Graphic &graphic);
                
                /* output the graphic as a subshape of a top level shape, given its id and bounds */
                void PrintInnerShape(GVJ_t* job, const Graphic* graphic, unsigned int outerId, boxf outerBounds);