#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
+#ifndef WIN32
#include <unistd.h>
+#endif
#include <memory.h>
+#include <string.h>
#include "../types.h"
#include "../mem.h"
#include "../gfxdevice.h"
#include "../gfxtools.h"
+#include "ops.h"
typedef struct _internal {
gfxdevice_t*out;
int l;
va_list arglist;
va_start(arglist, format);
- vsprintf(buf, format, arglist);
+ vsnprintf(buf, sizeof(buf)-1, format, arglist);
va_end(arglist);
l = strlen(buf);
while(l && buf[l-1]=='\n') {
gfximage_t img2;
img2.width = img->width;
img2.height = img->height;
- img2.data = malloc(img->width*img->height*4);
+ img2.data = (gfxcolor_t*)malloc(img->width*img->height*4);
int x,y;
for(y=0;y<img->height;y++) {
gfxcolor_t*in = &img->data[y*img->width];
i->out->drawchar(i->out, font, glyphnr, color, matrix);
}
-void ops_drawlink(struct _gfxdevice*dev, gfxline_t*line, char*action)
+void ops_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action)
{
internal_t*i = (internal_t*)dev->internal;
i->out->drawlink(i->out, line, action);
gfxresult_t* ops_finish(struct _gfxdevice*dev)
{
- free(dev->internal);dev->internal = 0;
+ if(dev->internal)
+ free(dev->internal);
+ dev->internal = 0;
return 0;
}