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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
https://bugs.gentoo.org/883069
https://src.fedoraproject.org/rpms/dia/raw/rawhide/f/dia-0.97.3-const-ft_vector.patch
https://src.fedoraproject.org/rpms/dia/blob/rawhide/f/dia-0.97.3-g_test_add_data_func_1.patch
https://src.fedoraproject.org/rpms/dia/blob/rawhide/f/dia-0.97.3-g_test_add_data_func_2.patch
https://src.fedoraproject.org/rpms/dia/blob/rawhide/f/dia-0.97.3-get_data_size.patch
From e5557aa1d396bc3ca80240f7b5c0a1831a5cf209 Mon Sep 17 00:00:00 2001
From: Hans Breuer <hans@breuer.org>
Date: Sat, 4 May 2013 15:20:15 +0200
Subject: [PATCH] [warningectomy] initialization from incompatible pointer type
FT_Outline_Funcs take const FT_Vector* nowadays.
--- a/plug-ins/postscript/diapsft2renderer.c
+++ b/plug-ins/postscript/diapsft2renderer.c
@@ -61,16 +61,16 @@ void draw_bezier_outline(DiaPsRenderer *renderer,
double pos_y
);
/* Countour traveling functions */
-static int paps_move_to( FT_Vector* to,
+static int paps_move_to( const FT_Vector* to,
void *user_data);
-static int paps_line_to( FT_Vector* to,
+static int paps_line_to( const FT_Vector* to,
void *user_data);
-static int paps_conic_to( FT_Vector* control,
- FT_Vector* to,
+static int paps_conic_to( const FT_Vector* control,
+ const FT_Vector* to,
void *user_data);
-static int paps_cubic_to( FT_Vector* control1,
- FT_Vector* control2,
- FT_Vector* to,
+static int paps_cubic_to( const FT_Vector* control1,
+ const FT_Vector* control2,
+ const FT_Vector* to,
void *user_data);
static void dia_ps_ft2_renderer_class_init (DiaPsFt2RendererClass *klass);
@@ -111,7 +111,7 @@ set_font(DiaRenderer *self, DiaFont *font, real height)
/*======================================================================
outline traversing functions.
----------------------------------------------------------------------*/
-static int paps_move_to( FT_Vector* to,
+static int paps_move_to( const FT_Vector* to,
void *user_data)
{
OutlineInfo *outline_info = (OutlineInfo*)user_data;
@@ -121,7 +121,7 @@ static int paps_move_to( FT_Vector* to,
return 0;
}
-static int paps_line_to( FT_Vector* to,
+static int paps_line_to( const FT_Vector* to,
void *user_data)
{
OutlineInfo *outline_info = (OutlineInfo*)user_data;
@@ -131,8 +131,8 @@ static int paps_line_to( FT_Vector* to,
return 0;
}
-static int paps_conic_to( FT_Vector* control,
- FT_Vector* to,
+static int paps_conic_to( const FT_Vector* control,
+ const FT_Vector* to,
void *user_data)
{
OutlineInfo *outline_info = (OutlineInfo*)user_data;
@@ -144,9 +144,9 @@ static int paps_conic_to( FT_Vector* control,
return 0;
}
-static int paps_cubic_to( FT_Vector* control1,
- FT_Vector* control2,
- FT_Vector* to,
+static int paps_cubic_to( const FT_Vector* control1,
+ const FT_Vector* control2,
+ const FT_Vector* to,
void *user_data)
{
OutlineInfo *outline_info = (OutlineInfo*)user_data;
--
GitLab
From caddfcab250fe677ecf294fad835b71e6b10cf26 Mon Sep 17 00:00:00 2001
From: Hans Breuer <hans@breuer.org>
Date: Fri, 3 Oct 2014 22:26:36 +0200
Subject: [PATCH] [warningectomy] incompatible pointer types passing ...
test-boundingbox.c:152:58: warning: incompatible pointer types passing 'void (const struct _TestBeziers *)' to parameter of type 'GTestDataFunc' (aka 'void (*)(gconstpointer)') [-Wincompatible-pointer-types]
g_test_add_data_func (testpath, &_test_beziers[i], _check_one_bezier);
^~~~~~~~~~~~~~~~~
test-svg.c:117:55: warning: incompatible pointer types passing 'void (const PathData *)' to parameter of type 'GTestDataFunc' (aka 'void (*)(gconstpointer)') [-Wincompatible-pointer-types]
g_test_add_data_func (testpath, &_test_path[i], _check_one_path);
^~~~~~~~~~~~~~~
--- a/tests/test-boundingbox.c
+++ b/tests/test-boundingbox.c
@@ -132,8 +132,9 @@ static struct _TestBeziers {
#undef BEZ
static void
-_check_one_bezier (const struct _TestBeziers *test)
+_check_one_bezier (gconstpointer p)
{
+ const struct _TestBeziers *test = p;
Rectangle rect;
PolyBBExtras extra = {0, T*.7, T*.7, T*.7, 0 };
Backport from https://gitlab.gnome.org/GNOME/dia/-/commit/9c481f649414190bf8d6741cbca1777e9766756b
--- a/tests/test-objects.c
+++ b/tests/test-objects.c.g_test_add_data_func_2
@@ -39,8 +39,9 @@
int num_objects = 0;
static void
-_test_creation (const DiaObjectType *type)
+_test_creation (gconstpointer user_data)
{
+ const DiaObjectType *type = (const DiaObjectType *)user_data;
int i;
Handle *h1 = NULL, *h2 = NULL;
Point point = {0, 0};
@@ -112,8 +113,9 @@
}
static void
-_test_copy (const DiaObjectType *type)
+_test_copy (gconstpointer user_data)
{
+ const DiaObjectType *type = (const DiaObjectType *)user_data;
Handle *h1 = NULL, *h2 = NULL;
Point from = {0, 0};
DiaObject *oc, *o = type->ops->create (&from, type->default_user_data, &h1, &h2);
@@ -172,8 +174,9 @@
}
static void
-_test_movement (const DiaObjectType *type)
+_test_movement (gconstpointer user_data)
{
+ const DiaObjectType *type = (const DiaObjectType *)user_data;
Handle *h1 = NULL, *h2 = NULL;
Point from = {0, 0};
DiaObject *o = type->ops->create (&from, type->default_user_data, &h1, &h2);
@@ -215,8 +218,9 @@
}
static void
-_test_change (const DiaObjectType *type)
+_test_change (gconstpointer user_data)
{
+ const DiaObjectType *type = (const DiaObjectType *)user_data;
Handle *h1 = NULL, *h2 = NULL;
Point from = {0, 0};
DiaObject *o = type->ops->create (&from, type->default_user_data, &h1, &h2);
Backport from https://gitlab.gnome.org/GNOME/dia/-/commit/f57ea2685034ddbafc19f35d9b525a12283d7c24
--- a/lib/prop_geomtypes.c
+++ b/lib/prop_geomtypes.c.get_data_size
@@ -129,9 +129,10 @@
}
static int
-realprop_get_data_size(RealProperty *prop)
+realprop_get_data_size(void)
{
- return sizeof (prop->real_data);
+ RealProperty prop;
+ return sizeof (prop.real_data);
}
static const PropertyOps realprop_ops = {
@@ -242,9 +243,10 @@
}
static int
-lengthprop_get_data_size(LengthProperty *prop)
+lengthprop_get_data_size(void)
{
- return sizeof (prop->length_data);
+ LengthProperty prop;
+ return sizeof (prop.length_data);
}
static const PropertyOps lengthprop_ops = {
@@ -358,9 +360,10 @@
}
static int
-fontsizeprop_get_data_size(FontsizeProperty *prop)
+fontsizeprop_get_data_size(void)
{
- return sizeof (prop->fontsize_data);
+ FontsizeProperty prop;
+ return sizeof (prop.fontsize_data);
}
static const PropertyOps fontsizeprop_ops = {
--- a/lib/prop_inttypes.c
+++ b/lib/prop_inttypes.c.get_data_size
@@ -122,9 +122,10 @@
}
static int
-charprop_get_data_size(CharProperty *prop)
+charprop_get_data_size(void)
{
- return sizeof (prop->char_data);
+ CharProperty prop;
+ return sizeof (prop.char_data);
}
@@ -229,9 +230,10 @@
}
static int
-boolprop_get_data_size(BoolProperty *prop)
+boolprop_get_data_size(void)
{
- return sizeof (prop->bool_data);
+ BoolProperty prop;
+ return sizeof (prop.bool_data);
}
@@ -339,9 +341,10 @@
}
static int
-intprop_get_data_size(IntProperty *prop)
+intprop_get_data_size(void)
{
- return sizeof (prop->int_data);
+ IntProperty prop;
+ return sizeof (prop.int_data);
}
static const PropertyOps intprop_ops = {
--- a/lib/prop_text.c
+++ b/lib/prop_text.c.get_data_size
@@ -208,9 +208,10 @@
}
static int
-stringprop_get_data_size(StringProperty *prop)
+stringprop_get_data_size(void)
{
- return sizeof (prop->string_data); /* only the pointer */
+ StringProperty prop;
+ return sizeof (prop.string_data); /* only the pointer */
}
static StringListProperty *
--- a/lib/properties.h
+++ b/lib/properties.h.get_data_size
@@ -116,7 +116,7 @@
void *base, guint offset, guint offset2);
typedef void (*PropertyType_SetFromOffset)(Property *prop,
void *base, guint offset, guint offset2);
-typedef int (*PropertyType_GetDataSize)(Property *prop);
+typedef int (*PropertyType_GetDataSize)(void);
struct _PropertyOps {
--- a/objects/custom/custom_object.c
+++ b/objects/custom/custom_object.c.get_data_size
@@ -372,14 +372,7 @@
info->prop_offsets[i].name = info->props[i].name;
info->prop_offsets[i].type = info->props[i].type;
info->prop_offsets[i].offset = offs;
- /* FIXME:
- custom_object.c:328: warning: passing arg 1 of pointer to function
- from incompatible pointer type
- We don't have a Property* here so there is not much we can do about.
- Maybe it even works cause the sizeof() in *_get_data_size can be
- calculated at compile time. Anyway, a mess ;) --hb
- */
- size = info->props[i].ops->get_data_size (&info->props[i]);
+ size = info->props[i].ops->get_data_size ();
info->ext_attr_size += size;
offs += size;
}
|