From: Matthew Fernandez Date: Sun, 18 Apr 2021 00:37:47 +0000 (-0700) Subject: gdiplus plugin: swap a C-style cast for less powerful const_cast X-Git-Tag: 2.47.2~48^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ea453de2e90c3f2b3b68cf1c23eb90bb45a7a26;p=graphviz gdiplus plugin: swap a C-style cast for less powerful const_cast This allows the compiler to warn if, e.g., us->name ever changes type to something other than a char pointer. --- diff --git a/plugin/gdiplus/gvloadimage_gdiplus.cpp b/plugin/gdiplus/gvloadimage_gdiplus.cpp index bc0ca17e5..9a4a18308 100644 --- a/plugin/gdiplus/gvloadimage_gdiplus.cpp +++ b/plugin/gdiplus/gvloadimage_gdiplus.cpp @@ -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(us->name), us->f); us->data = Image::FromStream (stream); /* clean up */