|
root / base / mupdf / patches / 0001-deskew-index_t-rename.patch
0001-deskew-index_t-rename.patch Diff 202 lines 6.2 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
From: Chris Tusa <chris.tusa@leafscale.com>
Subject: fitz/deskew: rename index_t (clashes with illumos sys/types.h)

illumos's <sys/types.h> 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,