X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_gfx.c;h=351f958269374d3883900c58ce34e35a35410981;hb=2e6c98e893777e4abf7b05cb4ecf81dde088cdb8;hp=c012e5cf84df9be748ea2676090229dde2143f58;hpb=0881b8848ab8c1cb9b50db4599d4adc9391a774d;p=rrdtool.git diff --git a/src/rrd_gfx.c b/src/rrd_gfx.c index c012e5c..351f958 100644 --- a/src/rrd_gfx.c +++ b/src/rrd_gfx.c @@ -1,16 +1,21 @@ /**************************************************************************** - * RRDtool 1.2.12 Copyright by Tobi Oetiker, 1997-2005 + * RRDtool 1.2.19 Copyright by Tobi Oetiker, 1997-2007 **************************************************************************** * rrd_gfx.c graphics wrapper for rrdtool **************************************************************************/ /* #define DEBUG */ -#ifdef DEBUG -# define DPRINTF(...) fprintf(stderr, __VA_ARGS__); -#else -# define DPRINTF(...) -#endif +/* stupid MSVC doesnt support variadic macros = no debug for now! */ +#ifdef _MSC_VER +# define DPRINTF() +#else +# ifdef DEBUG +# define DPRINTF(...) fprintf(stderr, __VA_ARGS__); +# else +# define DPRINTF(...) +# endif /* DEBUG */ +#endif /* _MSC_VER */ #include "rrd_tool.h" #include #include @@ -1062,7 +1067,9 @@ static void svg_write_text(FILE *fp, const char *text) text_count = mbstowcs(cstr, "Enc-Err", 6); p = cstr; #else - const unsigned char *p = text, ch; + unsigned char *p = text; + unsigned char *cstr; + char ch; if (!p) return; #endif @@ -1071,7 +1078,7 @@ static void svg_write_text(FILE *fp, const char *text) ch = afm_fix_osx_charset(ch); /* unsafe macro */ switch (ch) { case 0: -#ifdef HAVE_MBSTOWCS +#ifdef HAVE_MBSTOWCS free(cstr); #endif return; @@ -1081,9 +1088,11 @@ static void svg_write_text(FILE *fp, const char *text) case '"': fputs(""", fp); break; default: if (ch == 32) { +#ifdef HAVE_MBSTOWCS if (p <= cstr + 1 || !*p || *p == 32) fputs(" ", fp); /* non-breaking space in unicode */ else +#endif fputc(32, fp); } else if (ch < 32 || ch >= 127) fprintf(fp, "&#%d;", (int)ch); @@ -1745,7 +1754,8 @@ static void eps_write_text(eps_state *state, gfx_node_t *node) text_count = mbstowcs(cstr, "Enc-Err", 6); p = cstr; #else - const unsigned char *p = node->text, ch; + const unsigned char *p = node->text; + unsigned char ch; if (!p) return; #endif @@ -2032,9 +2042,9 @@ static void pdf_put_string_contents_wide(pdf_buffer *buf, const afm_char *text) default: if (ch > 255) { pdf_put_char(buf, '?'); - } else if (ch >= 126 || ch < 32) { + } else if (ch > 125 || ch < 32) { pdf_put_char(buf, ch); - } else if (ch >= 0 && ch <= 255) { + } else { char tmp[10]; snprintf(tmp, sizeof(tmp), "\\%03o", (int)ch); pdf_puts(buf, tmp);