/****************************************************************************
- * RRDtool 1.2.11 Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.15 Copyright by Tobi Oetiker, 1997-2006
****************************************************************************
* 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 <png.h>
#include <ft2build.h>
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
ch = afm_fix_osx_charset(ch); /* unsafe macro */
switch (ch) {
case 0:
-#ifdef HAVE_MBSTOWCS
+#ifdef HAVE_MBSTOWCS
free(cstr);
#endif
return;
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);
"-->\n", fp);
svg_start_tag(fp, "svg");
fputs(" width=\"", fp);
- svg_write_number(fp, width * canvas->zoom);
+ svg_write_number(fp, width * canvas->zoom);
fputs("\" height=\"", fp);
- svg_write_number(fp, height * canvas->zoom);
+ svg_write_number(fp, height * canvas->zoom);
fputs("\" x=\"0\" y=\"0\" viewBox=\"", fp);
svg_write_number(fp, -LINEOFFSET);
fputs(" ", fp);
fputs(" ", fp);
svg_write_number(fp, height - LINEOFFSET);
fputs("\" preserveAspectRatio=\"xMidYMid\"", fp);
- fprintf(fp, " font-family=\"%s\"", svg_default_font); /* default font */
- fputs(" stroke-linecap=\"round\" stroke-linejoin=\"round\"", fp);
+ fprintf(fp, " font-family=\"%s\"", svg_default_font); /* default font */
+ fputs(" stroke-linecap=\"round\" stroke-linejoin=\"round\"", fp);
+ fputs(" xmlns=\"http://www.w3.org/2000/svg\"", fp);
+ fputs(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"", fp);
svg_close_tag(fp);
svg_start_tag(fp, "rect");
fprintf(fp, " x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"", width, height);
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
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);