#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"
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') {
col2.r = col->r;
col2.g = col->g;
col2.b = col->b;
- col2.a = (col->a * i->alpha)>>8;
+ col2.a = (col->a * i->alpha)/255;
return col2;
}
gfxresult_t* ops_finish(struct _gfxdevice*dev)
{
- free(dev->internal);dev->internal = 0;
+ if(dev->internal)
+ free(dev->internal);
+ dev->internal = 0;
return 0;
}