]> granicus.if.org Git - graphviz/commitdiff
GDI+ plugin: fix: swap duplicated 'gvwrite' prototypes for a header include
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 29 Mar 2022 15:20:33 +0000 (08:20 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 3 Apr 2022 03:10:45 +0000 (20:10 -0700)
Note that these prototypes were wrong. `gvwrite` takes a `char` pointer not
`unsigned char` pointer, and a `size_t` not `unsigned int` length.

plugin/gdiplus/gvdevice_gdiplus.cpp
plugin/gdiplus/gvrender_gdiplus.cpp

index 77ea6dbb0cb3dec382cab55c95bf96df27024d9b..27d33c734ca55cb707a6af24849d4e92af966aef 100644 (file)
 
 #include <gvc/gvplugin_device.h>
 #include <gvc/gvplugin_render.h>
+#include <gvc/gvio.h>
 #include "gvplugin_gdiplus.h"
 
-extern "C" size_t gvwrite(GVJ_t *job, const unsigned char *s, unsigned int len);
-
 using namespace Gdiplus;
 
 static void gdiplus_format(GVJ_t *job)
@@ -40,7 +39,7 @@ static void gdiplus_format(GVJ_t *job)
        /* NOTE: this is somewhat inefficient since we should be streaming directly to gvdevice rather than buffering first */
        /* ... however, GDI+ requires any such direct IStream to implement Seek Read, Write, Stat methods and gvdevice really only offers a write-once model */
        stream->Release();
-       gvwrite(job, (const unsigned char*)GlobalLock(buffer), GlobalSize(buffer));
+       gvwrite(job, (const char*)GlobalLock(buffer), GlobalSize(buffer));
 
        GlobalFree(buffer);
 }
index ab1db2ce8a207cc267523f32342036384eb7d446..d23c1a662f1c57ef0fbd4d967534a6566b649114 100644 (file)
 
 #include <gvc/gvplugin_device.h>
 #include <gvc/gvplugin_render.h>
+#include <gvc/gvio.h>
 #include "gvplugin_gdiplus.h"
 
 #include <memory>
 #include <vector>
 
-extern "C" size_t gvwrite(GVJ_t *job, const unsigned char *s, unsigned int len);
-
 using namespace std;
 using namespace Gdiplus;
 
@@ -81,7 +80,7 @@ static void gdiplusgen_end_job(GVJ_t *job)
                HGLOBAL buffer = nullptr;
                GetHGlobalFromStream(stream, &buffer);
                stream->Release();
-               gvwrite(job, (unsigned char*)GlobalLock(buffer), GlobalSize(buffer));
+               gvwrite(job, (char*)GlobalLock(buffer), GlobalSize(buffer));
                GlobalFree(buffer);
        }
        else if (job->device.id == FORMAT_METAFILE)