summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-10-13 06:40:05 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-10-13 06:40:05 +0000
commit114598d40feee6dd9c5de45b0cc7cedefbdedd00 (patch)
treeda3d139f7c74dc58b9bc11fc8d63290dccd35b12 /Build/source
parent79c720fad26a4abca2cf02568777b74ecd68a238 (diff)
texk/ps2pkm: Minor bug fix. Avoid use of LONG (int for Unix but defined as long by MinGW)
git-svn-id: svn://tug.org/texlive/trunk@35365 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/ps2pkm/ChangeLog25
-rw-r--r--Build/source/texk/ps2pkm/arith.c36
-rw-r--r--Build/source/texk/ps2pkm/arith.h12
-rw-r--r--Build/source/texk/ps2pkm/basics.h4
-rw-r--r--Build/source/texk/ps2pkm/c-auto.in20
-rwxr-xr-xBuild/source/texk/ps2pkm/configure62
-rw-r--r--Build/source/texk/ps2pkm/configure.ac7
-rw-r--r--Build/source/texk/ps2pkm/curves.c2
-rw-r--r--Build/source/texk/ps2pkm/ffilest.h4
-rw-r--r--Build/source/texk/ps2pkm/filenames.c5
-rw-r--r--Build/source/texk/ps2pkm/fontfcn.c4
-rw-r--r--Build/source/texk/ps2pkm/fontstruct.h2
-rw-r--r--Build/source/texk/ps2pkm/fsmasks.h4
-rw-r--r--Build/source/texk/ps2pkm/hints.c2
-rw-r--r--Build/source/texk/ps2pkm/lines.c8
-rw-r--r--Build/source/texk/ps2pkm/objects.c10
-rw-r--r--Build/source/texk/ps2pkm/objects.h7
-rw-r--r--Build/source/texk/ps2pkm/paths.c9
-rw-r--r--Build/source/texk/ps2pkm/pk2bm.c5
-rw-r--r--Build/source/texk/ps2pkm/pkin.c4
-rw-r--r--Build/source/texk/ps2pkm/pkout.c12
-rw-r--r--Build/source/texk/ps2pkm/pkout.h10
-rw-r--r--Build/source/texk/ps2pkm/ps2pk.c23
-rw-r--r--Build/source/texk/ps2pkm/regions.c32
-rw-r--r--Build/source/texk/ps2pkm/spaces.c22
-rw-r--r--Build/source/texk/ps2pkm/spaces.h2
-rw-r--r--Build/source/texk/ps2pkm/t1funcs.c26
-rw-r--r--Build/source/texk/ps2pkm/t1info.c4
-rw-r--r--Build/source/texk/ps2pkm/t1io.c2
-rw-r--r--Build/source/texk/ps2pkm/t1snap.c1
-rw-r--r--Build/source/texk/ps2pkm/t1stdio.h4
-rw-r--r--Build/source/texk/ps2pkm/token.c36
-rw-r--r--Build/source/texk/ps2pkm/types.h25
-rw-r--r--Build/source/texk/ps2pkm/util.c8
-rw-r--r--Build/source/texk/ps2pkm/util.h10
35 files changed, 286 insertions, 163 deletions
diff --git a/Build/source/texk/ps2pkm/ChangeLog b/Build/source/texk/ps2pkm/ChangeLog
index 6a6ed4234b2..19b6d5940d3 100644
--- a/Build/source/texk/ps2pkm/ChangeLog
+++ b/Build/source/texk/ps2pkm/ChangeLog
@@ -1,4 +1,25 @@
-2014-10-09 Peter Breitenlohner <peb@mppmu.mpg.de>
+2014-10-13 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * paths.c: Bug fix: Avoid use of uninitialized variable.
+
+ * basics.h, filenames.c, fontfcn.c, pk2bm.c, pkin.c, t1io.c,
+ t1snap.c, types.h: Always include "c-auto.h" first in all C
+ files (directly or indirectly via "basics.h" or "types.h").
+
+ * configure.ac: Add AC_TYPE_(U)INT32_T and AC_TYPE_INTPTR_T.
+
+ * pkout.[ch], ps2pk.c: Replace (U)INT32 => (u)int32_t.
+
+ * arith.[ch], curves.c, ffilest.h, fsmasks.h, hints.c, lines.c,
+ objects.[ch], paths.c, regions.c, spaces.[ch], t1funcs.c,
+ t1info.c, t1stdio.h, token.c, types.h, util.[ch]: Replace
+ (U)LONG => (u)int32_t, to avoid LONG defined as long for MinGW
+ (and MSVC?).
+
+ * fontstruct.h, ps2pk.c, util.h: Change MakeAtom() return type
+ long => intptr_t (large enough for 'void *' even for WIN64).
+
+2014-10-12 Peter Breitenlohner <peb@mppmu.mpg.de>
More general cleanup:
* *.[ch]: ANSI/ISO C function prototypes and definitions.
@@ -8,7 +29,7 @@
* Makefile.am: t1imager.h. t1stub.c, and trig.h are not used.
Enable compiler warnings.
-2014-10-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+2014-10-09 Peter Breitenlohner <peb@mppmu.mpg.de>
* basics.h: Declare fatal() as noreturn (gcc and MSVC).
* pkout.c (magnification): Fatal error if no value found.
diff --git a/Build/source/texk/ps2pkm/arith.c b/Build/source/texk/ps2pkm/arith.c
index 9199042ecea..eba1b5dcde7 100644
--- a/Build/source/texk/ps2pkm/arith.c
+++ b/Build/source/texk/ps2pkm/arith.c
@@ -75,14 +75,14 @@ The following code is INDEPENDENT of:
first or least significant byte first.
:eol.
-SHORTSIZE is the number of bits in a short; LONGSIZE is the number of
-bits in a long; MAXSHORT is the maximum unsigned short:
+SHORTSIZE is the number of bits in a short; INT32SIZE is the number of
+bits in an int32_t; MAXSHORT is the maximum unsigned short:
*/
/*SHARED LINE(S) ORIGINATED HERE*/
/*
ASSEMBLE concatenates two shorts to form a long:
*/
-#define ASSEMBLE(hi,lo) ((((ULONG)hi)<<SHORTSIZE)+(lo))
+#define ASSEMBLE(hi,lo) ((((uint32_t)hi)<<SHORTSIZE)+(lo))
/*
HIGHDIGIT extracts the most significant short from a long; LOWDIGIT
extracts the least significant short from a long:
@@ -93,7 +93,7 @@ extracts the least significant short from a long:
/*
SIGNBITON tests the high order bit of a long 'w':
*/
-#define SIGNBITON(w) (((LONG)w)<0)
+#define SIGNBITON(w) (((int32_t)w)<0)
/*SHARED LINE(S) ORIGINATED HERE*/
@@ -105,12 +105,12 @@ SIGNBITON tests the high order bit of a long 'w':
The two multiplicands must be positive.
*/
-void DLmult(register doublelong *product, register ULONG u, register ULONG v)
+void DLmult(register doublelong *product, register uint32_t u, register uint32_t v)
{
- register ULONG u1, u2; /* the digits of u */
- register ULONG v1, v2; /* the digits of v */
+ register uint32_t u1, u2; /* the digits of u */
+ register uint32_t v1, v2; /* the digits of v */
register unsigned int w1, w2, w3, w4; /* the digits of w */
- register ULONG t; /* temporary variable */
+ register uint32_t t; /* temporary variable */
/* printf("DLmult(? ?, %x, %x)\n", u, v); */
u1 = HIGHDIGIT(u);
u2 = LOWDIGIT(u);
@@ -149,15 +149,15 @@ Both the dividend and the divisor must be positive.
void DLdiv(
doublelong *quotient, /* also where dividend is, originally */
- ULONG divisor)
+ uint32_t divisor)
{
- register ULONG u1u2 = quotient->high;
- register ULONG u3u4 = quotient->low;
- register LONG u3; /* single digit of dividend */
+ register uint32_t u1u2 = quotient->high;
+ register uint32_t u3u4 = quotient->low;
+ register int32_t u3; /* single digit of dividend */
register int v1,v2; /* divisor in registers */
- register LONG t; /* signed copy of u1u2 */
+ register int32_t t; /* signed copy of u1u2 */
register int qhat; /* guess at the quotient digit */
- register ULONG q3q4; /* low two digits of quotient */
+ register uint32_t q3q4; /* low two digits of quotient */
register int shift; /* holds the shift value for normalizing */
register int j; /* loop variable */
@@ -199,9 +199,9 @@ void DLdiv(
shift--;
divisor >>= 1;
- if ((u1u2 >> (LONGSIZE - shift)) != 0 && shift != 0)
+ if ((u1u2 >> (INT32SIZE - shift)) != 0 && shift != 0)
t1_abort("DLdiv: dividend too large");
- u1u2 = (u1u2 << shift) + ((shift == 0) ? 0 : u3u4 >> (LONGSIZE - shift));
+ u1u2 = (u1u2 << shift) + ((shift == 0) ? 0 : u3u4 >> (INT32SIZE - shift));
u3u4 <<= shift;
/*
@@ -287,7 +287,7 @@ less than the max of the lows. So, the test is "if and only if".
void DLadd(doublelong *u, doublelong *v) /* u = u + v */
{
- register ULONG lowmax = MAX(u->low, v->low);
+ register uint32_t lowmax = MAX(u->low, v->low);
/* printf("DLadd(%x %x, %x %x)\n", u->high, u->low, v->high, v->low); */
u->high += v->high;
@@ -372,7 +372,7 @@ fractpel FPdiv(register fractpel dividend, register fractpel divisor)
negative = !negative;
}
w.low = dividend << FRACTBITS;
- w.high = dividend >> (LONGSIZE - FRACTBITS);
+ w.high = dividend >> (INT32SIZE - FRACTBITS);
DLdiv(&w, divisor);
if (w.high != 0 || SIGNBITON(w.low)) {
IfTrace2(TRUE,"FPdiv: overflow, %d/%d\n", dividend, divisor);
diff --git a/Build/source/texk/ps2pkm/arith.h b/Build/source/texk/ps2pkm/arith.h
index 9b0d4e063be..834f776dd50 100644
--- a/Build/source/texk/ps2pkm/arith.h
+++ b/Build/source/texk/ps2pkm/arith.h
@@ -34,22 +34,22 @@
#endif
#define SHORTSIZE (sizeof(SHORT)*8)
-#define LONGSIZE (SHORTSIZE*2)
+#define INT32SIZE (SHORTSIZE*2)
#define MAXSHORT ((1<<SHORTSIZE)-1)
/*END SHARED*/
/*SHARED*/
typedef struct {
- LONG high;
- ULONG low;
+ int32_t high;
+ uint32_t low;
} doublelong;
/*END SHARED*/
/*SHARED*/
#define DLrightshift(dl,N) { \
- dl.low = (dl.low >> N) + (((ULONG) dl.high) << (LONGSIZE - N)); \
+ dl.low = (dl.low >> N) + (((uint32_t) dl.high) << (INT32SIZE - N)); \
dl.high >>= N; \
}
@@ -58,8 +58,8 @@ typedef struct {
#include "types.h"
-void DLmult(doublelong *, ULONG, ULONG),
- DLdiv(doublelong *, ULONG),
+void DLmult(doublelong *, uint32_t, uint32_t),
+ DLdiv(doublelong *, uint32_t),
DLadd(doublelong *, doublelong *),
DLsub(doublelong *, doublelong *);
diff --git a/Build/source/texk/ps2pkm/basics.h b/Build/source/texk/ps2pkm/basics.h
index 8c20a75dae2..97cadda6046 100644
--- a/Build/source/texk/ps2pkm/basics.h
+++ b/Build/source/texk/ps2pkm/basics.h
@@ -4,6 +4,9 @@
* VERSION: 1.0 (September 1995)
*/
+#ifdef HAVE_CONFIG_H
+#include "c-auto.h"
+#endif
#ifndef NOBASICS
@@ -11,7 +14,6 @@
# include <kpathsea/config.h>
# include <kpathsea/c-pathch.h>
# include <kpathsea/c-fopen.h>
-# include <c-auto.h>
# define PATHSEP ENV_SEP
# define DIRSEP DIR_SEP
# define RB FOPEN_RBIN_MODE
diff --git a/Build/source/texk/ps2pkm/c-auto.in b/Build/source/texk/ps2pkm/c-auto.in
index f0023ca8da8..db97d2d05c6 100644
--- a/Build/source/texk/ps2pkm/c-auto.in
+++ b/Build/source/texk/ps2pkm/c-auto.in
@@ -31,6 +31,9 @@
/* Define to 1 if you have the `getwd' function. */
#undef HAVE_GETWD
+/* Define to 1 if the system has the type `intptr_t'. */
+#undef HAVE_INTPTR_T
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -156,6 +159,11 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT32_T
+
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
@@ -170,13 +178,25 @@
#undef inline
#endif
+/* Define to the type of a signed integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+#undef int32_t
+
/* Define to the type of a signed integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#undef int64_t
+/* Define to the type of a signed integer type wide enough to hold a pointer,
+ if such a type exists, and if the system does not define it. */
+#undef intptr_t
+
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#undef uint64_t
diff --git a/Build/source/texk/ps2pkm/configure b/Build/source/texk/ps2pkm/configure
index 650511a0f8d..c2f52c0e69e 100755
--- a/Build/source/texk/ps2pkm/configure
+++ b/Build/source/texk/ps2pkm/configure
@@ -13086,6 +13086,68 @@ fi
done
+ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
+case $ac_cv_c_int32_t in #(
+ no|yes) ;; #(
+ *)
+
+cat >>confdefs.h <<_ACEOF
+#define int32_t $ac_cv_c_int32_t
+_ACEOF
+;;
+esac
+
+
+ ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
+if test "x$ac_cv_type_intptr_t" = xyes; then :
+
+$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h
+
+else
+ for ac_type in 'int' 'long int' 'long long int'; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+cat >>confdefs.h <<_ACEOF
+#define intptr_t $ac_type
+_ACEOF
+
+ ac_type=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test -z "$ac_type" && break
+ done
+fi
+
+
+ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
+case $ac_cv_c_uint32_t in #(
+ no|yes) ;; #(
+ *)
+
+$as_echo "#define _UINT32_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint32_t $ac_cv_c_uint32_t
+_ACEOF
+;;
+ esac
+
+
for ac_func in vprintf
do :
ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf"
diff --git a/Build/source/texk/ps2pkm/configure.ac b/Build/source/texk/ps2pkm/configure.ac
index aee3538c2e0..c9c8f35ada5 100644
--- a/Build/source/texk/ps2pkm/configure.ac
+++ b/Build/source/texk/ps2pkm/configure.ac
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
dnl
-dnl Copyright (C) 2009, 2013 Peter Breitenlohner <tex-live@tug.org>
+dnl Copyright (C) 2009-2014 Peter Breitenlohner <tex-live@tug.org>
dnl
dnl This file is free software; the copyright holder
dnl gives unlimited permission to copy and/or distribute it,
@@ -21,6 +21,11 @@ dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h])
+dnl Checks for types.
+AC_TYPE_INT32_T
+AC_TYPE_INTPTR_T
+AC_TYPE_UINT32_T
+
dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memset])
diff --git a/Build/source/texk/ps2pkm/curves.c b/Build/source/texk/ps2pkm/curves.c
index 77da96b5dfa..08b7a866d1d 100644
--- a/Build/source/texk/ps2pkm/curves.c
+++ b/Build/source/texk/ps2pkm/curves.c
@@ -182,7 +182,7 @@ the starting values. If this overflows, a 'long', we are in trouble:
#if defined(BITS)
#undef BITS
#endif
-#define BITS (sizeof(LONG)*8)
+#define BITS (sizeof(int32_t)*8)
#define HIGHTEST(p) (((p)>>(BITS-4)) != 0) /* includes sign bit */
#define TOOBIG(xy) ((xy < 0) ? HIGHTEST(-xy) : HIGHTEST(xy))
diff --git a/Build/source/texk/ps2pkm/ffilest.h b/Build/source/texk/ps2pkm/ffilest.h
index c84f4f5b216..006e5fa0423 100644
--- a/Build/source/texk/ps2pkm/ffilest.h
+++ b/Build/source/texk/ps2pkm/ffilest.h
@@ -109,8 +109,8 @@ typedef struct _FontTable {
typedef struct _FontDirectory {
char *directory;
- ULONG dir_mtime;
- ULONG alias_mtime;
+ uint32_t dir_mtime;
+ uint32_t alias_mtime;
FontTableRec scalable;
FontTableRec nonScalable;
} FontDirectoryRec;
diff --git a/Build/source/texk/ps2pkm/filenames.c b/Build/source/texk/ps2pkm/filenames.c
index 1a3d3a55c3c..a08827a31f9 100644
--- a/Build/source/texk/ps2pkm/filenames.c
+++ b/Build/source/texk/ps2pkm/filenames.c
@@ -6,9 +6,12 @@
* VERSION: 1.5 (September 1995)
*/
+#ifdef HAVE_CONFIG_H
+#include "c-auto.h"
+#endif
+
#ifdef KPATHSEA
#include <kpathsea/kpathsea.h>
-#include <c-auto.h>
#endif
#include <stdio.h>
diff --git a/Build/source/texk/ps2pkm/fontfcn.c b/Build/source/texk/ps2pkm/fontfcn.c
index e4dfb2360b6..85c3e654e17 100644
--- a/Build/source/texk/ps2pkm/fontfcn.c
+++ b/Build/source/texk/ps2pkm/fontfcn.c
@@ -29,6 +29,10 @@
*/
/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */
+#ifdef HAVE_CONFIG_H
+#include "c-auto.h"
+#endif
+
#include <stdio.h>
#include <string.h>
#include "objects.h"
diff --git a/Build/source/texk/ps2pkm/fontstruct.h b/Build/source/texk/ps2pkm/fontstruct.h
index 39c40f477f4..7b9212f1e3b 100644
--- a/Build/source/texk/ps2pkm/fontstruct.h
+++ b/Build/source/texk/ps2pkm/fontstruct.h
@@ -51,7 +51,7 @@ typedef enum {
typedef struct _FontProp {
long name;
- long value; /* assumes ATOM is not larger than INT32 */
+ intptr_t value; /* large enough to hole an 'int' or 'void *' */
} FontPropRec;
typedef struct _FontResolution {
diff --git a/Build/source/texk/ps2pkm/fsmasks.h b/Build/source/texk/ps2pkm/fsmasks.h
index 7904ab85922..dba6e8ec61b 100644
--- a/Build/source/texk/ps2pkm/fsmasks.h
+++ b/Build/source/texk/ps2pkm/fsmasks.h
@@ -66,7 +66,7 @@
#define BitmapFormatMaskScanLinePad (1L << 3)
#define BitmapFormatMaskScanLineUnit (1L << 4)
-typedef ULONG fsBitmapFormat;
-typedef ULONG fsBitmapFormatMask;
+typedef uint32_t fsBitmapFormat;
+typedef uint32_t fsBitmapFormatMask;
#endif /* _FSMASKS_H_ */
diff --git a/Build/source/texk/ps2pkm/hints.c b/Build/source/texk/ps2pkm/hints.c
index 33fe5639d3d..5cd52aab7e7 100644
--- a/Build/source/texk/ps2pkm/hints.c
+++ b/Build/source/texk/ps2pkm/hints.c
@@ -816,7 +816,7 @@ void ApplyContinuity(struct region *R)
pel rightXabove,rightXbelow,leftXabove,leftXbelow;
pel leftX,rightX;
int i;
- LONG newcenter,abovecenter,belowcenter;
+ int32_t newcenter,abovecenter,belowcenter;
FixSubPaths(R);
if (RegionDebug >= 3)
diff --git a/Build/source/texk/ps2pkm/lines.c b/Build/source/texk/ps2pkm/lines.c
index 10b282e7348..41a1d5beb25 100644
--- a/Build/source/texk/ps2pkm/lines.c
+++ b/Build/source/texk/ps2pkm/lines.c
@@ -134,10 +134,10 @@ static void Bresenham(
register fractpel x2, /* ending point ... */
register fractpel y2) /* ... on the line (down) */
{
- register LONG dx,dy; /* change in x and y, in my own precision */
- register LONG x,y; /* integer pel starting point */
- register int count; /* integer pel delta y */
- register LONG d; /* the Bresenham algorithm error term */
+ register int32_t dx,dy; /* change in x and y, in my own precision */
+ register int32_t x,y; /* integer pel starting point */
+ register int count; /* integer pel delta y */
+ register int32_t d; /* the Bresenham algorithm error term */
x1 = TruncFP(x1, FRACTBITS-PREC);
y1 = TruncFP(y1, FRACTBITS-PREC);
diff --git a/Build/source/texk/ps2pkm/objects.c b/Build/source/texk/ps2pkm/objects.c
index 9906466984c..ba18c9ca7fa 100644
--- a/Build/source/texk/ps2pkm/objects.c
+++ b/Build/source/texk/ps2pkm/objects.c
@@ -247,7 +247,7 @@ afterwards. 3-26-91 PNM
/*
:h2.TYPE1IMAGER Object Functions
-:h3.LONGCOPY() - Macro to Copy "long" Aligned Data
+:h3.INT32COPY() - Macro to Copy "long" Aligned Data
Copying arbitrary bytes in C is a bit of a problem. "strcpy" can't be
used, because 0 bytes are special-cased. Most environments have a
@@ -302,8 +302,8 @@ struct xobject *t1_Allocate(
/*
* round up 'size' and 'extra' to be an integer number of 'long's:
*/
- size = (size + sizeof(LONG) - 1) & -sizeof(LONG);
- extra = (extra + sizeof(LONG) - 1) & -sizeof(LONG);
+ size = (size + sizeof(int32_t) - 1) & -sizeof(int32_t);
+ extra = (extra + sizeof(int32_t) - 1) & -sizeof(int32_t);
if (size + extra <= 0)
t1_abort("Non-positive allocate?");
r = (struct xobject *) Xalloc(size + extra);
@@ -326,7 +326,7 @@ struct xobject *t1_Allocate(
function, which was in turn called by Unique(). (PNM) */
if (!ISPERMANENT(template->flag))
--template->references;
- LONGCOPY(r, template, size);
+ INT32COPY(r, template, size);
r->flag &= ~(ISPERMANENT(ON) | ISIMMORTAL(ON));
/* added reference field 3-2-6-91 PNM */
r->references = 1;
@@ -1125,7 +1125,7 @@ void InitImager(void)
/* Undef malloc so that we can get to the system call. */
/* All other calls to malloc are defined to Xalloc. */
- if (sizeof(SHORT) != 2 || sizeof(LONG) != 4)
+ if (sizeof(SHORT) != 2 || sizeof(int32_t) != 4)
t1_abort("Fundamental TYPE1IMAGER assumptions invalid in this port");
InitSpaces();
InitFonts();
diff --git a/Build/source/texk/ps2pkm/objects.h b/Build/source/texk/ps2pkm/objects.h
index aad912d3f65..a5c3633cf21 100644
--- a/Build/source/texk/ps2pkm/objects.h
+++ b/Build/source/texk/ps2pkm/objects.h
@@ -35,7 +35,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <kpathsea/kpathsea.h>
-#include <c-auto.h>
#endif
#include "types.h"
@@ -170,9 +169,9 @@ struct xobject {
/*END SHARED*/
/*SHARED*/
-#define LONGCOPY(dest,source,bytes) { \
- register LONG *p1 = (LONG *)dest; register LONG *p2 = (LONG *)source; \
- register int count = (bytes) / sizeof(LONG); \
+#define INT32COPY(dest,source,bytes) { \
+ register int32_t *p1 = (int32_t *)dest; register int32_t *p2 = (int32_t *)source; \
+ register int count = (bytes) / sizeof(int32_t); \
while (--count >= 0) *p1++ = *p2++; }
diff --git a/Build/source/texk/ps2pkm/paths.c b/Build/source/texk/ps2pkm/paths.c
index 77d7bde70c2..684ff29b47b 100644
--- a/Build/source/texk/ps2pkm/paths.c
+++ b/Build/source/texk/ps2pkm/paths.c
@@ -231,13 +231,13 @@ struct segment *ILoc(
register struct segment *r;
IfTrace3((MustTraceCalls),"..ILoc(S=%p, x=%d, y=%d)\n",
- S, (LONG) x, (LONG) y);
+ S, (int32_t) x, (int32_t) y);
r = (struct segment *)Allocate(sizeof(struct segment), &movetemplate, 0);
TYPECHECK("Loc", S, SPACETYPE, r, (0), struct segment *);
r->last = r;
r->context = S->context;
- (*S->iconvert)(&r->dest, S, (LONG) x, (LONG) y);
+ (*S->iconvert)(&r->dest, S, (int32_t) x, (int32_t) y);
ConsumeSpace(S);
return(r);
}
@@ -1010,17 +1010,20 @@ void PathDelta(
register struct segment *p, /* input path */
register struct fractpoint *pt) /* pointer to x,y to set */
{
- struct fractpoint mypoint; /* I pass this to TextDelta */
register fractpel x,y; /* working variables for path current point */
for (x=y=0; p != NULL; p=p->link) {
x += p->dest.x;
y += p->dest.y;
+#if 0 /* fonts.h defines TextDelta as empty, thus mypoint is not initialized */
if (p->type == TEXTTYPE) {
+ struct fractpoint mypoint;
+
TextDelta(p, &mypoint);
x += mypoint.x;
y += mypoint.y;
}
+#endif
}
pt->x = x;
diff --git a/Build/source/texk/ps2pkm/pk2bm.c b/Build/source/texk/ps2pkm/pk2bm.c
index 30c4b736b9e..9e620581f0e 100644
--- a/Build/source/texk/ps2pkm/pk2bm.c
+++ b/Build/source/texk/ps2pkm/pk2bm.c
@@ -30,6 +30,11 @@
* Piet Tutelaers
* rcpt@urc.tue.nl
*/
+
+#ifdef HAVE_CONFIG_H
+#include "c-auto.h"
+#endif
+
#include <stdio.h>
#include "pkin.h"
diff --git a/Build/source/texk/ps2pkm/pkin.c b/Build/source/texk/ps2pkm/pkin.c
index 45083b3cf50..a424a239787 100644
--- a/Build/source/texk/ps2pkm/pkin.c
+++ b/Build/source/texk/ps2pkm/pkin.c
@@ -14,6 +14,10 @@
* rcpt@urc.tue.nl
*/
+#ifdef HAVE_CONFIG_H
+#include "c-auto.h"
+#endif
+
#ifdef DEBUG
#include <stdio.h>
#endif
diff --git a/Build/source/texk/ps2pkm/pkout.c b/Build/source/texk/ps2pkm/pkout.c
index 82441da3844..6f7a07d7a2c 100644
--- a/Build/source/texk/ps2pkm/pkout.c
+++ b/Build/source/texk/ps2pkm/pkout.c
@@ -77,14 +77,14 @@ static void pk2(int x)
pk1(x & 0x0000ff);
}
-static void pk3(INT32 x)
+static void pk3(int32_t x)
{
pk1((x & 0x00ff0000) >> 16);
pk1((x & 0x0000ff00) >> 8);
pk1(x & 0x000000ff);
}
-static void pk4(INT32 x)
+static void pk4(int32_t x)
{
if (x < 0) { /* next two lines from mackay@cs.washington.edu */
x += 2<<29; x += 2<<29;
@@ -100,7 +100,7 @@ static int MAX_COUNTS; /* length of array to hold runlengths */
void pk_preamble(char *comment, /* source of the font */
float pointsize, /* pointsize in points */
- INT32 checksum, /* should equal to tfm-value */
+ int32_t checksum, /* should equal to tfm-value */
unsigned int h_res, /* horizontal resolution (dpi) */
unsigned int v_res) /* vertical resolution (dpi) */
{
@@ -116,9 +116,9 @@ void pk_preamble(char *comment, /* source of the font */
pk1(len);
for (i=0; i<len; i++) pk1(*comment++);
- pk4((INT32)(pointsize * (1<<20) + 0.5));
+ pk4((int32_t)(pointsize * (1<<20) + 0.5));
pk4(checksum);
- pk4((INT32)(h_res / DPI * (1<<16))); pk4((INT32)(v_res / DPI * (1<<16)));
+ pk4((int32_t)(h_res / DPI * (1<<16))); pk4((int32_t)(v_res / DPI * (1<<16)));
}
/* From `The GFtoPK processor', pp. 231 */
@@ -410,7 +410,7 @@ static void pk_bitmap(int width, int cnt, int runlength[])
/* For packing a character */
void pk_char(int char_code, /* character code 0..255 */
- INT32 tfm_width, /* TFM width of character */
+ int32_t tfm_width, /* TFM width of character */
int h_escapement, /* horizontal escapement in pixels */
unsigned int width, /* width of bounding box */
unsigned int height, /* height of bounding box */
diff --git a/Build/source/texk/ps2pkm/pkout.h b/Build/source/texk/ps2pkm/pkout.h
index 2fd03256e0d..525246ad4fe 100644
--- a/Build/source/texk/ps2pkm/pkout.h
+++ b/Build/source/texk/ps2pkm/pkout.h
@@ -11,12 +11,6 @@
* AUTHOR: Piet Tutelaers (rcpt@urc.tue.nl)
*/
-#ifdef WORD16
-typedef long INT32;
-#else
-typedef int INT32;
-#endif
-
/* A function for opening a pk file */
void pk_open(char *name);
@@ -26,13 +20,13 @@ void pk_close(void);
/* A function for writing the preamble */
void pk_preamble(char *comment, /* comment string: source of font */
float pointsize, /* design size in points */
- INT32 checksum, /* checksum */
+ int32_t checksum, /* checksum */
unsigned int h_res, /* horizontal resolution (dpi) */
unsigned int v_res); /* vertical resolution (dpi) */
/* For packing a character */
void pk_char(int char_code, /* character code 0..255 */
- INT32 tfm_width, /* TFM width of character */
+ int32_t tfm_width, /* TFM width of character */
int h_escapement, /* horizontal escapement in pixels */
unsigned int width, /* width of bounding box */
unsigned int height, /* height of bounding box */
diff --git a/Build/source/texk/ps2pkm/ps2pk.c b/Build/source/texk/ps2pkm/ps2pk.c
index 50b297b9f7b..6c4ce589fea 100644
--- a/Build/source/texk/ps2pkm/ps2pk.c
+++ b/Build/source/texk/ps2pkm/ps2pk.c
@@ -227,10 +227,9 @@ int W, H, /* width and height of character glyph */
int verbose = 0, debug = 0;
/* Provide old (-O flag) and new (default) checksum function */
-typedef unsigned int UINT32;
-static UINT32 checksum(encoding, int [256]);
-static UINT32 old_checksum(encoding, int [256]);
-UINT32 (*pchecksum)(encoding, int [256]) = checksum;
+static uint32_t checksum(encoding, int [256]);
+static uint32_t old_checksum(encoding, int [256]);
+uint32_t (*pchecksum)(encoding, int [256]) = checksum;
/* Prototypes */
static int next_pixel(void);
@@ -238,7 +237,7 @@ static int next_pixel(void);
static void print_pixmap(void);
#endif
static void first_pixel(CharInfoRec *);
-static INT32 TFMwidth(int);
+static int32_t TFMwidth(int);
static int h_escapement(int);
static void add_option(const char *, const char *);
@@ -548,10 +547,10 @@ int main(int argc, char *argv[])
* The checksum should garantee that our PK file belongs to the correct TFM
* file! Exactly the same as the afm2tfm (dvips5487) calculation.
*/
-static UINT32 old_checksum(encoding ev, int width[256])
+static uint32_t old_checksum(encoding ev, int width[256])
{
int i;
- UINT32 s1 = 0, s2 = 0;
+ uint32_t s1 = 0, s2 = 0;
char *p ;
for (i=0; i<256; i++) {
@@ -566,10 +565,10 @@ static UINT32 old_checksum(encoding ev, int width[256])
/*
* The new checksum algorithm.
*/
-static UINT32 checksum(encoding ev, int width[256])
+static uint32_t checksum(encoding ev, int width[256])
{
int i;
- UINT32 s1 = 0, s2 = 0;
+ uint32_t s1 = 0, s2 = 0;
char *p ;
for (i=0; i<256; i++) {
@@ -636,7 +635,7 @@ print_pixmap(void)
an integer representation for fractions. The decimal point is
left from bit 20. (The method is `stolen' from afm2tfm.) */
-static INT32
+static int32_t
TFMwidth(int wx)
{
return (((wx / 1000) << 20) +
@@ -680,9 +679,9 @@ int CheckFSFormat(int format, int fmask, int *bit, int *Byte, int *scan,
}
-long MakeAtom(const char *p, unsigned int len, int foo)
+intptr_t MakeAtom(const char *p, unsigned int len, int foo)
{
- return (long)p;
+ return (intptr_t)p;
}
#if 0
diff --git a/Build/source/texk/ps2pkm/regions.c b/Build/source/texk/ps2pkm/regions.c
index b0d16bab16c..8a513c19d51 100644
--- a/Build/source/texk/ps2pkm/regions.c
+++ b/Build/source/texk/ps2pkm/regions.c
@@ -295,7 +295,7 @@ static struct edgelist *NewEdge(
register int iy; /* ymin adjusted for 'long' alignment purposes */
IfTrace2((RegionDebug),"....new edge: ymin=%d, ymax=%d ",
- (LONG)ymin, (LONG) ymax);
+ (int32_t)ymin, (int32_t) ymax);
if (ymin >= ymax)
t1_abort("newedge: height not positive");
/*
@@ -305,7 +305,7 @@ if the xvalues are long aligned by ANDing the address with the
(sizeof(long) - 1)--if non zero, the xvalues are not aligned well. We
set 'iy' to the ymin value that would give us good alignment:
*/
- iy = ymin - (((unsigned long) xvalues) & (sizeof(LONG) - 1)) / sizeof(pel);
+ iy = ymin - (((unsigned long) xvalues) & (sizeof(int32_t) - 1)) / sizeof(pel);
r = (struct edgelist *)Allocate(sizeof(struct edgelist), &template,
(ymax - iy) * sizeof(pel));
@@ -327,7 +327,7 @@ We must round up (ymax - iy) so we get the ceiling of the number of
longs. The destination must be able to hold these extra bytes because
Allocate() makes everything it allocates be in multiples of longs.
*/
- LONGCOPY(&r[1], xvalues, (ymax - iy) * sizeof(pel) + sizeof(LONG) - 1);
+ INT32COPY(&r[1], xvalues, (ymax - iy) * sizeof(pel) + sizeof(int32_t) - 1);
IfTrace1((RegionDebug),"result=%p\n", r);
return(r);
@@ -376,7 +376,7 @@ struct region *Interior(
char tempflag; /* flag; is path temporary? */
char Cflag; /* flag; should we apply continuity? */
- IfTrace2((MustTraceCalls),". INTERIOR(%p, %d)\n", p, (LONG) fillrule);
+ IfTrace2((MustTraceCalls),". INTERIOR(%p, %d)\n", p, (int32_t) fillrule);
if (p == NULL)
return(NULL);
@@ -662,7 +662,7 @@ void ChangeDirection(
register int ydiff; /* allowed Y difference in 'currentworkarea' */
IfTrace4((RegionDebug>0),"Change Y direction (%d) from (%d,%d), dy=%d\n",
- (LONG) type, x, y, dy);
+ (int32_t) type, x, y, dy);
if (type != CD_FIRST) {
@@ -904,7 +904,7 @@ static struct edgelist *splitedge(
register struct edgelist *r; /* temp pointer to new structure */
register struct edgelist *lastlist; /* temp pointer to last 'list' value */
- IfTrace2((RegionDebug > 1),"splitedge of %p at %d ", list, (LONG) y);
+ IfTrace2((RegionDebug > 1),"splitedge of %p at %d ", list, (int32_t) y);
lastlist = new = NULL;
@@ -1182,7 +1182,7 @@ out the new situation:
IfTrace3((RegionDebug > 1),
"SwathUnion is overlapped until %d: before=%p after=%p\n",
- (LONG) TOP(edge) + h, before, after);
+ (int32_t) TOP(edge) + h, before, after);
/*
OK, if we touched either of our neighbors we need to split at that point
and recursively sort the split edge onto the list. One tricky part
@@ -1497,8 +1497,8 @@ struct segment *RegionBounds(register struct region *R)
void DumpArea(register struct region *area)
{
IfTrace1(TRUE,"Dumping area %p,", area);
- IfTrace4(TRUE," X %d:%d Y %d:%d;", (LONG) area->xmin,
- (LONG) area->xmax, (LONG) area->ymin,(LONG) area->ymax);
+ IfTrace4(TRUE," X %d:%d Y %d:%d;", (int32_t) area->xmin,
+ (int32_t) area->xmax, (int32_t) area->ymin,(int32_t) area->ymax);
IfTrace4(TRUE," origin=(%d,%d), ending=(%d,%d)\n",
area->origin.x, area->origin.y, area->ending.x, area->ending.y);
DumpEdges(area->anchor);
@@ -1528,10 +1528,10 @@ void DumpEdges(register struct edgelist *edges)
edgecheck(p, ymin, ymax);
ymin = p->ymin; ymax = p->ymax;
IfTrace3(TRUE,". at %p type=%d flag=%x",
- p, (LONG) p->type,(LONG) p->flag);
+ p, (int32_t) p->type,(int32_t) p->flag);
IfTrace4(TRUE," bounding box HxW is %dx%d at (%d,%d)\n",
- (LONG) ymax - ymin, (LONG) p->xmax - p->xmin,
- (LONG) p->xmin, (LONG) ymin);
+ (int32_t) ymax - ymin, (int32_t) p->xmax - p->xmin,
+ (int32_t) p->xmin, (int32_t) ymin);
}
}
else {
@@ -1548,16 +1548,16 @@ void DumpEdges(register struct edgelist *edges)
ymin, ymax);
for (p=p2; INSWATH(p,ymin,ymax); p = p->link) {
IfTrace4(TRUE,". . at %p[%x] range %d:%d, ",
- p, (LONG) p->flag,
- (LONG) p->xmin, (LONG)p->xmax);
+ p, (int32_t) p->flag,
+ (int32_t) p->xmin, (int32_t)p->xmax);
IfTrace1(TRUE, "subpath=%p,\n", p->subpath);
}
}
for (y=MAX(ymin,RegionDebugYMin); y < MIN(ymax, RegionDebugYMax); y++) {
- IfTrace1(TRUE,". . . Y[%5d] ", (LONG) y);
+ IfTrace1(TRUE,". . . Y[%5d] ", (int32_t) y);
for (p=p2; INSWATH(p,ymin,ymax); p = p->link)
IfTrace1(TRUE,"%5d ",
- (LONG) p->xvalues[y - ymin]);
+ (int32_t) p->xvalues[y - ymin]);
IfTrace0(TRUE,"\n");
}
while (INSWATH(p2, ymin, ymax))
diff --git a/Build/source/texk/ps2pkm/spaces.c b/Build/source/texk/ps2pkm/spaces.c
index aca852743a8..d7b78984ae7 100644
--- a/Build/source/texk/ps2pkm/spaces.c
+++ b/Build/source/texk/ps2pkm/spaces.c
@@ -242,7 +242,7 @@ int FindContext(
if (i >= nextcontext) {
if (i >= MAXCONTEXTS)
t1_abort("Context: out of them");
- LONGCOPY(contexts[i].normal, M, sizeof(contexts[i].normal));
+ INT32COPY(contexts[i].normal, M, sizeof(contexts[i].normal));
MatrixInvert(M, contexts[i].inverse);
nextcontext++;
}
@@ -274,7 +274,7 @@ struct XYspace *Context(
n = FindDeviceContext(device);
- LONGCOPY(M, contexts[n].normal, sizeof(M));
+ INT32COPY(M, contexts[n].normal, sizeof(M));
M[0][0] *= units;
M[0][1] *= units;
@@ -365,7 +365,8 @@ static void FXYConvert(
static void IXYConvert(
register struct fractpoint *pt, /* point to set */
register struct XYspace *S, /* relevant coordinate space */
- register LONG x, register LONG y) /* user's coordinates of point */
+ register int32_t x, register int32_t y)
+ /* user's coordinates of point */
{
pt->x = (*S->ixconvert)(S->itofract[0][0], S->itofract[1][0], x, y);
pt->y = (*S->iyconvert)(S->itofract[0][1], S->itofract[1][1], x, y);
@@ -381,7 +382,8 @@ integers to floats, and do the arithmetic all with floats:
static void ForceFloat(
register struct fractpoint *pt, /* point to set */
register struct XYspace *S, /* relevant coordinate space */
- register LONG x, register LONG y) /* user's coordinates of point */
+ register int32_t x, register int32_t y)
+ /* user's coordinates of point */
{
(*S->convert)(pt, S, (DOUBLE) x, (DOUBLE) y);
}
@@ -439,7 +441,7 @@ special cases when one of the coefficients is 0.
static fractpel IXYboth(
register fractpel cx, register fractpel cy, /* x and y coefficients */
- register LONG x, register LONG y) /* user x,y */
+ register int32_t x, register int32_t y) /* user x,y */
{
return(x * cx + y * cy);
}
@@ -447,7 +449,7 @@ static fractpel IXYboth(
/*ARGSUSED*/
static fractpel IXonly(
register fractpel cx, register fractpel cy, /* x and y coefficients */
- register LONG x, register LONG y) /* user x,y */
+ register int32_t x, register int32_t y) /* user x,y */
{
return(x * cx);
}
@@ -455,7 +457,7 @@ static fractpel IXonly(
/*ARGSUSED*/
static fractpel IYonly(
register fractpel cx, register fractpel cy, /* x and y coefficients */
- register LONG x, register LONG y) /* user x,y */
+ register int32_t x, register int32_t y) /* user x,y */
{
return(y * cy);
}
@@ -480,7 +482,7 @@ on how the functions in the XYspace structure are filled out.
static fractpel FPXYboth(
register fractpel cx, register fractpel cy, /* x and y coefficients */
- register LONG x, register LONG y) /* user x,y */
+ register int32_t x, register int32_t y) /* user x,y */
{
return( FPmult(x, cx) + FPmult(y, cy) );
}
@@ -488,7 +490,7 @@ static fractpel FPXYboth(
/*ARGSUSED*/
static fractpel FPXonly(
register fractpel cx, register fractpel cy, /* x and y coefficients */
- register LONG x, register LONG y) /* user x,y */
+ register int32_t x, register int32_t y) /* user x,y */
{
return( FPmult(x, cx) );
}
@@ -496,7 +498,7 @@ static fractpel FPXonly(
/*ARGSUSED*/
static fractpel FPYonly(
register fractpel cx, register fractpel cy, /* x and y coefficients */
- register LONG x, register LONG y) /* user x,y */
+ register int32_t x, register int32_t y) /* user x,y */
{
return( FPmult(y, cy) );
}
diff --git a/Build/source/texk/ps2pkm/spaces.h b/Build/source/texk/ps2pkm/spaces.h
index cbd2e02e9f8..baadecf1678 100644
--- a/Build/source/texk/ps2pkm/spaces.h
+++ b/Build/source/texk/ps2pkm/spaces.h
@@ -34,7 +34,7 @@
#define IDENTITY t1_Identity
typedef SHORT pel; /* integer pel locations */
-typedef LONG fractpel; /* fractional pel locations */
+typedef int32_t fractpel; /* fractional pel locations */
#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */
/*
diff --git a/Build/source/texk/ps2pkm/t1funcs.c b/Build/source/texk/ps2pkm/t1funcs.c
index 364f53a5aec..e95623f6938 100644
--- a/Build/source/texk/ps2pkm/t1funcs.c
+++ b/Build/source/texk/ps2pkm/t1funcs.c
@@ -71,12 +71,12 @@
#include "util.h"
#include "fontfcn.h"
-static int Type1GetGlyphs(struct _Font *pFont, ULONG count,
+static int Type1GetGlyphs(struct _Font *pFont, uint32_t count,
unsigned char *chars, FontEncoding charEncoding,
- ULONG *glyphCount, struct _CharInfo **glyphs);
-static int Type1GetMetrics(struct _Font *pFont, ULONG count,
+ uint32_t *glyphCount, struct _CharInfo **glyphs);
+static int Type1GetMetrics(struct _Font *pFont, uint32_t count,
unsigned char *chars, FontEncoding charEncoding,
- ULONG *glyphCount, xCharInfo **glyphs );
+ uint32_t *glyphCount, xCharInfo **glyphs );
static void fillrun(register char *p,pel x0,pel x1,int bit);
static void fill(char *dest,int h,int w,struct region *area,
int byte,int bit,int wordsize);
@@ -175,8 +175,8 @@ int Type1OpenScalable (
return (rc);
for (i=0; i < 256-FIRSTCOL; i++) {
- LONG h,w;
- LONG paddedW;
+ int32_t h,w;
+ int32_t paddedW;
if (ev[i] == NULL) continue;
len = strlen(ev[i]);
@@ -270,10 +270,10 @@ int Type1OpenScalable (
static int
Type1GetGlyphs(
FontPtr pFont,
- ULONG count,
+ uint32_t count,
register unsigned char *chars,
FontEncoding charEncoding,
- ULONG *glyphCount, /* RETURN */
+ uint32_t *glyphCount, /* RETURN */
CharInfoPtr *glyphs) /* RETURN */
{
unsigned int firstRow;
@@ -335,10 +335,10 @@ Type1GetGlyphs(
static int
Type1GetMetrics(
FontPtr pFont,
- ULONG count,
+ uint32_t count,
register unsigned char *chars,
FontEncoding charEncoding,
- ULONG *glyphCount, /* RETURN */
+ uint32_t *glyphCount, /* RETURN */
xCharInfo **glyphs) /* RETURN */
{
static CharInfoRec nonExistantChar;
@@ -425,9 +425,9 @@ it:
case 64:
case 32:
{
- register ULONG data,*p;
+ register uint32_t data,*p;
- p = (ULONG *) dest;
+ p = (uint32_t *) dest;
for (i = h * w / 32; --i >= 0;) {
data = *p;
@@ -437,7 +437,7 @@ it:
}
if (wordsize == 64) {
- p = (ULONG *) dest;
+ p = (uint32_t *) dest;
for (i = h * w / 64; --i >= 0;) {
data = *p++;
diff --git a/Build/source/texk/ps2pkm/t1info.c b/Build/source/texk/ps2pkm/t1info.c
index 5e1767bbb00..fd86c3c797a 100644
--- a/Build/source/texk/ps2pkm/t1info.c
+++ b/Build/source/texk/ps2pkm/t1info.c
@@ -81,7 +81,7 @@ enum scaleType {
typedef struct _fontProp {
const char *name;
- LONG atom;
+ int32_t atom;
enum scaleType type;
} fontProp;
@@ -166,7 +166,7 @@ ComputeBounds(
{
int i;
xCharInfo minchar, maxchar;
- LONG width = 0;
+ int32_t width = 0;
int numchars = 0;
int totchars;
int overlap;
diff --git a/Build/source/texk/ps2pkm/t1io.c b/Build/source/texk/ps2pkm/t1io.c
index 6dca5507c82..384e3d19c31 100644
--- a/Build/source/texk/ps2pkm/t1io.c
+++ b/Build/source/texk/ps2pkm/t1io.c
@@ -37,7 +37,9 @@
#define STATIC static
#endif
+#ifdef HAVE_CONFIG_H
#include "c-auto.h"
+#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
diff --git a/Build/source/texk/ps2pkm/t1snap.c b/Build/source/texk/ps2pkm/t1snap.c
index 62c85dbeffa..7f1f29c1bc4 100644
--- a/Build/source/texk/ps2pkm/t1snap.c
+++ b/Build/source/texk/ps2pkm/t1snap.c
@@ -28,6 +28,7 @@
* SOFTWARE.
*/
+#include "types.h"
#include "objects.h"
#include "spaces.h"
#include "paths.h"
diff --git a/Build/source/texk/ps2pkm/t1stdio.h b/Build/source/texk/ps2pkm/t1stdio.h
index 5398966276e..f19d9627edd 100644
--- a/Build/source/texk/ps2pkm/t1stdio.h
+++ b/Build/source/texk/ps2pkm/t1stdio.h
@@ -36,9 +36,9 @@ typedef unsigned char F_char;
typedef struct F_FILE {
F_char *b_base; /* Pointer to beginning of buffer */
- LONG b_size; /* Size of the buffer */
+ int32_t b_size; /* Size of the buffer */
F_char *b_ptr; /* Pointer to next char in buffer */
- LONG b_cnt; /* Number of chars remaining in buffer */
+ int32_t b_cnt; /* Number of chars remaining in buffer */
F_char flags; /* other flags; != 0 means getc must call fgetc */
F_char ungotc; /* Place for ungotten char; flag set if present */
short error; /* error status */
diff --git a/Build/source/texk/ps2pkm/token.c b/Build/source/texk/ps2pkm/token.c
index d175b6f24e2..fd768072e32 100644
--- a/Build/source/texk/ps2pkm/token.c
+++ b/Build/source/texk/ps2pkm/token.c
@@ -97,7 +97,7 @@ static DOUBLE Exp10T[128] = {
1e56, 1e57, 1e58, 1e59, 1e60, 1e61, 1e62, 1e63
};
-static DOUBLE P10(LONG exponent)
+static DOUBLE P10(int32_t exponent)
{
DOUBLE value, power;
@@ -237,18 +237,18 @@ static int skip_comment(int ch)
/* decimal integer or real number mantissa */
static int m_sign;
-static LONG m_value;
-static LONG m_scale;
+static int32_t m_value;
+static int32_t m_scale;
/* real number exponent */
static int e_sign;
-static LONG e_value;
-static LONG e_scale;
+static int32_t e_value;
+static int32_t e_scale;
/* radix number */
-static LONG r_base;
-static LONG r_value;
-static LONG r_scale;
+static int32_t r_base;
+static int32_t r_value;
+static int32_t r_scale;
static int add_sign(int ch)
{
@@ -265,7 +265,7 @@ static int add_1st_digits(int ch)
static int add_digits(int ch)
{
- LONG value, p_value, scale;
+ int32_t value, p_value, scale;
int digit;
/* On entry, expect m_sign to be set to '+' or '-';
@@ -371,7 +371,7 @@ static int add_decpt(int ch)
static int add_fraction(int ch)
{
- LONG value, scale;
+ int32_t value, scale;
int digit;
/* On entry, expect m_value and m_scale to be initialized,
@@ -474,8 +474,8 @@ static int add_e_sign(int ch)
static int add_exponent(int ch)
{
- LONG value, p_value;
- LONG scale = 0;
+ int32_t value, p_value;
+ int32_t scale = 0;
int digit;
/* On entry, expect e_sign to be set to '+' or '-' */
@@ -556,8 +556,8 @@ static int add_radix(int ch)
static int add_r_digits(int ch)
{
- ULONG value;
- LONG radix, scale;
+ uint32_t value;
+ int32_t radix, scale;
int digit;
/* NOTE: The syntax of a radix number allows only for
@@ -594,7 +594,7 @@ static int add_r_digits(int ch)
/* Add digits until boundary case reached */
while((digit=digit_value[ch]) < radix
- && value < (MAX_ULONG / radix)) {
+ && value < (MAX_INT32 / radix)) {
value = value * radix + digit;
save_ch(ch);
ch = next_ch();
@@ -604,9 +604,9 @@ static int add_r_digits(int ch)
if ((digit=digit_value[ch]) < radix) {
/* Examine boundary case ---
- * radix*(MAX_ULONG/radix) <= number <= MAX_ULONG
+ * radix*(MAX_INT32/radix) <= number <= MAX_INT32
*/
- if (value == (MAX_ULONG/radix) && digit <= MAX_ULONG%radix)
+ if (value == (MAX_INT32/radix) && digit <= MAX_INT32%radix)
value = value * radix + digit;
else
++scale;
@@ -623,7 +623,7 @@ static int add_r_digits(int ch)
}
/* Store result */
- r_value = (LONG) value; /* result is signed */
+ r_value = (int32_t) value; /* result is signed */
r_scale = scale;
return(ch);
diff --git a/Build/source/texk/ps2pkm/types.h b/Build/source/texk/ps2pkm/types.h
index 42d38d1c454..16df811bd98 100644
--- a/Build/source/texk/ps2pkm/types.h
+++ b/Build/source/texk/ps2pkm/types.h
@@ -9,26 +9,23 @@
#ifndef __PS2PK_TYPES__
#define __PS2PK_TYPES__
+#ifdef HAVE_CONFIG_H
+#include "c-auto.h"
+#endif
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
#ifdef KPATHSEA
#include <kpathsea/kpathsea.h>
-#include <c-auto.h>
#endif /* KPATHSEA */
typedef unsigned short USHORT; /* 16 bits */
typedef short SHORT; /* 16 bits */
-#if defined(WORD16)
-typedef long LONG; /* 32 bits */
-typedef unsigned long ULONG; /* 32 bits */
-#elif defined(WORD64)
-typedef int LONG; /* 32 bits */
-typedef unsigned long ULONG; /* 32 bits */
-#else /* default: WORD32 */
-# ifndef WIN32
-/* These are already defined under WIN32 */
-typedef int LONG; /* 32 bits */
-typedef unsigned int ULONG; /* 32 bits */
-# endif
-#endif
typedef double DOUBLE; /* 64 bits */
typedef char *encoding[256];
diff --git a/Build/source/texk/ps2pkm/util.c b/Build/source/texk/ps2pkm/util.c
index d2310bb989f..3c7b82ca9d8 100644
--- a/Build/source/texk/ps2pkm/util.c
+++ b/Build/source/texk/ps2pkm/util.c
@@ -34,10 +34,10 @@
#include "util.h"
#include "fontmisc.h"
-static char *vm_base = NULL; /* Start of virtual memory area */
- char *vm_next = NULL; /* Pointer to first free byte */
- LONG vm_free = 0; /* Count of free bytes */
- LONG vm_size = 0; /* Total size of memory */
+static char *vm_base = NULL; /* Start of virtual memory area */
+ char *vm_next = NULL; /* Pointer to first free byte */
+ int32_t vm_free = 0; /* Count of free bytes */
+ int32_t vm_size = 0; /* Total size of memory */
/*
* Initialize memory.
diff --git a/Build/source/texk/ps2pkm/util.h b/Build/source/texk/ps2pkm/util.h
index 2db9a14ddd4..f38f9519d7c 100644
--- a/Build/source/texk/ps2pkm/util.h
+++ b/Build/source/texk/ps2pkm/util.h
@@ -50,10 +50,10 @@ typedef int boolean;
* NOTE: These really should be based on PostScript types,
* for example, sizeof(ps_integer), or sizeof(ps_unsigned)
*/
-#define MAX_ULONG (~(ULONG)(0))
+#define MAX_INT32 (~(uint32_t)(0))
/* This code is portable, assuming K&R C and 2's complement arithmetic */
#define MAX_INTEGER \
- ((LONG)((((ULONG) 1)<<(sizeof(ULONG)*8-1))-1))
+ ((int32_t)((((uint32_t) 1)<<(sizeof(uint32_t)*8-1))-1))
#define MIN_INTEGER ((-MAX_INTEGER)-1)
#define MAX_ARRAY_CNT (65535)
@@ -74,8 +74,8 @@ typedef int boolean;
/* Routines for managing virtual memory */
/***================================================================***/
extern boolean vm_init(void);
-extern LONG vm_free;
-extern LONG vm_size;
+extern int32_t vm_free;
+extern int32_t vm_size;
extern char *vm_next;
extern char *vm_alloc(unsigned int bytes);
/***================================================================***/
@@ -187,7 +187,7 @@ extern void objFormatFile(psobj *, FILE *);
extern void *Xalloc(size_t);
extern void Xfree(void *);
-extern long MakeAtom(const char *, unsigned int, int);
+extern intptr_t MakeAtom(const char *, unsigned int, int);
extern void QueryFontLib(char *, const char *, void *, int *);
/*