X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_gfx.c;h=f4c04efe925073637db6565b5cde07ce9697f3f5;hb=c966bf04b22f45e38ca9d1b318514154b33c367d;hp=eb46ba92121f775e487f11533ba86d7d76004694;hpb=cd9bdc9dd1cd1655e4b63f9382afad8cbec0a8ee;p=rrdtool.git diff --git a/src/rrd_gfx.c b/src/rrd_gfx.c index eb46ba9..f4c04ef 100644 --- a/src/rrd_gfx.c +++ b/src/rrd_gfx.c @@ -7,9 +7,9 @@ /* #define DEBUG */ #ifdef DEBUG -# define DPRINTF(x,...) fprintf(stderr, x, ## __VA_ARGS__); +# define DPRINTF(...) fprintf(stderr, __VA_ARGS__); #else -# define DPRINTF(x,...) +# define DPRINTF(...) #endif #include "rrd_tool.h" #include @@ -386,7 +386,11 @@ gfx_string gfx_string_create(gfx_canvas_t *canvas, FT_Face face,const char *text cstr = malloc(sizeof(wchar_t) * clen); /* yes we are allocating probably too much here, I know */ string->count=mbstowcs(cstr,text,clen); if ( string->count == -1){ - string->count=mbstowcs(cstr,"Enc-Err",6); + /* conversion did not work, so lets fall back to just use what we got */ + string->count=clen-1; + for(n=0;text[n] != '\0';n++){ + cstr[n]=(unsigned char)text[n]; + } } #else char *cstr = strdup(text);