#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
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:
*/
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);
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);
}
{
if (im) {
gdImagePng(im, PNGfile);
+ fclose(PNGfile);
gdImageDestroy(im);
im = NULL;
- fclose(PNGfile);
}
}
}
}
-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;
}
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;
}