From: Chris Tusa Subject: fitz/deskew: rename index_t (clashes with illumos sys/types.h) illumos's already typedefs index_t as 'short' (an SVR4 STREAMS-era type), which conflicts with deskew.c's own struct index_t typedef (transitively included via mupdf/fitz.h -> mupdf/memento.h -> stdlib.h -> sys/wait.h -> sys/types.h). Rename mupdf's local type to fz_deskew_index_t (deskew.c/.h only - no other file in the tree uses this name) to remove the collision rather than fighting illumos's system header. diff --git a/source/fitz/deskew.c b/source/fitz/deskew.c --- a/source/fitz/deskew.c 2026-06-25 14:05:09.000000000 -0500 +++ b/source/fitz/deskew.c 2026-07-22 21:04:17.710448696 -0500 @@ -261,7 +261,7 @@ uint8_t slow; /* Flag */ int32_t first_pixel; /* offset of first value in source data */ int32_t last_pixel; /* last pixel number */ -} index_t; +} fz_deskew_index_t; #if ARCH_HAS_NEON typedef int16_t weight_t; @@ -271,7 +271,7 @@ typedef void (zoom_y_fn)(uint8_t * dst, const uint8_t * __restrict tmp, - const index_t * __restrict index, + const fz_deskew_index_t * __restrict index, const weight_t * __restrict weights, uint32_t width, uint32_t channels, @@ -279,7 +279,7 @@ int32_t y); typedef void (zoom_x_fn)(uint8_t * __restrict tmp, const uint8_t * __restrict src, - const index_t * __restrict index, + const fz_deskew_index_t * __restrict index, const weight_t * __restrict weights, uint32_t dst_w, uint32_t src_w, @@ -317,9 +317,9 @@ uint32_t dst_h_borderless; uint32_t skip_l; uint32_t skip_t; - index_t *index_x[SUB_PIX_X]; + fz_deskew_index_t *index_x[SUB_PIX_X]; weight_t *weights_x[SUB_PIX_X]; - index_t *index_y[SUB_PIX_Y]; + fz_deskew_index_t *index_y[SUB_PIX_Y]; weight_t *weights_y[SUB_PIX_Y]; uint32_t max_y_weights[SUB_PIX_Y]; uint8_t bg[FZ_MAX_COLORS]; @@ -381,7 +381,7 @@ static void make_x_weights(fz_context *ctx, - index_t **indexp, + fz_deskew_index_t **indexp, weight_t **weightsp, uint32_t src_w, uint32_t dst_w, @@ -391,7 +391,7 @@ int sse_slow) { double squeeze; - index_t *index; + fz_deskew_index_t *index; weight_t *weights; uint32_t i; double offset = ((double)offset_f)/offset_n; @@ -419,7 +419,7 @@ weights = (weight_t *)fz_malloc_aligned(ctx, sizeof(*weights) * max_weights * dst_w + SSE_SLOP, sizeof(weight_t) * 4); memset(weights, 0, sizeof(*weights) * max_weights * dst_w); fz_try(ctx) - index = (index_t *)fz_malloc(ctx, sizeof(*index) * dst_w + SSE_SLOP); + index = (fz_deskew_index_t *)fz_malloc(ctx, sizeof(*index) * dst_w + SSE_SLOP); fz_catch(ctx) { fz_free_aligned(ctx, weights); @@ -497,7 +497,7 @@ */ static void make_y_weights(fz_context *ctx, - index_t **indexp, + fz_deskew_index_t **indexp, weight_t **weightsp, uint32_t *max_weightsp, uint32_t dst_w, @@ -508,7 +508,7 @@ uint32_t h) { double squeeze; - index_t *index; + fz_deskew_index_t *index; weight_t *weights; uint32_t i; double offset = ((double)offset_f)/offset_n; @@ -538,7 +538,7 @@ weights = (weight_t *)fz_malloc_aligned(ctx, sizeof(*weights) * max_weights * dst_w, sizeof(weight_t) * 4); fz_try(ctx) - index = (index_t *)fz_malloc(ctx, sizeof(*index) * dst_w); + index = (fz_deskew_index_t *)fz_malloc(ctx, sizeof(*index) * dst_w); fz_catch(ctx) { fz_free_aligned(ctx, weights); @@ -587,7 +587,7 @@ #ifdef DEBUG_DESKEWER static void -dump_weights(const index_t *index, +dump_weights(const fz_deskew_index_t *index, const weight_t *weights, uint32_t w, const char *str) @@ -623,7 +623,7 @@ uint32_t num_w = deskewer->dst_w; weight_t *new_weights = fz_malloc_aligned(ctx, num_w * deskewer->max_y_weights[i] * sizeof(weight_t) * 4, sizeof(weight_t) * 4); - index_t *index; + fz_deskew_index_t *index; weight_t *weights; index = deskewer->index_y[i]; diff --git a/source/fitz/deskew_c.h b/source/fitz/deskew_c.h --- a/source/fitz/deskew_c.h 2026-06-25 14:05:09.000000000 -0500 +++ b/source/fitz/deskew_c.h 2026-07-22 21:04:17.710702010 -0500 @@ -25,7 +25,7 @@ static void zoom_x(uint8_t * FZ_RESTRICT tmp, const uint8_t * FZ_RESTRICT src, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t dst_w, uint32_t src_w, @@ -109,7 +109,7 @@ static void zoom_x1(uint8_t * FZ_RESTRICT tmp, const uint8_t * FZ_RESTRICT src, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t dst_w, uint32_t src_w, @@ -183,7 +183,7 @@ static void zoom_x3(uint8_t * FZ_RESTRICT tmp, const uint8_t * FZ_RESTRICT src, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t dst_w, uint32_t src_w, @@ -280,7 +280,7 @@ static void zoom_x4(uint8_t * FZ_RESTRICT tmp, const uint8_t * FZ_RESTRICT src, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t dst_w, uint32_t src_w, @@ -388,7 +388,7 @@ static void zoom_y(uint8_t * dst, const uint8_t * FZ_RESTRICT tmp, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t width, uint32_t channels, @@ -431,7 +431,7 @@ static void zoom_y1(uint8_t * dst, const uint8_t * FZ_RESTRICT tmp, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t width, uint32_t channels, @@ -471,7 +471,7 @@ static void zoom_y3(uint8_t * dst, const uint8_t * FZ_RESTRICT tmp, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t width, uint32_t channels, @@ -520,7 +520,7 @@ static void zoom_y4(uint8_t * dst, const uint8_t * FZ_RESTRICT tmp, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t width, uint32_t channels, --- a/source/fitz/subset-cff.c +++ b/source/fitz/subset-cff.c @@ -24,6 +24,11 @@ #include +/* illumos already typedefs index_t (SVR4 STREAMS-era + * short). Rename ours to avoid the redefinition conflict - see the + * same fix in deskew.c. */ +#define index_t mu_index_t + /* For the purposes of this code, and to save my tiny brain from overload, we will adopt the following notation: