diff options
author | hrs <hrs@FreeBSD.org> | 2013-05-01 10:45:12 +0800 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2013-05-01 10:45:12 +0800 |
commit | 7060af3405734fda1e4fa72a91e7223ae2d9ac1e (patch) | |
tree | 233aaa622aecadadc1d839888d2a15892ac0621d /print | |
parent | 95e68bcc18ecb89fbad5ad1b66e95fdabf00caf4 (diff) | |
download | freebsd-ports-gnome-7060af3405734fda1e4fa72a91e7223ae2d9ac1e.tar.gz freebsd-ports-gnome-7060af3405734fda1e4fa72a91e7223ae2d9ac1e.tar.zst freebsd-ports-gnome-7060af3405734fda1e4fa72a91e7223ae2d9ac1e.zip |
Fix issues on 64-bit platforms.
Diffstat (limited to 'print')
25 files changed, 747 insertions, 6 deletions
diff --git a/print/ghostscript7/Makefile b/print/ghostscript7/Makefile index 173df6157d3b..0909dee7c21b 100644 --- a/print/ghostscript7/Makefile +++ b/print/ghostscript7/Makefile @@ -3,7 +3,7 @@ PORTNAME= ghostscript PORTVERSION= 7.07 -PORTREVISION= 26 +PORTREVISION= 27 CATEGORIES= print MASTER_SITES= SF/ghostscript/gnu-gs/${PORTVERSION}:gs_srcs \ ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/gnu/gs${PORTVERSION:S/.//}/:gs_srcs \ @@ -13,8 +13,8 @@ MASTER_SITE_SUBDIR= \ ./:ports_jp PKGNAMESUFFIX= 7 DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:gs_srcs -EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} DIST_SUBDIR= ${PORTNAME} +EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} MAINTAINER= doceng@FreeBSD.org COMMENT= Ghostscript 7.x PostScript interpreter @@ -97,7 +97,6 @@ XCFLAGS+= -DA4 CONTRIB_UPP= lqx70ch.upp lqx70cl.upp lqx70cm.upp \ stc740ih.upp stc740p.upp stc740pl.upp - .if ${PORT_OPTIONS:MX11} MAKE_ENV+= GS_SHLIB_VER="${SHLIB_VER}" SHLIB_VER= 1 diff --git a/print/ghostscript7/files/patch-src-gsalloc.c b/print/ghostscript7/files/patch-src-gsalloc.c new file mode 100644 index 000000000000..7c29a14eeada --- /dev/null +++ b/print/ghostscript7/files/patch-src-gsalloc.c @@ -0,0 +1,11 @@ +--- src/gsalloc.c.orig 2013-04-30 11:14:17.000000000 +0900 ++++ src/gsalloc.c 2013-04-30 11:14:34.000000000 +0900 +@@ -195,7 +195,7 @@ + iimem->large_size = ((chunk_size / 4) & -obj_align_mod) + 1; + iimem->is_controlled = false; + iimem->gc_status.vm_threshold = chunk_size * 3L; +- iimem->gc_status.max_vm = max_long; ++ iimem->gc_status.max_vm = 0x7fffffff; + iimem->gc_status.psignal = NULL; + iimem->gc_status.signal_value = 0; + iimem->gc_status.enabled = false; diff --git a/print/ghostscript7/files/patch-src-gxclrast.c b/print/ghostscript7/files/patch-src-gxclrast.c new file mode 100644 index 000000000000..59d5053ad305 --- /dev/null +++ b/print/ghostscript7/files/patch-src-gxclrast.c @@ -0,0 +1,15 @@ +--- src/gxclrast.c.orig 2013-04-30 09:13:13.000000000 +0900 ++++ src/gxclrast.c 2013-04-30 09:13:41.000000000 +0900 +@@ -87,10 +87,10 @@ + private long + cmd_get_w(const byte * p, const byte ** rp) + { +- long val = *p++ & 0x7f; ++ int val = *p++ & 0x7f; + int shift = 7; + +- for (; val += (long)(*p & 0x7f) << shift, *p++ > 0x7f; shift += 7); ++ for (; val += (int)(*p & 0x7f) << shift, *p++ > 0x7f; shift += 7); + *rp = p; + return val; + } diff --git a/print/ghostscript7/files/patch-src-gxfixed.h b/print/ghostscript7/files/patch-src-gxfixed.h new file mode 100644 index 000000000000..0988ca612c9b --- /dev/null +++ b/print/ghostscript7/files/patch-src-gxfixed.h @@ -0,0 +1,46 @@ +--- src/gxfixed.h.orig 2013-04-30 11:29:39.000000000 +0900 ++++ src/gxfixed.h 2013-04-30 11:31:03.000000000 +0900 +@@ -27,12 +27,22 @@ + * quantities: integers lose accuracy in crucial places, + * and floating point arithmetic is slow. + */ +-typedef long fixed; +-typedef ulong ufixed; /* only used in a very few places */ +-#define ARCH_SIZEOF_FIXED ARCH_SIZEOF_LONG ++#if ARCH_SIZEOF_INT == 4 ++typedef int fixed; ++typedef uint ufixed; /* only used in a very few places */ ++# define ARCH_SIZEOF_FIXED ARCH_SIZEOF_INT ++# define max_fixed max_int ++# define min_fixed min_int ++#else ++# if ARCH_SIZEOF_LONG == 4 ++ typedef long fixed; ++ typedef ulong ufixed; /* only used in a very few places */ ++# define ARCH_SIZEOF_FIXED ARCH_SIZEOF_LONG ++# define max_fixed max_long ++# define min_fixed min_long ++# endif ++#endif + +-#define max_fixed max_long +-#define min_fixed min_long + #define fixed_0 0L + #define fixed_epsilon 1L + /* +@@ -120,13 +130,8 @@ + #define fixed_truncated(x) ((x) < 0 ? fixed_ceiling(x) : fixed_floor(x)) + + /* Define the largest and smallest integer values that fit in a fixed. */ +-#if arch_sizeof_int == arch_sizeof_long +-# define max_int_in_fixed fixed2int(max_fixed) +-# define min_int_in_fixed fixed2int(min_fixed) +-#else +-# define max_int_in_fixed max_int +-# define min_int_in_fixed min_int +-#endif ++#define max_int_in_fixed fixed2int(max_fixed) ++#define min_int_in_fixed fixed2int(min_fixed) + + #ifdef USE_FPU + # define USE_FPU_FIXED (USE_FPU < 0 && arch_floats_are_IEEE && arch_sizeof_long == 4) diff --git a/print/ghostscript7/files/patch-src-ibnum.c b/print/ghostscript7/files/patch-src-ibnum.c new file mode 100644 index 000000000000..2df0a7d138c7 --- /dev/null +++ b/print/ghostscript7/files/patch-src-ibnum.c @@ -0,0 +1,49 @@ +--- src/ibnum.c.orig 2003-01-17 09:49:04.000000000 +0900 ++++ src/ibnum.c 2013-04-30 11:18:27.000000000 +0900 +@@ -124,11 +124,11 @@ + case num_int32: + case num_int32 + 16: + if ((format & 31) == 0) { +- np->value.intval = sdecodelong(str, format); ++ np->value.intval = sdecodeint32(str, format); + return t_integer; + } else { + np->value.realval = +- (double)sdecodelong(str, format) * ++ (double)sdecodeint32(str, format) * + binary_scale[format & 31]; + return t_real; + } +@@ -171,18 +171,14 @@ + } + + /* Decode a (32-bit, signed) long. */ +-long +-sdecodelong(const byte * p, int format) ++int ++sdecodeint32(const byte * p, int format) + { + int a = p[0], b = p[1], c = p[2], d = p[3]; +- long v = (num_is_lsb(format) ? +- ((long)d << 24) + ((long)c << 16) + (b << 8) + a : +- ((long)a << 24) + ((long)b << 16) + (c << 8) + d); ++ int v = (num_is_lsb(format) ? ++ ((int)d << 24) + ((int)c << 16) + (b << 8) + a : ++ ((int)a << 24) + ((int)b << 16) + (c << 8) + d); + +-#if arch_sizeof_long > 4 +- /* Propagate bit 31 as the sign. */ +- v = (v ^ 0x80000000L) - 0x80000000L; +-#endif + return v; + } + +@@ -190,7 +186,7 @@ + float + sdecodefloat(const byte * p, int format) + { +- bits32 lnum = (bits32) sdecodelong(p, format); ++ bits32 lnum = (bits32) sdecodeint32(p, format); + float fnum; + + #if !arch_floats_are_IEEE diff --git a/print/ghostscript7/files/patch-src-ibnum.h b/print/ghostscript7/files/patch-src-ibnum.h new file mode 100644 index 000000000000..ffec70cac2ae --- /dev/null +++ b/print/ghostscript7/files/patch-src-ibnum.h @@ -0,0 +1,11 @@ +--- src/ibnum.h.orig 2013-04-30 10:50:12.000000000 +0900 ++++ src/ibnum.h 2013-04-30 10:50:29.000000000 +0900 +@@ -60,7 +60,7 @@ + int sdecode_number(P3(const byte *, int, ref *)); + int sdecodeshort(P2(const byte *, int)); + uint sdecodeushort(P2(const byte *, int)); +-long sdecodelong(P2(const byte *, int)); ++int sdecodeint32(P2(const byte *, int)); + float sdecodefloat(P2(const byte *, int)); + + #endif /* ibnum_INCLUDED */ diff --git a/print/ghostscript7/files/patch-src-idebug.c b/print/ghostscript7/files/patch-src-idebug.c new file mode 100644 index 000000000000..142926b4474b --- /dev/null +++ b/print/ghostscript7/files/patch-src-idebug.c @@ -0,0 +1,11 @@ +--- src/idebug.c.orig 2013-04-30 11:06:57.000000000 +0900 ++++ src/idebug.c 2013-04-30 11:07:09.000000000 +0900 +@@ -90,7 +90,7 @@ + case t_fontID: + goto strct; + case t_integer: +- dprintf1("int %ld", pref->value.intval); ++ dprintf1("int %d", pref->value.intval); + break; + case t_mark: + dprintf("mark"); diff --git a/print/ghostscript7/files/patch-src-idparam.c b/print/ghostscript7/files/patch-src-idparam.c new file mode 100644 index 000000000000..636d7c16b510 --- /dev/null +++ b/print/ghostscript7/files/patch-src-idparam.c @@ -0,0 +1,21 @@ +--- src/idparam.c.orig 2013-04-30 10:54:55.000000000 +0900 ++++ src/idparam.c 2013-04-30 10:55:23.000000000 +0900 +@@ -61,8 +61,7 @@ + int maxval, int defaultval, int *pvalue) + { + ref *pdval; +- int code; +- long ival; ++ int code, ival; + + if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0) { + ival = defaultval; +@@ -349,7 +348,7 @@ + } else { + if (!r_has_type(puniqueid, t_integer) || + puniqueid->value.intval < 0 || +- puniqueid->value.intval > 0xffffffL ++ puniqueid->value.intval > 0xffffff + ) + return_error(e_rangecheck); + /* Apparently fonts created by Fontographer often have */ diff --git a/print/ghostscript7/files/patch-src-iparam.c b/print/ghostscript7/files/patch-src-iparam.c new file mode 100644 index 000000000000..b0bb91a4d3ef --- /dev/null +++ b/print/ghostscript7/files/patch-src-iparam.c @@ -0,0 +1,33 @@ +--- src/iparam.c.orig 2013-04-30 11:12:36.000000000 +0900 ++++ src/iparam.c 2013-04-30 11:13:07.000000000 +0900 +@@ -67,7 +67,7 @@ + int len; + byte *buf; + +- sprintf(istr, "%ld", pref->value.intval); ++ sprintf(istr, "%d", pref->value.intval); + len = strlen(istr); + /* GC will take care of freeing this: */ + buf = gs_alloc_string(plist->memory, len, "ref_to_key"); +@@ -394,7 +394,7 @@ + { + int code; + stack_param_list *const splist = (stack_param_list *) plist; +- long index = penum->intval; ++ int index = penum->intval; + ref *stack_element; + + do { +@@ -563,12 +563,6 @@ + code = gs_note_error(e_typecheck); + break; + } +-#if arch_sizeof_int < arch_sizeof_long +- if (elt.value.intval != (int)elt.value.intval) { +- code = gs_note_error(e_rangecheck); +- break; +- } +-#endif + piv[i] = (int)elt.value.intval; + } + if (code < 0) { diff --git a/print/ghostscript7/files/patch-src-iref.h b/print/ghostscript7/files/patch-src-iref.h new file mode 100644 index 000000000000..33313d38047b --- /dev/null +++ b/print/ghostscript7/files/patch-src-iref.h @@ -0,0 +1,11 @@ +--- src/iref.h.orig 2013-04-30 11:13:29.000000000 +0900 ++++ src/iref.h 2013-04-30 11:13:41.000000000 +0900 +@@ -441,7 +441,7 @@ + #define r_set_ptr(rp,ptr) ((rp)->value.pstruct = (obj_header_t *)(ptr)) + + union v { /* name the union to keep gdb happy */ +- long intval; ++ int intval; + ushort boolval; + float realval; + ulong saveid; diff --git a/print/ghostscript7/files/patch-src-iscan.c b/print/ghostscript7/files/patch-src-iscan.c new file mode 100644 index 000000000000..cd8b03f6ab56 --- /dev/null +++ b/print/ghostscript7/files/patch-src-iscan.c @@ -0,0 +1,11 @@ +--- src/iscan.c.orig 2013-04-30 10:47:49.000000000 +0900 ++++ src/iscan.c 2013-04-30 10:48:19.000000000 +0900 +@@ -635,7 +635,7 @@ + uint size = ref_stack_count_inline(&o_stack) - pstack; + ref arr; + +- if_debug4('S', "[S}]d=%d, s=%d->%ld, c=%d\n", ++ if_debug4('S', "[S}]d=%d, s=%d->%d, c=%d\n", + pdepth, pstack, + (pstack == pdepth ? 0 : + ref_stack_index(&o_stack, size)->value.intval), diff --git a/print/ghostscript7/files/patch-src-iscanbin.c b/print/ghostscript7/files/patch-src-iscanbin.c new file mode 100644 index 000000000000..1f39c88b7209 --- /dev/null +++ b/print/ghostscript7/files/patch-src-iscanbin.c @@ -0,0 +1,83 @@ +--- src/iscanbin.c.orig 2013-04-30 10:51:53.000000000 +0900 ++++ src/iscanbin.c 2013-04-30 10:53:42.000000000 +0900 +@@ -173,7 +173,7 @@ + pbs->num_format = num_format; + if (top_size == 0) { + /* Extended header (2-byte array size, 4-byte length) */ +- ulong lsize; ++ uint lsize; + + if (rcnt < 7) { + s_end_inline(s, p - 1, rlimit); +@@ -183,7 +183,7 @@ + if (p[1] != 0) /* reserved, must be 0 */ + return_error(e_syntaxerror); + top_size = sdecodeushort(p + 2, num_format); +- lsize = sdecodelong(p + 4, num_format); ++ lsize = sdecodeint32(p + 4, num_format); + if ((size = lsize) != lsize) + return_error(e_limitcheck); + hsize = 8; +@@ -445,8 +445,7 @@ + for (; index < max_array_index; p += SIZEOF_BIN_SEQ_OBJ, index++) { + ref *op = abase + index; + uint osize; +- long value; +- uint atype, attrs; ++ int value, atype, attrs; + + s_end_inline(s, p, rlimit); /* in case of error */ + if (rlimit - p < SIZEOF_BIN_SEQ_OBJ) { +@@ -464,14 +463,14 @@ + make_null(op); + break; + case BS_TYPE_INTEGER: +- make_int(op, sdecodelong(p + 5, num_format)); ++ make_int(op, sdecodeint32(p + 5, num_format)); + break; + case BS_TYPE_REAL:{ + float vreal; + + osize = sdecodeushort(p + 3, num_format); + if (osize != 0) { /* fixed-point number */ +- value = sdecodelong(p + 5, num_format); ++ value = sdecodeint32(p + 5, num_format); + vreal = (float)ldexp((double)value, -osize); + } else { + vreal = sdecodefloat(p + 5, num_format); +@@ -480,7 +479,7 @@ + break; + } + case BS_TYPE_BOOLEAN: +- make_bool(op, sdecodelong(p + 5, num_format) != 0); ++ make_bool(op, sdecodeint32(p + 5, num_format) != 0); + break; + case BS_TYPE_STRING: + osize = sdecodeushort(p + 3, num_format); +@@ -492,7 +491,7 @@ + make_empty_string(op, attrs); + break; + } +- value = sdecodelong(p + 5, num_format); ++ value = sdecodeint32(p + 5, num_format); + if (value < max_array_index * SIZEOF_BIN_SEQ_OBJ || + value + osize > size + ) +@@ -524,7 +523,7 @@ + /* falls through */ + case BS_TYPE_NAME: + osize = sdecodeushort(p + 3, num_format); +- value = sdecodelong(p + 5, num_format); ++ value = sdecodeint32(p + 5, num_format); + switch (osize) { + case 0: + code = array_get(user_names_p, value, op); +@@ -546,7 +545,7 @@ + osize = sdecodeushort(p + 3, num_format); + atype = t_array; + arr: +- value = sdecodelong(p + 5, num_format); ++ value = sdecodeint32(p + 5, num_format); + if (value + osize > min_string_index || + value & (SIZEOF_BIN_SEQ_OBJ - 1) + ) diff --git a/print/ghostscript7/files/patch-src-iscannum.c b/print/ghostscript7/files/patch-src-iscannum.c new file mode 100644 index 000000000000..4a69664074a6 --- /dev/null +++ b/print/ghostscript7/files/patch-src-iscannum.c @@ -0,0 +1,203 @@ +--- src/iscannum.c.orig 2003-01-17 09:49:04.000000000 +0900 ++++ src/iscannum.c 2013-04-30 11:17:14.000000000 +0900 +@@ -57,7 +57,6 @@ + }; + + int ival; +- long lval; + double dval; + int exp10; + int code = 0; +@@ -104,8 +103,26 @@ + GET_NEXT(c, sp, goto iret); + if (!IS_DIGIT(d, c)) + break; +- if (WOULD_OVERFLOW(ival, d, max_int)) +- goto i2l; ++ if (WOULD_OVERFLOW((unsigned)ival, d, max_int)) { ++ /* goto i2l; */ ++ if (ival == max_int / 10 && d == (max_int % 10) + 1 && sign < 0) { ++ GET_NEXT(c, sp, c= EOFC); ++ dval = -(double)min_int; ++ if (c == 'e' || c == 'E') { ++ exp10 = 0; ++ goto fs; ++ } else if (c == '.') { ++ GET_NEXT(c, sp, c = EOFC); ++ exp10 = 0; ++ goto fd; ++ } else if (!IS_DIGIT(d, c)) { ++ ival = min_int; ++ break; ++ } ++ } else ++ dval = ival; ++ goto l2d; ++ } + } + ind: /* We saw a non-digit while accumulating an integer in ival. */ + switch (c) { +@@ -116,6 +133,8 @@ + *psp = sp; + code = 1; + break; ++ case EOFC: ++ break; + case 'e': + case 'E': + if (sign < 0) +@@ -125,8 +144,8 @@ + goto fe; + case '#': + { +- const uint radix = (uint)ival; +- ulong uval = 0, lmax; ++ const int radix = ival; ++ uint uval = 0, imax; + + if (sign || radix < min_radix || radix > max_radix) + return_error(e_syntaxerror); +@@ -136,19 +155,19 @@ + + switch (radix) { + case 2: +- shift = 1, lmax = max_ulong >> 1; ++ shift = 1, imax = max_uint >> 1; + break; + case 4: +- shift = 2, lmax = max_ulong >> 2; ++ shift = 2, imax = max_uint >> 2; + break; + case 8: +- shift = 3, lmax = max_ulong >> 3; ++ shift = 3, imax = max_uint >> 3; + break; + case 16: +- shift = 4, lmax = max_ulong >> 4; ++ shift = 4, imax = max_uint >> 4; + break; + case 32: +- shift = 5, lmax = max_ulong >> 5; ++ shift = 5, imax = max_uint >> 5; + break; + default: /* can't happen */ + return_error(e_rangecheck); +@@ -161,13 +180,13 @@ + code = 1; + break; + } +- if (uval > lmax) ++ if (uval > imax) + return_error(e_limitcheck); + } + } else { +- int lrem = max_ulong % radix; ++ int irem = max_uint % radix; + +- lmax = max_ulong / radix; ++ imax = max_uint / radix; + for (;; uval = uval * radix + d) { + GET_NEXT(c, sp, break); + d = decoder[c]; +@@ -176,8 +195,8 @@ + code = 1; + break; + } +- if (uval >= lmax && +- (uval > lmax || d > lrem) ++ if (uval >= imax && ++ (uval > imax || d > irem) + ) + return_error(e_limitcheck); + } +@@ -190,55 +209,6 @@ + make_int(pref, (sign < 0 ? -ival : ival)); + return code; + +- /* Accumulate a long in lval. */ +-i2l: +- for (lval = ival;;) { +- if (WOULD_OVERFLOW(lval, d, max_long)) { +- /* Make a special check for entering the smallest */ +- /* (most negative) integer. */ +- if (lval == max_long / 10 && +- d == (int)(max_long % 10) + 1 && sign < 0 +- ) { +- GET_NEXT(c, sp, c = EOFC); +- dval = -(double)min_long; +- if (c == 'e' || c == 'E' || c == '.') { +- exp10 = 0; +- goto fs; +- } else if (!IS_DIGIT(d, c)) { +- lval = min_long; +- break; +- } +- } else +- dval = lval; +- goto l2d; +- } +- lval = lval * 10 + d; +- GET_NEXT(c, sp, goto lret); +- if (!IS_DIGIT(d, c)) +- break; +- } +- switch (c) { +- case '.': +- GET_NEXT(c, sp, c = EOFC); +- exp10 = 0; +- goto l2r; +- case EOFC: +- break; +- default: +- *psp = sp; +- code = 1; +- break; +- case 'e': +- case 'E': +- exp10 = 0; +- goto le; +- case '#': +- return_error(e_syntaxerror); +- } +-lret: +- make_int(pref, (sign < 0 ? -lval : lval)); +- return code; +- + /* Accumulate a double in dval. */ + l2d: + exp10 = 0; +@@ -274,8 +244,8 @@ + exp10 = 0; + while (IS_DIGIT(d, c)) { + if (WOULD_OVERFLOW(ival, d, max_int)) { +- lval = ival; +- goto l2r; ++ dval = ival; ++ goto fd; + } + ival = ival * 10 + d; + exp10--; +@@ -293,23 +263,6 @@ + dval = ival; + goto fe; + +- /* We saw a '.' while accumulating a long in lval. */ +-l2r: +- while (IS_DIGIT(d, c)) { +- if (WOULD_OVERFLOW(lval, d, max_long)) { +- dval = lval; +- goto fd; +- } +- lval = lval * 10 + d; +- exp10--; +- GET_NEXT(c, sp, c = EOFC); +- } +-le: +- if (sign < 0) +- lval = -lval; +- dval = lval; +- goto fe; +- + /* Now we are accumulating a double in dval. */ + fd: + while (IS_DIGIT(d, c)) { diff --git a/print/ghostscript7/files/patch-src-iutil.c b/print/ghostscript7/files/patch-src-iutil.c new file mode 100644 index 000000000000..c77cb19ddd84 --- /dev/null +++ b/print/ghostscript7/files/patch-src-iutil.c @@ -0,0 +1,11 @@ +--- src/iutil.c.orig 2013-04-30 10:51:05.000000000 +0900 ++++ src/iutil.c 2013-04-30 10:51:20.000000000 +0900 +@@ -428,7 +428,7 @@ + data = (const byte *)(op->value.boolval ? "true" : "false"); + break; + case t_integer: +- sprintf(buf, "%ld", op->value.intval); ++ sprintf(buf, "%d", op->value.intval); + break; + case t_string: + check_read(*op); diff --git a/print/ghostscript7/files/patch-src-zarith.c b/print/ghostscript7/files/patch-src-zarith.c new file mode 100644 index 000000000000..582f61e8f144 --- /dev/null +++ b/print/ghostscript7/files/patch-src-zarith.c @@ -0,0 +1,48 @@ +--- src/zarith.c.orig 2013-04-30 11:07:41.000000000 +0900 ++++ src/zarith.c 2013-04-30 11:08:43.000000000 +0900 +@@ -32,9 +32,9 @@ + */ + + /* Define max and min values for what will fit in value.intval. */ +-#define MIN_INTVAL min_long +-#define MAX_INTVAL max_long +-#define MAX_HALF_INTVAL ((1L << (size_of(long) * 4 - 1)) - 1) ++#define MIN_INTVAL 0x80000000 ++#define MAX_INTVAL 0x7fffffff ++#define MAX_HALF_INTVAL 0x7fff + + /* <num1> <num2> add <sum> */ + /* We make this into a separate procedure because */ +@@ -64,7 +64,7 @@ + op[-1].value.realval += (double)op->value.intval; + break; + case t_integer: { +- long int2 = op->value.intval; ++ int int2 = op->value.intval; + + if (((op[-1].value.intval += int2) ^ int2) < 0 && + ((op[-1].value.intval - int2) ^ int2) >= 0 +@@ -158,10 +158,10 @@ + op[-1].value.realval *= (double)op->value.intval; + break; + case t_integer: { +- long int1 = op[-1].value.intval; +- long int2 = op->value.intval; +- long abs1 = (int1 >= 0 ? int1 : -int1); +- long abs2 = (int2 >= 0 ? int2 : -int2); ++ int int1 = op[-1].value.intval; ++ int int2 = op->value.intval; ++ uint abs1 = (uint)(int1 >= 0 ? int1 : -int1); ++ uint abs2 = (uint)(int2 >= 0 ? int2 : -int2); + float fprod; + + if ((abs1 > MAX_HALF_INTVAL || abs2 > MAX_HALF_INTVAL) && +@@ -212,7 +212,7 @@ + op[-1].value.realval -= (double)op->value.intval; + break; + case t_integer: { +- long int1 = op[-1].value.intval; ++ int int1 = op[-1].value.intval; + + if ((int1 ^ (op[-1].value.intval = int1 - op->value.intval)) < 0 && + (int1 ^ op->value.intval) < 0 diff --git a/print/ghostscript7/files/patch-src-zcontrol.c b/print/ghostscript7/files/patch-src-zcontrol.c new file mode 100644 index 000000000000..d00a600c19ec --- /dev/null +++ b/print/ghostscript7/files/patch-src-zcontrol.c @@ -0,0 +1,20 @@ +--- src/zcontrol.c.orig 2013-04-30 11:09:59.000000000 +0900 ++++ src/zcontrol.c 2013-04-30 11:11:03.000000000 +0900 +@@ -356,7 +356,7 @@ + { + os_ptr op = osp; + register es_ptr ep = esp; +- long var = ep[-3].value.intval; ++ int var = ep[-3].value.intval; + + if (var > ep[-1].value.intval) { + esp -= 5; /* pop everything */ +@@ -375,7 +375,7 @@ + { + os_ptr op = osp; + register es_ptr ep = esp; +- long var = ep[-3].value.intval; ++ int var = ep[-3].value.intval; + + if (var < ep[-1].value.intval) { + esp -= 5; /* pop everything */ diff --git a/print/ghostscript7/files/patch-src-zdict.c b/print/ghostscript7/files/patch-src-zdict.c new file mode 100644 index 000000000000..050ecc841717 --- /dev/null +++ b/print/ghostscript7/files/patch-src-zdict.c @@ -0,0 +1,29 @@ +--- src/zdict.c.orig 2013-04-30 11:04:05.000000000 +0900 ++++ src/zdict.c 2013-04-30 11:04:34.000000000 +0900 +@@ -35,12 +35,9 @@ + os_ptr op = osp; + + check_type(*op, t_integer); +-#if arch_sizeof_int < arch_sizeof_long +- check_int_leu(*op, max_uint); +-#else + if (op->value.intval < 0) + return_error(e_rangecheck); +-#endif ++ + return dict_create((uint) op->value.intval, op); + } + +@@ -458,12 +455,8 @@ + check_type(*op1, t_dictionary); + check_dict_write(*op1); + check_type(*op, t_integer); +-#if arch_sizeof_int < arch_sizeof_long +- check_int_leu(*op, max_uint); +-#else + if (op->value.intval < 0) + return_error(e_rangecheck); +-#endif + new_size = (uint) op->value.intval; + if (dict_length(op - 1) > new_size) + return_error(e_dictfull); diff --git a/print/ghostscript7/files/patch-src-zdps.c b/print/ghostscript7/files/patch-src-zdps.c new file mode 100644 index 000000000000..414a296cd4ea --- /dev/null +++ b/print/ghostscript7/files/patch-src-zdps.c @@ -0,0 +1,25 @@ +--- src/zdps.c.orig 2013-04-30 11:05:10.000000000 +0900 ++++ src/zdps.c 2013-04-30 11:05:50.000000000 +0900 +@@ -46,19 +46,18 @@ + { + os_ptr op = osp; + int code; +- long x, y; ++ int x, y; + + check_type(op[-2], t_integer); + check_type(op[-1], t_integer); + check_type(*op, t_integer); + x = op[-1].value.intval; + y = op->value.intval; +- if (x != (int)x || y != (int)y || +- op[-2].value.intval < -1 || ++ if (op[-2].value.intval < -1 || + op[-2].value.intval >= gs_color_select_count + ) + return_error(e_rangecheck); +- code = gs_setscreenphase(igs, (int)x, (int)y, ++ code = gs_setscreenphase(igs, x, y, + (gs_color_select_t) op[-2].value.intval); + if (code >= 0) + pop(3); diff --git a/print/ghostscript7/files/patch-src-zfunc4.c b/print/ghostscript7/files/patch-src-zfunc4.c new file mode 100644 index 000000000000..0d8610978652 --- /dev/null +++ b/print/ghostscript7/files/patch-src-zfunc4.c @@ -0,0 +1,13 @@ +--- src/zfunc4.c.orig 2013-04-30 10:45:00.000000000 +0900 ++++ src/zfunc4.c 2013-04-30 10:45:23.000000000 +0900 +@@ -150,10 +150,6 @@ + case t_integer: { + int i = elt.value.intval; + +-#if ARCH_SIZEOF_INT < ARCH_SIZEOF_LONG +- if (i != elt.value.intval) /* check for truncation */ +- return_error(e_rangecheck); +-#endif + if (i == (byte)i) { + *p = PtCr_byte; + p[1] = (byte)i; diff --git a/print/ghostscript7/files/patch-src-zgeneric.c b/print/ghostscript7/files/patch-src-zgeneric.c new file mode 100644 index 000000000000..d99189a5e16a --- /dev/null +++ b/print/ghostscript7/files/patch-src-zgeneric.c @@ -0,0 +1,20 @@ +--- src/zgeneric.c.orig 2013-04-30 10:55:48.000000000 +0900 ++++ src/zgeneric.c 2013-04-30 10:56:40.000000000 +0900 +@@ -76,7 +76,7 @@ + int count, i; + int code; + +- if ((ulong) op->value.intval > op - osbot) { ++ if ((uint)op->value.intval > (uint)(op - osbot)) { + /* There might be enough elements in other blocks. */ + check_int_ltu(*op, ref_stack_count(&o_stack)); + count = op->value.intval; +@@ -471,7 +471,7 @@ + { + os_ptr op = osp; + es_ptr obj = esp - 2; +- int index = (int)esp->value.intval; ++ int index = esp->value.intval; + + push(2); /* make room for key and value */ + if ((index = dict_next(obj, index, op - 1)) >= 0) { /* continue */ diff --git a/print/ghostscript7/files/patch-src-ziodev.c b/print/ghostscript7/files/patch-src-ziodev.c new file mode 100644 index 000000000000..2cd6f0add7a9 --- /dev/null +++ b/print/ghostscript7/files/patch-src-ziodev.c @@ -0,0 +1,11 @@ +--- src/ziodev.c.orig 2013-04-30 11:06:19.000000000 +0900 ++++ src/ziodev.c 2013-04-30 11:06:30.000000000 +0900 +@@ -79,8 +79,6 @@ + const byte *dname; + + check_type(*op, t_integer); +- if (op->value.intval != (int)op->value.intval) +- return_error(e_rangecheck); + iodev = gs_getiodevice((int)(op->value.intval)); + if (iodev == 0) /* index out of range */ + return_error(e_rangecheck); diff --git a/print/ghostscript7/files/patch-src-zmath.c b/print/ghostscript7/files/patch-src-zmath.c new file mode 100644 index 000000000000..94576da80fdf --- /dev/null +++ b/print/ghostscript7/files/patch-src-zmath.c @@ -0,0 +1,18 @@ +--- src/zmath.c.orig 2013-04-30 10:43:55.000000000 +0900 ++++ src/zmath.c 2013-04-30 10:44:23.000000000 +0900 +@@ -229,14 +229,10 @@ + zsrand(i_ctx_t *i_ctx_p) + { + os_ptr op = osp; +- long state; ++ int state; + + check_type(*op, t_integer); + state = op->value.intval; +-#if arch_sizeof_long > 4 +- /* Trim the state back to 32 bits. */ +- state = (int)state; +-#endif + /* + * The following somewhat bizarre adjustments are according to + * public information from Adobe describing their implementation. diff --git a/print/ghostscript7/files/patch-src-zstack.c b/print/ghostscript7/files/patch-src-zstack.c new file mode 100644 index 000000000000..f1359936e410 --- /dev/null +++ b/print/ghostscript7/files/patch-src-zstack.c @@ -0,0 +1,11 @@ +--- src/zstack.c.orig 2013-04-30 10:54:14.000000000 +0900 ++++ src/zstack.c 2013-04-30 10:54:26.000000000 +0900 +@@ -70,7 +70,7 @@ + register os_ptr opn; + + check_type(*op, t_integer); +- if ((ulong)op->value.intval >= op - osbot) { ++ if ((uint)op->value.intval >= op - osbot) { + /* Might be in an older stack block. */ + ref *elt; + diff --git a/print/ghostscript7/files/patch-src-ztype.c b/print/ghostscript7/files/patch-src-ztype.c new file mode 100644 index 000000000000..98be203c6abe --- /dev/null +++ b/print/ghostscript7/files/patch-src-ztype.c @@ -0,0 +1,34 @@ +--- src/ztype.c.orig 2013-04-30 10:46:12.000000000 +0900 ++++ src/ztype.c 2013-04-30 10:46:55.000000000 +0900 +@@ -53,10 +53,10 @@ + * constant expressions, so we can't use min_long and max_long. + * What a nuisance! + */ +-#define ALT_MIN_LONG (-1L << (arch_sizeof_long * 8 - 1)) +-#define ALT_MAX_LONG (~(ALT_MIN_LONG)) +-private const double min_int_real = (ALT_MIN_LONG * 1.0 - 1); +-private const double max_int_real = (ALT_MAX_LONG * 1.0 + 1); ++#define ALT_MIN_INT (-1 << 31) ++#define ALT_MAX_INT (~(ALT_MIN_INT)) ++static const double min_int_real = (ALT_MIN_INT * 1.0 - 1); ++static const double max_int_real = (ALT_MAX_INT * 1.0 + 1); + + #define REAL_CAN_BE_INT(v)\ + ((v) > min_int_real && (v) < max_int_real) +@@ -356,14 +356,14 @@ + return_op_typecheck(op - 2); + } + } else { +- ulong ival; ++ uint ival; + byte digits[sizeof(ulong) * 8]; + byte *endp = &digits[countof(digits)]; + byte *dp = endp; + + switch (r_type(op - 2)) { + case t_integer: +- ival = (ulong) op[-2].value.intval; ++ ival = (uint) op[-2].value.intval; + break; + case t_real: + { diff --git a/print/ghostscript7/pkg-descr b/print/ghostscript7/pkg-descr index dad34a8cfa36..dac9b390920a 100644 --- a/print/ghostscript7/pkg-descr +++ b/print/ghostscript7/pkg-descr @@ -6,9 +6,6 @@ This is distributed with the GNU General Public License, which allows free use, and free copying and redistribution under certain conditions (including, in some cases, commercial distribution). -This is the older version 7, for those that can't (or don't want to) use -the newer Ghostscript version 8. - This port includes add-on packages (not part of the official gs release) o HP8XX driver for HP DeskJet 880C/882C/895C - http://www.gelhaus.net/hp880c/ |