]> www.fi.muni.cz Git - evince.git/commitdiff
remove TRUE and FALSE definitions, glib provides them (PlaceImage,
authorMatthew S. Wilson <msw@rpath.com>
Mon, 4 Jul 2005 20:38:48 +0000 (20:38 +0000)
committerMatt Wilson <msw@src.gnome.org>
Mon, 4 Jul 2005 20:38:48 +0000 (20:38 +0000)
2005-07-04  Matthew S. Wilson  <msw@rpath.com>

* tiff/tiff2ps.c: remove TRUE and FALSE definitions, glib provides
them
(PlaceImage, tiff2ps_process_page): use
g_ascii_dtostr to convert floats to strings in a locale-safe way.

ChangeLog
tiff/tiff2ps.c

index 9a65860b13b8e403c2f0ff7299d8320e5efb9521..73298f9ef403661e460d94d170166d8aaee89232 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-04  Matthew S. Wilson  <msw@rpath.com>
+
+       * tiff/tiff2ps.c: remove TRUE and FALSE definitions, glib provides
+       them
+       (PlaceImage, tiff2ps_process_page): use
+       g_ascii_dtostr to convert floats to strings in a locale-safe way.
+
+
 2005-07-04  Martin Kretzschmar  <martink@gnome.org>
 
        * shell/main.c: include libgnomeui/gnome-authentication-manager.h
index 3e2bd32edfb042c220b83e038c4be80b6cd7fce4..632169b1555c98d4f20b8b116cced1a99cccfc88 100644 (file)
 /*
  * NB: this code assumes uint32 works with printf's %l[ud].
  */
-#ifndef TRUE
-#define        TRUE    1
-#define        FALSE   0
-#endif
-
 
 struct _TIFF2PSContext
 {
@@ -377,6 +372,8 @@ PlaceImage(TIFF2PSContext *ctx, double pagewidth, double pageheight,
        double subimageheight;
        double splitheight;
        double overlap;
+       /* buffers for locale-insitive number formatting */
+       gchar buf[2][G_ASCII_DTOSTR_BUF_SIZE];
 
        pagewidth *= PS_UNIT_SIZE;
        pageheight *= PS_UNIT_SIZE;
@@ -427,11 +424,16 @@ PlaceImage(TIFF2PSContext *ctx, double pagewidth, double pageheight,
 
        bottom_offset += ytran / (cnt?2:1);
        if (cnt)
-           left_offset += xtran / 2;
-       fprintf(ctx->fd, "%f %f translate\n", left_offset, bottom_offset);
-       fprintf(ctx->fd, "%f %f scale\n", xscale, yscale);
+               left_offset += xtran / 2;
+
+       fprintf(ctx->fd, "%s %s translate\n",
+               g_ascii_dtostr(buf[0], sizeof(buf[0]), left_offset),
+               g_ascii_dtostr(buf[1], sizeof(buf[1]), bottom_offset));
+       fprintf(ctx->fd, "%s %s scale\n",
+               g_ascii_dtostr(buf[0], sizeof(buf[0]), xscale),
+               g_ascii_dtostr(buf[1], sizeof(buf[1]), yscale));
        if (ctx->rotate)
-           fputs ("1 1 translate 180 ctx->rotate\n", ctx->fd);
+               fputs ("1 1 translate 180 ctx->rotate\n", ctx->fd);
 
        return splitpage;
 }
@@ -449,6 +451,8 @@ tiff2ps_process_page(TIFF2PSContext* ctx, TIFF* tif, double pw, double ph,
        double bottom_offset = bm * PS_UNIT_SIZE;
        uint16* sampleinfo;
        int split;
+       /* buffers for locale-insitive number formatting */
+       gchar buf[2][G_ASCII_DTOSTR_BUF_SIZE];
 
        if (!TIFFGetField(tif, TIFFTAG_XPOSITION, &ox))
                ox = 0;
@@ -509,8 +513,9 @@ tiff2ps_process_page(TIFF2PSContext* ctx, TIFF* tif, double pw, double ph,
                        } else
                                psh=ctx->rotate ? prw:prh;
                        fprintf(ctx->fd,
-                               "1 dict begin /PageSize [ %f %f ] def currentdict end setpagedevice\n",
-                               psw, psh);
+                               "1 dict begin /PageSize [ %s %s ] def currentdict end setpagedevice\n",
+                               g_ascii_dtostr(buf[0], sizeof(buf[0]), psw),
+                               g_ascii_dtostr(buf[1], sizeof(buf[1]), psh));
                        fputs(
                              "<<\n  /Policies <<\n    /PageSize 3\n  >>\n>> setpagedevice\n",
                              ctx->fd);
@@ -553,15 +558,19 @@ tiff2ps_process_page(TIFF2PSContext* ctx, TIFF* tif, double pw, double ph,
                                        left_offset +=
                                                (pw - prw * scale) / 2;
                                }
-                               fprintf(ctx->fd, "%f %f translate\n",
-                                       left_offset, bottom_offset);
-                               fprintf(ctx->fd, "%f %f scale\n",
-                                       prw * scale, prh * scale);
+                               fprintf(ctx->fd, "%s %s translate\n",
+                                       g_ascii_dtostr(buf[0], sizeof(buf[0]), left_offset),
+                                       g_ascii_dtostr(buf[1], sizeof(buf[1]), bottom_offset));
+                               fprintf(ctx->fd, "%s %s scale\n",
+                                       g_ascii_dtostr(buf[0], sizeof(buf[0]), prw * scale),
+                                       g_ascii_dtostr(buf[1], sizeof(buf[1]), prh * scale));
                                if (ctx->rotate)
                                        fputs ("1 1 translate 180 ctx->rotate\n", ctx->fd);
                        }
                } else {
-                       fprintf(ctx->fd, "%f %f scale\n", prw, prh);
+                       fprintf(ctx->fd, "%s %s scale\n",
+                               g_ascii_dtostr(buf[0], sizeof(buf[0]), prw),
+                               g_ascii_dtostr(buf[1], sizeof(buf[1]), prh));
                        if (ctx->rotate)
                                fputs ("1 1 translate 180 ctx->rotate\n", ctx->fd);
                }