From f679710efce4506c61e96154ad626041fe63ad51 Mon Sep 17 00:00:00 2001 From: ellson Date: Thu, 4 Oct 2007 20:20:46 +0000 Subject: [PATCH] some minor clean up --- lib/gvc/gvdevice.c | 12 +++++------- plugin/gd/gvdevice_gd.c | 6 +++--- plugin/gd/gvrender_gd_vrml.c | 2 +- plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c | 4 ++-- plugin/pango/gvrender_pango.c | 4 ++-- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/lib/gvc/gvdevice.c b/lib/gvc/gvdevice.c index b8e524b70..e9a9d3d94 100644 --- a/lib/gvc/gvdevice.c +++ b/lib/gvc/gvdevice.c @@ -49,7 +49,7 @@ #include "gvcproc.h" -size_t gvdevice_write (GVJ_t * job, char *s, unsigned int len) +size_t gvdevice_write (GVJ_t * job, const unsigned char *s, unsigned int len) { if (job->flags & GVDEVICE_COMPRESSED_FORMAT) { #ifdef HAVE_LIBZ @@ -60,11 +60,9 @@ size_t gvdevice_write (GVJ_t * job, char *s, unsigned int len) return fwrite(s, sizeof(char), len, job->output_file); } -/* gvdevice selection is done in gvrender_select() in gvrender.c */ - void gvdevice_fputs(GVJ_t * job, char *s) { - gvdevice_write (job, s, strlen(s)); + gvdevice_write (job, (unsigned char*)s, strlen(s)); } /* gvdevice_printf: @@ -76,15 +74,15 @@ void gvdevice_fputs(GVJ_t * job, char *s) */ void gvdevice_printf(GVJ_t * job, const char *format, ...) { - char buf[BUFSIZ]; + unsigned char buf[BUFSIZ]; unsigned int len; va_list argp; va_start(argp, format); #ifdef HAVE_VSNPRINTF - len = vsnprintf(buf, sizeof(buf), format, argp); + len = vsnprintf((char *)buf, sizeof(buf), format, argp); #else - len = vsprintf(buf, format, argp); + len = vsprintf((char *)buf, format, argp); #endif va_end(argp); diff --git a/plugin/gd/gvdevice_gd.c b/plugin/gd/gvdevice_gd.c index 02b7f83eb..43fbd8a39 100644 --- a/plugin/gd/gvdevice_gd.c +++ b/plugin/gd/gvdevice_gd.c @@ -34,17 +34,17 @@ typedef enum { FORMAT_XBM, } format_type; -extern size_t gvdevice_write(GVJ_t * job, char * s, unsigned int len); +extern size_t gvdevice_write(GVJ_t * job, const unsigned char * s, unsigned int len); int gvdevice_gd_putBuf (gdIOCtx *context, const void *buffer, int len) { - return gvdevice_write((GVJ_t *)(context->tell), (char *)buffer, (unsigned int)len); + return gvdevice_write((GVJ_t *)(context->tell), buffer, (unsigned int)len); } /* used by gif output */ void gvdevice_gd_putC (gdIOCtx *context, int C) { - char c = C; + unsigned char c = C; gvdevice_write((GVJ_t *)(context->tell), &c, 1); } diff --git a/plugin/gd/gvrender_gd_vrml.c b/plugin/gd/gvrender_gd_vrml.c index efb0b50be..712915c22 100644 --- a/plugin/gd/gvrender_gd_vrml.c +++ b/plugin/gd/gvrender_gd_vrml.c @@ -272,9 +272,9 @@ static void vrml_end_node(GVJ_t *job) { if (im) { gdImagePng(im, PNGfile); + fclose(PNGfile); gdImageDestroy(im); im = NULL; - fclose(PNGfile); } } diff --git a/plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c b/plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c index 2fd3d5ffb..99d70e069 100644 --- a/plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c +++ b/plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c @@ -59,12 +59,12 @@ argb2rgba ( unsigned int width, unsigned int height, unsigned char *data) } } -extern size_t gvdevice_write(GVJ_t * job, char *s, unsigned int len); +extern size_t gvdevice_write(GVJ_t * job, const unsigned char *s, unsigned int len); static gboolean writer ( const gchar *buf, gsize count, GError **error, gpointer data) { - if (count == gvdevice_write((GVJ_t *)data, (char*)buf, count)) + if (count == gvdevice_write((GVJ_t *)data, (const unsigned char*)buf, count)) return TRUE; return FALSE; } diff --git a/plugin/pango/gvrender_pango.c b/plugin/pango/gvrender_pango.c index 44b813f62..e8bee88e1 100644 --- a/plugin/pango/gvrender_pango.c +++ b/plugin/pango/gvrender_pango.c @@ -113,12 +113,12 @@ static void cairogen_set_color(cairo_t * cr, gvcolor_t * color) color->u.RGBA[2], color->u.RGBA[3]); } -extern size_t gvdevice_write(GVJ_t * job, char *s, unsigned int len); +extern size_t gvdevice_write(GVJ_t * job, const unsigned char *s, unsigned int len); static cairo_status_t writer (void *closure, const unsigned char *data, unsigned int length) { - if (length == gvdevice_write((GVJ_t *)closure, (char*)data, length)) + if (length == gvdevice_write((GVJ_t *)closure, data, length)) return CAIRO_STATUS_SUCCESS; return CAIRO_STATUS_WRITE_ERROR; } -- 2.40.0