]> granicus.if.org Git - graphviz/commitdiff
gdiplus plugin: swap a C-style cast for less powerful const_cast
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 18 Apr 2021 00:37:47 +0000 (17:37 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 24 Apr 2021 03:14:26 +0000 (20:14 -0700)
This allows the compiler to warn if, e.g., us->name ever changes type to
something other than a char pointer.

plugin/gdiplus/gvloadimage_gdiplus.cpp

index bc0ca17e5ccb4758958504222bf7274a476e51f2..9a4a1830881592d9abe5d0dc9acafe0c4a575557 100644 (file)
@@ -47,7 +47,7 @@ static Image* gdiplus_loadimage(GVJ_t * job, usershape_t *us)
 
                /* create image from the usershape file */
                /* NOTE: since Image::FromStream consumes the stream, we assume FileStream's lifetime should be shorter than us->name and us->f... */   
-               IStream *stream = FileStream::Create((char*)us->name, us->f);
+               IStream *stream = FileStream::Create(const_cast<char*>(us->name), us->f);
                us->data = Image::FromStream (stream);
                
                /* clean up */