X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fpostscript.c;h=5acb02f547d6ab4d724ab7fb230887ae98c3baa4;hb=8fa7f3f6640c0eec450149cf5ccfab15d5391f55;hp=c828a0df2a49136cf73433458384996355516d31;hpb=33a381c1da6c8a92ad8e1809e64a4953e9586b26;p=pspp diff --git a/src/postscript.c b/src/postscript.c index c828a0df2a..5acb02f547 100644 --- a/src/postscript.c +++ b/src/postscript.c @@ -27,27 +27,18 @@ #include #include #include +#include #if HAVE_UNISTD_H #include #endif -#if TIME_WITH_SYS_TIME -#include -#include -#else -#if HAVE_SYS_TIME_H -#include -#else -#include -#endif -#endif - #include "alloc.h" #include "bitvector.h" #include "error.h" #include "filename.h" #include "font.h" +#include "getl.h" #include "getline.h" #include "hash.h" #include "main.h" @@ -57,6 +48,9 @@ #include "som.h" #include "version.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) + /* FIXMEs: optimize-text-size not implemented. @@ -326,7 +320,7 @@ ps_preopen_driver (struct outp_driver *this) assert (this->driver_open == 0); msg (VM (1), _("PostScript driver initializing as `%s'..."), this->name); - this->ext = x = xmalloc (sizeof (struct ps_driver_ext)); + this->ext = x = xmalloc (sizeof *x); this->res = PSUS; this->horiz = this->vert = 1; this->width = this->length = 0; @@ -1452,7 +1446,7 @@ postopen (struct file_ext *f) char *beg; beg = buf2 = fn_interp_vars (buf, ps_get_var); len = strlen (buf2); - while (isspace (*beg)) + while (isspace ((unsigned char) *beg)) beg++, len--; if (beg[len - 1] == '\n') len--; @@ -1494,7 +1488,7 @@ quote_ps_name (char *dest, const char *string) const char *sp; for (sp = string; *sp; sp++) - switch (*(unsigned char *) sp) + switch (*sp) { case 'a': case 'f': @@ -1569,7 +1563,7 @@ quote_ps_name (char *dest, const char *string) *dp++ = '<'; for (sp = string; *sp && dp < &dest[256]; sp++) { - sprintf (dp, "%02x", *(unsigned char *) sp); + sprintf (dp, "%02x", (unsigned char) *sp); dp += 2; } return stpcpy (dp, ">cvn"); @@ -1594,7 +1588,7 @@ quote_ps_string (char *dest, const char *string) dp = stpcpy (dp, "\\("); else if (*sp == ')') dp = stpcpy (dp, "\\)"); - else if (*sp < 32 || *((unsigned char *) sp) > 127) + else if (*sp < 32 || (unsigned char) *sp > 127) dp = spprintf (dp, "\\%3o", *sp); else *dp++ = *sp; @@ -1908,7 +1902,7 @@ line (struct outp_driver *this, int type, int ind, int dep1, int dep2) if ((*f)->ndep >= (*f)->mdep) { (*f)->mdep += 16; - *f = xrealloc (*f, (sizeof **f + sizeof (int[2]) * ((*f)->mdep - 1))); + *f = xrealloc (*f, sizeof **f + sizeof (int[2]) * ((*f)->mdep - 1)); } (*f)->dep[(*f)->ndep][0] = dep1; (*f)->dep[(*f)->ndep][1] = dep2; @@ -2472,7 +2466,7 @@ write_text (struct outp_driver *this, if (TEST_BIT (literal_chars[ext->data], cp->ch)) *lp++ = cp->ch; else - switch (cp->ch) + switch ((char) cp->ch) { case '(': lp = stpcpy (lp, "\\("); @@ -2741,7 +2735,7 @@ text (struct outp_driver *this, struct outp_text *t, int draw) } else { - buf = xrealloc (buf, sizeof *buf * buf_len * 2); + buf = xnrealloc (buf, buf_len * 2, sizeof *buf); buf_loc = buf + buf_len; buf_end = buf + buf_len * 2; }