Skip to content

Commit 6dcdba0

Browse files
ksundenmeeseeksmachine
authored andcommitted
Backport PR matplotlib#31672: Backport an additional fix to qhull printf strings
1 parent 7c4bea5 commit 6dcdba0

1 file changed

Lines changed: 75 additions & 20 deletions

File tree

subprojects/packagefiles/qhull-143.patch

Lines changed: 75 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
From cd8c281da87d38820ecc4c452bbf6fd921155915 Mon Sep 17 00:00:00 2001
1+
From 61c21986f4ebd1fb68b615ac89231ad1173f6b84 Mon Sep 17 00:00:00 2001
22
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
33
Date: Thu, 28 Mar 2024 00:54:59 -0400
4-
Subject: [PATCH 1/3] Annotate printf-like functions with GCC's format
4+
Subject: [PATCH 1/4] Annotate printf-like functions with GCC's format
55
attribute
66

77
This allows checking format strings when building with `-Wformat` (or
88
with `-Wall`).
9+
10+
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
911
---
1012
src/libqhull/libqhull.h | 13 ++++++++++---
1113
src/libqhull_r/libqhull_r.h | 13 ++++++++++---
1214
src/testqset_r/testqset_r.c | 4 ++--
1315
3 files changed, 22 insertions(+), 8 deletions(-)
1416

1517
diff --git a/src/libqhull/libqhull.h b/src/libqhull/libqhull.h
16-
index 90c0519b..1080ec11 100644
18+
index 90c0519..1080ec1 100644
1719
--- a/src/libqhull/libqhull.h
1820
+++ b/src/libqhull/libqhull.h
1921
@@ -60,6 +60,13 @@
@@ -48,7 +50,7 @@ index 90c0519b..1080ec11 100644
4850
/***** -geom.c/geom2.c/random.c prototypes (duplicated from geom.h, random.h) ****************/
4951

5052
diff --git a/src/libqhull_r/libqhull_r.h b/src/libqhull_r/libqhull_r.h
51-
index 023e0181..917f96af 100644
53+
index 376c1e2..b5185bc 100644
5254
--- a/src/libqhull_r/libqhull_r.h
5355
+++ b/src/libqhull_r/libqhull_r.h
5456
@@ -48,6 +48,13 @@
@@ -83,7 +85,7 @@ index 023e0181..917f96af 100644
8385
/***** -geom_r.c/geom2_r.c/random_r.c prototypes (duplicated from geom_r.h, random_r.h) ****************/
8486

8587
diff --git a/src/testqset_r/testqset_r.c b/src/testqset_r/testqset_r.c
86-
index 671494f3..b0253e0e 100644
88+
index 671494f..b0253e0 100644
8789
--- a/src/testqset_r/testqset_r.c
8890
+++ b/src/testqset_r/testqset_r.c
8991
@@ -117,7 +117,7 @@ int error_count= 0; /* Global error_count. checkSetContents(qh) keeps its own
@@ -104,12 +106,16 @@ index 671494f3..b0253e0e 100644
104106
void qh_fprintf(qhT *qh, FILE *fp, int msgcode, const char *fmt, ... )
105107
{
106108
static int needs_cr= 0; /* True if qh_fprintf needs a CR. testqset_r is not itself reentrant */
109+
--
110+
2.54.0
111+
107112

108-
From cc7e366259866d4cd24a312a4aaf891ff0abe85a Mon Sep 17 00:00:00 2001
113+
From 14f0beeffbfb2505c5b0bf4b8d1b0981025461f5 Mon Sep 17 00:00:00 2001
109114
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
110115
Date: Thu, 28 Mar 2024 01:05:06 -0400
111-
Subject: [PATCH 2/3] Fix arguments inconsistent with their format strings
116+
Subject: [PATCH 2/4] Fix arguments inconsistent with their format strings
112117

118+
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
113119
---
114120
src/libqhull/global.c | 2 +-
115121
src/libqhull/merge.c | 11 +++++------
@@ -123,7 +129,7 @@ Subject: [PATCH 2/3] Fix arguments inconsistent with their format strings
123129
9 files changed, 28 insertions(+), 28 deletions(-)
124130

125131
diff --git a/src/libqhull/global.c b/src/libqhull/global.c
126-
index 27babbb4..faf67f37 100644
132+
index 9a81001..47dc46d 100644
127133
--- a/src/libqhull/global.c
128134
+++ b/src/libqhull/global.c
129135
@@ -2248,7 +2248,7 @@ void qh_lib_check(int qhullLibraryType, int qhTsize, int vertexTsize, int ridgeT
@@ -136,7 +142,7 @@ index 27babbb4..faf67f37 100644
136142
}
137143
if (last_errcode) {
138144
diff --git a/src/libqhull/merge.c b/src/libqhull/merge.c
139-
index de3a0b00..89392dc6 100644
145+
index de3a0b0..89392dc 100644
140146
--- a/src/libqhull/merge.c
141147
+++ b/src/libqhull/merge.c
142148
@@ -427,7 +427,7 @@ void qh_appendmergeset(facetT *facet, facetT *neighbor, mergeType mergetype, coo
@@ -186,7 +192,7 @@ index de3a0b00..89392dc6 100644
186192
ridge->mergevertex= True; /* disables check for duplicate vertices in qh_checkfacet */
187193
ridgeA->mergevertex= True;
188194
diff --git a/src/libqhull/poly2.c b/src/libqhull/poly2.c
189-
index 0bdfa6d6..9077b9c3 100644
195+
index 4a207b8..b30a2b6 100644
190196
--- a/src/libqhull/poly2.c
191197
+++ b/src/libqhull/poly2.c
192198
@@ -1144,7 +1144,7 @@ boolT qh_checklists(facetT *facetlist) {
@@ -209,7 +215,7 @@ index 0bdfa6d6..9077b9c3 100644
209215
facet->flipped= False;
210216
facet->toporient ^= (unsigned char)True;
211217
diff --git a/src/libqhull_r/global_r.c b/src/libqhull_r/global_r.c
212-
index 3a0b9c62..c681a715 100644
218+
index 04b9b4d..01dfe8e 100644
213219
--- a/src/libqhull_r/global_r.c
214220
+++ b/src/libqhull_r/global_r.c
215221
@@ -2201,7 +2201,7 @@ void qh_lib_check(int qhullLibraryType, int qhTsize, int vertexTsize, int ridgeT
@@ -222,7 +228,7 @@ index 3a0b9c62..c681a715 100644
222228
}
223229
if (last_errcode) {
224230
diff --git a/src/libqhull_r/mem_r.c b/src/libqhull_r/mem_r.c
225-
index 7d5509eb..d811f733 100644
231+
index 7d5509e..d811f73 100644
226232
--- a/src/libqhull_r/mem_r.c
227233
+++ b/src/libqhull_r/mem_r.c
228234
@@ -186,7 +186,7 @@ void qh_memcheck(qhT *qh) {
@@ -244,7 +250,7 @@ index 7d5509eb..d811f733 100644
244250

245251
/*-<a href="qh-mem_r.htm#TOC"
246252
diff --git a/src/libqhull_r/merge_r.c b/src/libqhull_r/merge_r.c
247-
index f3c899cd..55a86afd 100644
253+
index f3c899c..55a86af 100644
248254
--- a/src/libqhull_r/merge_r.c
249255
+++ b/src/libqhull_r/merge_r.c
250256
@@ -427,7 +427,7 @@ void qh_appendmergeset(qhT *qh, facetT *facet, facetT *neighbor, mergeType merge
@@ -294,7 +300,7 @@ index f3c899cd..55a86afd 100644
294300
ridge->mergevertex= True; /* disables check for duplicate vertices in qh_checkfacet */
295301
ridgeA->mergevertex= True;
296302
diff --git a/src/libqhull_r/poly2_r.c b/src/libqhull_r/poly2_r.c
297-
index 01758340..4d9a0c51 100644
303+
index 1ab5244..a97254e 100644
298304
--- a/src/libqhull_r/poly2_r.c
299305
+++ b/src/libqhull_r/poly2_r.c
300306
@@ -1145,7 +1145,7 @@ boolT qh_checklists(qhT *qh, facetT *facetlist) {
@@ -317,7 +323,7 @@ index 01758340..4d9a0c51 100644
317323
facet->flipped= False;
318324
facet->toporient ^= (unsigned char)True;
319325
diff --git a/src/libqhullcpp/Qhull.cpp b/src/libqhullcpp/Qhull.cpp
320-
index d5c75e92..3123e8ae 100644
326+
index d5c75e9..3123e8a 100644
321327
--- a/src/libqhullcpp/Qhull.cpp
322328
+++ b/src/libqhullcpp/Qhull.cpp
323329
@@ -357,7 +357,7 @@ initializeFeasiblePoint(int hulldim)
@@ -330,7 +336,7 @@ index d5c75e92..3123e8ae 100644
330336
}
331337
qh_qh->feasible_point= static_cast<coordT*>(qh_malloc(static_cast<size_t>(hulldim) * sizeof(coordT)));
332338
diff --git a/src/testqset_r/testqset_r.c b/src/testqset_r/testqset_r.c
333-
index b0253e0e..5ea87394 100644
339+
index b0253e0..5ea8739 100644
334340
--- a/src/testqset_r/testqset_r.c
335341
+++ b/src/testqset_r/testqset_r.c
336342
@@ -532,7 +532,7 @@ void testSetequalInEtc(qhT *qh, int numInts, int *intarray, int checkEvery)
@@ -380,19 +386,23 @@ index b0253e0e..5ea87394 100644
380386
error_count++;
381387
}
382388
}
389+
--
390+
2.54.0
383391

384-
From f7c3bbdfd23c034f5af66fa1f067691aac3378d8 Mon Sep 17 00:00:00 2001
392+
393+
From 2dda51b2f2ec394462cb95ce37b5afc9701c8446 Mon Sep 17 00:00:00 2001
385394
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
386395
Date: Thu, 28 Mar 2024 05:11:33 -0400
387-
Subject: [PATCH 3/3] Don't pass user-defined input as format string
396+
Subject: [PATCH 3/4] Don't pass user-defined input as format string
388397

398+
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
389399
---
390400
src/libqhull/io.c | 2 +-
391401
src/libqhull_r/io_r.c | 2 +-
392402
2 files changed, 2 insertions(+), 2 deletions(-)
393403

394404
diff --git a/src/libqhull/io.c b/src/libqhull/io.c
395-
index beed156a..7b7f4546 100644
405+
index beed156..7b7f454 100644
396406
--- a/src/libqhull/io.c
397407
+++ b/src/libqhull/io.c
398408
@@ -1618,7 +1618,7 @@ void qh_printcenter(FILE *fp, qh_PRINT format, const char *string, facetT *facet
@@ -405,7 +415,7 @@ index beed156a..7b7f4546 100644
405415
num= qh hull_dim-1;
406416
if (!facet->normal || !facet->upperdelaunay || !qh ATinfinity) {
407417
diff --git a/src/libqhull_r/io_r.c b/src/libqhull_r/io_r.c
408-
index a80a5b14..389b1aa6 100644
418+
index a80a5b1..389b1aa 100644
409419
--- a/src/libqhull_r/io_r.c
410420
+++ b/src/libqhull_r/io_r.c
411421
@@ -1618,7 +1618,7 @@ void qh_printcenter(qhT *qh, FILE *fp, qh_PRINT format, const char *string, face
@@ -417,3 +427,48 @@ index a80a5b14..389b1aa6 100644
417427
if (qh->CENTERtype == qh_ASvoronoi) {
418428
num= qh->hull_dim-1;
419429
if (!facet->normal || !facet->upperdelaunay || !qh->ATinfinity) {
430+
--
431+
2.54.0
432+
433+
434+
From b6d5a184cd64d160a50d799ad8b179efeffed121 Mon Sep 17 00:00:00 2001
435+
From: Brad Barber <bradb@shore.net>
436+
Date: Sun, 7 Sep 2025 14:52:49 -0400
437+
Subject: [PATCH 4/4] poly2.c, poly2_r.c: fixed missing
438+
'getid_(previousvertex)' for #143
439+
440+
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
441+
---
442+
src/libqhull/poly2.c | 2 +-
443+
src/libqhull_r/poly2_r.c | 2 +-
444+
2 files changed, 2 insertions(+), 2 deletions(-)
445+
446+
diff --git a/src/libqhull/poly2.c b/src/libqhull/poly2.c
447+
index b30a2b6..f70180e 100644
448+
--- a/src/libqhull/poly2.c
449+
+++ b/src/libqhull/poly2.c
450+
@@ -1144,7 +1144,7 @@ boolT qh_checklists(facetT *facetlist) {
451+
vertex->visitid= qh vertex_visit;
452+
if (vertex->previous != previousvertex) {
453+
qh_fprintf(qh ferr, 6427, "qhull internal error (qh_checklists): expecting v%d.previous == v%d. Got v%d\n",
454+
- vertex->id, previousvertex->id, getid_(vertex->previous));
455+
+ vertex->id, getid_(previousvertex), getid_(vertex->previous));
456+
waserror= True;
457+
errorvertex= vertex;
458+
}
459+
diff --git a/src/libqhull_r/poly2_r.c b/src/libqhull_r/poly2_r.c
460+
index a97254e..44110db 100644
461+
--- a/src/libqhull_r/poly2_r.c
462+
+++ b/src/libqhull_r/poly2_r.c
463+
@@ -1145,7 +1145,7 @@ boolT qh_checklists(qhT *qh, facetT *facetlist) {
464+
vertex->visitid= qh->vertex_visit;
465+
if (vertex->previous != previousvertex) {
466+
qh_fprintf(qh, qh->ferr, 6427, "qhull internal error (qh_checklists): expecting v%d.previous == v%d. Got v%d\n",
467+
- vertex->id, previousvertex->id, getid_(vertex->previous));
468+
+ vertex->id, getid_(previousvertex), getid_(vertex->previous));
469+
waserror= True;
470+
errorvertex= vertex;
471+
}
472+
--
473+
2.54.0
474+

0 commit comments

Comments
 (0)