1 --- libs/teckit/source/Compiler.cpp
2 +++ libs/teckit/source/Compiler.cpp 2007-03-02 10:34:35.000000000 +0000
3 @@ -1397,13 +1397,16 @@ Compiler::Compiler(const char* txt, UInt
5 int result = compress2(dest + 8, &destLen, compiledTable, compiledSize, Z_BEST_COMPRESSION);
8 - realloc(dest, destLen);
9 - WRITE(((FileHeader*)dest)->type, kMagicNumberCmp);
10 - WRITE(((FileHeader*)dest)->version, compiledSize);
11 - free(compiledTable);
12 - compiledTable = dest;
13 - compiledSize = destLen;
14 + if (realloc(dest, destLen+8) != NULL) {
16 + WRITE(((FileHeader*)dest)->type, kMagicNumberCmp);
17 + WRITE(((FileHeader*)dest)->version, compiledSize);
18 + free(compiledTable);
19 + compiledTable = dest;
20 + compiledSize = destLen;
27 --- texk/kpathsea/xputenv.c
28 +++ texk/kpathsea/xputenv.c 2007-03-02 10:14:53.000000000 +0000
29 @@ -95,7 +95,7 @@ xputenv(const char *var, const char *val
30 if (cur_loc == saved_count) {
33 - saved_env = XRETALLOC(saved_env, saved_count, const char *);
34 + XRETALLOC(saved_env, saved_count, const char *);
36 /* We owned the old string. */
37 free(saved_env[cur_loc]);
38 --- texk/ps2pkm/token.c
39 +++ texk/ps2pkm/token.c 2007-01-10 09:26:00.000000000 +0100
40 @@ -108,7 +108,7 @@ static DOUBLE P10(exponent)
43 value = (exponent & 1 ? power : 1.0);
44 - exponent = -(++exponent >> 1); /* portable C for -(exponent/2) */
45 + exponent = -((exponent+1) >> 1); /* portable C for -(exponent/2) */
49 --- texk/ps2pkm/type1.c
50 +++ texk/ps2pkm/type1.c 2007-01-10 17:09:30.000000000 +0100
51 @@ -110,11 +110,11 @@ typedef struct xobject xobject;
52 static DOUBLE tmpx; /* Store macro argument in tmpx to avoid re-evaluation */
53 static LONG tmpi; /* Store converted value in tmpi to avoid re-evaluation */
55 -#define FABS(x) (((tmpx = (x)) < 0.0) ? -tmpx : tmpx)
56 +#define FABS(x) ({ tmpx = (x); (tmpx < 0.0) ? -tmpx : tmpx; })
58 -#define CEIL(x) (((tmpi = (LONG) (tmpx = (x))) < tmpx) ? ++tmpi : tmpi)
59 +#define CEIL(x) ({ tmpi = (LONG) (tmpx = (x)); (tmpi < tmpx) ? ++tmpi : tmpi; })
61 -#define FLOOR(x) (((tmpi = (LONG) (tmpx = (x))) > tmpx) ? --tmpi : tmpi)
62 +#define FLOOR(x) ({ tmpi = (LONG) (tmpx = (x)); (tmpi > tmpx) ? --tmpi : tmpi; })
64 #define ROUND(x) FLOOR((x) + 0.5)
66 --- texk/web2c/mpware/mpto.c
67 +++ texk/web2c/mpware/mpto.c 2007-03-02 10:36:04.000000000 +0000
78 /* MetaPost itself has a configurable max line length, but we can afford to
79 use smaller values than that */
80 --- texk/web2c/pdftexdir/utils.c
81 +++ texk/web2c/pdftexdir/utils.c 2007-03-02 10:16:35.000000000 +0000
82 @@ -1369,7 +1369,7 @@ int newcolorstack(integer s, integer lit
83 colstacks_size += STACK_INCREMENT;
84 /* If (MAX_COLORSTACKS mod STACK_INCREMENT = 0) then we don't
85 need to check the case that size overruns MAX_COLORSTACKS. */
86 - colstacks = xretalloc(colstacks, colstacks_size, colstack_type);
87 + xretalloc(colstacks, colstacks_size, colstack_type);
89 /* claim new color stack */
90 colstack_num = colstacks_used++;
91 --- texk/makeindexk/genind.h
92 +++ texk/makeindexk/genind.h 2007-03-15 15:28:43.000000000 +0000
97 +#ifndef __has_idx_printf
98 +#define __has_idx_printf
100 +static __inline__ int idx_printf(FILE *stream, const char *format, ...)
104 + va_start(ap, format);
105 + ret = vfprintf(stream, format, ap);
111 #define IND_ERROR(F, D) { \
113 fprintf(ilg_fp, "\n"); \
116 "## Warning (input = %s, line = %d; output = %s, line = %d):\n -- ", \
117 curr->fn, curr->lc, ind_fn, ind_lc+1); \
118 - fprintf(ilg_fp, F, D); \
119 + idx_printf(ilg_fp, F, D); \
123 --- texk/makeindexk/mkind.h
124 +++ texk/makeindexk/mkind.h 2007-03-15 15:29:28.000000000 +0000
125 @@ -253,10 +253,24 @@
126 #define STREQ(A, B) (strcmp(A, B) == 0)
127 #define STRNEQ(A, B) (strcmp(A, B) != 0)
129 +#ifndef __has_idx_printf
130 +#define __has_idx_printf
132 +static __inline__ int idx_printf(FILE *stream, const char *format, ...)
136 + va_start(ap, format);
137 + ret = vfprintf(stream, format, ap);
143 #define MESSAGE(F, S) { \
145 - fprintf(stderr, F, S); \
146 - fprintf(ilg_fp, F, S); \
147 + idx_printf(stderr, F, S); \
148 + idx_printf(ilg_fp, F, S); \
151 #if USE_KPATHSEA /* kpathsea defines a different FATAL */
155 #define FATAL(F, S) { \
156 - fprintf(stderr, F, S); \
157 + idx_printf(stderr, F, S); \
158 fprintf(stderr, USAGE, pgm_fn); \
161 --- texk/makeindexk/scanid.h
162 +++ texk/makeindexk/scanid.h 2007-03-15 15:27:12.000000000 +0000
167 +#ifndef __has_idx_printf
168 +#define __has_idx_printf
170 +static __inline__ int idx_printf(FILE *stream, const char *format, ...)
174 + va_start(ap, format);
175 + ret = vfprintf(stream, format, ap);
181 #define IDX_ERROR(F, D) { \
183 fprintf(ilg_fp, "\n"); \
186 fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n -- ", \
188 - fprintf(ilg_fp, F, D); \
189 + idx_printf(ilg_fp, F, D); \
193 --- texk/makeindexk/scanst.h
194 +++ texk/makeindexk/scanst.h 2007-03-15 15:48:48.000000000 +0000
197 #define INDENTLEN_DEF 16
199 +#ifndef __has_idx_printf
200 +#define __has_idx_printf
202 +static __inline__ int idx_printf(FILE *stream, const char *format, ...)
206 + va_start(ap, format);
207 + ret = vfprintf(stream, format, ap);
213 #define STY_ERROR(F, D) { \
215 fprintf(ilg_fp, "\n"); \
218 fprintf(ilg_fp, "** Input style error (file = %s, line = %d):\n -- ", \
220 - fprintf(ilg_fp, F, D); \
221 + idx_printf(ilg_fp, F, D); \