From 94926663afd7812a53b983ae366c3d4946e19c70 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 29 Mar 2022 08:20:33 -0700 Subject: [PATCH] GDI+ plugin: fix: swap duplicated 'gvwrite' prototypes for a header include 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 | 5 ++--- plugin/gdiplus/gvrender_gdiplus.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/plugin/gdiplus/gvdevice_gdiplus.cpp b/plugin/gdiplus/gvdevice_gdiplus.cpp index 77ea6dbb0..27d33c734 100644 --- a/plugin/gdiplus/gvdevice_gdiplus.cpp +++ b/plugin/gdiplus/gvdevice_gdiplus.cpp @@ -13,10 +13,9 @@ #include #include +#include #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); } diff --git a/plugin/gdiplus/gvrender_gdiplus.cpp b/plugin/gdiplus/gvrender_gdiplus.cpp index ab1db2ce8..d23c1a662 100644 --- a/plugin/gdiplus/gvrender_gdiplus.cpp +++ b/plugin/gdiplus/gvrender_gdiplus.cpp @@ -15,13 +15,12 @@ #include #include +#include #include "gvplugin_gdiplus.h" #include #include -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) -- 2.40.0