Branch data Line data Source code
1 : : /*
2 : : SPDX-License-Identifier: GPL-2.0-or-later AND LGPL-2.0-or-later AND MIT
3 : : SPDX-FileCopyrightText: 2010-2012 Collabora, Ltd.
4 : : SPDX-FileCopyrightText: 2010 Johan Dahlin
5 : : SPDX-FileCopyrightText: 2010 Sugar Labs
6 : : SPDX-FileCopyrightText: 2010 Zach Goldberg
7 : : SPDX-FileCopyrightText: 2011 Alex Eftimie
8 : : SPDX-FileCopyrightText: 2011-2012 Canonical Ltd.
9 : : SPDX-FileCopyrightText: 2011-2012 Colin Walters <walters@verbum.org>
10 : : SPDX-FileCopyrightText: 2011 Dan Winship
11 : : SPDX-FileCopyrightText: 2011-2012 Giovanni Campagna
12 : : SPDX-FileCopyrightText: 2011 Ignacio Casal Quinteiro
13 : : SPDX-FileCopyrightText: 2011-2012 Jasper St. Pierre
14 : : SPDX-FileCopyrightText: 2011 Laszlo Pandy
15 : : SPDX-FileCopyrightText: 2011 Red Hat, Inc.
16 : : SPDX-FileCopyrightText: 2012 Bastian Winkler
17 : : SPDX-FileCopyrightText: 2012 Epitech
18 : : SPDX-FileCopyrightText: 2012 Gonzalo Odiard
19 : : SPDX-FileCopyrightText: 2012-2013 Martin Pitt
20 : : SPDX-FileCopyrightText: 2012-2013 Paolo Borelli
21 : : SPDX-FileCopyrightText: 2012 Sebastian Pölsterl
22 : : SPDX-FileCopyrightText: 2013 Simon Feltman
23 : : SPDX-FileCopyrightText: 2014 Lionel Landwerlin
24 : : SPDX-FileCopyrightText: 2014 RIFT.io, Inc.
25 : : SPDX-FileCopyrightText: 2014 SuSE
26 : : SPDX-FileCopyrightText: 2016 Endless Mobile, Inc.
27 : : SPDX-FileCopyrightText: 2016-2018, 2023, 2025 Philip Chimento
28 : : SPDX-FileCopyrightText: 2017 Christoph Reiter
29 : : SPDX-FileCopyrightText: 2018 Tomasz Miąsko
30 : : SPDX-FileCopyrightText: 2019 Stéphane Seng
31 : : SPDX-FileCopyrightText: 2020-2023 Marco Trevisan
32 : : SPDX-FileCopyrightText: 2020, 2024 Simon McVittie
33 : : SPDX-FileCopyrightText: 2021 Carlos Garnacho
34 : : */
35 : :
36 : : #include <stdint.h>
37 : : #include <string.h>
38 : :
39 : : #include "gimarshallingtests.h"
40 : :
41 : : /* Unaligned buffer, for testing that language bindings can deal with pointers
42 : : * allocated at arbitrary 1-byte alignments. */
43 : : static guint8 *unaligned_buffer = NULL;
44 : : static const size_t UNALIGNED_BUFFER_SIZE = 33;
45 : :
46 : : /**
47 : : * gi_marshalling_tests_cleanup_unaligned_buffer:
48 : : *
49 : : * It's OK not to call this and just leak the buffer, but if you are running
50 : : * your tests with AddressSanitizer or valgrind, you should call this after
51 : : * completing each unaligned buffer test.
52 : : *
53 : : * We can't send an unaligned buffer as (transfer full) because g_free() won't
54 : : * work on it on Windows.
55 : : */
56 : : void
57 : 6 : gi_marshalling_tests_cleanup_unaligned_buffer (void)
58 : : {
59 : 6 : g_aligned_free_sized (unaligned_buffer, 8, UNALIGNED_BUFFER_SIZE);
60 : 6 : unaligned_buffer = NULL;
61 : 6 : }
62 : :
63 : : static const guint8 *
64 : 6 : init_unaligned_buffer (void)
65 : : {
66 [ - + ]: 6 : if (unaligned_buffer)
67 : 0 : gi_marshalling_tests_cleanup_unaligned_buffer ();
68 : :
69 : 6 : unaligned_buffer = g_aligned_alloc0 (1, UNALIGNED_BUFFER_SIZE, 8);
70 [ + + ]: 204 : for (size_t ix = 0; ix < UNALIGNED_BUFFER_SIZE; ix++)
71 : 198 : unaligned_buffer[ix] = (uintptr_t) (unaligned_buffer + ix) & 0x07;
72 : 6 : return unaligned_buffer + 1;
73 : : }
74 : :
75 : : static void gi_marshalling_tests_boxed_struct_free (GIMarshallingTestsBoxedStruct *v);
76 : :
77 : : /* Booleans */
78 : :
79 : : gboolean
80 : 1 : gi_marshalling_tests_boolean_return_true (void)
81 : : {
82 : 1 : return TRUE;
83 : : }
84 : :
85 : : gboolean
86 : 1 : gi_marshalling_tests_boolean_return_false (void)
87 : : {
88 : 1 : return FALSE;
89 : : }
90 : :
91 : : void
92 : 1 : gi_marshalling_tests_boolean_in_true (gboolean v)
93 : : {
94 : 1 : g_assert (v == TRUE);
95 : 1 : }
96 : :
97 : : void
98 : 1 : gi_marshalling_tests_boolean_in_false (gboolean v)
99 : : {
100 : 1 : g_assert (v == FALSE);
101 : 1 : }
102 : :
103 : : /**
104 : : * gi_marshalling_tests_boolean_out_true:
105 : : * @v: (out):
106 : : */
107 : : void
108 : 1 : gi_marshalling_tests_boolean_out_true (gboolean *v)
109 : : {
110 : 1 : *v = TRUE;
111 : 1 : }
112 : :
113 : : /**
114 : : * gi_marshalling_tests_boolean_out_false:
115 : : * @v: (out):
116 : : */
117 : : void
118 : 1 : gi_marshalling_tests_boolean_out_false (gboolean *v)
119 : : {
120 : 1 : *v = FALSE;
121 : 1 : }
122 : :
123 : : /**
124 : : * gi_marshalling_tests_boolean_out_uninitialized:
125 : : * @v: (out):
126 : : */
127 : : gboolean
128 : 1 : gi_marshalling_tests_boolean_out_uninitialized (gboolean *v G_GNUC_UNUSED)
129 : : {
130 : 1 : return FALSE;
131 : : }
132 : :
133 : : /**
134 : : * gi_marshalling_tests_boolean_inout_true_false:
135 : : * @v: (inout):
136 : : */
137 : : void
138 : 1 : gi_marshalling_tests_boolean_inout_true_false (gboolean *v)
139 : : {
140 : 1 : g_assert (*v == TRUE);
141 : 1 : *v = FALSE;
142 : 1 : }
143 : :
144 : : /**
145 : : * gi_marshalling_tests_boolean_inout_false_true:
146 : : * @v: (inout):
147 : : */
148 : : void
149 : 1 : gi_marshalling_tests_boolean_inout_false_true (gboolean *v)
150 : : {
151 : 1 : g_assert (*v == FALSE);
152 : 1 : *v = TRUE;
153 : 1 : }
154 : :
155 : : /* Integers */
156 : :
157 : : gint8
158 : 1 : gi_marshalling_tests_int8_return_max (void)
159 : : {
160 : 1 : return G_MAXINT8;
161 : : }
162 : :
163 : : gint8
164 : 1 : gi_marshalling_tests_int8_return_min (void)
165 : : {
166 : 1 : return G_MININT8;
167 : : }
168 : :
169 : : void
170 : 1 : gi_marshalling_tests_int8_in_max (gint8 v)
171 : : {
172 : 1 : g_assert_cmpint (v, ==, G_MAXINT8);
173 : 1 : }
174 : :
175 : : void
176 : 1 : gi_marshalling_tests_int8_in_min (gint8 v)
177 : : {
178 : 1 : g_assert_cmpint (v, ==, G_MININT8);
179 : 1 : }
180 : :
181 : : /**
182 : : * gi_marshalling_tests_int8_out_max:
183 : : * @v: (out):
184 : : */
185 : : void
186 : 1 : gi_marshalling_tests_int8_out_max (gint8 *v)
187 : : {
188 : 1 : *v = G_MAXINT8;
189 : 1 : }
190 : :
191 : : /**
192 : : * gi_marshalling_tests_int8_out_min:
193 : : * @v: (out):
194 : : */
195 : : void
196 : 1 : gi_marshalling_tests_int8_out_min (gint8 *v)
197 : : {
198 : 1 : *v = G_MININT8;
199 : 1 : }
200 : :
201 : : /**
202 : : * gi_marshalling_tests_int8_out_uninitialized:
203 : : * @v: (out):
204 : : */
205 : : gboolean
206 : 1 : gi_marshalling_tests_int8_out_uninitialized (gint8 *v G_GNUC_UNUSED)
207 : : {
208 : 1 : return FALSE;
209 : : }
210 : :
211 : : /**
212 : : * gi_marshalling_tests_int8_inout_max_min:
213 : : * @v: (inout):
214 : : */
215 : : void
216 : 1 : gi_marshalling_tests_int8_inout_max_min (gint8 *v)
217 : : {
218 : 1 : g_assert_cmpint (*v, ==, G_MAXINT8);
219 : 1 : *v = G_MININT8;
220 : 1 : }
221 : :
222 : : /**
223 : : * gi_marshalling_tests_int8_inout_min_max:
224 : : * @v: (inout):
225 : : */
226 : : void
227 : 1 : gi_marshalling_tests_int8_inout_min_max (gint8 *v)
228 : : {
229 : 1 : g_assert_cmpint (*v, ==, G_MININT8);
230 : 1 : *v = G_MAXINT8;
231 : 1 : }
232 : :
233 : : guint8
234 : 1 : gi_marshalling_tests_uint8_return (void)
235 : : {
236 : 1 : return G_MAXUINT8;
237 : : }
238 : :
239 : : void
240 : 1 : gi_marshalling_tests_uint8_in (guint8 v)
241 : : {
242 : 1 : g_assert_cmpuint (v, ==, G_MAXUINT8);
243 : 1 : }
244 : :
245 : : /**
246 : : * gi_marshalling_tests_uint8_out:
247 : : * @v: (out):
248 : : */
249 : : void
250 : 1 : gi_marshalling_tests_uint8_out (guint8 *v)
251 : : {
252 : 1 : *v = G_MAXUINT8;
253 : 1 : }
254 : :
255 : : /**
256 : : * gi_marshalling_tests_uint8_out_uninitialized:
257 : : * @v: (out):
258 : : */
259 : : gboolean
260 : 1 : gi_marshalling_tests_uint8_out_uninitialized (guint8 *v G_GNUC_UNUSED)
261 : : {
262 : 1 : return FALSE;
263 : : }
264 : :
265 : : /**
266 : : * gi_marshalling_tests_uint8_inout:
267 : : * @v: (inout):
268 : : */
269 : : void
270 : 1 : gi_marshalling_tests_uint8_inout (guint8 *v)
271 : : {
272 : 1 : g_assert_cmpuint (*v, ==, G_MAXUINT8);
273 : 1 : *v = 0;
274 : 1 : }
275 : :
276 : : gint16
277 : 1 : gi_marshalling_tests_int16_return_max (void)
278 : : {
279 : 1 : return G_MAXINT16;
280 : : }
281 : :
282 : : gint16
283 : 1 : gi_marshalling_tests_int16_return_min (void)
284 : : {
285 : 1 : return G_MININT16;
286 : : }
287 : :
288 : : void
289 : 1 : gi_marshalling_tests_int16_in_max (gint16 v)
290 : : {
291 : 1 : g_assert_cmpint (v, ==, G_MAXINT16);
292 : 1 : }
293 : :
294 : : void
295 : 1 : gi_marshalling_tests_int16_in_min (gint16 v)
296 : : {
297 : 1 : g_assert_cmpint (v, ==, G_MININT16);
298 : 1 : }
299 : :
300 : : /**
301 : : * gi_marshalling_tests_int16_out_max:
302 : : * @v: (out):
303 : : */
304 : : void
305 : 1 : gi_marshalling_tests_int16_out_max (gint16 *v)
306 : : {
307 : 1 : *v = G_MAXINT16;
308 : 1 : }
309 : :
310 : : /**
311 : : * gi_marshalling_tests_int16_out_min:
312 : : * @v: (out):
313 : : */
314 : : void
315 : 1 : gi_marshalling_tests_int16_out_min (gint16 *v)
316 : : {
317 : 1 : *v = G_MININT16;
318 : 1 : }
319 : :
320 : : /**
321 : : * gi_marshalling_tests_int16_out_uninitialized:
322 : : * @v: (out):
323 : : */
324 : : gboolean
325 : 1 : gi_marshalling_tests_int16_out_uninitialized (gint16 *v G_GNUC_UNUSED)
326 : : {
327 : 1 : return FALSE;
328 : : }
329 : :
330 : : /**
331 : : * gi_marshalling_tests_int16_inout_max_min:
332 : : * @v: (inout):
333 : : */
334 : : void
335 : 1 : gi_marshalling_tests_int16_inout_max_min (gint16 *v)
336 : : {
337 : 1 : g_assert_cmpint (*v, ==, G_MAXINT16);
338 : 1 : *v = G_MININT16;
339 : 1 : }
340 : :
341 : : /**
342 : : * gi_marshalling_tests_int16_inout_min_max:
343 : : * @v: (inout):
344 : : */
345 : : void
346 : 1 : gi_marshalling_tests_int16_inout_min_max (gint16 *v)
347 : : {
348 : 1 : g_assert_cmpint (*v, ==, G_MININT16);
349 : 1 : *v = G_MAXINT16;
350 : 1 : }
351 : :
352 : : guint16
353 : 1 : gi_marshalling_tests_uint16_return (void)
354 : : {
355 : 1 : return G_MAXUINT16;
356 : : }
357 : :
358 : : void
359 : 1 : gi_marshalling_tests_uint16_in (guint16 v)
360 : : {
361 : 1 : g_assert_cmpuint (v, ==, G_MAXUINT16);
362 : 1 : }
363 : :
364 : : /**
365 : : * gi_marshalling_tests_uint16_out:
366 : : * @v: (out):
367 : : */
368 : : void
369 : 1 : gi_marshalling_tests_uint16_out (guint16 *v)
370 : : {
371 : 1 : *v = G_MAXUINT16;
372 : 1 : }
373 : :
374 : : /**
375 : : * gi_marshalling_tests_uint16_out_uninitialized:
376 : : * @v: (out):
377 : : */
378 : : gboolean
379 : 1 : gi_marshalling_tests_uint16_out_uninitialized (guint16 *v G_GNUC_UNUSED)
380 : : {
381 : 1 : return FALSE;
382 : : }
383 : :
384 : : /**
385 : : * gi_marshalling_tests_uint16_inout:
386 : : * @v: (inout):
387 : : */
388 : : void
389 : 1 : gi_marshalling_tests_uint16_inout (guint16 *v)
390 : : {
391 : 1 : g_assert_cmpuint (*v, ==, G_MAXUINT16);
392 : 1 : *v = 0;
393 : 1 : }
394 : :
395 : : gint32
396 : 1 : gi_marshalling_tests_int32_return_max (void)
397 : : {
398 : 1 : return G_MAXINT32;
399 : : }
400 : :
401 : : gint32
402 : 1 : gi_marshalling_tests_int32_return_min (void)
403 : : {
404 : 1 : return G_MININT32;
405 : : }
406 : :
407 : : void
408 : 1 : gi_marshalling_tests_int32_in_max (gint32 v)
409 : : {
410 : 1 : g_assert_cmpint (v, ==, G_MAXINT32);
411 : 1 : }
412 : :
413 : : void
414 : 1 : gi_marshalling_tests_int32_in_min (gint32 v)
415 : : {
416 : 1 : g_assert_cmpint (v, ==, G_MININT32);
417 : 1 : }
418 : :
419 : : /**
420 : : * gi_marshalling_tests_int32_out_max:
421 : : * @v: (out):
422 : : */
423 : : void
424 : 1 : gi_marshalling_tests_int32_out_max (gint32 *v)
425 : : {
426 : 1 : *v = G_MAXINT32;
427 : 1 : }
428 : :
429 : : /**
430 : : * gi_marshalling_tests_int32_out_min:
431 : : * @v: (out):
432 : : */
433 : : void
434 : 1 : gi_marshalling_tests_int32_out_min (gint32 *v)
435 : : {
436 : 1 : *v = G_MININT32;
437 : 1 : }
438 : :
439 : : /**
440 : : * gi_marshalling_tests_int32_out_uninitialized:
441 : : * @v: (out):
442 : : */
443 : : gboolean
444 : 1 : gi_marshalling_tests_int32_out_uninitialized (gint32 *v G_GNUC_UNUSED)
445 : : {
446 : 1 : return FALSE;
447 : : }
448 : :
449 : : /**
450 : : * gi_marshalling_tests_int32_inout_max_min:
451 : : * @v: (inout):
452 : : */
453 : : void
454 : 1 : gi_marshalling_tests_int32_inout_max_min (gint32 *v)
455 : : {
456 : 1 : g_assert_cmpint (*v, ==, G_MAXINT32);
457 : 1 : *v = G_MININT32;
458 : 1 : }
459 : :
460 : : /**
461 : : * gi_marshalling_tests_int32_inout_min_max:
462 : : * @v: (inout):
463 : : */
464 : : void
465 : 1 : gi_marshalling_tests_int32_inout_min_max (gint32 *v)
466 : : {
467 : 1 : g_assert_cmpint (*v, ==, G_MININT32);
468 : 1 : *v = G_MAXINT32;
469 : 1 : }
470 : :
471 : : guint32
472 : 1 : gi_marshalling_tests_uint32_return (void)
473 : : {
474 : 1 : return G_MAXUINT32;
475 : : }
476 : :
477 : : void
478 : 1 : gi_marshalling_tests_uint32_in (guint32 v)
479 : : {
480 : 1 : g_assert_cmpuint (v, ==, G_MAXUINT32);
481 : 1 : }
482 : :
483 : : /**
484 : : * gi_marshalling_tests_uint32_out:
485 : : * @v: (out):
486 : : */
487 : : void
488 : 1 : gi_marshalling_tests_uint32_out (guint32 *v)
489 : : {
490 : 1 : *v = G_MAXUINT32;
491 : 1 : }
492 : :
493 : : /**
494 : : * gi_marshalling_tests_uint32_out_uninitialized:
495 : : * @v: (out):
496 : : */
497 : : gboolean
498 : 1 : gi_marshalling_tests_uint32_out_uninitialized (guint32 *v G_GNUC_UNUSED)
499 : : {
500 : 1 : return FALSE;
501 : : }
502 : :
503 : : /**
504 : : * gi_marshalling_tests_uint32_inout:
505 : : * @v: (inout):
506 : : */
507 : : void
508 : 1 : gi_marshalling_tests_uint32_inout (guint32 *v)
509 : : {
510 : 1 : g_assert_cmpuint (*v, ==, G_MAXUINT32);
511 : 1 : *v = 0;
512 : 1 : }
513 : :
514 : : gint64
515 : 1 : gi_marshalling_tests_int64_return_max (void)
516 : : {
517 : 1 : return G_MAXINT64;
518 : : }
519 : :
520 : : gint64
521 : 1 : gi_marshalling_tests_int64_return_min (void)
522 : : {
523 : 1 : return G_MININT64;
524 : : }
525 : :
526 : : void
527 : 1 : gi_marshalling_tests_int64_in_max (gint64 v)
528 : : {
529 : 1 : g_assert_cmpint (v, ==, G_MAXINT64);
530 : 1 : }
531 : :
532 : : void
533 : 1 : gi_marshalling_tests_int64_in_min (gint64 v)
534 : : {
535 : 1 : g_assert_cmpint (v, ==, G_MININT64);
536 : 1 : }
537 : :
538 : : /**
539 : : * gi_marshalling_tests_int64_out_max:
540 : : * @v: (out):
541 : : */
542 : : void
543 : 1 : gi_marshalling_tests_int64_out_max (gint64 *v)
544 : : {
545 : 1 : *v = G_MAXINT64;
546 : 1 : }
547 : :
548 : : /**
549 : : * gi_marshalling_tests_int64_out_min:
550 : : * @v: (out):
551 : : */
552 : : void
553 : 1 : gi_marshalling_tests_int64_out_min (gint64 *v)
554 : : {
555 : 1 : *v = G_MININT64;
556 : 1 : }
557 : :
558 : : /**
559 : : * gi_marshalling_tests_int64_out_uninitialized:
560 : : * @v: (out):
561 : : */
562 : : gboolean
563 : 1 : gi_marshalling_tests_int64_out_uninitialized (gint64 *v G_GNUC_UNUSED)
564 : : {
565 : 1 : return FALSE;
566 : : }
567 : :
568 : : /**
569 : : * gi_marshalling_tests_int64_inout_max_min:
570 : : * @v: (inout):
571 : : */
572 : : void
573 : 0 : gi_marshalling_tests_int64_inout_max_min (gint64 *v)
574 : : {
575 : 0 : g_assert_cmpint (*v, ==, G_MAXINT64);
576 : 0 : *v = G_MININT64;
577 : 0 : }
578 : :
579 : : /**
580 : : * gi_marshalling_tests_int64_inout_min_max:
581 : : * @v: (inout):
582 : : */
583 : : void
584 : 0 : gi_marshalling_tests_int64_inout_min_max (gint64 *v)
585 : : {
586 : 0 : g_assert_cmpint (*v, ==, G_MININT64);
587 : 0 : *v = G_MAXINT64;
588 : 0 : }
589 : :
590 : : guint64
591 : 1 : gi_marshalling_tests_uint64_return (void)
592 : : {
593 : 1 : return G_MAXUINT64;
594 : : }
595 : :
596 : : void
597 : 1 : gi_marshalling_tests_uint64_in (guint64 v)
598 : : {
599 : 1 : g_assert_cmpuint (v, ==, G_MAXUINT64);
600 : 1 : }
601 : :
602 : : /**
603 : : * gi_marshalling_tests_uint64_out:
604 : : * @v: (out):
605 : : */
606 : : void
607 : 1 : gi_marshalling_tests_uint64_out (guint64 *v)
608 : : {
609 : 1 : *v = G_MAXUINT64;
610 : 1 : }
611 : :
612 : : /**
613 : : * gi_marshalling_tests_uint64_out_uninitialized:
614 : : * @v: (out):
615 : : */
616 : : gboolean
617 : 1 : gi_marshalling_tests_uint64_out_uninitialized (guint64 *v G_GNUC_UNUSED)
618 : : {
619 : 1 : return FALSE;
620 : : }
621 : :
622 : : /**
623 : : * gi_marshalling_tests_uint64_inout:
624 : : * @v: (inout):
625 : : */
626 : : void
627 : 0 : gi_marshalling_tests_uint64_inout (guint64 *v)
628 : : {
629 : 0 : g_assert_cmpuint (*v, ==, G_MAXUINT64);
630 : 0 : *v = 0;
631 : 0 : }
632 : :
633 : : gshort
634 : 1 : gi_marshalling_tests_short_return_max (void)
635 : : {
636 : 1 : return G_MAXSHORT;
637 : : }
638 : :
639 : : gshort
640 : 1 : gi_marshalling_tests_short_return_min (void)
641 : : {
642 : 1 : return G_MINSHORT;
643 : : }
644 : :
645 : : void
646 : 1 : gi_marshalling_tests_short_in_max (gshort short_)
647 : : {
648 : 1 : g_assert_cmpint (short_, ==, G_MAXSHORT);
649 : 1 : }
650 : :
651 : : void
652 : 1 : gi_marshalling_tests_short_in_min (gshort short_)
653 : : {
654 : 1 : g_assert_cmpint (short_, ==, G_MINSHORT);
655 : 1 : }
656 : :
657 : : /**
658 : : * gi_marshalling_tests_short_out_max:
659 : : * @short_: (out):
660 : : */
661 : : void
662 : 1 : gi_marshalling_tests_short_out_max (gshort *short_)
663 : : {
664 : 1 : *short_ = G_MAXSHORT;
665 : 1 : }
666 : :
667 : : /**
668 : : * gi_marshalling_tests_short_out_min:
669 : : * @short_: (out):
670 : : */
671 : : void
672 : 1 : gi_marshalling_tests_short_out_min (gshort *short_)
673 : : {
674 : 1 : *short_ = G_MINSHORT;
675 : 1 : }
676 : :
677 : : /**
678 : : * gi_marshalling_tests_short_out_uninitialized:
679 : : * @v: (out):
680 : : */
681 : : gboolean
682 : 1 : gi_marshalling_tests_short_out_uninitialized (gshort *v G_GNUC_UNUSED)
683 : : {
684 : 1 : return FALSE;
685 : : }
686 : :
687 : : /**
688 : : * gi_marshalling_tests_short_inout_max_min:
689 : : * @short_: (inout):
690 : : */
691 : : void
692 : 1 : gi_marshalling_tests_short_inout_max_min (gshort *short_)
693 : : {
694 : 1 : g_assert_cmpint (*short_, ==, G_MAXSHORT);
695 : 1 : *short_ = G_MINSHORT;
696 : 1 : }
697 : :
698 : : /**
699 : : * gi_marshalling_tests_short_inout_min_max:
700 : : * @short_: (inout):
701 : : */
702 : : void
703 : 1 : gi_marshalling_tests_short_inout_min_max (gshort *short_)
704 : : {
705 : 1 : g_assert_cmpint (*short_, ==, G_MINSHORT);
706 : 1 : *short_ = G_MAXSHORT;
707 : 1 : }
708 : :
709 : : gushort
710 : 1 : gi_marshalling_tests_ushort_return (void)
711 : : {
712 : 1 : return G_MAXUSHORT;
713 : : }
714 : :
715 : : void
716 : 1 : gi_marshalling_tests_ushort_in (gushort ushort_)
717 : : {
718 : 1 : g_assert_cmpuint (ushort_, ==, G_MAXUSHORT);
719 : 1 : }
720 : :
721 : : /**
722 : : * gi_marshalling_tests_ushort_out:
723 : : * @ushort_: (out):
724 : : */
725 : : void
726 : 1 : gi_marshalling_tests_ushort_out (gushort *ushort_)
727 : : {
728 : 1 : *ushort_ = G_MAXUSHORT;
729 : 1 : }
730 : :
731 : : /**
732 : : * gi_marshalling_tests_ushort_out_uninitialized:
733 : : * @v: (out):
734 : : */
735 : : gboolean
736 : 1 : gi_marshalling_tests_ushort_out_uninitialized (gushort *v G_GNUC_UNUSED)
737 : : {
738 : 1 : return FALSE;
739 : : }
740 : :
741 : : /**
742 : : * gi_marshalling_tests_ushort_inout:
743 : : * @ushort_: (inout):
744 : : */
745 : : void
746 : 1 : gi_marshalling_tests_ushort_inout (gushort *ushort_)
747 : : {
748 : 1 : g_assert_cmpuint (*ushort_, ==, G_MAXUSHORT);
749 : 1 : *ushort_ = 0;
750 : 1 : }
751 : :
752 : : gint
753 : 1 : gi_marshalling_tests_int_return_max (void)
754 : : {
755 : 1 : return G_MAXINT;
756 : : }
757 : :
758 : : gint
759 : 1 : gi_marshalling_tests_int_return_min (void)
760 : : {
761 : 1 : return G_MININT;
762 : : }
763 : :
764 : : void
765 : 1 : gi_marshalling_tests_int_in_max (gint int_)
766 : : {
767 : 1 : g_assert_cmpint (int_, ==, G_MAXINT);
768 : 1 : }
769 : :
770 : : void
771 : 1 : gi_marshalling_tests_int_in_min (gint int_)
772 : : {
773 : 1 : g_assert_cmpint (int_, ==, G_MININT);
774 : 1 : }
775 : :
776 : : /**
777 : : * gi_marshalling_tests_int_out_max:
778 : : * @int_: (out):
779 : : */
780 : : void
781 : 1 : gi_marshalling_tests_int_out_max (gint *int_)
782 : : {
783 : 1 : *int_ = G_MAXINT;
784 : 1 : }
785 : :
786 : : /**
787 : : * gi_marshalling_tests_int_out_min:
788 : : * @int_: (out):
789 : : */
790 : : void
791 : 1 : gi_marshalling_tests_int_out_min (gint *int_)
792 : : {
793 : 1 : *int_ = G_MININT;
794 : 1 : }
795 : :
796 : : /**
797 : : * gi_marshalling_tests_int_out_uninitialized:
798 : : * @v: (out):
799 : : */
800 : : gboolean
801 : 1 : gi_marshalling_tests_int_out_uninitialized (gint *v G_GNUC_UNUSED)
802 : : {
803 : 1 : return FALSE;
804 : : }
805 : :
806 : : /**
807 : : * gi_marshalling_tests_int_inout_max_min:
808 : : * @int_: (inout):
809 : : */
810 : : void
811 : 1 : gi_marshalling_tests_int_inout_max_min (gint *int_)
812 : : {
813 : 1 : g_assert_cmpint (*int_, ==, G_MAXINT);
814 : 1 : *int_ = G_MININT;
815 : 1 : }
816 : :
817 : : /**
818 : : * gi_marshalling_tests_int_inout_min_max:
819 : : * @int_: (inout):
820 : : */
821 : : void
822 : 1 : gi_marshalling_tests_int_inout_min_max (gint *int_)
823 : : {
824 : 1 : g_assert_cmpint (*int_, ==, G_MININT);
825 : 1 : *int_ = G_MAXINT;
826 : 1 : }
827 : :
828 : : guint
829 : 1 : gi_marshalling_tests_uint_return (void)
830 : : {
831 : 1 : return G_MAXUINT;
832 : : }
833 : :
834 : : void
835 : 1 : gi_marshalling_tests_uint_in (guint uint_)
836 : : {
837 : 1 : g_assert_cmpuint (uint_, ==, G_MAXUINT);
838 : 1 : }
839 : :
840 : : /**
841 : : * gi_marshalling_tests_uint_out:
842 : : * @uint_: (out):
843 : : */
844 : : void
845 : 1 : gi_marshalling_tests_uint_out (guint *uint_)
846 : : {
847 : 1 : *uint_ = G_MAXUINT;
848 : 1 : }
849 : :
850 : : /**
851 : : * gi_marshalling_tests_uint_out_uninitialized:
852 : : * @v: (out):
853 : : */
854 : : gboolean
855 : 1 : gi_marshalling_tests_uint_out_uninitialized (guint *v G_GNUC_UNUSED)
856 : : {
857 : 1 : return FALSE;
858 : : }
859 : :
860 : : /**
861 : : * gi_marshalling_tests_uint_inout:
862 : : * @uint_: (inout):
863 : : */
864 : : void
865 : 1 : gi_marshalling_tests_uint_inout (guint *uint_)
866 : : {
867 : 1 : g_assert_cmpuint (*uint_, ==, G_MAXUINT);
868 : 1 : *uint_ = 0;
869 : 1 : }
870 : :
871 : : glong
872 : 1 : gi_marshalling_tests_long_return_max (void)
873 : : {
874 : 1 : return G_MAXLONG;
875 : : }
876 : :
877 : : glong
878 : 1 : gi_marshalling_tests_long_return_min (void)
879 : : {
880 : 1 : return G_MINLONG;
881 : : }
882 : :
883 : : void
884 : 1 : gi_marshalling_tests_long_in_max (glong long_)
885 : : {
886 : 1 : g_assert_cmpint (long_, ==, G_MAXLONG);
887 : 1 : }
888 : :
889 : : void
890 : 1 : gi_marshalling_tests_long_in_min (glong long_)
891 : : {
892 : 1 : g_assert_cmpint (long_, ==, G_MINLONG);
893 : 1 : }
894 : :
895 : : /**
896 : : * gi_marshalling_tests_long_out_max:
897 : : * @long_: (out):
898 : : */
899 : : void
900 : 1 : gi_marshalling_tests_long_out_max (glong *long_)
901 : : {
902 : 1 : *long_ = G_MAXLONG;
903 : 1 : }
904 : :
905 : : /**
906 : : * gi_marshalling_tests_long_out_min:
907 : : * @long_: (out):
908 : : */
909 : : void
910 : 1 : gi_marshalling_tests_long_out_min (glong *long_)
911 : : {
912 : 1 : *long_ = G_MINLONG;
913 : 1 : }
914 : :
915 : : /**
916 : : * gi_marshalling_tests_long_out_uninitialized:
917 : : * @v: (out):
918 : : */
919 : : gboolean
920 : 1 : gi_marshalling_tests_long_out_uninitialized (glong *v G_GNUC_UNUSED)
921 : : {
922 : 1 : return FALSE;
923 : : }
924 : :
925 : : /**
926 : : * gi_marshalling_tests_long_inout_max_min:
927 : : * @long_: (inout):
928 : : */
929 : : void
930 : 0 : gi_marshalling_tests_long_inout_max_min (glong *long_)
931 : : {
932 : 0 : g_assert_cmpint (*long_, ==, G_MAXLONG);
933 : 0 : *long_ = G_MINLONG;
934 : 0 : }
935 : :
936 : : /**
937 : : * gi_marshalling_tests_long_inout_min_max:
938 : : * @long_: (inout):
939 : : */
940 : : void
941 : 0 : gi_marshalling_tests_long_inout_min_max (glong *long_)
942 : : {
943 : 0 : g_assert_cmpint (*long_, ==, G_MINLONG);
944 : 0 : *long_ = G_MAXLONG;
945 : 0 : }
946 : :
947 : : gulong
948 : 1 : gi_marshalling_tests_ulong_return (void)
949 : : {
950 : 1 : return G_MAXULONG;
951 : : }
952 : :
953 : : void
954 : 1 : gi_marshalling_tests_ulong_in (gulong ulong_)
955 : : {
956 : 1 : g_assert_cmpuint (ulong_, ==, G_MAXULONG);
957 : 1 : }
958 : :
959 : : /**
960 : : * gi_marshalling_tests_ulong_out:
961 : : * @ulong_: (out):
962 : : */
963 : : void
964 : 1 : gi_marshalling_tests_ulong_out (gulong *ulong_)
965 : : {
966 : 1 : *ulong_ = G_MAXULONG;
967 : 1 : }
968 : :
969 : : /**
970 : : * gi_marshalling_tests_ulong_out_uninitialized:
971 : : * @v: (out):
972 : : */
973 : : gboolean
974 : 1 : gi_marshalling_tests_ulong_out_uninitialized (gulong *v G_GNUC_UNUSED)
975 : : {
976 : 1 : return FALSE;
977 : : }
978 : :
979 : : /**
980 : : * gi_marshalling_tests_ulong_inout:
981 : : * @ulong_: (inout):
982 : : */
983 : : void
984 : 0 : gi_marshalling_tests_ulong_inout (gulong *ulong_)
985 : : {
986 : 0 : g_assert_cmpuint (*ulong_, ==, G_MAXULONG);
987 : 0 : *ulong_ = 0;
988 : 0 : }
989 : :
990 : : gssize
991 : 1 : gi_marshalling_tests_ssize_return_max (void)
992 : : {
993 : 1 : return G_MAXSSIZE;
994 : : }
995 : :
996 : : gssize
997 : 1 : gi_marshalling_tests_ssize_return_min (void)
998 : : {
999 : 1 : return G_MINSSIZE;
1000 : : }
1001 : :
1002 : : void
1003 : 1 : gi_marshalling_tests_ssize_in_max (gssize ssize)
1004 : : {
1005 : 1 : g_assert_cmpint (ssize, ==, G_MAXSSIZE);
1006 : 1 : }
1007 : :
1008 : : void
1009 : 1 : gi_marshalling_tests_ssize_in_min (gssize ssize)
1010 : : {
1011 : 1 : g_assert_cmpint (ssize, ==, G_MINSSIZE);
1012 : 1 : }
1013 : :
1014 : : /**
1015 : : * gi_marshalling_tests_ssize_out_max:
1016 : : * @ssize: (out):
1017 : : */
1018 : : void
1019 : 1 : gi_marshalling_tests_ssize_out_max (gssize *ssize)
1020 : : {
1021 : 1 : *ssize = G_MAXSSIZE;
1022 : 1 : }
1023 : :
1024 : : /**
1025 : : * gi_marshalling_tests_ssize_out_min:
1026 : : * @ssize: (out):
1027 : : */
1028 : : void
1029 : 1 : gi_marshalling_tests_ssize_out_min (gssize *ssize)
1030 : : {
1031 : 1 : *ssize = G_MINSSIZE;
1032 : 1 : }
1033 : :
1034 : : /**
1035 : : * gi_marshalling_tests_ssize_out_uninitialized:
1036 : : * @v: (out):
1037 : : */
1038 : : gboolean
1039 : 1 : gi_marshalling_tests_ssize_out_uninitialized (gssize *v G_GNUC_UNUSED)
1040 : : {
1041 : 1 : return FALSE;
1042 : : }
1043 : :
1044 : : /**
1045 : : * gi_marshalling_tests_ssize_inout_max_min:
1046 : : * @ssize: (inout):
1047 : : */
1048 : : void
1049 : 0 : gi_marshalling_tests_ssize_inout_max_min (gssize *ssize)
1050 : : {
1051 : 0 : g_assert_cmpint (*ssize, ==, G_MAXSSIZE);
1052 : 0 : *ssize = G_MINSSIZE;
1053 : 0 : }
1054 : :
1055 : : /**
1056 : : * gi_marshalling_tests_ssize_inout_min_max:
1057 : : * @ssize: (inout):
1058 : : */
1059 : : void
1060 : 0 : gi_marshalling_tests_ssize_inout_min_max (gssize *ssize)
1061 : : {
1062 : 0 : g_assert_cmpint (*ssize, ==, G_MINSSIZE);
1063 : 0 : *ssize = G_MAXSSIZE;
1064 : 0 : }
1065 : :
1066 : : gsize
1067 : 1 : gi_marshalling_tests_size_return (void)
1068 : : {
1069 : 1 : return G_MAXSIZE;
1070 : : }
1071 : :
1072 : : void
1073 : 1 : gi_marshalling_tests_size_in (gsize size)
1074 : : {
1075 : 1 : g_assert_cmpuint (size, ==, G_MAXSIZE);
1076 : 1 : }
1077 : :
1078 : : /**
1079 : : * gi_marshalling_tests_size_out:
1080 : : * @size: (out):
1081 : : */
1082 : : void
1083 : 1 : gi_marshalling_tests_size_out (gsize *size)
1084 : : {
1085 : 1 : *size = G_MAXSIZE;
1086 : 1 : }
1087 : :
1088 : : /**
1089 : : * gi_marshalling_tests_size_out_uninitialized:
1090 : : * @v: (out):
1091 : : */
1092 : : gboolean
1093 : 1 : gi_marshalling_tests_size_out_uninitialized (gsize *v G_GNUC_UNUSED)
1094 : : {
1095 : 1 : return FALSE;
1096 : : }
1097 : :
1098 : : /**
1099 : : * gi_marshalling_tests_size_inout:
1100 : : * @size: (inout):
1101 : : */
1102 : : void
1103 : 0 : gi_marshalling_tests_size_inout (gsize *size)
1104 : : {
1105 : 0 : g_assert_cmpuint (*size, ==, G_MAXSIZE);
1106 : 0 : *size = 0;
1107 : 0 : }
1108 : :
1109 : : gfloat
1110 : 1 : gi_marshalling_tests_float_return (void)
1111 : : {
1112 : 1 : return G_MAXFLOAT;
1113 : : }
1114 : :
1115 : : void
1116 : 1 : gi_marshalling_tests_float_in (gfloat v)
1117 : : {
1118 : 1 : g_assert_cmpfloat (v, ==, G_MAXFLOAT);
1119 : 1 : }
1120 : :
1121 : : /**
1122 : : * gi_marshalling_tests_float_out:
1123 : : * @v: (out):
1124 : : */
1125 : : void
1126 : 1 : gi_marshalling_tests_float_out (gfloat *v)
1127 : : {
1128 : 1 : *v = G_MAXFLOAT;
1129 : 1 : }
1130 : :
1131 : : #define NONCANONICAL_NAN_BIT_PATTERN_32 0xfffb1236;
1132 : : #define NONCANONICAL_NAN_BIT_PATTERN_64 0xfffb1236fedcba98;
1133 : :
1134 : : static gfloat
1135 : 2 : noncanonical_nan_float (void)
1136 : : {
1137 : : gfloat retval;
1138 : :
1139 : : if (sizeof (gfloat) == sizeof (guint32))
1140 : : {
1141 : 2 : guint32 bit_pattern = NONCANONICAL_NAN_BIT_PATTERN_32;
1142 : 2 : memcpy (&retval, &bit_pattern, sizeof (gfloat));
1143 : : }
1144 : : else
1145 : : {
1146 : : g_assert (sizeof (gfloat) == sizeof (guint64) && "gfloat must be 32 or 64 bits");
1147 : : guint64 bit_pattern = NONCANONICAL_NAN_BIT_PATTERN_64;
1148 : : memcpy (&retval, &bit_pattern, sizeof (gfloat));
1149 : : }
1150 : :
1151 : 2 : return retval;
1152 : : }
1153 : :
1154 : : /**
1155 : : * gi_marshalling_tests_float_noncanonical_nan_out:
1156 : : * @v: (out):
1157 : : */
1158 : : void
1159 : 1 : gi_marshalling_tests_float_noncanonical_nan_out (gfloat *v)
1160 : : {
1161 : 1 : *v = noncanonical_nan_float ();
1162 : 1 : }
1163 : :
1164 : : /**
1165 : : * gi_marshalling_tests_float_out_uninitialized:
1166 : : * @v: (out):
1167 : : */
1168 : : gboolean
1169 : 1 : gi_marshalling_tests_float_out_uninitialized (gfloat *v G_GNUC_UNUSED)
1170 : : {
1171 : 1 : return FALSE;
1172 : : }
1173 : :
1174 : : /**
1175 : : * gi_marshalling_tests_float_inout:
1176 : : * @v: (inout):
1177 : : */
1178 : : void
1179 : 1 : gi_marshalling_tests_float_inout (gfloat *v)
1180 : : {
1181 : 1 : g_assert_cmpfloat (*v, ==, G_MAXFLOAT);
1182 : 1 : *v = G_MINFLOAT;
1183 : 1 : }
1184 : :
1185 : : gdouble
1186 : 1 : gi_marshalling_tests_double_return (void)
1187 : : {
1188 : 1 : return G_MAXDOUBLE;
1189 : : }
1190 : :
1191 : : void
1192 : 1 : gi_marshalling_tests_double_in (gdouble v)
1193 : : {
1194 : 1 : g_assert_cmpfloat (v, ==, G_MAXDOUBLE);
1195 : 1 : }
1196 : :
1197 : : /**
1198 : : * gi_marshalling_tests_double_out:
1199 : : * @v: (out):
1200 : : */
1201 : : void
1202 : 1 : gi_marshalling_tests_double_out (gdouble *v)
1203 : : {
1204 : 1 : *v = G_MAXDOUBLE;
1205 : 1 : }
1206 : :
1207 : : static gdouble
1208 : 2 : noncanonical_nan_double (void)
1209 : : {
1210 : : gdouble retval;
1211 : :
1212 : : g_assert (sizeof (gdouble) == sizeof (guint64) && "gdouble must be 64 bits");
1213 : :
1214 : 2 : guint64 bit_pattern = NONCANONICAL_NAN_BIT_PATTERN_64;
1215 : 2 : memcpy (&retval, &bit_pattern, sizeof (gdouble));
1216 : :
1217 : 2 : return retval;
1218 : : }
1219 : :
1220 : : /**
1221 : : * gi_marshalling_tests_double_noncanonical_nan_out:
1222 : : * @v: (out):
1223 : : */
1224 : : void
1225 : 1 : gi_marshalling_tests_double_noncanonical_nan_out (gdouble *v)
1226 : : {
1227 : 1 : *v = noncanonical_nan_double ();
1228 : 1 : }
1229 : :
1230 : : /**
1231 : : * gi_marshalling_tests_double_out_uninitialized:
1232 : : * @v: (out):
1233 : : */
1234 : : gboolean
1235 : 1 : gi_marshalling_tests_double_out_uninitialized (gdouble *v G_GNUC_UNUSED)
1236 : : {
1237 : 1 : return FALSE;
1238 : : }
1239 : :
1240 : : /**
1241 : : * gi_marshalling_tests_double_inout:
1242 : : * @v: (inout):
1243 : : */
1244 : : void
1245 : 1 : gi_marshalling_tests_double_inout (gdouble *v)
1246 : : {
1247 : 1 : g_assert_cmpfloat (*v, ==, G_MAXDOUBLE);
1248 : 1 : *v = G_MINDOUBLE;
1249 : 1 : }
1250 : :
1251 : : time_t
1252 : 1 : gi_marshalling_tests_time_t_return (void)
1253 : : {
1254 : 1 : return 1234567890;
1255 : : }
1256 : :
1257 : : void
1258 : 1 : gi_marshalling_tests_time_t_in (time_t v)
1259 : : {
1260 : 1 : g_assert_cmpuint (v, ==, 1234567890);
1261 : 1 : }
1262 : :
1263 : : /**
1264 : : * gi_marshalling_tests_time_t_out:
1265 : : * @v: (out):
1266 : : */
1267 : : void
1268 : 1 : gi_marshalling_tests_time_t_out (time_t *v)
1269 : : {
1270 : 1 : *v = 1234567890;
1271 : 1 : }
1272 : :
1273 : : /**
1274 : : * gi_marshalling_tests_time_t_out_uninitialized:
1275 : : * @v: (out):
1276 : : */
1277 : : gboolean
1278 : 1 : gi_marshalling_tests_time_t_out_uninitialized (time_t *v G_GNUC_UNUSED)
1279 : : {
1280 : 1 : return FALSE;
1281 : : }
1282 : :
1283 : : /**
1284 : : * gi_marshalling_tests_time_t_inout:
1285 : : * @v: (inout):
1286 : : */
1287 : : void
1288 : 1 : gi_marshalling_tests_time_t_inout (time_t *v)
1289 : : {
1290 : 1 : g_assert_cmpuint (*v, ==, 1234567890);
1291 : 1 : *v = 0;
1292 : 1 : }
1293 : :
1294 : : off_t
1295 : 1 : gi_marshalling_tests_off_t_return (void)
1296 : : {
1297 : 1 : return 1234567890;
1298 : : }
1299 : :
1300 : : void
1301 : 1 : gi_marshalling_tests_off_t_in (off_t v)
1302 : : {
1303 : 1 : g_assert_cmpuint (v, ==, 1234567890);
1304 : 1 : }
1305 : :
1306 : : /**
1307 : : * gi_marshalling_tests_off_t_out:
1308 : : * @v: (out):
1309 : : */
1310 : : void
1311 : 1 : gi_marshalling_tests_off_t_out (off_t *v)
1312 : : {
1313 : 1 : *v = 1234567890;
1314 : 1 : }
1315 : :
1316 : : /**
1317 : : * gi_marshalling_tests_off_t_out_uninitialized:
1318 : : * @v: (out):
1319 : : */
1320 : : gboolean
1321 : 1 : gi_marshalling_tests_off_t_out_uninitialized (off_t *v G_GNUC_UNUSED)
1322 : : {
1323 : 1 : return FALSE;
1324 : : }
1325 : :
1326 : : /**
1327 : : * gi_marshalling_tests_off_t_inout:
1328 : : * @v: (inout):
1329 : : */
1330 : : void
1331 : 1 : gi_marshalling_tests_off_t_inout (off_t *v)
1332 : : {
1333 : 1 : g_assert_cmpuint (*v, ==, 1234567890);
1334 : 1 : *v = 0;
1335 : 1 : }
1336 : :
1337 : : #ifdef G_OS_UNIX
1338 : :
1339 : : dev_t
1340 : 1 : gi_marshalling_tests_dev_t_return (void)
1341 : : {
1342 : 1 : return 1234567890;
1343 : : }
1344 : :
1345 : : void
1346 : 1 : gi_marshalling_tests_dev_t_in (dev_t v)
1347 : : {
1348 : 1 : g_assert_cmpuint (v, ==, 1234567890);
1349 : 1 : }
1350 : :
1351 : : /**
1352 : : * gi_marshalling_tests_dev_t_out:
1353 : : * @v: (out):
1354 : : */
1355 : : void
1356 : 1 : gi_marshalling_tests_dev_t_out (dev_t *v)
1357 : : {
1358 : 1 : *v = 1234567890;
1359 : 1 : }
1360 : :
1361 : : /**
1362 : : * gi_marshalling_tests_dev_t_out_uninitialized:
1363 : : * @v: (out):
1364 : : */
1365 : : gboolean
1366 : 1 : gi_marshalling_tests_dev_t_out_uninitialized (dev_t *v G_GNUC_UNUSED)
1367 : : {
1368 : 1 : return FALSE;
1369 : : }
1370 : :
1371 : : /**
1372 : : * gi_marshalling_tests_dev_t_inout:
1373 : : * @v: (inout):
1374 : : */
1375 : : void
1376 : 0 : gi_marshalling_tests_dev_t_inout (dev_t *v)
1377 : : {
1378 : 0 : g_assert_cmpuint (*v, ==, 1234567890);
1379 : 0 : *v = 0;
1380 : 0 : }
1381 : :
1382 : : gid_t
1383 : 1 : gi_marshalling_tests_gid_t_return (void)
1384 : : {
1385 : 1 : return 65534;
1386 : : }
1387 : :
1388 : : void
1389 : 1 : gi_marshalling_tests_gid_t_in (gid_t v)
1390 : : {
1391 : 1 : g_assert_cmpuint (v, ==, 65534);
1392 : 1 : }
1393 : :
1394 : : /**
1395 : : * gi_marshalling_tests_gid_t_out:
1396 : : * @v: (out):
1397 : : */
1398 : : void
1399 : 1 : gi_marshalling_tests_gid_t_out (gid_t *v)
1400 : : {
1401 : 1 : *v = 65534;
1402 : 1 : }
1403 : :
1404 : : /**
1405 : : * gi_marshalling_tests_gid_t_out_uninitialized:
1406 : : * @v: (out):
1407 : : */
1408 : : gboolean
1409 : 1 : gi_marshalling_tests_gid_t_out_uninitialized (gid_t *v G_GNUC_UNUSED)
1410 : : {
1411 : 1 : return FALSE;
1412 : : }
1413 : :
1414 : : /**
1415 : : * gi_marshalling_tests_gid_t_inout:
1416 : : * @v: (inout):
1417 : : */
1418 : : void
1419 : 1 : gi_marshalling_tests_gid_t_inout (gid_t *v)
1420 : : {
1421 : 1 : g_assert_cmpuint (*v, ==, 65534);
1422 : 1 : *v = 0;
1423 : 1 : }
1424 : :
1425 : : pid_t
1426 : 1 : gi_marshalling_tests_pid_t_return (void)
1427 : : {
1428 : 1 : return 12345;
1429 : : }
1430 : :
1431 : : void
1432 : 1 : gi_marshalling_tests_pid_t_in (pid_t v)
1433 : : {
1434 : 1 : g_assert_cmpuint (v, ==, 12345);
1435 : 1 : }
1436 : :
1437 : : /**
1438 : : * gi_marshalling_tests_pid_t_out:
1439 : : * @v: (out):
1440 : : */
1441 : : void
1442 : 1 : gi_marshalling_tests_pid_t_out (pid_t *v)
1443 : : {
1444 : 1 : *v = 12345;
1445 : 1 : }
1446 : :
1447 : : /**
1448 : : * gi_marshalling_tests_pid_t_out_uninitialized:
1449 : : * @v: (out):
1450 : : */
1451 : : gboolean
1452 : 1 : gi_marshalling_tests_pid_t_out_uninitialized (pid_t *v G_GNUC_UNUSED)
1453 : : {
1454 : 1 : return FALSE;
1455 : : }
1456 : :
1457 : : /**
1458 : : * gi_marshalling_tests_pid_t_inout:
1459 : : * @v: (inout):
1460 : : */
1461 : : void
1462 : 1 : gi_marshalling_tests_pid_t_inout (pid_t *v)
1463 : : {
1464 : 1 : g_assert_cmpuint (*v, ==, 12345);
1465 : 1 : *v = 0;
1466 : 1 : }
1467 : :
1468 : : socklen_t
1469 : 1 : gi_marshalling_tests_socklen_t_return (void)
1470 : : {
1471 : 1 : return 123;
1472 : : }
1473 : :
1474 : : void
1475 : 1 : gi_marshalling_tests_socklen_t_in (socklen_t v)
1476 : : {
1477 : 1 : g_assert_cmpuint (v, ==, 123);
1478 : 1 : }
1479 : :
1480 : : /**
1481 : : * gi_marshalling_tests_socklen_t_out:
1482 : : * @v: (out):
1483 : : */
1484 : : void
1485 : 1 : gi_marshalling_tests_socklen_t_out (socklen_t *v)
1486 : : {
1487 : 1 : *v = 123;
1488 : 1 : }
1489 : :
1490 : : /**
1491 : : * gi_marshalling_tests_socklen_t_out_uninitialized:
1492 : : * @v: (out):
1493 : : */
1494 : : gboolean
1495 : 1 : gi_marshalling_tests_socklen_t_out_uninitialized (socklen_t *v G_GNUC_UNUSED)
1496 : : {
1497 : 1 : return FALSE;
1498 : : }
1499 : :
1500 : : /**
1501 : : * gi_marshalling_tests_socklen_t_inout:
1502 : : * @v: (inout):
1503 : : */
1504 : : void
1505 : 1 : gi_marshalling_tests_socklen_t_inout (socklen_t *v)
1506 : : {
1507 : 1 : g_assert_cmpuint (*v, ==, 123);
1508 : 1 : *v = 0;
1509 : 1 : }
1510 : :
1511 : : uid_t
1512 : 1 : gi_marshalling_tests_uid_t_return (void)
1513 : : {
1514 : 1 : return 65534;
1515 : : }
1516 : :
1517 : : void
1518 : 1 : gi_marshalling_tests_uid_t_in (uid_t v)
1519 : : {
1520 : 1 : g_assert_cmpuint (v, ==, 65534);
1521 : 1 : }
1522 : :
1523 : : /**
1524 : : * gi_marshalling_tests_uid_t_out:
1525 : : * @v: (out):
1526 : : */
1527 : : void
1528 : 1 : gi_marshalling_tests_uid_t_out (uid_t *v)
1529 : : {
1530 : 1 : *v = 65534;
1531 : 1 : }
1532 : :
1533 : : /**
1534 : : * gi_marshalling_tests_uid_t_out_uninitialized:
1535 : : * @v: (out):
1536 : : */
1537 : : gboolean
1538 : 1 : gi_marshalling_tests_uid_t_out_uninitialized (uid_t *v G_GNUC_UNUSED)
1539 : : {
1540 : 1 : return FALSE;
1541 : : }
1542 : :
1543 : : /**
1544 : : * gi_marshalling_tests_uid_t_inout:
1545 : : * @v: (inout):
1546 : : */
1547 : : void
1548 : 1 : gi_marshalling_tests_uid_t_inout (uid_t *v)
1549 : : {
1550 : 1 : g_assert_cmpuint (*v, ==, 65534);
1551 : 1 : *v = 0;
1552 : 1 : }
1553 : :
1554 : : #endif /* G_OS_UNIX */
1555 : :
1556 : : GType
1557 : 1 : gi_marshalling_tests_gtype_return (void)
1558 : : {
1559 : 1 : return G_TYPE_NONE;
1560 : : }
1561 : :
1562 : : GType
1563 : 1 : gi_marshalling_tests_gtype_string_return (void)
1564 : : {
1565 : 1 : return G_TYPE_STRING;
1566 : : }
1567 : :
1568 : : void
1569 : 2 : gi_marshalling_tests_gtype_in (GType gtype)
1570 : : {
1571 : 2 : g_assert (gtype == G_TYPE_NONE);
1572 : 2 : }
1573 : :
1574 : : void
1575 : 2 : gi_marshalling_tests_gtype_string_in (GType gtype)
1576 : : {
1577 : 2 : g_assert (gtype == G_TYPE_STRING);
1578 : 2 : }
1579 : :
1580 : : /**
1581 : : * gi_marshalling_tests_gtype_out:
1582 : : * @gtype: (out):
1583 : : */
1584 : : void
1585 : 1 : gi_marshalling_tests_gtype_out (GType *gtype)
1586 : : {
1587 : 1 : *gtype = G_TYPE_NONE;
1588 : 1 : }
1589 : :
1590 : : /**
1591 : : * gi_marshalling_tests_gtype_out_uninitialized:
1592 : : * @v: (out):
1593 : : */
1594 : : gboolean
1595 : 1 : gi_marshalling_tests_gtype_out_uninitialized (GType *v G_GNUC_UNUSED)
1596 : : {
1597 : 1 : return FALSE;
1598 : : }
1599 : :
1600 : : /**
1601 : : * gi_marshalling_tests_gtype_string_out:
1602 : : * @gtype: (out):
1603 : : */
1604 : : void
1605 : 1 : gi_marshalling_tests_gtype_string_out (GType *gtype)
1606 : : {
1607 : 1 : *gtype = G_TYPE_STRING;
1608 : 1 : }
1609 : :
1610 : : /**
1611 : : * gi_marshalling_tests_gtype_inout:
1612 : : * @gtype: (inout):
1613 : : */
1614 : : void
1615 : 1 : gi_marshalling_tests_gtype_inout (GType *gtype)
1616 : : {
1617 : 1 : g_assert (*gtype == G_TYPE_NONE);
1618 : 1 : *gtype = G_TYPE_INT;
1619 : 1 : }
1620 : :
1621 : : const gchar *
1622 : 1 : gi_marshalling_tests_utf8_none_return (void)
1623 : : {
1624 : 1 : return GI_MARSHALLING_TESTS_CONSTANT_UTF8;
1625 : : }
1626 : :
1627 : : gchar *
1628 : 1 : gi_marshalling_tests_utf8_full_return (void)
1629 : : {
1630 : 1 : return g_strdup (GI_MARSHALLING_TESTS_CONSTANT_UTF8);
1631 : : }
1632 : :
1633 : : void
1634 : 1 : gi_marshalling_tests_utf8_none_in (const gchar *utf8)
1635 : : {
1636 : 1 : g_assert_cmpstr (GI_MARSHALLING_TESTS_CONSTANT_UTF8, ==, utf8);
1637 : 1 : }
1638 : :
1639 : : /**
1640 : : * gi_marshalling_tests_utf8_full_in:
1641 : : * @utf8: (transfer full):
1642 : : */
1643 : : void
1644 : 1 : gi_marshalling_tests_utf8_full_in (gchar *utf8)
1645 : : {
1646 : 1 : g_assert_cmpstr (GI_MARSHALLING_TESTS_CONSTANT_UTF8, ==, utf8);
1647 : 1 : g_free (utf8);
1648 : 1 : }
1649 : :
1650 : : /**
1651 : : * gi_marshalling_tests_utf8_as_uint8array_in:
1652 : : * @array: (array length=len) (element-type guint8): Byte data that happens to be UTF-8
1653 : : * @len: Length
1654 : : *
1655 : : * Takes data that happens to be UTF-8 as a byte array, to test
1656 : : * binding conversion from their string type (e.g. JavaScript's
1657 : : * UTF-16) to UTF-8.
1658 : : */
1659 : : void
1660 : 2 : gi_marshalling_tests_utf8_as_uint8array_in (const guint8 *array, gsize len)
1661 : : {
1662 : 2 : gsize orig_len = strlen (GI_MARSHALLING_TESTS_CONSTANT_UTF8);
1663 : 2 : g_assert_cmpint (orig_len, ==, len);
1664 : 2 : g_assert (memcmp (GI_MARSHALLING_TESTS_CONSTANT_UTF8, array, len) == 0);
1665 : 2 : }
1666 : :
1667 : : /**
1668 : : * gi_marshalling_tests_utf8_none_out:
1669 : : * @utf8: (out) (transfer none):
1670 : : */
1671 : : void
1672 : 1 : gi_marshalling_tests_utf8_none_out (const gchar **utf8)
1673 : : {
1674 : 1 : *utf8 = GI_MARSHALLING_TESTS_CONSTANT_UTF8;
1675 : 1 : }
1676 : :
1677 : : /**
1678 : : * gi_marshalling_tests_utf8_none_out_uninitialized:
1679 : : * @v: (out) (transfer none):
1680 : : */
1681 : : gboolean
1682 : 1 : gi_marshalling_tests_utf8_none_out_uninitialized (const gchar **v G_GNUC_UNUSED)
1683 : : {
1684 : 1 : return FALSE;
1685 : : }
1686 : :
1687 : : /**
1688 : : * gi_marshalling_tests_utf8_full_out:
1689 : : * @utf8: (out) (transfer full):
1690 : : */
1691 : : void
1692 : 1 : gi_marshalling_tests_utf8_full_out (gchar **utf8)
1693 : : {
1694 : 1 : *utf8 = g_strdup (GI_MARSHALLING_TESTS_CONSTANT_UTF8);
1695 : 1 : }
1696 : :
1697 : : /**
1698 : : * gi_marshalling_tests_utf8_dangling_out:
1699 : : * @utf8: (out) (transfer full):
1700 : : */
1701 : : void
1702 : 1 : gi_marshalling_tests_utf8_dangling_out (gchar **utf8 G_GNUC_UNUSED)
1703 : : {
1704 : : /* Intentionally don't touch the pointer to see how
1705 : : the bindings handle this case. Bindings should be
1706 : : robust against broken C functions and can initialize
1707 : : even OUT vlues to NULL.
1708 : : */
1709 : 1 : }
1710 : :
1711 : : /**
1712 : : * gi_marshalling_tests_utf8_none_inout:
1713 : : * @utf8: (inout) (transfer none):
1714 : : */
1715 : : void
1716 : 1 : gi_marshalling_tests_utf8_none_inout (const gchar **utf8)
1717 : : {
1718 : 1 : g_assert_cmpstr (GI_MARSHALLING_TESTS_CONSTANT_UTF8, ==, *utf8);
1719 : 1 : *utf8 = "";
1720 : 1 : }
1721 : :
1722 : : /**
1723 : : * gi_marshalling_tests_utf8_full_inout:
1724 : : * @utf8: (inout) (transfer full):
1725 : : */
1726 : : void
1727 : 0 : gi_marshalling_tests_utf8_full_inout (gchar **utf8)
1728 : : {
1729 : 0 : g_assert_cmpstr (GI_MARSHALLING_TESTS_CONSTANT_UTF8, ==, *utf8);
1730 : 0 : g_free (*utf8);
1731 : 0 : *utf8 = g_strdup ("");
1732 : 0 : }
1733 : :
1734 : : /**
1735 : : * gi_marshalling_tests_init_function:
1736 : : * @n_args: (inout) (allow-none): number of args
1737 : : * @argv: (inout) (array length=n_args) (allow-none): args
1738 : : *
1739 : : * This is like gtk_init().
1740 : : */
1741 : : gboolean
1742 : 3 : gi_marshalling_tests_init_function (gint *n_args, char ***argv)
1743 : : {
1744 [ + + ]: 3 : if (n_args == NULL)
1745 : 1 : return TRUE;
1746 : :
1747 [ + + ]: 2 : if (*n_args == 0)
1748 : 1 : return TRUE;
1749 : 1 : (*n_args)--;
1750 : 1 : g_assert (argv != NULL);
1751 : : /* we have transfer ownership full, so we need to free the element ourself */
1752 : 1 : g_free ((*argv)[*n_args]);
1753 : 1 : (*argv)[*n_args] = NULL;
1754 : 1 : return TRUE;
1755 : : }
1756 : :
1757 : : /**
1758 : : * gi_marshalling_tests_array_fixed_int_return:
1759 : : *
1760 : : * Returns: (array fixed-size=4):
1761 : : */
1762 : : const gint *
1763 : 1 : gi_marshalling_tests_array_fixed_int_return (void)
1764 : : {
1765 : : static gint ints[] = { -1, 0, 1, 2 };
1766 : 1 : return ints;
1767 : : }
1768 : :
1769 : : /**
1770 : : * gi_marshalling_tests_array_fixed_short_return:
1771 : : *
1772 : : * Returns: (array fixed-size=4):
1773 : : */
1774 : : const gshort *
1775 : 1 : gi_marshalling_tests_array_fixed_short_return (void)
1776 : : {
1777 : : static gshort shorts[] = { -1, 0, 1, 2 };
1778 : 1 : return shorts;
1779 : : }
1780 : :
1781 : : /**
1782 : : * gi_marshalling_tests_array_fixed_return_unaligned:
1783 : : *
1784 : : * Note that the buffer will leak unless you call
1785 : : * gi_marshalling_tests_cleanup_unaligned_buffer().
1786 : : *
1787 : : * Returns: (array fixed-size=32) (transfer none):
1788 : : */
1789 : : const guint8 *
1790 : 1 : gi_marshalling_tests_array_fixed_return_unaligned (void)
1791 : : {
1792 : 1 : return init_unaligned_buffer ();
1793 : : }
1794 : :
1795 : : /**
1796 : : * gi_marshalling_tests_array_fixed_int_in:
1797 : : * @ints: (array fixed-size=4):
1798 : : */
1799 : : void
1800 : 1 : gi_marshalling_tests_array_fixed_int_in (const gint *ints)
1801 : : {
1802 : 1 : g_assert_cmpint (ints[0], ==, -1);
1803 : 1 : g_assert_cmpint (ints[1], ==, 0);
1804 : 1 : g_assert_cmpint (ints[2], ==, 1);
1805 : 1 : g_assert_cmpint (ints[3], ==, 2);
1806 : 1 : }
1807 : :
1808 : : /**
1809 : : * gi_marshalling_tests_array_fixed_caller_allocated_out:
1810 : : * @ints: (out caller-allocates) (array fixed-size=4):
1811 : : */
1812 : : void
1813 : 1 : gi_marshalling_tests_array_fixed_caller_allocated_out (gint *ints)
1814 : : {
1815 : 1 : ints[0] = -1;
1816 : 1 : ints[1] = 0;
1817 : 1 : ints[2] = 1;
1818 : 1 : ints[3] = 2;
1819 : 1 : }
1820 : :
1821 : : /**
1822 : : * gi_marshalling_tests_array_fixed_short_in:
1823 : : * @shorts: (array fixed-size=4):
1824 : : */
1825 : : void
1826 : 1 : gi_marshalling_tests_array_fixed_short_in (const gshort *shorts)
1827 : : {
1828 : 1 : g_assert_cmpint (shorts[0], ==, -1);
1829 : 1 : g_assert_cmpint (shorts[1], ==, 0);
1830 : 1 : g_assert_cmpint (shorts[2], ==, 1);
1831 : 1 : g_assert_cmpint (shorts[3], ==, 2);
1832 : 1 : }
1833 : :
1834 : : /**
1835 : : * gi_marshalling_tests_array_fixed_out:
1836 : : * @ints: (out) (array fixed-size=4) (transfer none):
1837 : : */
1838 : : void
1839 : 1 : gi_marshalling_tests_array_fixed_out (gint **ints)
1840 : : {
1841 : : static gint values[] = { -1, 0, 1, 2 };
1842 : 1 : *ints = values;
1843 : 1 : }
1844 : :
1845 : : /**
1846 : : * gi_marshalling_tests_array_fixed_out_uninitialized:
1847 : : * @v: (out) (array fixed-size=4) (transfer none):
1848 : : */
1849 : : gboolean
1850 : 1 : gi_marshalling_tests_array_fixed_out_uninitialized (gint **v G_GNUC_UNUSED)
1851 : : {
1852 : 1 : return FALSE;
1853 : : }
1854 : :
1855 : : /**
1856 : : * gi_marshalling_tests_array_fixed_out_unaligned:
1857 : : * @v: (out) (array fixed-size=32) (transfer none):
1858 : : *
1859 : : * Note that the buffer will leak unless you call
1860 : : * gi_marshalling_tests_cleanup_unaligned_buffer().
1861 : : */
1862 : : void
1863 : 1 : gi_marshalling_tests_array_fixed_out_unaligned (const guint8 **v)
1864 : : {
1865 : 1 : *v = init_unaligned_buffer ();
1866 : 1 : }
1867 : :
1868 : : /**
1869 : : * gi_marshalling_tests_array_fixed_out_struct:
1870 : : * @structs: (out) (array fixed-size=2) (transfer none):
1871 : : */
1872 : : void
1873 : 1 : gi_marshalling_tests_array_fixed_out_struct (GIMarshallingTestsSimpleStruct **structs)
1874 : : {
1875 : : static GIMarshallingTestsSimpleStruct *values;
1876 : :
1877 [ + - ]: 1 : if (values == NULL)
1878 : : {
1879 : 1 : values = g_new (GIMarshallingTestsSimpleStruct, 2);
1880 : :
1881 : 1 : values[0].long_ = 7;
1882 : 1 : values[0].int8 = 6;
1883 : :
1884 : 1 : values[1].long_ = 6;
1885 : 1 : values[1].int8 = 7;
1886 : : }
1887 : :
1888 : 1 : *structs = values;
1889 : 1 : }
1890 : :
1891 : : /**
1892 : : * gi_marshalling_tests_array_fixed_out_struct_uninitialized:
1893 : : * @v: (out):
1894 : : */
1895 : : gboolean
1896 : 1 : gi_marshalling_tests_array_fixed_out_struct_uninitialized (GIMarshallingTestsSimpleStruct **v G_GNUC_UNUSED)
1897 : : {
1898 : 1 : return FALSE;
1899 : : }
1900 : :
1901 : : /**
1902 : : * gi_marshalling_tests_array_fixed_caller_allocated_struct_out:
1903 : : * @structs: (out caller-allocates) (array fixed-size=4):
1904 : : */
1905 : : void
1906 : 1 : gi_marshalling_tests_array_fixed_caller_allocated_struct_out (GIMarshallingTestsSimpleStruct *structs)
1907 : : {
1908 : 1 : structs[0].long_ = -2;
1909 : 1 : structs[0].int8 = -1;
1910 : 1 : structs[1].long_ = 1;
1911 : 1 : structs[1].int8 = 2;
1912 : 1 : structs[2].long_ = 3;
1913 : 1 : structs[2].int8 = 4;
1914 : 1 : structs[3].long_ = 5;
1915 : 1 : structs[3].int8 = 6;
1916 : 1 : }
1917 : :
1918 : : /**
1919 : : * gi_marshalling_tests_array_fixed_inout:
1920 : : * @ints: (inout) (array fixed-size=4) (transfer none):
1921 : : */
1922 : : void
1923 : 1 : gi_marshalling_tests_array_fixed_inout (gint **ints)
1924 : : {
1925 : : static gint values[] = { 2, 1, 0, -1 };
1926 : :
1927 : 1 : g_assert_cmpint ((*ints)[0], ==, -1);
1928 : 1 : g_assert_cmpint ((*ints)[1], ==, 0);
1929 : 1 : g_assert_cmpint ((*ints)[2], ==, 1);
1930 : 1 : g_assert_cmpint ((*ints)[3], ==, 2);
1931 : :
1932 : 1 : *ints = values;
1933 : 1 : }
1934 : :
1935 : : /**
1936 : : * gi_marshalling_tests_array_return:
1937 : : *
1938 : : * Returns: (array length=length):
1939 : : */
1940 : : const gint *
1941 : 1 : gi_marshalling_tests_array_return (gint *length)
1942 : : {
1943 : : static gint ints[] = { -1, 0, 1, 2 };
1944 : :
1945 : 1 : *length = 4;
1946 : 1 : return ints;
1947 : : }
1948 : :
1949 : : /**
1950 : : * gi_marshalling_tests_array_return_etc:
1951 : : * @first:
1952 : : * @length: (out):
1953 : : * @last:
1954 : : * @sum: (out):
1955 : : *
1956 : : * Returns: (array length=length):
1957 : : */
1958 : : const gint *
1959 : 1 : gi_marshalling_tests_array_return_etc (gint first, gint *length, gint last, gint *sum)
1960 : : {
1961 : : static gint ints[] = { -1, 0, 1, 2 };
1962 : :
1963 : 1 : ints[0] = first;
1964 : 1 : ints[3] = last;
1965 : 1 : *sum = first + last;
1966 : 1 : *length = 4;
1967 : 1 : return ints;
1968 : : }
1969 : :
1970 : : /**
1971 : : * gi_marshalling_tests_array_return_unaligned:
1972 : : * @len: (out):
1973 : : *
1974 : : * Note that the buffer will leak unless you call
1975 : : * gi_marshalling_tests_cleanup_unaligned_buffer().
1976 : : *
1977 : : * Returns: (array length=len):
1978 : : */
1979 : : const guint8 *
1980 : 1 : gi_marshalling_tests_array_return_unaligned (gsize *len)
1981 : : {
1982 : 1 : *len = UNALIGNED_BUFFER_SIZE - 1;
1983 : 1 : return init_unaligned_buffer ();
1984 : : }
1985 : :
1986 : : /**
1987 : : * gi_marshalling_tests_array_in:
1988 : : * @ints: (array length=length):
1989 : : * @length:
1990 : : */
1991 : : void
1992 : 4 : gi_marshalling_tests_array_in (const gint *ints, gint length)
1993 : : {
1994 : 4 : g_assert_cmpint (length, ==, 4);
1995 : 4 : g_assert_cmpint (ints[0], ==, -1);
1996 : 4 : g_assert_cmpint (ints[1], ==, 0);
1997 : 4 : g_assert_cmpint (ints[2], ==, 1);
1998 : 4 : g_assert_cmpint (ints[3], ==, 2);
1999 : 4 : }
2000 : :
2001 : : /**
2002 : : * gi_marshalling_tests_array_in_len_before:
2003 : : * @length:
2004 : : * @ints: (array length=length):
2005 : : */
2006 : : void
2007 : 1 : gi_marshalling_tests_array_in_len_before (gint length, const gint *ints)
2008 : : {
2009 : 1 : gi_marshalling_tests_array_in (ints, length);
2010 : 1 : }
2011 : :
2012 : : /**
2013 : : * gi_marshalling_tests_array_in_len_zero_terminated:
2014 : : * @ints: (array length=length zero-terminated):
2015 : : * @length:
2016 : : */
2017 : : void
2018 : 1 : gi_marshalling_tests_array_in_len_zero_terminated (const gint *ints, gint length)
2019 : : {
2020 : 1 : g_assert_cmpint (length, ==, 4);
2021 : :
2022 : 1 : g_assert_cmpint (ints[0], ==, -1);
2023 : 1 : g_assert_cmpint (ints[1], ==, 0);
2024 : 1 : g_assert_cmpint (ints[2], ==, 1);
2025 : 1 : g_assert_cmpint (ints[3], ==, 2);
2026 : :
2027 : : /* One past the end, null terminator */
2028 : 1 : g_assert_cmpint (ints[4], ==, 0);
2029 : 1 : }
2030 : :
2031 : : /**
2032 : : * gi_marshalling_tests_array_string_in:
2033 : : * @strings: (array length=length):
2034 : : */
2035 : : void
2036 : 1 : gi_marshalling_tests_array_string_in (const gchar **strings, gint length)
2037 : : {
2038 : 1 : g_assert_cmpint (length, ==, 2);
2039 : 1 : g_assert_cmpstr (strings[0], ==, "foo");
2040 : 1 : g_assert_cmpstr (strings[1], ==, "bar");
2041 : 1 : }
2042 : :
2043 : : /**
2044 : : * gi_marshalling_tests_array_uint8_in:
2045 : : * @chars: (array length=length):
2046 : : */
2047 : : void
2048 : 4 : gi_marshalling_tests_array_uint8_in (const guint8 *chars, gint length)
2049 : : {
2050 : 4 : g_assert_cmpint (length, ==, 4);
2051 : 4 : g_assert (chars[0] == 'a');
2052 : 4 : g_assert (chars[1] == 'b');
2053 : 4 : g_assert (chars[2] == 'c');
2054 : 4 : g_assert (chars[3] == 'd');
2055 : 4 : }
2056 : :
2057 : : /**
2058 : : * gi_marshalling_tests_array_int64_in:
2059 : : * @ints: (array length=length):
2060 : : * @length:
2061 : : */
2062 : : void
2063 : 1 : gi_marshalling_tests_array_int64_in (const gint64 *ints, gint length)
2064 : : {
2065 : 1 : g_assert_cmpint (length, ==, 4);
2066 : 1 : g_assert_cmpint (ints[0], ==, -1);
2067 : 1 : g_assert_cmpint (ints[1], ==, 0);
2068 : 1 : g_assert_cmpint (ints[2], ==, 1);
2069 : 1 : g_assert_cmpint (ints[3], ==, 2);
2070 : 1 : }
2071 : :
2072 : : /**
2073 : : * gi_marshalling_tests_array_uint64_in:
2074 : : * @ints: (array length=length):
2075 : : * @length:
2076 : : */
2077 : : void
2078 : 1 : gi_marshalling_tests_array_uint64_in (const guint64 *ints, gint length)
2079 : : {
2080 : 1 : g_assert_cmpint (length, ==, 4);
2081 : 1 : g_assert_cmpint (ints[0], ==, -1);
2082 : 1 : g_assert_cmpint (ints[1], ==, 0);
2083 : 1 : g_assert_cmpint (ints[2], ==, 1);
2084 : 1 : g_assert_cmpint (ints[3], ==, 2);
2085 : 1 : }
2086 : :
2087 : : /**
2088 : : * gi_marshalling_tests_array_unichar_in:
2089 : : * @chars: (array length=length):
2090 : : * @length:
2091 : : */
2092 : : void
2093 : 2 : gi_marshalling_tests_array_unichar_in (const gunichar *chars, gint length)
2094 : : {
2095 : : int ix;
2096 : : static const gunichar expected[] = GI_MARSHALLING_TESTS_CONSTANT_UCS4;
2097 : 2 : g_assert_cmpint (length, ==, 12);
2098 [ + + ]: 26 : for (ix = 0; ix < length; ix++)
2099 : 24 : g_assert_cmpuint (chars[ix], ==, expected[ix]);
2100 : 2 : }
2101 : :
2102 : : /**
2103 : : * gi_marshalling_tests_array_bool_in:
2104 : : * @bools: (array length=length):
2105 : : * @length:
2106 : : */
2107 : : void
2108 : 2 : gi_marshalling_tests_array_bool_in (const gboolean *bools, gint length)
2109 : : {
2110 : 2 : g_assert_cmpint (length, ==, 4);
2111 : 2 : g_assert_cmpint (bools[0], ==, TRUE);
2112 : 2 : g_assert_cmpint (bools[1], ==, FALSE);
2113 : 2 : g_assert_cmpint (bools[2], ==, TRUE);
2114 : 2 : g_assert_cmpint (bools[3], ==, TRUE);
2115 : 2 : }
2116 : :
2117 : : /**
2118 : : * gi_marshalling_tests_array_struct_in:
2119 : : * @structs: (array length=length):
2120 : : */
2121 : : void
2122 : 3 : gi_marshalling_tests_array_struct_in (GIMarshallingTestsBoxedStruct **structs, gint length)
2123 : : {
2124 : 3 : g_assert_cmpint (length, ==, 3);
2125 : 3 : g_assert_cmpint (structs[0]->long_, ==, 1);
2126 : 3 : g_assert_cmpint (structs[1]->long_, ==, 2);
2127 : 3 : g_assert_cmpint (structs[2]->long_, ==, 3);
2128 : 3 : }
2129 : :
2130 : : /**
2131 : : * gi_marshalling_tests_array_struct_value_in:
2132 : : * @structs: (array length=length):
2133 : : */
2134 : : void
2135 : 0 : gi_marshalling_tests_array_struct_value_in (GIMarshallingTestsBoxedStruct *structs, gint length)
2136 : : {
2137 : 0 : g_assert_cmpint (length, ==, 3);
2138 : 0 : g_assert_cmpint (structs[0].long_, ==, 1);
2139 : 0 : g_assert_cmpint (structs[1].long_, ==, 2);
2140 : 0 : g_assert_cmpint (structs[2].long_, ==, 3);
2141 : 0 : }
2142 : :
2143 : : /**
2144 : : * gi_marshalling_tests_array_simple_struct_in:
2145 : : * @structs: (array length=length):
2146 : : */
2147 : : void
2148 : 0 : gi_marshalling_tests_array_simple_struct_in (GIMarshallingTestsSimpleStruct *structs, gint length)
2149 : : {
2150 : 0 : g_assert_cmpint (length, ==, 3);
2151 : 0 : g_assert_cmpint (structs[0].long_, ==, 1);
2152 : 0 : g_assert_cmpint (structs[1].long_, ==, 2);
2153 : 0 : g_assert_cmpint (structs[2].long_, ==, 3);
2154 : 0 : }
2155 : :
2156 : : /**
2157 : : * gi_marshalling_tests_multi_array_key_value_in:
2158 : : * @keys: (array length=length):
2159 : : * @values: (array length=length):
2160 : : */
2161 : : void
2162 : 1 : gi_marshalling_tests_multi_array_key_value_in (gint length, const gchar **keys, const GValue *values)
2163 : : {
2164 : 1 : g_assert_cmpint (length, ==, 3);
2165 : 1 : g_assert_cmpstr ("one", ==, keys[0]);
2166 : 1 : g_assert_cmpint (g_value_get_int (&values[0]), ==, 1);
2167 : 1 : g_assert_cmpstr ("two", ==, keys[1]);
2168 : 1 : g_assert_cmpint (g_value_get_int (&values[1]), ==, 2);
2169 : 1 : g_assert_cmpstr ("three", ==, keys[2]);
2170 : 1 : g_assert_cmpint (g_value_get_int (&values[2]), ==, 3);
2171 : 1 : }
2172 : :
2173 : : /**
2174 : : * gi_marshalling_tests_array_struct_take_in:
2175 : : * @structs: (array length=length) (transfer full):
2176 : : */
2177 : : void
2178 : 2 : gi_marshalling_tests_array_struct_take_in (GIMarshallingTestsBoxedStruct **structs, gint length)
2179 : : {
2180 : 2 : gi_marshalling_tests_array_struct_in (structs, length);
2181 : :
2182 : : /* only really useful if run in valgrind actually */
2183 : 2 : gi_marshalling_tests_boxed_struct_free (structs[0]);
2184 : 2 : gi_marshalling_tests_boxed_struct_free (structs[1]);
2185 : 2 : gi_marshalling_tests_boxed_struct_free (structs[2]);
2186 : 2 : g_free (structs);
2187 : 2 : }
2188 : :
2189 : : /**
2190 : : * gi_marshalling_tests_array_enum_in:
2191 : : * @_enum: (array length=length) (transfer none):
2192 : : * @length:
2193 : : */
2194 : : void
2195 : 1 : gi_marshalling_tests_array_enum_in (GIMarshallingTestsEnum *v, gint length)
2196 : : {
2197 : 1 : g_assert_cmpint (length, ==, 3);
2198 : 1 : g_assert_cmpint (v[0], ==, GI_MARSHALLING_TESTS_ENUM_VALUE1);
2199 : 1 : g_assert_cmpint (v[1], ==, GI_MARSHALLING_TESTS_ENUM_VALUE2);
2200 : 1 : g_assert_cmpint (v[2], ==, GI_MARSHALLING_TESTS_ENUM_VALUE3);
2201 : 1 : }
2202 : :
2203 : : /**
2204 : : * gi_marshalling_tests_array_flags_in:
2205 : : * @flags: (array length=length) (transfer none):
2206 : : * @length:
2207 : : */
2208 : : void
2209 : 1 : gi_marshalling_tests_array_flags_in (GIMarshallingTestsFlags *v, gint length)
2210 : : {
2211 : 1 : g_assert_cmpint (length, ==, 3);
2212 : 1 : g_assert_cmpint (v[0], ==, GI_MARSHALLING_TESTS_FLAGS_VALUE1);
2213 : 1 : g_assert_cmpint (v[1], ==, GI_MARSHALLING_TESTS_FLAGS_VALUE2);
2214 : 1 : g_assert_cmpint (v[2], ==, GI_MARSHALLING_TESTS_FLAGS_VALUE3);
2215 : 1 : }
2216 : :
2217 : : /**
2218 : : * gi_marshalling_tests_array_in_guint64_len:
2219 : : * @ints: (array length=length) (transfer none):
2220 : : * @length:
2221 : : */
2222 : : void
2223 : 1 : gi_marshalling_tests_array_in_guint64_len (const gint *ints, guint64 length)
2224 : : {
2225 : 1 : g_assert_cmpint (length, ==, 4);
2226 : :
2227 : 1 : gi_marshalling_tests_array_in (ints, length);
2228 : 1 : }
2229 : :
2230 : : /**
2231 : : * gi_marshalling_tests_array_in_guint8_len:
2232 : : * @ints: (array length=length) (transfer none):
2233 : : * @length:
2234 : : */
2235 : : void
2236 : 1 : gi_marshalling_tests_array_in_guint8_len (const gint *ints, guint8 length)
2237 : : {
2238 : 1 : g_assert_cmpint (length, ==, 4);
2239 : :
2240 : 1 : gi_marshalling_tests_array_in (ints, length);
2241 : 1 : }
2242 : :
2243 : : /**
2244 : : * gi_marshalling_tests_array_out:
2245 : : * @ints: (out) (array length=length) (transfer none):
2246 : : */
2247 : : void
2248 : 1 : gi_marshalling_tests_array_out (gint **ints, gint *length)
2249 : : {
2250 : : static gint values[] = { -1, 0, 1, 2 };
2251 : :
2252 : 1 : *length = 4;
2253 : 1 : *ints = values;
2254 : 1 : }
2255 : :
2256 : : /**
2257 : : * gi_marshalling_tests_array_out_uninitialized:
2258 : : * @v: (out) (array length=length) (transfer none):
2259 : : * @length:
2260 : : */
2261 : : gboolean
2262 : 1 : gi_marshalling_tests_array_out_uninitialized (gint **v G_GNUC_UNUSED, gint *length G_GNUC_UNUSED)
2263 : : {
2264 : 1 : return FALSE;
2265 : : }
2266 : :
2267 : : /**
2268 : : * gi_marshalling_tests_array_out_unaligned:
2269 : : * @v: (out) (array length=len) (transfer none):
2270 : : * @len:
2271 : : *
2272 : : * Note that the buffer will leak unless you call
2273 : : * gi_marshalling_tests_cleanup_unaligned_buffer().
2274 : : */
2275 : : void
2276 : 1 : gi_marshalling_tests_array_out_unaligned (const guint8 **v, gsize *len)
2277 : : {
2278 : 1 : *v = init_unaligned_buffer ();
2279 : 1 : *len = UNALIGNED_BUFFER_SIZE - 1;
2280 : 1 : }
2281 : :
2282 : : /**
2283 : : * gi_marshalling_tests_array_out_etc:
2284 : : * @first:
2285 : : * @ints: (out) (array length=length) (transfer none):
2286 : : * @length: (out):
2287 : : * @last:
2288 : : * @sum: (out):
2289 : : */
2290 : : void
2291 : 1 : gi_marshalling_tests_array_out_etc (gint first, gint **ints, gint *length, gint last, gint *sum)
2292 : : {
2293 : : static gint values[] = { -1, 0, 1, 2 };
2294 : :
2295 : 1 : values[0] = first;
2296 : 1 : values[3] = last;
2297 : 1 : *sum = first + last;
2298 : 1 : *length = 4;
2299 : 1 : *ints = values;
2300 : 1 : }
2301 : :
2302 : : /**
2303 : : * gi_marshalling_tests_array_bool_out:
2304 : : * @bools: (out) (array length=length) (transfer none):
2305 : : */
2306 : : void
2307 : 1 : gi_marshalling_tests_array_bool_out (const gboolean **bools, gint *length)
2308 : : {
2309 : : static const gboolean values[] = { TRUE, FALSE, TRUE, TRUE };
2310 : :
2311 : 1 : *length = 4;
2312 : 1 : *bools = values;
2313 : 1 : }
2314 : :
2315 : : /**
2316 : : * gi_marshalling_tests_array_unichar_out:
2317 : : * @chars: (out) (array length=length) (transfer none):
2318 : : */
2319 : : void
2320 : 1 : gi_marshalling_tests_array_unichar_out (const gunichar **chars, gint *length)
2321 : : {
2322 : : static const gunichar values[] = GI_MARSHALLING_TESTS_CONSTANT_UCS4;
2323 : 1 : *length = 12;
2324 : 1 : *chars = values;
2325 : 1 : }
2326 : :
2327 : : /**
2328 : : * gi_marshalling_tests_array_inout:
2329 : : * @ints: (inout) (array length=length) (transfer none):
2330 : : * @length: (inout):
2331 : : */
2332 : : void
2333 : 2 : gi_marshalling_tests_array_inout (gint **ints, gint *length)
2334 : : {
2335 : : static gint values[] = { -2, -1, 0, 1, 2 };
2336 : :
2337 : 2 : g_assert_cmpint (*length, ==, 4);
2338 : 2 : g_assert_cmpint ((*ints)[0], ==, -1);
2339 : 2 : g_assert_cmpint ((*ints)[1], ==, 0);
2340 : 2 : g_assert_cmpint ((*ints)[2], ==, 1);
2341 : 2 : g_assert_cmpint ((*ints)[3], ==, 2);
2342 : :
2343 : 2 : *length = 5;
2344 : 2 : *ints = values;
2345 : 2 : }
2346 : :
2347 : : /**
2348 : : * gi_marshalling_tests_array_inout_etc:
2349 : : * @first:
2350 : : * @ints: (inout) (array length=length) (transfer none):
2351 : : * @length: (inout):
2352 : : * @last:
2353 : : * @sum: (out):
2354 : : */
2355 : : void
2356 : 1 : gi_marshalling_tests_array_inout_etc (gint first, gint **ints, gint *length, gint last, gint *sum)
2357 : : {
2358 : : static gint values[] = { -2, -1, 0, 1, 2 };
2359 : :
2360 : 1 : g_assert_cmpint (*length, ==, 4);
2361 : 1 : g_assert_cmpint ((*ints)[0], ==, -1);
2362 : 1 : g_assert_cmpint ((*ints)[1], ==, 0);
2363 : 1 : g_assert_cmpint ((*ints)[2], ==, 1);
2364 : 1 : g_assert_cmpint ((*ints)[3], ==, 2);
2365 : :
2366 : 1 : values[0] = first;
2367 : 1 : values[4] = last;
2368 : 1 : *sum = first + last;
2369 : 1 : *length = 5;
2370 : 1 : *ints = values;
2371 : 1 : }
2372 : :
2373 : : /**
2374 : : * gi_marshalling_tests_array_in_nonzero_nonlen:
2375 : : * @first:
2376 : : * @chars: (array):
2377 : : */
2378 : : void
2379 : 1 : gi_marshalling_tests_array_in_nonzero_nonlen (gint first G_GNUC_UNUSED,
2380 : : const guint8 *chars)
2381 : : {
2382 : 1 : g_assert (chars[0] == 'a');
2383 : 1 : g_assert (chars[1] == 'b');
2384 : 1 : g_assert (chars[2] == 'c');
2385 : 1 : g_assert (chars[3] == 'd');
2386 : 1 : }
2387 : :
2388 : : /**
2389 : : * gi_marshalling_tests_array_zero_terminated_return:
2390 : : *
2391 : : * Returns: (array zero-terminated) (transfer none):
2392 : : */
2393 : : const gchar **
2394 : 1 : gi_marshalling_tests_array_zero_terminated_return (void)
2395 : : {
2396 : : static const gchar *values[] = { "0", "1", "2", NULL };
2397 : 1 : return values;
2398 : : }
2399 : :
2400 : : /**
2401 : : * gi_marshalling_tests_array_zero_terminated_return_null:
2402 : : *
2403 : : * Returns: (array zero-terminated) (transfer none):
2404 : : */
2405 : : gchar **
2406 : 1 : gi_marshalling_tests_array_zero_terminated_return_null (void)
2407 : : {
2408 : 1 : return NULL;
2409 : : }
2410 : :
2411 : : /**
2412 : : * gi_marshalling_tests_array_zero_terminated_return_struct:
2413 : : *
2414 : : * Returns: (array zero-terminated) (transfer full):
2415 : : */
2416 : : GIMarshallingTestsBoxedStruct **
2417 : 1 : gi_marshalling_tests_array_zero_terminated_return_struct (void)
2418 : : {
2419 : 1 : GIMarshallingTestsBoxedStruct **ret = (GIMarshallingTestsBoxedStruct **) g_new (gpointer, 4);
2420 : :
2421 : 1 : ret[0] = gi_marshalling_tests_boxed_struct_new ();
2422 : 1 : ret[0]->long_ = 42;
2423 : :
2424 : 1 : ret[1] = gi_marshalling_tests_boxed_struct_new ();
2425 : 1 : ret[1]->long_ = 43;
2426 : :
2427 : 1 : ret[2] = gi_marshalling_tests_boxed_struct_new ();
2428 : 1 : ret[2]->long_ = 44;
2429 : :
2430 : 1 : ret[3] = NULL;
2431 : :
2432 : 1 : return ret;
2433 : : }
2434 : :
2435 : : /**
2436 : : * gi_marshalling_tests_array_zero_terminated_return_sequential_struct:
2437 : : *
2438 : : * Returns: (array zero-terminated) (transfer full):
2439 : : */
2440 : : GIMarshallingTestsBoxedStruct *
2441 : 1 : gi_marshalling_tests_array_zero_terminated_return_sequential_struct (void)
2442 : : {
2443 : 1 : GIMarshallingTestsBoxedStruct *ret = (GIMarshallingTestsBoxedStruct *) g_new0 (GIMarshallingTestsBoxedStruct, 4);
2444 : :
2445 : 1 : ret[0].long_ = 42;
2446 : 1 : ret[1].long_ = 43;
2447 : 1 : ret[2].long_ = 44;
2448 : :
2449 : 1 : return ret;
2450 : : }
2451 : :
2452 : : /**
2453 : : * gi_marshalling_tests_array_zero_terminated_return_unichar:
2454 : : *
2455 : : * Returns: (array zero-terminated) (transfer full):
2456 : : */
2457 : : gunichar *
2458 : 1 : gi_marshalling_tests_array_zero_terminated_return_unichar (void)
2459 : : {
2460 : : static const gunichar value[] = GI_MARSHALLING_TESTS_CONSTANT_UCS4;
2461 : 1 : gunichar *retval = g_new0 (gunichar, 13);
2462 : 1 : memcpy (retval, value, 12 * sizeof (gunichar));
2463 : 1 : return retval;
2464 : : }
2465 : :
2466 : : /**
2467 : : * gi_marshalling_tests_array_zero_terminated_return_unaligned:
2468 : : *
2469 : : * Note that the buffer will leak unless you call
2470 : : * gi_marshalling_tests_cleanup_unaligned_buffer().
2471 : : *
2472 : : * Returns: (array zero-terminated) (transfer none):
2473 : : */
2474 : : const guint8 *
2475 : 1 : gi_marshalling_tests_array_zero_terminated_return_unaligned (void)
2476 : : {
2477 : 1 : return init_unaligned_buffer ();
2478 : : }
2479 : :
2480 : : /**
2481 : : * gi_marshalling_tests_array_zero_terminated_in:
2482 : : * @utf8s: (array zero-terminated) (transfer none):
2483 : : */
2484 : : void
2485 : 1 : gi_marshalling_tests_array_zero_terminated_in (gchar **utf8s)
2486 : : {
2487 : 1 : g_assert (g_strv_length (utf8s));
2488 : 1 : g_assert_cmpstr (utf8s[0], ==, "0");
2489 : 1 : g_assert_cmpstr (utf8s[1], ==, "1");
2490 : 1 : g_assert_cmpstr (utf8s[2], ==, "2");
2491 : 1 : }
2492 : :
2493 : : /**
2494 : : * gi_marshalling_tests_array_zero_terminated_out:
2495 : : * @utf8s: (out) (array zero-terminated) (transfer none):
2496 : : */
2497 : : void
2498 : 1 : gi_marshalling_tests_array_zero_terminated_out (const gchar ***utf8s)
2499 : : {
2500 : : static const gchar *values[] = { "0", "1", "2", NULL };
2501 : 1 : *utf8s = values;
2502 : 1 : }
2503 : :
2504 : : /**
2505 : : * gi_marshalling_tests_array_zero_terminated_out_uninitialized:
2506 : : * @v: (out) (array zero-terminated) (transfer none):
2507 : : */
2508 : : gboolean
2509 : 1 : gi_marshalling_tests_array_zero_terminated_out_uninitialized (const gchar ***v G_GNUC_UNUSED)
2510 : : {
2511 : 1 : return FALSE;
2512 : : }
2513 : :
2514 : : /**
2515 : : * gi_marshalling_tests_array_zero_terminated_out_unaligned:
2516 : : * @v: (out) (array zero-terminated) (transfer none):
2517 : : *
2518 : : * Note that the buffer will leak unless you call
2519 : : * gi_marshalling_tests_cleanup_unaligned_buffer().
2520 : : */
2521 : : void
2522 : 1 : gi_marshalling_tests_array_zero_terminated_out_unaligned (const guint8 **v)
2523 : : {
2524 : 1 : *v = init_unaligned_buffer ();
2525 : 1 : }
2526 : :
2527 : : /**
2528 : : * gi_marshalling_tests_array_zero_terminated_inout:
2529 : : * @utf8s: (inout) (array zero-terminated) (transfer none):
2530 : : */
2531 : : void
2532 : 1 : gi_marshalling_tests_array_zero_terminated_inout (const gchar ***utf8s)
2533 : : {
2534 : : static const gchar *values[] = { "-1", "0", "1", "2", NULL };
2535 : :
2536 : 1 : g_assert (g_strv_length ((gchar **) (*utf8s)));
2537 : 1 : g_assert_cmpstr ((*utf8s)[0], ==, "0");
2538 : 1 : g_assert_cmpstr ((*utf8s)[1], ==, "1");
2539 : 1 : g_assert_cmpstr ((*utf8s)[2], ==, "2");
2540 : :
2541 : 1 : *utf8s = values;
2542 : 1 : }
2543 : :
2544 : : /**
2545 : : * gi_marshalling_tests_array_gvariant_none_in:
2546 : : * @variants: (array zero-terminated) (transfer none):
2547 : : *
2548 : : * Returns: (array zero-terminated) (transfer none):
2549 : : */
2550 : : GVariant **
2551 : 1 : gi_marshalling_tests_array_gvariant_none_in (GVariant **variants)
2552 : : {
2553 : : /* Use a static container to detect if someone tries to free it */
2554 : : static GVariant *private_container[3] = { NULL, NULL, NULL };
2555 : :
2556 [ + - ]: 1 : if (private_container[0] == NULL)
2557 : : {
2558 : 1 : private_container[0] = g_variant_new_int32 (27);
2559 : 1 : private_container[1] = g_variant_new_string ("Hello");
2560 : : }
2561 : :
2562 : 1 : g_assert (variants != NULL);
2563 : 1 : g_assert_cmpint (g_variant_get_int32 (variants[0]), ==, 27);
2564 : 1 : g_assert_cmpstr (g_variant_get_string (variants[1], NULL), ==, "Hello");
2565 : 1 : g_assert (variants[2] == NULL);
2566 : :
2567 : 1 : return private_container;
2568 : : }
2569 : :
2570 : : /**
2571 : : * gi_marshalling_tests_array_gvariant_container_in:
2572 : : * @variants: (array zero-terminated) (transfer container):
2573 : : *
2574 : : * Returns: (array zero-terminated) (transfer container):
2575 : : */
2576 : : GVariant **
2577 : 1 : gi_marshalling_tests_array_gvariant_container_in (GVariant **variants)
2578 : : {
2579 : : GVariant **container;
2580 : :
2581 : 1 : g_assert (variants != NULL);
2582 : 1 : g_assert_cmpint (g_variant_get_int32 (variants[0]), ==, 27);
2583 : 1 : g_assert_cmpstr (g_variant_get_string (variants[1], NULL), ==, "Hello");
2584 : 1 : g_assert (variants[2] == NULL);
2585 : :
2586 : 1 : container = g_new0 (GVariant *, 3);
2587 : : /* This is a floating reference, so it's fine for transfer container */
2588 : 1 : container[0] = g_variant_new_int32 (g_variant_get_int32 (variants[0]));
2589 : 1 : container[1] = variants[1];
2590 : 1 : g_free (variants);
2591 : :
2592 : 1 : return container;
2593 : : }
2594 : :
2595 : : /**
2596 : : * gi_marshalling_tests_array_gvariant_full_in:
2597 : : * @variants: (array zero-terminated) (transfer full):
2598 : : *
2599 : : * Returns: (array zero-terminated) (transfer full):
2600 : : */
2601 : : GVariant **
2602 : 1 : gi_marshalling_tests_array_gvariant_full_in (GVariant **variants)
2603 : : {
2604 : : GVariant **container;
2605 : :
2606 : 1 : g_assert (variants != NULL);
2607 : 1 : g_assert_cmpint (g_variant_get_int32 (variants[0]), ==, 27);
2608 : 1 : g_assert_cmpstr (g_variant_get_string (variants[1], NULL), ==, "Hello");
2609 : 1 : g_assert (variants[2] == NULL);
2610 : :
2611 : : /* To catch different behaviors we reconstruct one variant from scratch,
2612 : : * while taking the refernce of the other. Both approaches are legal with full
2613 : : * transfer in and out */
2614 : 1 : container = g_new0 (GVariant *, 3);
2615 : 1 : container[0] = g_variant_ref_sink (
2616 : : g_variant_new_int32 (g_variant_get_int32 (variants[0])));
2617 : 1 : g_variant_unref (variants[0]);
2618 : :
2619 : : /* In case the variant is floating, we want to transform it into a full
2620 : : * reference, so that's fully owned by the container like if the case
2621 : : * above, otherwise we just steal it since it has already a strong reference.
2622 : : */
2623 : 1 : container[1] = g_variant_take_ref (variants[1]);
2624 : 1 : g_free (variants);
2625 : :
2626 : 1 : return container;
2627 : : }
2628 : :
2629 : : /* The following tests expect the following arrays:
2630 : : * in: 🅰, β, c, d (the first two characters are U+1F170 and U+03B2)
2631 : : * out/return: a, b, ¢, 🔠 (the last two characters are U+00A2 and U+1F520)
2632 : : * This is intended to test the full capabilities of C arrays of a basic type.
2633 : : * UTF-8 strings and filenames are the only basic types that need to be released
2634 : : * as individual elements, so we test UTF-8 strings. We test ASCII characters,
2635 : : * basic multilingual plane characters, and astral plane characters in both the
2636 : : * in and out arrays.
2637 : : */
2638 : : #define SQUARED_A "\xf0\x9f\x85\xb0"
2639 : : #define BETA "\xce\xb2"
2640 : : #define CENT "\xc2\xa2"
2641 : : #define ABCD "\xf0\x9f\x94\xa0"
2642 : :
2643 : : /**
2644 : : * gi_marshalling_tests_length_array_utf8_none_return:
2645 : : *
2646 : : * Returns: (array length=out_length) (transfer none):
2647 : : */
2648 : : const gchar *const *
2649 : 2 : gi_marshalling_tests_length_array_utf8_none_return (size_t *out_length)
2650 : : {
2651 : : static const gchar *array[] = { "a", "b", CENT, ABCD };
2652 : :
2653 : 2 : *out_length = 4;
2654 : 2 : return array;
2655 : : }
2656 : :
2657 : : /**
2658 : : * gi_marshalling_tests_length_array_utf8_container_return:
2659 : : *
2660 : : * Returns: (array length=out_length) (transfer container):
2661 : : */
2662 : : const gchar **
2663 : 2 : gi_marshalling_tests_length_array_utf8_container_return (size_t *out_length)
2664 : : {
2665 : 2 : const gchar **array = g_new0 (const gchar *, 4);
2666 : :
2667 : 2 : array[0] = "a";
2668 : 2 : array[1] = "b";
2669 : 2 : array[2] = CENT;
2670 : 2 : array[3] = ABCD;
2671 : :
2672 : 2 : *out_length = 4;
2673 : 2 : return array;
2674 : : }
2675 : :
2676 : : /**
2677 : : * gi_marshalling_tests_length_array_utf8_full_return:
2678 : : *
2679 : : * Returns: (array length=out_length) (transfer full):
2680 : : */
2681 : : gchar **
2682 : 2 : gi_marshalling_tests_length_array_utf8_full_return (size_t *out_length)
2683 : : {
2684 : 2 : gchar **array = g_new0 (gchar *, 4);
2685 : 2 : array[0] = g_strdup ("a");
2686 : 2 : array[1] = g_strdup ("b");
2687 : 2 : array[2] = g_strdup (CENT);
2688 : 2 : array[3] = g_strdup (ABCD);
2689 : :
2690 : 2 : *out_length = 4;
2691 : 2 : return array;
2692 : : }
2693 : :
2694 : : /**
2695 : : * gi_marshalling_tests_length_array_utf8_none_in:
2696 : : * @array: (array length=length) (transfer none):
2697 : : */
2698 : : void
2699 : 5 : gi_marshalling_tests_length_array_utf8_none_in (const gchar *const *array, size_t length)
2700 : : {
2701 : 5 : g_assert_cmpint (length, ==, 4);
2702 : :
2703 : 5 : g_assert_cmpstr (array[0], ==, SQUARED_A);
2704 : 5 : g_assert_cmpstr (array[1], ==, BETA);
2705 : 5 : g_assert_cmpstr (array[2], ==, "c");
2706 : 5 : g_assert_cmpstr (array[3], ==, "d");
2707 : 5 : }
2708 : :
2709 : : /**
2710 : : * gi_marshalling_tests_length_array_utf8_container_in:
2711 : : * @array: (array length=length) (transfer container):
2712 : : */
2713 : : void
2714 : 0 : gi_marshalling_tests_length_array_utf8_container_in (const gchar **array, size_t length)
2715 : : {
2716 : 0 : gi_marshalling_tests_length_array_utf8_none_in (array, length);
2717 : :
2718 [ # # ]: 0 : g_clear_pointer (&array, g_free);
2719 : 0 : }
2720 : :
2721 : : /**
2722 : : * gi_marshalling_tests_length_array_utf8_full_in:
2723 : : * @array: (array length=length) (transfer full):
2724 : : */
2725 : : void
2726 : 3 : gi_marshalling_tests_length_array_utf8_full_in (gchar **array, size_t length)
2727 : : {
2728 : 3 : gi_marshalling_tests_length_array_utf8_none_in ((const gchar *const *) array, length);
2729 : :
2730 [ + - ]: 3 : g_clear_pointer (&array[0], g_free);
2731 [ + - ]: 3 : g_clear_pointer (&array[1], g_free);
2732 [ + - ]: 3 : g_clear_pointer (&array[2], g_free);
2733 [ + - ]: 3 : g_clear_pointer (&array[3], g_free);
2734 : :
2735 [ + - ]: 3 : g_clear_pointer (&array, g_free);
2736 : 3 : }
2737 : :
2738 : : /**
2739 : : * gi_marshalling_tests_length_array_utf8_none_out:
2740 : : * @array_out: (array length=out_length) (out) (transfer none):
2741 : : * @out_length: (out):
2742 : : */
2743 : : void
2744 : 1 : gi_marshalling_tests_length_array_utf8_none_out (const gchar *const **array_out, size_t *out_length)
2745 : : {
2746 : 1 : *array_out = gi_marshalling_tests_length_array_utf8_none_return (out_length);
2747 : 1 : }
2748 : :
2749 : : /**
2750 : : * gi_marshalling_tests_length_array_utf8_container_out:
2751 : : * @array_out: (array length=out_length) (out) (transfer container):
2752 : : */
2753 : : void
2754 : 1 : gi_marshalling_tests_length_array_utf8_container_out (const gchar ***array_out, size_t *out_length)
2755 : : {
2756 : 1 : *array_out = gi_marshalling_tests_length_array_utf8_container_return (out_length);
2757 : 1 : }
2758 : :
2759 : : /**
2760 : : * gi_marshalling_tests_length_array_utf8_full_out:
2761 : : * @array_out: (array length=out_length) (out) (transfer full):
2762 : : */
2763 : : void
2764 : 1 : gi_marshalling_tests_length_array_utf8_full_out (gchar ***array_out, size_t *out_length)
2765 : : {
2766 : 1 : *array_out = gi_marshalling_tests_length_array_utf8_full_return (out_length);
2767 : 1 : }
2768 : :
2769 : : /**
2770 : : * gi_marshalling_tests_length_array_utf8_none_inout:
2771 : : * @array_inout: (array length=inout_length) (inout) (transfer none):
2772 : : * @inout_length: (inout):
2773 : : */
2774 : : void
2775 : 1 : gi_marshalling_tests_length_array_utf8_none_inout (const gchar *const **array_inout, size_t *inout_length)
2776 : : {
2777 : : static const gchar *array_out[] = { "a", "b", CENT, ABCD };
2778 : :
2779 : 1 : g_assert_nonnull (inout_length);
2780 : 1 : gi_marshalling_tests_length_array_utf8_none_in (*array_inout, *inout_length);
2781 : :
2782 : 1 : *array_inout = array_out;
2783 : 1 : *inout_length = 4;
2784 : 1 : }
2785 : :
2786 : : /**
2787 : : * gi_marshalling_tests_length_array_utf8_container_inout:
2788 : : * @array_inout: (array length=inout_length) (inout) (transfer container):
2789 : : * @inout_length: (inout):
2790 : : */
2791 : : void
2792 : 0 : gi_marshalling_tests_length_array_utf8_container_inout (const gchar ***array_inout, size_t *inout_length)
2793 : : {
2794 : 0 : const gchar **array_out = g_new0 (const gchar *, 4);
2795 : :
2796 : 0 : g_assert_nonnull (inout_length);
2797 : 0 : g_assert_nonnull (array_inout);
2798 : 0 : gi_marshalling_tests_length_array_utf8_container_in (*array_inout, *inout_length);
2799 : :
2800 : 0 : array_out[0] = "a";
2801 : 0 : array_out[1] = "b";
2802 : 0 : array_out[2] = CENT;
2803 : 0 : array_out[3] = ABCD;
2804 : :
2805 : 0 : *array_inout = array_out;
2806 : 0 : *inout_length = 4;
2807 : 0 : }
2808 : :
2809 : : /**
2810 : : * gi_marshalling_tests_length_array_utf8_full_inout:
2811 : : * @array_inout: (array length=inout_length) (inout) (transfer full):
2812 : : * @inout_length: (inout):
2813 : : */
2814 : : void
2815 : 2 : gi_marshalling_tests_length_array_utf8_full_inout (gchar ***array_inout, size_t *inout_length)
2816 : : {
2817 : 2 : gchar **array_out = g_new0 (gchar *, 4);
2818 : :
2819 : 2 : g_assert_nonnull (inout_length);
2820 : 2 : g_assert_nonnull (array_inout);
2821 : 2 : gi_marshalling_tests_length_array_utf8_full_in (
2822 : 2 : g_steal_pointer (array_inout), *inout_length);
2823 : :
2824 : 2 : array_out[0] = g_strdup ("a");
2825 : 2 : array_out[1] = g_strdup ("b");
2826 : 2 : array_out[2] = g_strdup (CENT);
2827 : 2 : array_out[3] = g_strdup (ABCD);
2828 : :
2829 : 2 : *array_inout = array_out;
2830 : 2 : *inout_length = 4;
2831 : 2 : }
2832 : :
2833 : : /**
2834 : : * gi_marshalling_tests_length_array_utf8_optional_inout:
2835 : : * @inout_length: (inout) (optional): @array_inout's length
2836 : : * @array_inout: (inout) (array length=inout_length) (optional): array ["🅰", "β", "c", "d"]
2837 : : *
2838 : : * See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9524
2839 : : */
2840 : : void
2841 : 3 : gi_marshalling_tests_length_array_utf8_optional_inout (int *inout_length, char **array_inout[])
2842 : : {
2843 [ + + ]: 3 : if (inout_length == NULL)
2844 : : {
2845 : 1 : g_assert_null (array_inout);
2846 : : }
2847 [ + + ]: 2 : else if (*inout_length > 0)
2848 : : {
2849 : 1 : size_t size = *inout_length;
2850 : :
2851 : 1 : g_assert_nonnull (array_inout);
2852 : 1 : g_assert_nonnull (*array_inout);
2853 : :
2854 : 1 : gi_marshalling_tests_length_array_utf8_full_inout (array_inout, &size);
2855 : 1 : *inout_length = size;
2856 : : }
2857 : : else
2858 : : {
2859 : 1 : g_free (*array_inout);
2860 : :
2861 : 1 : gchar **array_out = g_new0 (gchar *, 2);
2862 : :
2863 : 1 : g_assert_nonnull (inout_length);
2864 : 1 : g_assert_nonnull (array_inout);
2865 : :
2866 : 1 : array_out[0] = g_strdup ("a");
2867 : 1 : array_out[1] = g_strdup ("b");
2868 : :
2869 : 1 : *array_inout = array_out;
2870 : 1 : *inout_length = 2;
2871 : : }
2872 : 3 : }
2873 : :
2874 : : /**
2875 : : * gi_marshalling_tests_zero_terminated_array_utf8_none_return:
2876 : : *
2877 : : * Returns: (array zero-terminated) (transfer none):
2878 : : */
2879 : : const gchar *const *
2880 : 2 : gi_marshalling_tests_zero_terminated_array_utf8_none_return (void)
2881 : : {
2882 : : static const gchar *array[] = { "a", "b", CENT, ABCD, NULL };
2883 : 2 : return array;
2884 : : }
2885 : :
2886 : : /**
2887 : : * gi_marshalling_tests_zero_terminated_array_utf8_container_return:
2888 : : *
2889 : : * Returns: (array zero-terminated) (transfer container):
2890 : : */
2891 : : const gchar **
2892 : 2 : gi_marshalling_tests_zero_terminated_array_utf8_container_return (void)
2893 : : {
2894 : 2 : const gchar **array = g_new0 (const gchar *, 5);
2895 : :
2896 : 2 : array[0] = "a";
2897 : 2 : array[1] = "b";
2898 : 2 : array[2] = CENT;
2899 : 2 : array[3] = ABCD;
2900 : :
2901 : 2 : return array;
2902 : : }
2903 : :
2904 : : /**
2905 : : * gi_marshalling_tests_zero_terminated_array_utf8_full_return:
2906 : : *
2907 : : * Returns: (array zero-terminated) (transfer full):
2908 : : */
2909 : : gchar **
2910 : 2 : gi_marshalling_tests_zero_terminated_array_utf8_full_return (void)
2911 : : {
2912 : 2 : gchar **array = g_new0 (gchar *, 5);
2913 : :
2914 : 2 : array[0] = g_strdup ("a");
2915 : 2 : array[1] = g_strdup ("b");
2916 : 2 : array[2] = g_strdup (CENT);
2917 : 2 : array[3] = g_strdup (ABCD);
2918 : :
2919 : 2 : return array;
2920 : : }
2921 : :
2922 : : /**
2923 : : * gi_marshalling_tests_zero_terminated_array_utf8_none_in:
2924 : : * @array: (array zero-terminated) (transfer none):
2925 : : */
2926 : : void
2927 : 4 : gi_marshalling_tests_zero_terminated_array_utf8_none_in (const gchar *const *array)
2928 : : {
2929 : 4 : g_assert_cmpstr (array[0], ==, SQUARED_A);
2930 : 4 : g_assert_cmpstr (array[1], ==, BETA);
2931 : 4 : g_assert_cmpstr (array[2], ==, "c");
2932 : 4 : g_assert_cmpstr (array[3], ==, "d");
2933 : :
2934 : 4 : g_assert_null (array[4]);
2935 : 4 : }
2936 : :
2937 : : /**
2938 : : * gi_marshalling_tests_zero_terminated_array_utf8_container_in:
2939 : : * @array: (array zero-terminated) (transfer container):
2940 : : */
2941 : : void
2942 : 0 : gi_marshalling_tests_zero_terminated_array_utf8_container_in (const gchar **array)
2943 : : {
2944 : 0 : gi_marshalling_tests_zero_terminated_array_utf8_none_in (array);
2945 : :
2946 [ # # ]: 0 : g_clear_pointer (&array, g_free);
2947 : 0 : }
2948 : :
2949 : : /**
2950 : : * gi_marshalling_tests_zero_terminated_array_utf8_full_in:
2951 : : * @array: (array zero-terminated) (transfer full):
2952 : : */
2953 : : void
2954 : 2 : gi_marshalling_tests_zero_terminated_array_utf8_full_in (gchar **array)
2955 : : {
2956 : 2 : gi_marshalling_tests_zero_terminated_array_utf8_none_in ((const gchar *const *) array);
2957 : :
2958 [ + - + + ]: 10 : for (size_t i = 0; array && array[i] != NULL; i++)
2959 [ + - ]: 8 : g_clear_pointer (&array[i], g_free);
2960 : :
2961 [ + - ]: 2 : g_clear_pointer (&array, g_free);
2962 : 2 : }
2963 : :
2964 : : /**
2965 : : * gi_marshalling_tests_zero_terminated_array_utf8_none_out:
2966 : : * @array_out: (array zero-terminated) (out) (transfer none):
2967 : : */
2968 : : void
2969 : 1 : gi_marshalling_tests_zero_terminated_array_utf8_none_out (const gchar *const **array_out)
2970 : : {
2971 : 1 : *array_out = gi_marshalling_tests_zero_terminated_array_utf8_none_return ();
2972 : 1 : }
2973 : :
2974 : : /**
2975 : : * gi_marshalling_tests_zero_terminated_array_utf8_container_out:
2976 : : * @array_out: (array zero-terminated) (out) (transfer container):
2977 : : */
2978 : : void
2979 : 1 : gi_marshalling_tests_zero_terminated_array_utf8_container_out (const gchar ***array_out)
2980 : : {
2981 : 1 : *array_out = gi_marshalling_tests_zero_terminated_array_utf8_container_return ();
2982 : 1 : }
2983 : :
2984 : : /**
2985 : : * gi_marshalling_tests_zero_terminated_array_utf8_full_out:
2986 : : * @array_out: (array zero-terminated) (out) (transfer full):
2987 : : */
2988 : : void
2989 : 1 : gi_marshalling_tests_zero_terminated_array_utf8_full_out (gchar ***array_out)
2990 : : {
2991 : 1 : *array_out = gi_marshalling_tests_zero_terminated_array_utf8_full_return ();
2992 : 1 : }
2993 : :
2994 : : /**
2995 : : * gi_marshalling_tests_zero_terminated_array_utf8_none_inout:
2996 : : * @array_inout: (array zero-terminated) (inout) (transfer none):
2997 : : */
2998 : : void
2999 : 1 : gi_marshalling_tests_zero_terminated_array_utf8_none_inout (const gchar *const **array_inout)
3000 : : {
3001 : : static const gchar *array_out[] = { "a", "b", CENT, ABCD, NULL };
3002 : :
3003 : 1 : gi_marshalling_tests_zero_terminated_array_utf8_none_in (*array_inout);
3004 : :
3005 : 1 : *array_inout = array_out;
3006 : 1 : }
3007 : :
3008 : : /**
3009 : : * gi_marshalling_tests_zero_terminated_array_utf8_container_inout:
3010 : : * @array_inout: (array zero-terminated) (inout) (transfer container):
3011 : : */
3012 : : void
3013 : 0 : gi_marshalling_tests_zero_terminated_array_utf8_container_inout (const gchar ***array_inout)
3014 : : {
3015 : 0 : const gchar **array_out = g_new0 (const gchar *, 5);
3016 : :
3017 : 0 : gi_marshalling_tests_zero_terminated_array_utf8_container_in (*array_inout);
3018 : :
3019 : 0 : array_out[0] = "a";
3020 : 0 : array_out[1] = "b";
3021 : 0 : array_out[2] = CENT;
3022 : 0 : array_out[3] = ABCD;
3023 : :
3024 : 0 : *array_inout = array_out;
3025 : 0 : }
3026 : :
3027 : : /**
3028 : : * gi_marshalling_tests_zero_terminated_array_utf8_full_inout:
3029 : : * @array_inout: (array zero-terminated) (inout) (transfer full):
3030 : : */
3031 : : void
3032 : 1 : gi_marshalling_tests_zero_terminated_array_utf8_full_inout (gchar ***array_inout)
3033 : : {
3034 : 1 : gchar **array_out = g_new0 (gchar *, 5);
3035 : :
3036 : 1 : gi_marshalling_tests_zero_terminated_array_utf8_full_in (
3037 : 1 : g_steal_pointer (array_inout));
3038 : :
3039 : 1 : array_out[0] = g_strdup ("a");
3040 : 1 : array_out[1] = g_strdup ("b");
3041 : 1 : array_out[2] = g_strdup (CENT);
3042 : 1 : array_out[3] = g_strdup (ABCD);
3043 : :
3044 : 1 : *array_inout = array_out;
3045 : 1 : }
3046 : :
3047 : : /**
3048 : : * gi_marshalling_tests_fixed_array_utf8_none_return:
3049 : : *
3050 : : * Returns: (array fixed-size=4) (transfer none):
3051 : : */
3052 : : const gchar *const *
3053 : 2 : gi_marshalling_tests_fixed_array_utf8_none_return (void)
3054 : : {
3055 : : static const gchar *array[] = { "a", "b", CENT, ABCD };
3056 : 2 : return array;
3057 : : }
3058 : :
3059 : : /**
3060 : : * gi_marshalling_tests_fixed_array_utf8_container_return:
3061 : : *
3062 : : * Returns: (array fixed-size=4) (transfer container):
3063 : : */
3064 : : const gchar **
3065 : 2 : gi_marshalling_tests_fixed_array_utf8_container_return (void)
3066 : : {
3067 : 2 : const gchar **array = g_new0 (const gchar *, 4);
3068 : :
3069 : 2 : array[0] = "a";
3070 : 2 : array[1] = "b";
3071 : 2 : array[2] = CENT;
3072 : 2 : array[3] = ABCD;
3073 : :
3074 : 2 : return array;
3075 : : }
3076 : :
3077 : : /**
3078 : : * gi_marshalling_tests_fixed_array_utf8_full_return:
3079 : : *
3080 : : * Returns: (array fixed-size=4) (transfer full):
3081 : : */
3082 : : gchar **
3083 : 2 : gi_marshalling_tests_fixed_array_utf8_full_return (void)
3084 : : {
3085 : 2 : gchar **array = g_new0 (gchar *, 4);
3086 : :
3087 : 2 : array[0] = g_strdup ("a");
3088 : 2 : array[1] = g_strdup ("b");
3089 : 2 : array[2] = g_strdup (CENT);
3090 : 2 : array[3] = g_strdup (ABCD);
3091 : :
3092 : 2 : return array;
3093 : : }
3094 : :
3095 : : /**
3096 : : * gi_marshalling_tests_fixed_array_utf8_none_in:
3097 : : * @array: (array fixed-size=4) (transfer none):
3098 : : */
3099 : : void
3100 : 4 : gi_marshalling_tests_fixed_array_utf8_none_in (const gchar *const *array)
3101 : : {
3102 : 4 : g_assert_cmpstr (array[0], ==, SQUARED_A);
3103 : 4 : g_assert_cmpstr (array[1], ==, BETA);
3104 : 4 : g_assert_cmpstr (array[2], ==, "c");
3105 : 4 : g_assert_cmpstr (array[3], ==, "d");
3106 : 4 : }
3107 : :
3108 : : /**
3109 : : * gi_marshalling_tests_fixed_array_utf8_container_in:
3110 : : * @array: (array fixed-size=4) (transfer container):
3111 : : */
3112 : : void
3113 : 0 : gi_marshalling_tests_fixed_array_utf8_container_in (const gchar **array)
3114 : : {
3115 : 0 : gi_marshalling_tests_fixed_array_utf8_none_in (array);
3116 : :
3117 [ # # ]: 0 : g_clear_pointer (&array, g_free);
3118 : 0 : }
3119 : :
3120 : : /**
3121 : : * gi_marshalling_tests_fixed_array_utf8_full_in:
3122 : : * @array: (array fixed-size=4) (transfer full):
3123 : : */
3124 : : void
3125 : 2 : gi_marshalling_tests_fixed_array_utf8_full_in (gchar **array)
3126 : : {
3127 : 2 : gi_marshalling_tests_fixed_array_utf8_none_in ((const gchar *const *) array);
3128 : :
3129 [ + - ]: 2 : g_clear_pointer (&array[0], g_free);
3130 [ + - ]: 2 : g_clear_pointer (&array[1], g_free);
3131 [ + - ]: 2 : g_clear_pointer (&array[2], g_free);
3132 [ + - ]: 2 : g_clear_pointer (&array[3], g_free);
3133 : :
3134 [ + - ]: 2 : g_clear_pointer (&array, g_free);
3135 : 2 : }
3136 : :
3137 : : /**
3138 : : * gi_marshalling_tests_fixed_array_utf8_none_out:
3139 : : * @array_out: (array fixed-size=4) (out) (transfer none):
3140 : : */
3141 : : void
3142 : 1 : gi_marshalling_tests_fixed_array_utf8_none_out (const gchar *const **array_out)
3143 : : {
3144 : 1 : *array_out = gi_marshalling_tests_fixed_array_utf8_none_return ();
3145 : 1 : }
3146 : :
3147 : : /**
3148 : : * gi_marshalling_tests_fixed_array_utf8_container_out:
3149 : : * @array_out: (array fixed-size=4) (out) (transfer container):
3150 : : */
3151 : : void
3152 : 1 : gi_marshalling_tests_fixed_array_utf8_container_out (const gchar ***array_out)
3153 : : {
3154 : 1 : *array_out = gi_marshalling_tests_fixed_array_utf8_container_return ();
3155 : 1 : }
3156 : :
3157 : : /**
3158 : : * gi_marshalling_tests_fixed_array_utf8_full_out:
3159 : : * @array_out: (array fixed-size=4) (out) (transfer full):
3160 : : */
3161 : : void
3162 : 1 : gi_marshalling_tests_fixed_array_utf8_full_out (gchar ***array_out)
3163 : : {
3164 : 1 : *array_out = gi_marshalling_tests_fixed_array_utf8_full_return ();
3165 : 1 : }
3166 : :
3167 : : /**
3168 : : * gi_marshalling_tests_fixed_array_utf8_none_inout:
3169 : : * @array_inout: (array fixed-size=4) (inout) (transfer none):
3170 : : */
3171 : : void
3172 : 1 : gi_marshalling_tests_fixed_array_utf8_none_inout (const gchar *const **array_inout)
3173 : : {
3174 : : static const gchar *array_out[] = { "a", "b", CENT, ABCD };
3175 : :
3176 : 1 : gi_marshalling_tests_fixed_array_utf8_none_in (*array_inout);
3177 : :
3178 : 1 : *array_inout = array_out;
3179 : 1 : }
3180 : :
3181 : : /**
3182 : : * gi_marshalling_tests_fixed_array_utf8_container_inout:
3183 : : * @array_inout: (array fixed-size=4) (inout) (transfer container):
3184 : : */
3185 : : void
3186 : 0 : gi_marshalling_tests_fixed_array_utf8_container_inout (const gchar ***array_inout)
3187 : : {
3188 : 0 : const gchar **array_out = g_new0 (const gchar *, 4);
3189 : :
3190 : 0 : gi_marshalling_tests_fixed_array_utf8_container_in (*array_inout);
3191 : :
3192 : 0 : array_out[0] = "a";
3193 : 0 : array_out[1] = "b";
3194 : 0 : array_out[2] = CENT;
3195 : 0 : array_out[3] = ABCD;
3196 : :
3197 : 0 : *array_inout = array_out;
3198 : 0 : }
3199 : :
3200 : : /**
3201 : : * gi_marshalling_tests_fixed_array_utf8_full_inout:
3202 : : * @array_inout: (array fixed-size=4) (inout) (transfer full):
3203 : : */
3204 : : void
3205 : 1 : gi_marshalling_tests_fixed_array_utf8_full_inout (gchar ***array_inout)
3206 : : {
3207 : 1 : gchar **array_out = g_new0 (gchar *, 4);
3208 : :
3209 : 1 : gi_marshalling_tests_fixed_array_utf8_full_in (
3210 : 1 : g_steal_pointer (array_inout));
3211 : :
3212 : 1 : array_out[0] = g_strdup ("a");
3213 : 1 : array_out[1] = g_strdup ("b");
3214 : 1 : array_out[2] = g_strdup (CENT);
3215 : 1 : array_out[3] = g_strdup (ABCD);
3216 : :
3217 : 1 : *array_inout = array_out;
3218 : 1 : }
3219 : :
3220 : : /**
3221 : : * gi_marshalling_tests_garray_int_none_return:
3222 : : *
3223 : : * Returns: (element-type gint) (transfer none):
3224 : : */
3225 : : GArray *
3226 : 1 : gi_marshalling_tests_garray_int_none_return (void)
3227 : : {
3228 : : static GArray *v = NULL;
3229 : : gint i;
3230 : :
3231 [ + - ]: 1 : if (v == NULL)
3232 : : {
3233 : 1 : v = g_array_new (TRUE, TRUE, sizeof (gint));
3234 [ + + ]: 5 : for (i = -1; i < 3; i++)
3235 : 4 : g_array_append_val (v, i);
3236 : : }
3237 : :
3238 : 1 : return v;
3239 : : }
3240 : :
3241 : : /**
3242 : : * gi_marshalling_tests_garray_uint64_none_return:
3243 : : *
3244 : : * Returns: (element-type guint64) (transfer none):
3245 : : */
3246 : : GArray *
3247 : 1 : gi_marshalling_tests_garray_uint64_none_return (void)
3248 : : {
3249 : : static GArray *array = NULL;
3250 : : guint64 i;
3251 : :
3252 [ + - ]: 1 : if (array == NULL)
3253 : : {
3254 : 1 : array = g_array_new (TRUE, TRUE, sizeof (guint64));
3255 : 1 : i = 0;
3256 : 1 : g_array_append_val (array, i);
3257 : 1 : i = G_MAXUINT64;
3258 : 1 : g_array_append_val (array, i);
3259 : : }
3260 : :
3261 : 1 : return array;
3262 : : }
3263 : :
3264 : : /**
3265 : : * gi_marshalling_tests_garray_enum_none_return:
3266 : : *
3267 : : * Returns: (element-type GIMarshallingTestsGEnum) (transfer none):
3268 : : */
3269 : : GArray *
3270 : 0 : gi_marshalling_tests_garray_enum_none_return (void)
3271 : : {
3272 : : static GArray *array = NULL;
3273 : : GIMarshallingTestsGEnum value;
3274 : :
3275 [ # # ]: 0 : if (array == NULL)
3276 : : {
3277 : 0 : array = g_array_new (TRUE, TRUE, sizeof (GIMarshallingTestsGEnum));
3278 : 0 : value = GI_MARSHALLING_TESTS_GENUM_VALUE1;
3279 : 0 : g_array_append_val (array, value);
3280 : 0 : value = GI_MARSHALLING_TESTS_GENUM_VALUE2;
3281 : 0 : g_array_append_val (array, value);
3282 : 0 : value = GI_MARSHALLING_TESTS_GENUM_VALUE3;
3283 : 0 : g_array_append_val (array, value);
3284 : : }
3285 : :
3286 : 0 : return array;
3287 : : }
3288 : :
3289 : : /**
3290 : : * gi_marshalling_tests_garray_utf8_none_return:
3291 : : *
3292 : : * Returns: (element-type utf8) (transfer none):
3293 : : */
3294 : : GArray *
3295 : 1 : gi_marshalling_tests_garray_utf8_none_return (void)
3296 : : {
3297 : : static GArray *array = NULL;
3298 : : static const gchar *values[] = { "0", "1", "2", NULL };
3299 : : gint i;
3300 : :
3301 [ + - ]: 1 : if (array == NULL)
3302 : : {
3303 : 1 : array = g_array_new (TRUE, TRUE, sizeof (gchar *));
3304 [ + + ]: 4 : for (i = 0; values[i]; i++)
3305 : 3 : g_array_append_val (array, values[i]);
3306 : : }
3307 : :
3308 : 1 : return array;
3309 : : }
3310 : :
3311 : : /**
3312 : : * gi_marshalling_tests_garray_utf8_container_return:
3313 : : *
3314 : : * Returns: (element-type utf8) (transfer container):
3315 : : */
3316 : : GArray *
3317 : 1 : gi_marshalling_tests_garray_utf8_container_return (void)
3318 : : {
3319 : 1 : GArray *array = NULL;
3320 : : static const gchar *values[] = { "0", "1", "2", NULL };
3321 : : gint i;
3322 : :
3323 : 1 : array = g_array_new (TRUE, TRUE, sizeof (gchar *));
3324 [ + + ]: 4 : for (i = 0; values[i]; i++)
3325 : 3 : g_array_append_val (array, values[i]);
3326 : :
3327 : 1 : return array;
3328 : : }
3329 : :
3330 : : /**
3331 : : * gi_marshalling_tests_garray_utf8_full_return:
3332 : : *
3333 : : * Returns: (element-type utf8) (transfer full):
3334 : : */
3335 : : GArray *
3336 : 1 : gi_marshalling_tests_garray_utf8_full_return (void)
3337 : : {
3338 : 1 : GArray *array = NULL;
3339 : : static const gchar *values[] = { "0", "1", "2", NULL };
3340 : : gint i;
3341 : :
3342 : 1 : array = g_array_new (TRUE, TRUE, sizeof (gchar *));
3343 [ + + ]: 4 : for (i = 0; values[i]; i++)
3344 : : {
3345 : 3 : gchar *str = g_strdup (values[i]);
3346 : 3 : g_array_append_val (array, str);
3347 : : }
3348 : :
3349 : 1 : return array;
3350 : : }
3351 : :
3352 : : /**
3353 : : * gi_marshalling_tests_garray_boxed_struct_full_return:
3354 : : *
3355 : : * Returns: (element-type GIMarshallingTestsBoxedStruct) (transfer full):
3356 : : */
3357 : : GArray *
3358 : 1 : gi_marshalling_tests_garray_boxed_struct_full_return (void)
3359 : : {
3360 : 1 : GArray *array = NULL;
3361 : : static const glong long_values[] = { 42, 43, 44 };
3362 : : gint i;
3363 : :
3364 : 1 : array = g_array_new (TRUE, TRUE, sizeof (GIMarshallingTestsBoxedStruct));
3365 : 1 : g_array_set_size (array, 3);
3366 [ + + ]: 4 : for (i = 0; i < 3; i++)
3367 : : {
3368 : : GIMarshallingTestsBoxedStruct *new_struct;
3369 : 3 : new_struct = &g_array_index (array, GIMarshallingTestsBoxedStruct, i);
3370 : 3 : memset (new_struct, 0, sizeof (GIMarshallingTestsSimpleStruct));
3371 : 3 : new_struct->long_ = long_values[i];
3372 : : }
3373 : :
3374 : 1 : return array;
3375 : : }
3376 : :
3377 : : /**
3378 : : * gi_marshalling_tests_garray_int_none_in:
3379 : : * @array_: (element-type gint) (transfer none):
3380 : : */
3381 : : void
3382 : 1 : gi_marshalling_tests_garray_int_none_in (GArray *array_)
3383 : : {
3384 : 1 : g_assert_cmpint (array_->len, ==, 4);
3385 : 1 : g_assert_cmpint (g_array_index (array_, gint, 0), ==, -1);
3386 : 1 : g_assert_cmpint (g_array_index (array_, gint, 1), ==, 0);
3387 : 1 : g_assert_cmpint (g_array_index (array_, gint, 2), ==, 1);
3388 : 1 : g_assert_cmpint (g_array_index (array_, gint, 3), ==, 2);
3389 : 1 : }
3390 : :
3391 : : /**
3392 : : * gi_marshalling_tests_garray_uint64_none_in:
3393 : : * @array_: (element-type guint64) (transfer none):
3394 : : */
3395 : : void
3396 : 1 : gi_marshalling_tests_garray_uint64_none_in (GArray *array_)
3397 : : {
3398 : 1 : g_assert_cmpint (array_->len, ==, 2);
3399 : 1 : g_assert_cmpint (g_array_index (array_, guint64, 0), ==, 0);
3400 : 1 : g_assert_cmpint (g_array_index (array_, guint64, 1), ==, G_MAXUINT64);
3401 : 1 : }
3402 : :
3403 : : /**
3404 : : * gi_marshalling_tests_garray_utf8_none_in:
3405 : : * @array_: (element-type utf8) (transfer none):
3406 : : */
3407 : : void
3408 : 2 : gi_marshalling_tests_garray_utf8_none_in (GArray *array_)
3409 : : {
3410 : 2 : g_assert_cmpint (array_->len, ==, 3);
3411 : 2 : g_assert_cmpstr (g_array_index (array_, gchar *, 0), ==, "0");
3412 : 2 : g_assert_cmpstr (g_array_index (array_, gchar *, 1), ==, "1");
3413 : 2 : g_assert_cmpstr (g_array_index (array_, gchar *, 2), ==, "2");
3414 : 2 : }
3415 : :
3416 : : /**
3417 : : * gi_marshalling_tests_garray_utf8_container_in:
3418 : : * @array_: (element-type utf8) (transfer container):
3419 : : */
3420 : : void
3421 : 0 : gi_marshalling_tests_garray_utf8_container_in (GArray *array_)
3422 : : {
3423 : 0 : gi_marshalling_tests_garray_utf8_none_in (array_);
3424 : 0 : g_array_unref (array_);
3425 : 0 : }
3426 : :
3427 : : /**
3428 : : * gi_marshalling_tests_garray_utf8_full_in:
3429 : : * @array_: (element-type utf8) (transfer full):
3430 : : */
3431 : : void
3432 : 1 : gi_marshalling_tests_garray_utf8_full_in (GArray *array_)
3433 : : {
3434 : 1 : gi_marshalling_tests_garray_utf8_none_in (array_);
3435 [ + + ]: 4 : for (size_t ix = 0; ix < 3; ix++)
3436 [ + - ]: 3 : g_clear_pointer (&g_array_index (array_, gchar *, ix), g_free);
3437 : 1 : g_array_unref (array_);
3438 : 1 : }
3439 : :
3440 : : /**
3441 : : * gi_marshalling_tests_garray_utf8_none_out:
3442 : : * @array_: (out) (element-type utf8) (transfer none):
3443 : : */
3444 : : void
3445 : 1 : gi_marshalling_tests_garray_utf8_none_out (GArray **array_)
3446 : : {
3447 : : static GArray *internal = NULL;
3448 : : static const gchar *values[] = { "0", "1", "2", NULL };
3449 : : gint i;
3450 : :
3451 [ + - ]: 1 : if (internal == NULL)
3452 : : {
3453 : 1 : internal = g_array_new (TRUE, TRUE, sizeof (gchar *));
3454 [ + + ]: 4 : for (i = 0; values[i]; i++)
3455 : 3 : g_array_append_val (internal, values[i]);
3456 : : }
3457 : :
3458 : 1 : *array_ = internal;
3459 : 1 : }
3460 : :
3461 : : /**
3462 : : * gi_marshalling_tests_garray_utf8_none_out_uninitialized:
3463 : : * @v: (out) (element-type utf8) (transfer none):
3464 : : */
3465 : : gboolean
3466 : 1 : gi_marshalling_tests_garray_utf8_none_out_uninitialized (GArray **v G_GNUC_UNUSED)
3467 : : {
3468 : 1 : return FALSE;
3469 : : }
3470 : :
3471 : : /**
3472 : : * gi_marshalling_tests_garray_utf8_container_out:
3473 : : * @array_: (out) (element-type utf8) (transfer container):
3474 : : */
3475 : : void
3476 : 1 : gi_marshalling_tests_garray_utf8_container_out (GArray **array_)
3477 : : {
3478 : : static const gchar *values[] = { "0", "1", "2", NULL };
3479 : : gint i;
3480 : :
3481 : 1 : *array_ = NULL;
3482 : :
3483 : 1 : *array_ = g_array_new (TRUE, TRUE, sizeof (gchar *));
3484 [ + + ]: 4 : for (i = 0; values[i]; i++)
3485 : 3 : g_array_append_val (*array_, values[i]);
3486 : 1 : }
3487 : :
3488 : : /**
3489 : : * gi_marshalling_tests_garray_utf8_container_out_uninitialized:
3490 : : * @v: (out) (element-type utf8) (transfer container):
3491 : : */
3492 : : gboolean
3493 : 1 : gi_marshalling_tests_garray_utf8_container_out_uninitialized (GArray **v G_GNUC_UNUSED)
3494 : : {
3495 : 1 : return FALSE;
3496 : : }
3497 : :
3498 : : /**
3499 : : * gi_marshalling_tests_garray_utf8_full_out:
3500 : : * @array_: (out) (element-type utf8) (transfer full):
3501 : : */
3502 : : void
3503 : 1 : gi_marshalling_tests_garray_utf8_full_out (GArray **array_)
3504 : : {
3505 : : static const gchar *values[] = { "0", "1", "2", NULL };
3506 : : gint i;
3507 : :
3508 : 1 : *array_ = NULL;
3509 : :
3510 : 1 : *array_ = g_array_new (TRUE, TRUE, sizeof (gchar *));
3511 [ + + ]: 4 : for (i = 0; values[i]; i++)
3512 : : {
3513 : 3 : gchar *str = g_strdup (values[i]);
3514 : 3 : g_array_append_val (*array_, str);
3515 : : }
3516 : 1 : }
3517 : :
3518 : : /**
3519 : : * gi_marshalling_tests_garray_utf8_full_out_uninitialized:
3520 : : * @v: (out) (element-type utf8) (transfer full):
3521 : : */
3522 : : gboolean
3523 : 1 : gi_marshalling_tests_garray_utf8_full_out_uninitialized (GArray **v G_GNUC_UNUSED)
3524 : : {
3525 : 1 : return FALSE;
3526 : : }
3527 : :
3528 : : /**
3529 : : * gi_marshalling_tests_garray_utf8_full_out_caller_allocated:
3530 : : * @array_: (out caller-allocates) (array) (element-type utf8) (transfer full):
3531 : : */
3532 : : void
3533 : 0 : gi_marshalling_tests_garray_utf8_full_out_caller_allocated (GArray *array_)
3534 : : {
3535 : : static const gchar *values[] = { "0", "1", "2", NULL };
3536 : : gint i;
3537 : :
3538 : 0 : g_array_set_size (array_, 0);
3539 [ # # ]: 0 : for (i = 0; values[i]; i++)
3540 : : {
3541 : 0 : gchar *str = g_strdup (values[i]);
3542 : 0 : g_array_append_val (array_, str);
3543 : : }
3544 : 0 : }
3545 : :
3546 : : /**
3547 : : * gi_marshalling_tests_garray_utf8_none_inout:
3548 : : * @array_: (inout) (element-type utf8) (transfer none):
3549 : : */
3550 : : void
3551 : 1 : gi_marshalling_tests_garray_utf8_none_inout (GArray **array_)
3552 : : {
3553 : : static GArray *internal = NULL;
3554 : : static const gchar *values[] = { "-2", "-1", "0", "1", NULL };
3555 : : gint i;
3556 : :
3557 : 1 : g_assert_cmpint ((*array_)->len, ==, 3);
3558 : 1 : g_assert_cmpstr (g_array_index (*array_, gchar *, 0), ==, "0");
3559 : 1 : g_assert_cmpstr (g_array_index (*array_, gchar *, 1), ==, "1");
3560 : 1 : g_assert_cmpstr (g_array_index (*array_, gchar *, 2), ==, "2");
3561 : :
3562 [ + - ]: 1 : if (internal == NULL)
3563 : : {
3564 : 1 : internal = g_array_new (TRUE, TRUE, sizeof (gchar *));
3565 [ + + ]: 5 : for (i = 0; values[i]; i++)
3566 : 4 : g_array_append_val (internal, values[i]);
3567 : : }
3568 : :
3569 : 1 : *array_ = internal;
3570 : 1 : }
3571 : :
3572 : : /**
3573 : : * gi_marshalling_tests_garray_utf8_container_inout:
3574 : : * @array_: (inout) (element-type utf8) (transfer container):
3575 : : */
3576 : : void
3577 : 0 : gi_marshalling_tests_garray_utf8_container_inout (GArray **array_)
3578 : : {
3579 : : static const gchar *val1 = "-2";
3580 : : static const gchar *val2 = "-1";
3581 : : static const gchar *val3 = "0";
3582 : : static const gchar *val4 = "1";
3583 : : GArray *result;
3584 : :
3585 : 0 : g_assert_cmpint ((*array_)->len, ==, 3);
3586 : 0 : g_assert_cmpstr (g_array_index (*array_, gchar *, 0), ==, "0");
3587 : 0 : g_assert_cmpstr (g_array_index (*array_, gchar *, 1), ==, "1");
3588 : 0 : g_assert_cmpstr (g_array_index (*array_, gchar *, 2), ==, "2");
3589 : :
3590 : 0 : result = g_array_new (TRUE, TRUE, sizeof (gchar *));
3591 : 0 : g_array_append_val (result, val1);
3592 : 0 : g_array_append_val (result, val2);
3593 : 0 : g_array_append_val (result, val3);
3594 : 0 : g_array_append_val (result, val4);
3595 : :
3596 : 0 : g_array_unref (*array_);
3597 : 0 : *array_ = result;
3598 : 0 : }
3599 : :
3600 : : /**
3601 : : * gi_marshalling_tests_garray_utf8_full_inout:
3602 : : * @array_: (inout) (element-type utf8) (transfer full):
3603 : : */
3604 : : void
3605 : 0 : gi_marshalling_tests_garray_utf8_full_inout (GArray **array_)
3606 : : {
3607 : : static const gchar *val1 = "-1";
3608 : : static const gchar *val2 = "-2";
3609 : : gchar *val;
3610 : : GArray *result;
3611 : :
3612 : 0 : g_assert_cmpint ((*array_)->len, ==, 3);
3613 : 0 : g_assert_cmpstr (g_array_index (*array_, gchar *, 0), ==, "0");
3614 : 0 : g_assert_cmpstr (g_array_index (*array_, gchar *, 1), ==, "1");
3615 : 0 : g_assert_cmpstr (g_array_index (*array_, gchar *, 2), ==, "2");
3616 : :
3617 : 0 : result = g_array_new (TRUE, TRUE, sizeof (gchar *));
3618 : 0 : val = g_strdup (val2);
3619 : 0 : g_array_append_val (result, val);
3620 : 0 : val = g_strdup (val1);
3621 : 0 : g_array_append_val (result, val);
3622 : 0 : val = g_strdup ("0");
3623 : 0 : g_array_append_val (result, val);
3624 : 0 : val = g_strdup ("1");
3625 : 0 : g_array_append_val (result, val);
3626 : :
3627 : 0 : g_array_unref (*array_);
3628 : 0 : *array_ = result;
3629 : 0 : }
3630 : :
3631 : : /**
3632 : : * gi_marshalling_tests_garray_bool_none_in:
3633 : : * @array_: (element-type gboolean) (transfer none):
3634 : : */
3635 : : void
3636 : 1 : gi_marshalling_tests_garray_bool_none_in (GArray *array_)
3637 : : {
3638 : 1 : g_assert_cmpint (array_->len, ==, 4);
3639 : 1 : g_assert_cmpint (g_array_index (array_, gboolean, 0), ==, TRUE);
3640 : 1 : g_assert_cmpint (g_array_index (array_, gboolean, 1), ==, FALSE);
3641 : 1 : g_assert_cmpint (g_array_index (array_, gboolean, 2), ==, TRUE);
3642 : 1 : g_assert_cmpint (g_array_index (array_, gboolean, 3), ==, TRUE);
3643 : 1 : }
3644 : :
3645 : : /**
3646 : : * gi_marshalling_tests_garray_unichar_none_in:
3647 : : * @array_: (element-type gunichar) (transfer none):
3648 : : */
3649 : : void
3650 : 2 : gi_marshalling_tests_garray_unichar_none_in (GArray *array_)
3651 : : {
3652 : : unsigned ix;
3653 : : static const gunichar expected[] = GI_MARSHALLING_TESTS_CONSTANT_UCS4;
3654 : 2 : g_assert_cmpint (array_->len, ==, 12);
3655 [ + + ]: 26 : for (ix = 0; ix < array_->len; ix++)
3656 : 24 : g_assert_cmpuint (g_array_index (array_, gunichar, ix), ==, expected[ix]);
3657 : 2 : }
3658 : :
3659 : : /**
3660 : : * gi_marshalling_tests_gptrarray_utf8_none_return:
3661 : : *
3662 : : * Returns: (element-type utf8) (transfer none):
3663 : : */
3664 : : GPtrArray *
3665 : 1 : gi_marshalling_tests_gptrarray_utf8_none_return (void)
3666 : : {
3667 : : static GPtrArray *parray = NULL;
3668 : : static const gchar *values[] = { "0", "1", "2" };
3669 : : gint i;
3670 : :
3671 [ + - ]: 1 : if (parray == NULL)
3672 : : {
3673 : 1 : parray = g_ptr_array_new ();
3674 [ + + ]: 4 : for (i = 0; i < 3; i++)
3675 : 3 : g_ptr_array_add (parray, (gpointer) values[i]);
3676 : : }
3677 : :
3678 : 1 : return parray;
3679 : : }
3680 : :
3681 : : /**
3682 : : * gi_marshalling_tests_gptrarray_utf8_container_return:
3683 : : *
3684 : : * Returns: (element-type utf8) (transfer container):
3685 : : */
3686 : : GPtrArray *
3687 : 3 : gi_marshalling_tests_gptrarray_utf8_container_return (void)
3688 : : {
3689 : 3 : GPtrArray *parray = NULL;
3690 : : static const gchar *values[] = { "0", "1", "2", NULL };
3691 : : gint i;
3692 : :
3693 : 3 : parray = g_ptr_array_new ();
3694 [ + + ]: 12 : for (i = 0; values[i]; i++)
3695 : 9 : g_ptr_array_add (parray, (gpointer) values[i]);
3696 : :
3697 : 3 : return parray;
3698 : : }
3699 : :
3700 : : /**
3701 : : * gi_marshalling_tests_gptrarray_utf8_full_return:
3702 : : *
3703 : : * Returns: (element-type utf8) (transfer full):
3704 : : */
3705 : : GPtrArray *
3706 : 2 : gi_marshalling_tests_gptrarray_utf8_full_return (void)
3707 : : {
3708 : 2 : GPtrArray *parray = NULL;
3709 : : static const gchar *values[] = { "0", "1", "2", NULL };
3710 : : gint i;
3711 : :
3712 : 2 : parray = g_ptr_array_new ();
3713 [ + + ]: 8 : for (i = 0; values[i]; i++)
3714 : : {
3715 : 6 : gchar *str = g_strdup (values[i]);
3716 : 6 : g_ptr_array_add (parray, (gpointer) str);
3717 : : }
3718 : :
3719 : 2 : return parray;
3720 : : }
3721 : :
3722 : : /**
3723 : : * gi_marshalling_tests_gptrarray_boxed_struct_full_return:
3724 : : *
3725 : : * Returns: (element-type GIMarshallingTestsBoxedStruct) (transfer full):
3726 : : */
3727 : : GPtrArray *
3728 : 4 : gi_marshalling_tests_gptrarray_boxed_struct_full_return (void)
3729 : : {
3730 : 4 : GPtrArray *parray = NULL;
3731 : : static const glong long_values[] = { 42, 43, 44 };
3732 : : gint i;
3733 : :
3734 : 4 : parray = g_ptr_array_new ();
3735 [ + + ]: 16 : for (i = 0; i < 3; i++)
3736 : : {
3737 : 12 : GIMarshallingTestsBoxedStruct *new_struct = gi_marshalling_tests_boxed_struct_new ();
3738 : 12 : new_struct->long_ = long_values[i];
3739 : 12 : g_ptr_array_add (parray, (gpointer) new_struct);
3740 : : }
3741 : :
3742 : 4 : return parray;
3743 : : }
3744 : :
3745 : : /**
3746 : : * gi_marshalling_tests_gptrarray_utf8_none_in:
3747 : : * @parray_: (element-type utf8) (transfer none):
3748 : : */
3749 : : void
3750 : 2 : gi_marshalling_tests_gptrarray_utf8_none_in (GPtrArray *parray_)
3751 : : {
3752 : 2 : g_assert_cmpint (parray_->len, ==, 3);
3753 : 2 : g_assert_cmpstr (g_ptr_array_index (parray_, 0), ==, "0");
3754 : 2 : g_assert_cmpstr (g_ptr_array_index (parray_, 1), ==, "1");
3755 : 2 : g_assert_cmpstr (g_ptr_array_index (parray_, 2), ==, "2");
3756 : 2 : }
3757 : :
3758 : : /**
3759 : : * gi_marshalling_tests_gptrarray_utf8_container_in:
3760 : : * @parray_: (element-type utf8) (transfer container):
3761 : : */
3762 : : void
3763 : 0 : gi_marshalling_tests_gptrarray_utf8_container_in (GPtrArray *parray_)
3764 : : {
3765 : 0 : gi_marshalling_tests_gptrarray_utf8_none_in (parray_);
3766 : 0 : g_ptr_array_unref (parray_);
3767 : 0 : }
3768 : :
3769 : : /**
3770 : : * gi_marshalling_tests_gptrarray_utf8_full_in:
3771 : : * @parray_: (element-type utf8) (transfer full):
3772 : : */
3773 : : void
3774 : 1 : gi_marshalling_tests_gptrarray_utf8_full_in (GPtrArray *parray_)
3775 : : {
3776 : 1 : gi_marshalling_tests_gptrarray_utf8_none_in (parray_);
3777 [ + + ]: 4 : for (size_t ix = 0; ix < 3; ix++)
3778 [ + - ]: 3 : g_clear_pointer (&g_ptr_array_index (parray_, ix), g_free);
3779 : 1 : g_ptr_array_unref (parray_);
3780 : 1 : }
3781 : :
3782 : : /**
3783 : : * gi_marshalling_tests_gptrarray_utf8_none_out:
3784 : : * @parray_: (out) (element-type utf8) (transfer none):
3785 : : */
3786 : : void
3787 : 1 : gi_marshalling_tests_gptrarray_utf8_none_out (GPtrArray **parray_)
3788 : : {
3789 : : static GPtrArray *internal = NULL;
3790 : : static const gchar *values[] = { "0", "1", "2", NULL };
3791 : : gint i;
3792 : :
3793 [ + - ]: 1 : if (internal == NULL)
3794 : : {
3795 : 1 : internal = g_ptr_array_new ();
3796 [ + + ]: 4 : for (i = 0; values[i]; i++)
3797 : 3 : g_ptr_array_add (internal, (gpointer) values[i]);
3798 : : }
3799 : :
3800 : 1 : *parray_ = internal;
3801 : 1 : }
3802 : :
3803 : : /**
3804 : : * gi_marshalling_tests_gptrarray_utf8_none_out_uninitialized:
3805 : : * @v: (out) (element-type utf8) (transfer none):
3806 : : */
3807 : : gboolean
3808 : 1 : gi_marshalling_tests_gptrarray_utf8_none_out_uninitialized (GPtrArray **v G_GNUC_UNUSED)
3809 : : {
3810 : 1 : return FALSE;
3811 : : }
3812 : :
3813 : : /**
3814 : : * gi_marshalling_tests_gptrarray_utf8_container_out:
3815 : : * @parray_: (out) (element-type utf8) (transfer container):
3816 : : */
3817 : : void
3818 : 1 : gi_marshalling_tests_gptrarray_utf8_container_out (GPtrArray **parray_)
3819 : : {
3820 : : static const gchar *values[] = { "0", "1", "2", NULL };
3821 : : gint i;
3822 : :
3823 : 1 : *parray_ = NULL;
3824 : :
3825 : 1 : *parray_ = g_ptr_array_new ();
3826 [ + + ]: 4 : for (i = 0; values[i]; i++)
3827 : 3 : g_ptr_array_add (*parray_, (gpointer) values[i]);
3828 : 1 : }
3829 : :
3830 : : /**
3831 : : * gi_marshalling_tests_gptrarray_utf8_container_out_uninitialized:
3832 : : * @v: (out) (element-type utf8) (transfer container):
3833 : : */
3834 : : gboolean
3835 : 1 : gi_marshalling_tests_gptrarray_utf8_container_out_uninitialized (GPtrArray **v G_GNUC_UNUSED)
3836 : : {
3837 : 1 : return FALSE;
3838 : : }
3839 : :
3840 : : /**
3841 : : * gi_marshalling_tests_gptrarray_utf8_full_out:
3842 : : * @parray_: (out) (element-type utf8) (transfer full):
3843 : : */
3844 : : void
3845 : 1 : gi_marshalling_tests_gptrarray_utf8_full_out (GPtrArray **parray_)
3846 : : {
3847 : : static const gchar *values[] = { "0", "1", "2", NULL };
3848 : : gint i;
3849 : :
3850 : 1 : *parray_ = NULL;
3851 : :
3852 : 1 : *parray_ = g_ptr_array_new ();
3853 [ + + ]: 4 : for (i = 0; values[i]; i++)
3854 : : {
3855 : 3 : gchar *str = g_strdup (values[i]);
3856 : 3 : g_ptr_array_add (*parray_, (gpointer) str);
3857 : : }
3858 : 1 : }
3859 : :
3860 : : /**
3861 : : * gi_marshalling_tests_gptrarray_utf8_full_out_uninitialized:
3862 : : * @v: (out) (element-type utf8) (transfer full):
3863 : : */
3864 : : gboolean
3865 : 1 : gi_marshalling_tests_gptrarray_utf8_full_out_uninitialized (GPtrArray **v G_GNUC_UNUSED)
3866 : : {
3867 : 1 : return FALSE;
3868 : : }
3869 : :
3870 : : /**
3871 : : * gi_marshalling_tests_gptrarray_utf8_none_inout:
3872 : : * @parray_: (inout) (element-type utf8) (transfer none):
3873 : : */
3874 : : void
3875 : 1 : gi_marshalling_tests_gptrarray_utf8_none_inout (GPtrArray **parray_)
3876 : : {
3877 : : static GPtrArray *internal = NULL;
3878 : : static const gchar *values[] = { "-2", "-1", "0", "1", NULL };
3879 : : gint i;
3880 : :
3881 : 1 : g_assert_cmpint ((*parray_)->len, ==, 3);
3882 : 1 : g_assert_cmpstr (g_ptr_array_index (*parray_, 0), ==, "0");
3883 : 1 : g_assert_cmpstr (g_ptr_array_index (*parray_, 1), ==, "1");
3884 : 1 : g_assert_cmpstr (g_ptr_array_index (*parray_, 2), ==, "2");
3885 : :
3886 [ + - ]: 1 : if (internal == NULL)
3887 : : {
3888 : 1 : internal = g_ptr_array_new ();
3889 [ + + ]: 5 : for (i = 0; values[i]; i++)
3890 : 4 : g_ptr_array_add (internal, (gpointer) values[i]);
3891 : : }
3892 : :
3893 : 1 : *parray_ = internal;
3894 : 1 : }
3895 : :
3896 : : /**
3897 : : * gi_marshalling_tests_gptrarray_utf8_container_inout:
3898 : : * @parray_: (inout) (element-type utf8) (transfer container):
3899 : : */
3900 : : void
3901 : 0 : gi_marshalling_tests_gptrarray_utf8_container_inout (GPtrArray **parray_)
3902 : : {
3903 : : static const gchar *val1 = "-2";
3904 : : static const gchar *val2 = "-1";
3905 : : static const gchar *val3 = "0";
3906 : : static const gchar *val4 = "1";
3907 : : GPtrArray *result;
3908 : :
3909 : 0 : g_assert_cmpint ((*parray_)->len, ==, 3);
3910 : 0 : g_assert_cmpstr (g_ptr_array_index (*parray_, 0), ==, "0");
3911 : 0 : g_assert_cmpstr (g_ptr_array_index (*parray_, 1), ==, "1");
3912 : 0 : g_assert_cmpstr (g_ptr_array_index (*parray_, 2), ==, "2");
3913 : :
3914 : 0 : result = g_ptr_array_new ();
3915 : 0 : g_ptr_array_add (result, (gpointer) val1);
3916 : 0 : g_ptr_array_add (result, (gpointer) val2);
3917 : 0 : g_ptr_array_add (result, (gpointer) val3);
3918 : 0 : g_ptr_array_add (result, (gpointer) val4);
3919 : :
3920 : 0 : g_ptr_array_unref (*parray_);
3921 : 0 : *parray_ = result;
3922 : 0 : }
3923 : :
3924 : : /**
3925 : : * gi_marshalling_tests_gptrarray_utf8_full_inout:
3926 : : * @parray_: (inout) (element-type utf8) (transfer full):
3927 : : */
3928 : : void
3929 : 0 : gi_marshalling_tests_gptrarray_utf8_full_inout (GPtrArray **parray_)
3930 : : {
3931 : : static const gchar *val1 = "-1";
3932 : : static const gchar *val2 = "-2";
3933 : : gchar *val;
3934 : : GPtrArray *result;
3935 : :
3936 : 0 : g_assert_cmpint ((*parray_)->len, ==, 3);
3937 : 0 : g_assert_cmpstr (g_ptr_array_index (*parray_, 0), ==, "0");
3938 : 0 : g_assert_cmpstr (g_ptr_array_index (*parray_, 1), ==, "1");
3939 : 0 : g_assert_cmpstr (g_ptr_array_index (*parray_, 2), ==, "2");
3940 : :
3941 : 0 : result = g_ptr_array_new ();
3942 : 0 : val = g_strdup (val2);
3943 : 0 : g_ptr_array_add (result, (gpointer) val);
3944 : 0 : val = g_strdup (val1);
3945 : 0 : g_ptr_array_add (result, (gpointer) val);
3946 : 0 : val = g_strdup ("0");
3947 : 0 : g_ptr_array_add (result, (gpointer) val);
3948 : 0 : val = g_strdup ("1");
3949 : 0 : g_ptr_array_add (result, (gpointer) val);
3950 : :
3951 : 0 : g_ptr_array_unref (*parray_);
3952 : 0 : *parray_ = result;
3953 : 0 : }
3954 : :
3955 : : /**
3956 : : * gi_marshalling_tests_bytearray_full_return:
3957 : : *
3958 : : * Returns: (transfer full):
3959 : : */
3960 : : GByteArray *
3961 : 3 : gi_marshalling_tests_bytearray_full_return (void)
3962 : : {
3963 : 3 : GByteArray *array = NULL;
3964 : 3 : guint8 data[] = { '\0', '1', '\xFF', '3' };
3965 : :
3966 : 3 : array = g_byte_array_new ();
3967 : 3 : g_byte_array_append (array, (const guint8 *) data, G_N_ELEMENTS (data));
3968 : :
3969 : 3 : return array;
3970 : : }
3971 : :
3972 : : /**
3973 : : * gi_marshalling_tests_bytearray_none_in:
3974 : : * @v: (element-type gint8) (transfer none):
3975 : : */
3976 : : void
3977 : 4 : gi_marshalling_tests_bytearray_none_in (GByteArray *v)
3978 : : {
3979 : 4 : g_assert_cmpuint (v->len, ==, 4);
3980 : 4 : g_assert_cmpuint (g_array_index (v, unsigned char, 0), ==, 0);
3981 : 4 : g_assert_cmpuint (g_array_index (v, unsigned char, 1), ==, 49);
3982 : 4 : g_assert_cmpuint (g_array_index (v, unsigned char, 2), ==, 0xFF);
3983 : 4 : g_assert_cmpuint (g_array_index (v, unsigned char, 3), ==, 51);
3984 : 4 : }
3985 : :
3986 : : /**
3987 : : * gi_marshalling_tests_bytearray_full_out:
3988 : : * @v: (out) (transfer full):
3989 : : */
3990 : : void
3991 : 1 : gi_marshalling_tests_bytearray_full_out (GByteArray **v)
3992 : : {
3993 : 1 : *v = gi_marshalling_tests_bytearray_full_return ();
3994 : 1 : }
3995 : :
3996 : : /**
3997 : : * gi_marshalling_tests_bytearray_full_inout:
3998 : : * @v: (inout) (transfer full):
3999 : : */
4000 : : void
4001 : 1 : gi_marshalling_tests_bytearray_full_inout (GByteArray **v)
4002 : : {
4003 : 1 : gi_marshalling_tests_bytearray_none_in (*v);
4004 : 1 : g_byte_array_unref (*v);
4005 : :
4006 : 1 : guint8 data[] = { 'h', 'e', 'l', '\0', '\xFF' };
4007 : :
4008 : 1 : GByteArray *array = g_byte_array_new ();
4009 : 1 : g_byte_array_append (array, (const guint8 *) data, G_N_ELEMENTS (data));
4010 : :
4011 : 1 : *v = array;
4012 : 1 : }
4013 : :
4014 : : /**
4015 : : * gi_marshalling_tests_gbytes_full_return:
4016 : : *
4017 : : * Returns: (transfer full):
4018 : : */
4019 : : GBytes *
4020 : 2 : gi_marshalling_tests_gbytes_full_return (void)
4021 : : {
4022 : : static guint8 data[] = { 0, 49, 0xFF, 51 };
4023 : :
4024 : 2 : return g_bytes_new_static (data, G_N_ELEMENTS (data));
4025 : : }
4026 : :
4027 : : /**
4028 : : * gi_marshalling_tests_gbytes_none_in:
4029 : : */
4030 : : void
4031 : 3 : gi_marshalling_tests_gbytes_none_in (GBytes *v)
4032 : : {
4033 : : const guint8 *data;
4034 : : gsize len;
4035 : 3 : data = g_bytes_get_data (v, &len);
4036 : :
4037 : 3 : g_assert_cmpuint (len, ==, 4);
4038 : 3 : g_assert_cmpuint (data[0], ==, 0);
4039 : 3 : g_assert_cmpuint (data[1], ==, 49);
4040 : 3 : g_assert_cmpuint (data[2], ==, 0xFF);
4041 : 3 : g_assert_cmpuint (data[3], ==, 51);
4042 : 3 : }
4043 : :
4044 : : /**
4045 : : * gi_marshalling_tests_gstrv_return:
4046 : : *
4047 : : * Returns: (transfer full): an array of strings
4048 : : */
4049 : : GStrv
4050 : 1 : gi_marshalling_tests_gstrv_return (void)
4051 : : {
4052 : 1 : GStrv values = g_new0 (gchar *, 4);
4053 : 1 : values[0] = g_strdup ("0");
4054 : 1 : values[1] = g_strdup ("1");
4055 : 1 : values[2] = g_strdup ("2");
4056 : 1 : values[3] = NULL;
4057 : 1 : return values;
4058 : : }
4059 : :
4060 : : /**
4061 : : * gi_marshalling_tests_gstrv_in:
4062 : : * @g_strv:
4063 : : */
4064 : : void
4065 : 1 : gi_marshalling_tests_gstrv_in (GStrv g_strv)
4066 : : {
4067 : 1 : g_assert_cmpint (g_strv_length (g_strv), ==, 3);
4068 : 1 : g_assert_cmpstr (g_strv[0], ==, "0");
4069 : 1 : g_assert_cmpstr (g_strv[1], ==, "1");
4070 : 1 : g_assert_cmpstr (g_strv[2], ==, "2");
4071 : 1 : }
4072 : :
4073 : : /**
4074 : : * gi_marshalling_tests_gstrv_out:
4075 : : * @g_strv: (out) (transfer none):
4076 : : */
4077 : : void
4078 : 1 : gi_marshalling_tests_gstrv_out (GStrv *g_strv)
4079 : : {
4080 : : static const gchar *values[] = { "0", "1", "2", NULL };
4081 : 1 : *g_strv = (gchar **) values;
4082 : 1 : }
4083 : :
4084 : : /**
4085 : : * gi_marshalling_tests_gstrv_out_uninitialized:
4086 : : * @v: (out) (transfer none):
4087 : : */
4088 : : gboolean
4089 : 1 : gi_marshalling_tests_gstrv_out_uninitialized (GStrv *v G_GNUC_UNUSED)
4090 : : {
4091 : 1 : return FALSE;
4092 : : }
4093 : :
4094 : : /**
4095 : : * gi_marshalling_tests_gstrv_inout:
4096 : : * @g_strv: (inout) (transfer none):
4097 : : */
4098 : : void
4099 : 1 : gi_marshalling_tests_gstrv_inout (GStrv *g_strv)
4100 : : {
4101 : : static const gchar *values[] = { "-1", "0", "1", "2", NULL };
4102 : :
4103 : 1 : g_assert (g_strv_length (*g_strv) == 3);
4104 : 1 : g_assert (strcmp ((*g_strv)[0], "0") == 0);
4105 : 1 : g_assert (strcmp ((*g_strv)[1], "1") == 0);
4106 : 1 : g_assert (strcmp ((*g_strv)[2], "2") == 0);
4107 : :
4108 : 1 : *g_strv = (gchar **) values;
4109 : 1 : }
4110 : :
4111 : : /**
4112 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_full_return:
4113 : : *
4114 : : * Returns: (array length=out_length) (element-type GStrv) (transfer full):
4115 : : */
4116 : : GStrv *
4117 : 2 : gi_marshalling_tests_length_array_of_gstrv_transfer_full_return (size_t *out_length)
4118 : : {
4119 : 2 : GStrv *array = g_new0 (GStrv, 3);
4120 : : GStrv values;
4121 : :
4122 : 2 : values = g_new0 (gchar *, 4);
4123 : 2 : values[0] = g_strdup ("0");
4124 : 2 : values[1] = g_strdup ("1");
4125 : 2 : values[2] = g_strdup ("2");
4126 : 2 : values[3] = NULL;
4127 : 2 : array[0] = g_steal_pointer (&values);
4128 : :
4129 : 2 : values = g_new0 (gchar *, 4);
4130 : 2 : values[0] = g_strdup ("3");
4131 : 2 : values[1] = g_strdup ("4");
4132 : 2 : values[2] = g_strdup ("5");
4133 : 2 : values[3] = NULL;
4134 : 2 : array[1] = g_steal_pointer (&values);
4135 : :
4136 : 2 : values = g_new0 (gchar *, 4);
4137 : 2 : values[0] = g_strdup ("6");
4138 : 2 : values[1] = g_strdup ("7");
4139 : 2 : values[2] = g_strdup ("8");
4140 : 2 : values[3] = NULL;
4141 : 2 : array[2] = g_steal_pointer (&values);
4142 : :
4143 : 2 : *out_length = 3;
4144 : :
4145 : 2 : return array;
4146 : : }
4147 : :
4148 : : /**
4149 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_container_return:
4150 : : *
4151 : : * Returns: (array length=out_length) (element-type GStrv) (transfer container):
4152 : : */
4153 : : GStrv *
4154 : 2 : gi_marshalling_tests_length_array_of_gstrv_transfer_container_return (size_t *out_length)
4155 : : {
4156 : 2 : GStrv *array = g_new0 (GStrv, 3);
4157 : : static const gchar *values0[] = { "0", "1", "2", NULL };
4158 : : static const gchar *values1[] = { "3", "4", "5", NULL };
4159 : : static const gchar *values2[] = { "6", "7", "8", NULL };
4160 : :
4161 : 2 : array[0] = (GStrv) values0;
4162 : 2 : array[1] = (GStrv) values1;
4163 : 2 : array[2] = (GStrv) values2;
4164 : :
4165 : 2 : *out_length = 3;
4166 : :
4167 : 2 : return array;
4168 : : }
4169 : :
4170 : : /**
4171 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_none_return:
4172 : : *
4173 : : * Returns: (array length=out_length) (element-type GStrv) (transfer none):
4174 : : */
4175 : : GStrv *
4176 : 2 : gi_marshalling_tests_length_array_of_gstrv_transfer_none_return (size_t *out_length)
4177 : : {
4178 : : static const gchar *values0[] = { "0", "1", "2", NULL };
4179 : : static const gchar *values1[] = { "3", "4", "5", NULL };
4180 : : static const gchar *values2[] = { "6", "7", "8", NULL };
4181 : : static const gchar **array[] = { values0, values1, values2 };
4182 : :
4183 : 2 : *out_length = 3;
4184 : :
4185 : 2 : return (GStrv *) array;
4186 : : }
4187 : :
4188 : : /**
4189 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_none_in:
4190 : : * @array: (array length=length) (element-type GStrv) (transfer none):
4191 : : */
4192 : : void
4193 : 4 : gi_marshalling_tests_length_array_of_gstrv_transfer_none_in (GStrv *array, size_t length)
4194 : : {
4195 : : GStrv g_strv;
4196 : :
4197 : 4 : g_assert_cmpint (length, ==, 3);
4198 : :
4199 : 4 : g_strv = array[0];
4200 : 4 : g_assert_cmpint (g_strv_length (g_strv), ==, 3);
4201 : 4 : g_assert_cmpstr (g_strv[0], ==, "0");
4202 : 4 : g_assert_cmpstr (g_strv[1], ==, "1");
4203 : 4 : g_assert_cmpstr (g_strv[2], ==, "2");
4204 : :
4205 : 4 : g_strv = array[1];
4206 : 4 : g_assert_cmpint (g_strv_length (g_strv), ==, 3);
4207 : 4 : g_assert_cmpstr (g_strv[0], ==, "3");
4208 : 4 : g_assert_cmpstr (g_strv[1], ==, "4");
4209 : 4 : g_assert_cmpstr (g_strv[2], ==, "5");
4210 : :
4211 : 4 : g_strv = array[2];
4212 : 4 : g_assert_cmpint (g_strv_length (g_strv), ==, 3);
4213 : 4 : g_assert_cmpstr (g_strv[0], ==, "6");
4214 : 4 : g_assert_cmpstr (g_strv[1], ==, "7");
4215 : 4 : g_assert_cmpstr (g_strv[2], ==, "8");
4216 : 4 : }
4217 : :
4218 : : /**
4219 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_container_in:
4220 : : * @array: (array length=length) (element-type GStrv) (transfer container):
4221 : : */
4222 : : void
4223 : 0 : gi_marshalling_tests_length_array_of_gstrv_transfer_container_in (GStrv *array, size_t length)
4224 : : {
4225 : 0 : gi_marshalling_tests_length_array_of_gstrv_transfer_none_in (array, length);
4226 : :
4227 [ # # ]: 0 : g_clear_pointer (&array, g_free);
4228 : 0 : }
4229 : :
4230 : : /**
4231 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_full_in:
4232 : : * @array: (array length=length) (element-type GStrv) (transfer full):
4233 : : */
4234 : : void
4235 : 2 : gi_marshalling_tests_length_array_of_gstrv_transfer_full_in (GStrv *array, size_t length)
4236 : : {
4237 : 2 : gi_marshalling_tests_length_array_of_gstrv_transfer_none_in (array, length);
4238 : :
4239 [ + - ]: 2 : g_clear_pointer (&array[0], g_strfreev);
4240 [ + - ]: 2 : g_clear_pointer (&array[1], g_strfreev);
4241 [ + - ]: 2 : g_clear_pointer (&array[2], g_strfreev);
4242 : :
4243 [ + - ]: 2 : g_clear_pointer (&array, g_free);
4244 : 2 : }
4245 : :
4246 : : /**
4247 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_none_out:
4248 : : * @array_out: (array length=out_length) (out) (element-type GStrv) (transfer none):
4249 : : * @out_length: (out):
4250 : : */
4251 : : void
4252 : 1 : gi_marshalling_tests_length_array_of_gstrv_transfer_none_out (GStrv **array_out, size_t *out_length)
4253 : : {
4254 : 1 : *array_out = gi_marshalling_tests_length_array_of_gstrv_transfer_none_return (out_length);
4255 : 1 : }
4256 : :
4257 : : /**
4258 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_container_out:
4259 : : * @array_out: (array length=out_length) (out) (element-type GStrv) (transfer container):
4260 : : */
4261 : : void
4262 : 1 : gi_marshalling_tests_length_array_of_gstrv_transfer_container_out (GStrv **array_out, size_t *out_length)
4263 : : {
4264 : 1 : *array_out = gi_marshalling_tests_length_array_of_gstrv_transfer_container_return (out_length);
4265 : 1 : }
4266 : :
4267 : : /**
4268 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_full_out:
4269 : : * @array_out: (array length=out_length) (out) (element-type GStrv) (transfer full):
4270 : : */
4271 : : void
4272 : 1 : gi_marshalling_tests_length_array_of_gstrv_transfer_full_out (GStrv **array_out, size_t *out_length)
4273 : : {
4274 : 1 : *array_out = gi_marshalling_tests_length_array_of_gstrv_transfer_full_return (out_length);
4275 : 1 : }
4276 : :
4277 : : /**
4278 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_full_inout:
4279 : : * @array_inout: (array length=inout_length) (inout) (element-type GStrv) (transfer full):
4280 : : * @inout_length: (inout):
4281 : : */
4282 : : void
4283 : 1 : gi_marshalling_tests_length_array_of_gstrv_transfer_full_inout (GStrv **array_inout, size_t *inout_length)
4284 : : {
4285 : 1 : GStrv *array = g_new0 (GStrv, 4);
4286 : : GStrv values;
4287 : :
4288 : 1 : g_assert_nonnull (inout_length);
4289 : 1 : g_assert_nonnull (array_inout);
4290 : 1 : gi_marshalling_tests_length_array_of_gstrv_transfer_full_in (
4291 : 1 : g_steal_pointer (array_inout), *inout_length);
4292 : :
4293 : 1 : values = g_new0 (gchar *, 5);
4294 : 1 : values[0] = g_strdup ("-1");
4295 : 1 : values[1] = g_strdup ("0");
4296 : 1 : values[2] = g_strdup ("1");
4297 : 1 : values[3] = g_strdup ("2");
4298 : 1 : values[4] = NULL;
4299 : 1 : array[0] = g_steal_pointer (&values);
4300 : :
4301 : 1 : values = g_new0 (gchar *, 5);
4302 : 1 : values[0] = g_strdup ("-1");
4303 : 1 : values[1] = g_strdup ("3");
4304 : 1 : values[2] = g_strdup ("4");
4305 : 1 : values[3] = g_strdup ("5");
4306 : 1 : values[4] = NULL;
4307 : 1 : array[1] = g_steal_pointer (&values);
4308 : :
4309 : 1 : values = g_new0 (gchar *, 5);
4310 : 1 : values[0] = g_strdup ("-1");
4311 : 1 : values[1] = g_strdup ("6");
4312 : 1 : values[2] = g_strdup ("7");
4313 : 1 : values[3] = g_strdup ("8");
4314 : 1 : values[4] = NULL;
4315 : 1 : array[2] = g_steal_pointer (&values);
4316 : :
4317 : 1 : values = g_new0 (gchar *, 5);
4318 : 1 : values[0] = g_strdup ("-1");
4319 : 1 : values[1] = g_strdup ("9");
4320 : 1 : values[2] = g_strdup ("10");
4321 : 1 : values[3] = g_strdup ("11");
4322 : 1 : values[4] = NULL;
4323 : 1 : array[3] = g_steal_pointer (&values);
4324 : :
4325 : 1 : *array_inout = (GStrv *) array;
4326 : 1 : *inout_length = 4;
4327 : 1 : }
4328 : :
4329 : : /**
4330 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_none_inout:
4331 : : * @array_inout: (array length=inout_length) (inout) (element-type GStrv) (transfer none):
4332 : : * @inout_length: (inout):
4333 : : */
4334 : : void
4335 : 1 : gi_marshalling_tests_length_array_of_gstrv_transfer_none_inout (GStrv **array_inout, size_t *inout_length)
4336 : : {
4337 : : static const gchar *values0[] = { "-1", "0", "1", "2", NULL };
4338 : : static const gchar *values1[] = { "-1", "3", "4", "5", NULL };
4339 : : static const gchar *values2[] = { "-1", "6", "7", "8", NULL };
4340 : : static const gchar *values3[] = { "-1", "9", "10", "11", NULL };
4341 : : static const gchar **array[] = { values0, values1, values2, values3 };
4342 : :
4343 : 1 : g_assert_nonnull (inout_length);
4344 : 1 : gi_marshalling_tests_length_array_of_gstrv_transfer_none_in (*array_inout, *inout_length);
4345 : :
4346 : 1 : *array_inout = (GStrv *) array;
4347 : 1 : *inout_length = 4;
4348 : 1 : }
4349 : :
4350 : : /**
4351 : : * gi_marshalling_tests_length_array_of_gstrv_transfer_container_inout:
4352 : : * @array_inout: (array length=inout_length) (inout) (element-type GStrv) (transfer container):
4353 : : * @inout_length: (inout):
4354 : : */
4355 : : void
4356 : 0 : gi_marshalling_tests_length_array_of_gstrv_transfer_container_inout (GStrv **array_inout, size_t *inout_length)
4357 : : {
4358 : 0 : GStrv *array = g_new0 (GStrv, 4);
4359 : : static const gchar *values0[] = { "-1", "0", "1", "2", NULL };
4360 : : static const gchar *values1[] = { "-1", "3", "4", "5", NULL };
4361 : : static const gchar *values2[] = { "-1", "6", "7", "8", NULL };
4362 : : static const gchar *values3[] = { "-1", "9", "10", "11", NULL };
4363 : :
4364 : 0 : g_assert_nonnull (inout_length);
4365 : 0 : g_assert_nonnull (array_inout);
4366 : 0 : gi_marshalling_tests_length_array_of_gstrv_transfer_container_in (*array_inout, *inout_length);
4367 : :
4368 : 0 : array[0] = (GStrv) values0;
4369 : 0 : array[1] = (GStrv) values1;
4370 : 0 : array[2] = (GStrv) values2;
4371 : 0 : array[3] = (GStrv) values3;
4372 : :
4373 : 0 : *array_inout = (GStrv *) array;
4374 : 0 : *inout_length = 4;
4375 : 0 : }
4376 : :
4377 : : /**
4378 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_full_return:
4379 : : *
4380 : : * Returns: (array zero-terminated) (element-type GStrv) (transfer full):
4381 : : */
4382 : : GStrv *
4383 : 2 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_full_return (void)
4384 : : {
4385 : 2 : GStrv *array = g_new0 (GStrv, 4);
4386 : : GStrv values;
4387 : :
4388 : 2 : values = g_new0 (gchar *, 4);
4389 : 2 : values[0] = g_strdup ("0");
4390 : 2 : values[1] = g_strdup ("1");
4391 : 2 : values[2] = g_strdup ("2");
4392 : 2 : values[3] = NULL;
4393 : 2 : array[0] = g_steal_pointer (&values);
4394 : :
4395 : 2 : values = g_new0 (gchar *, 4);
4396 : 2 : values[0] = g_strdup ("3");
4397 : 2 : values[1] = g_strdup ("4");
4398 : 2 : values[2] = g_strdup ("5");
4399 : 2 : values[3] = NULL;
4400 : 2 : array[1] = g_steal_pointer (&values);
4401 : :
4402 : 2 : values = g_new0 (gchar *, 4);
4403 : 2 : values[0] = g_strdup ("6");
4404 : 2 : values[1] = g_strdup ("7");
4405 : 2 : values[2] = g_strdup ("8");
4406 : 2 : values[3] = NULL;
4407 : 2 : array[2] = g_steal_pointer (&values);
4408 : :
4409 : 2 : return array;
4410 : : }
4411 : :
4412 : : /**
4413 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_container_return:
4414 : : *
4415 : : * Returns: (array zero-terminated) (element-type GStrv) (transfer container):
4416 : : */
4417 : : GStrv *
4418 : 2 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_container_return (void)
4419 : : {
4420 : 2 : GStrv *array = g_new0 (GStrv, 4);
4421 : : static const gchar *values0[] = { "0", "1", "2", NULL };
4422 : : static const gchar *values1[] = { "3", "4", "5", NULL };
4423 : : static const gchar *values2[] = { "6", "7", "8", NULL };
4424 : :
4425 : 2 : array[0] = (GStrv) values0;
4426 : 2 : array[1] = (GStrv) values1;
4427 : 2 : array[2] = (GStrv) values2;
4428 : 2 : array[3] = NULL;
4429 : :
4430 : 2 : return array;
4431 : : }
4432 : :
4433 : : /**
4434 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_return:
4435 : : *
4436 : : * Returns: (array zero-terminated) (element-type GStrv) (transfer none):
4437 : : */
4438 : : GStrv *
4439 : 2 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_return (void)
4440 : : {
4441 : : static const gchar *values0[] = { "0", "1", "2", NULL };
4442 : : static const gchar *values1[] = { "3", "4", "5", NULL };
4443 : : static const gchar *values2[] = { "6", "7", "8", NULL };
4444 : : static const gchar **array[] = { values0, values1, values2, NULL };
4445 : :
4446 : 2 : return (GStrv *) array;
4447 : : }
4448 : :
4449 : : /**
4450 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_full_return:
4451 : : *
4452 : : * Returns: (array fixed-size=3) (element-type GStrv) (transfer full):
4453 : : */
4454 : : GStrv *
4455 : 2 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_full_return (void)
4456 : : {
4457 : 2 : GStrv *array = g_new0 (GStrv, 3);
4458 : : GStrv values;
4459 : :
4460 : 2 : values = g_new0 (gchar *, 4);
4461 : 2 : values[0] = g_strdup ("0");
4462 : 2 : values[1] = g_strdup ("1");
4463 : 2 : values[2] = g_strdup ("2");
4464 : 2 : values[3] = NULL;
4465 : 2 : array[0] = g_steal_pointer (&values);
4466 : :
4467 : 2 : values = g_new0 (gchar *, 4);
4468 : 2 : values[0] = g_strdup ("3");
4469 : 2 : values[1] = g_strdup ("4");
4470 : 2 : values[2] = g_strdup ("5");
4471 : 2 : values[3] = NULL;
4472 : 2 : array[1] = g_steal_pointer (&values);
4473 : :
4474 : 2 : values = g_new0 (gchar *, 4);
4475 : 2 : values[0] = g_strdup ("6");
4476 : 2 : values[1] = g_strdup ("7");
4477 : 2 : values[2] = g_strdup ("8");
4478 : 2 : values[3] = NULL;
4479 : 2 : array[2] = g_steal_pointer (&values);
4480 : :
4481 : 2 : return array;
4482 : : }
4483 : :
4484 : : /**
4485 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_in:
4486 : : * @array: (array zero-terminated) (element-type GStrv) (transfer none):
4487 : : */
4488 : : void
4489 : 4 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_in (GStrv *array)
4490 : : {
4491 : : GStrv g_strv;
4492 : :
4493 : 4 : g_strv = array[0];
4494 : 4 : g_assert_cmpint (g_strv_length (g_strv), ==, 3);
4495 : 4 : g_assert_cmpstr (g_strv[0], ==, "0");
4496 : 4 : g_assert_cmpstr (g_strv[1], ==, "1");
4497 : 4 : g_assert_cmpstr (g_strv[2], ==, "2");
4498 : :
4499 : 4 : g_strv = array[1];
4500 : 4 : g_assert_cmpint (g_strv_length (g_strv), ==, 3);
4501 : 4 : g_assert_cmpstr (g_strv[0], ==, "3");
4502 : 4 : g_assert_cmpstr (g_strv[1], ==, "4");
4503 : 4 : g_assert_cmpstr (g_strv[2], ==, "5");
4504 : :
4505 : 4 : g_strv = array[2];
4506 : 4 : g_assert_cmpint (g_strv_length (g_strv), ==, 3);
4507 : 4 : g_assert_cmpstr (g_strv[0], ==, "6");
4508 : 4 : g_assert_cmpstr (g_strv[1], ==, "7");
4509 : 4 : g_assert_cmpstr (g_strv[2], ==, "8");
4510 : :
4511 : 4 : g_assert_null (array[3]);
4512 : 4 : }
4513 : :
4514 : : /**
4515 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_container_in:
4516 : : * @array: (array zero-terminated) (element-type GStrv) (transfer container):
4517 : : */
4518 : : void
4519 : 0 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_container_in (GStrv *array)
4520 : : {
4521 : 0 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_in (array);
4522 : :
4523 [ # # ]: 0 : g_clear_pointer (&array, g_free);
4524 : 0 : }
4525 : :
4526 : : /**
4527 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_full_in:
4528 : : * @array: (array zero-terminated) (element-type GStrv) (transfer full):
4529 : : */
4530 : : void
4531 : 2 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_full_in (GStrv *array)
4532 : : {
4533 : 2 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_in (array);
4534 : :
4535 [ + - + + ]: 8 : for (int i = 0; array && array[i] != NULL; i++)
4536 [ + - ]: 6 : g_clear_pointer (&array[i], g_strfreev);
4537 : :
4538 [ + - ]: 2 : g_clear_pointer (&array, g_free);
4539 : 2 : }
4540 : :
4541 : : /**
4542 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_out:
4543 : : * @array_out: (array zero-terminated) (out) (element-type GStrv) (transfer none):
4544 : : */
4545 : : void
4546 : 1 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_out (GStrv **array_out)
4547 : : {
4548 : 1 : *array_out = gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_return ();
4549 : 1 : }
4550 : :
4551 : : /**
4552 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_container_out:
4553 : : * @array_out: (array zero-terminated) (out) (element-type GStrv) (transfer container):
4554 : : */
4555 : : void
4556 : 1 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_container_out (GStrv **array_out)
4557 : : {
4558 : 1 : *array_out = gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_container_return ();
4559 : 1 : }
4560 : :
4561 : : /**
4562 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_full_out:
4563 : : * @array_out: (array zero-terminated) (out) (element-type GStrv) (transfer full):
4564 : : */
4565 : : void
4566 : 1 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_full_out (GStrv **array_out)
4567 : : {
4568 : 1 : *array_out = gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_full_return ();
4569 : 1 : }
4570 : :
4571 : : /**
4572 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_full_inout:
4573 : : * @array_inout: (array zero-terminated) (inout) (element-type GStrv) (transfer full):
4574 : : */
4575 : : void
4576 : 1 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_full_inout (GStrv **array_inout)
4577 : : {
4578 : 1 : GStrv *array = g_new0 (GStrv, 5);
4579 : : GStrv values;
4580 : :
4581 : 1 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_full_in (
4582 : 1 : g_steal_pointer (array_inout));
4583 : :
4584 : 1 : values = g_new0 (gchar *, 5);
4585 : 1 : values[0] = g_strdup ("-1");
4586 : 1 : values[1] = g_strdup ("0");
4587 : 1 : values[2] = g_strdup ("1");
4588 : 1 : values[3] = g_strdup ("2");
4589 : 1 : values[4] = NULL;
4590 : 1 : array[0] = g_steal_pointer (&values);
4591 : :
4592 : 1 : values = g_new0 (gchar *, 5);
4593 : 1 : values[0] = g_strdup ("-1");
4594 : 1 : values[1] = g_strdup ("3");
4595 : 1 : values[2] = g_strdup ("4");
4596 : 1 : values[3] = g_strdup ("5");
4597 : 1 : values[4] = NULL;
4598 : 1 : array[1] = g_steal_pointer (&values);
4599 : :
4600 : 1 : values = g_new0 (gchar *, 5);
4601 : 1 : values[0] = g_strdup ("-1");
4602 : 1 : values[1] = g_strdup ("6");
4603 : 1 : values[2] = g_strdup ("7");
4604 : 1 : values[3] = g_strdup ("8");
4605 : 1 : values[4] = NULL;
4606 : 1 : array[2] = g_steal_pointer (&values);
4607 : :
4608 : 1 : values = g_new0 (gchar *, 5);
4609 : 1 : values[0] = g_strdup ("-1");
4610 : 1 : values[1] = g_strdup ("9");
4611 : 1 : values[2] = g_strdup ("10");
4612 : 1 : values[3] = g_strdup ("11");
4613 : 1 : values[4] = NULL;
4614 : 1 : array[3] = g_steal_pointer (&values);
4615 : :
4616 : 1 : *array_inout = (GStrv *) array;
4617 : 1 : }
4618 : :
4619 : : /**
4620 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_inout:
4621 : : * @array_inout: (array zero-terminated) (inout) (element-type GStrv) (transfer none):
4622 : : */
4623 : : void
4624 : 1 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_inout (GStrv **array_inout)
4625 : : {
4626 : : static const gchar *values0[] = { "-1", "0", "1", "2", NULL };
4627 : : static const gchar *values1[] = { "-1", "3", "4", "5", NULL };
4628 : : static const gchar *values2[] = { "-1", "6", "7", "8", NULL };
4629 : : static const gchar *values3[] = { "-1", "9", "10", "11", NULL };
4630 : : static const gchar **array[] = { values0, values1, values2, values3, NULL };
4631 : :
4632 : 1 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_none_in (*array_inout);
4633 : :
4634 : 1 : *array_inout = (GStrv *) array;
4635 : 1 : }
4636 : :
4637 : : /**
4638 : : * gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_container_inout:
4639 : : * @array_inout: (array zero-terminated) (inout) (element-type GStrv) (transfer container):
4640 : : */
4641 : : void
4642 : 0 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_container_inout (GStrv **array_inout)
4643 : : {
4644 : 0 : GStrv *array = g_new0 (GStrv, 4);
4645 : :
4646 : : static const gchar *values0[] = { "-1", "0", "1", "2", NULL };
4647 : : static const gchar *values1[] = { "-1", "3", "4", "5", NULL };
4648 : : static const gchar *values2[] = { "-1", "6", "7", "8", NULL };
4649 : : static const gchar *values3[] = { "-1", "9", "10", "11", NULL };
4650 : :
4651 : 0 : gi_marshalling_tests_zero_terminated_array_of_gstrv_transfer_container_in (*array_inout);
4652 : :
4653 : 0 : array[0] = (GStrv) values0;
4654 : 0 : array[1] = (GStrv) values1;
4655 : 0 : array[2] = (GStrv) values2;
4656 : 0 : array[3] = (GStrv) values3;
4657 : :
4658 : 0 : *array_inout = (GStrv *) array;
4659 : 0 : }
4660 : :
4661 : : /**
4662 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_container_return:
4663 : : *
4664 : : * Returns: (array fixed-size=3) (element-type GStrv) (transfer container):
4665 : : */
4666 : : GStrv *
4667 : 2 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_container_return (void)
4668 : : {
4669 : 2 : GStrv *array = g_new0 (GStrv, 3);
4670 : : static const gchar *values0[] = { "0", "1", "2", NULL };
4671 : : static const gchar *values1[] = { "3", "4", "5", NULL };
4672 : : static const gchar *values2[] = { "6", "7", "8", NULL };
4673 : :
4674 : 2 : array[0] = (GStrv) values0;
4675 : 2 : array[1] = (GStrv) values1;
4676 : 2 : array[2] = (GStrv) values2;
4677 : :
4678 : 2 : return array;
4679 : : }
4680 : :
4681 : : /**
4682 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_return:
4683 : : *
4684 : : * Returns: (array fixed-size=3) (element-type GStrv) (transfer none):
4685 : : */
4686 : : GStrv *
4687 : 2 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_return (void)
4688 : : {
4689 : : static const gchar *values0[] = { "0", "1", "2", NULL };
4690 : : static const gchar *values1[] = { "3", "4", "5", NULL };
4691 : : static const gchar *values2[] = { "6", "7", "8", NULL };
4692 : : static const gchar **array[] = { values0, values1, values2 };
4693 : :
4694 : 2 : return (GStrv *) array;
4695 : : }
4696 : :
4697 : : /**
4698 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_in:
4699 : : * @array: (array fixed-size=3) (element-type GStrv) (transfer none):
4700 : : */
4701 : : void
4702 : 4 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_in (GStrv *array)
4703 : : {
4704 : : GStrv g_strv;
4705 : :
4706 : 4 : g_strv = array[0];
4707 : 4 : g_assert_cmpint (g_strv_length (g_strv), ==, 3);
4708 : 4 : g_assert_cmpstr (g_strv[0], ==, "0");
4709 : 4 : g_assert_cmpstr (g_strv[1], ==, "1");
4710 : 4 : g_assert_cmpstr (g_strv[2], ==, "2");
4711 : :
4712 : 4 : g_strv = array[1];
4713 : 4 : g_assert_cmpint (g_strv_length (g_strv), ==, 3);
4714 : 4 : g_assert_cmpstr (g_strv[0], ==, "3");
4715 : 4 : g_assert_cmpstr (g_strv[1], ==, "4");
4716 : 4 : g_assert_cmpstr (g_strv[2], ==, "5");
4717 : :
4718 : 4 : g_strv = array[2];
4719 : 4 : g_assert_cmpint (g_strv_length (g_strv), ==, 3);
4720 : 4 : g_assert_cmpstr (g_strv[0], ==, "6");
4721 : 4 : g_assert_cmpstr (g_strv[1], ==, "7");
4722 : 4 : g_assert_cmpstr (g_strv[2], ==, "8");
4723 : 4 : }
4724 : :
4725 : : /**
4726 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_container_in:
4727 : : * @array: (array fixed-size=3) (element-type GStrv) (transfer container):
4728 : : */
4729 : : void
4730 : 0 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_container_in (GStrv *array)
4731 : : {
4732 : 0 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_in (array);
4733 : :
4734 [ # # ]: 0 : g_clear_pointer (&array, g_free);
4735 : 0 : }
4736 : :
4737 : : /**
4738 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_full_in:
4739 : : * @array: (array fixed-size=3) (element-type GStrv) (transfer full):
4740 : : */
4741 : : void
4742 : 2 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_full_in (GStrv *array)
4743 : : {
4744 : 2 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_in (array);
4745 : :
4746 [ + - ]: 2 : g_clear_pointer (&array[0], g_strfreev);
4747 [ + - ]: 2 : g_clear_pointer (&array[1], g_strfreev);
4748 [ + - ]: 2 : g_clear_pointer (&array[2], g_strfreev);
4749 : :
4750 [ + - ]: 2 : g_clear_pointer (&array, g_free);
4751 : 2 : }
4752 : :
4753 : : /**
4754 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_out:
4755 : : * @array_out: (array fixed-size=3) (out) (element-type GStrv) (transfer none):
4756 : : */
4757 : : void
4758 : 1 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_out (GStrv **array_out)
4759 : : {
4760 : 1 : *array_out = gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_return ();
4761 : 1 : }
4762 : :
4763 : : /**
4764 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_container_out:
4765 : : * @array_out: (array fixed-size=3) (out) (element-type GStrv) (transfer container):
4766 : : */
4767 : : void
4768 : 1 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_container_out (GStrv **array_out)
4769 : : {
4770 : 1 : *array_out = gi_marshalling_tests_fixed_array_of_gstrv_transfer_container_return ();
4771 : 1 : }
4772 : :
4773 : : /**
4774 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_full_out:
4775 : : * @array_out: (array fixed-size=3) (out) (element-type GStrv) (transfer full):
4776 : : */
4777 : : void
4778 : 1 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_full_out (GStrv **array_out)
4779 : : {
4780 : 1 : *array_out = gi_marshalling_tests_fixed_array_of_gstrv_transfer_full_return ();
4781 : 1 : }
4782 : :
4783 : : /**
4784 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_full_inout:
4785 : : * @array_inout: (array fixed-size=3) (inout) (element-type GStrv) (transfer full):
4786 : : */
4787 : : void
4788 : 1 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_full_inout (GStrv **array_inout)
4789 : : {
4790 : 1 : GStrv *array = g_new0 (GStrv, 3);
4791 : : GStrv values;
4792 : :
4793 : 1 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_full_in (
4794 : 1 : g_steal_pointer (array_inout));
4795 : :
4796 : 1 : values = g_new0 (gchar *, 5);
4797 : 1 : values[0] = g_strdup ("-1");
4798 : 1 : values[1] = g_strdup ("0");
4799 : 1 : values[2] = g_strdup ("1");
4800 : 1 : values[3] = g_strdup ("2");
4801 : 1 : values[4] = NULL;
4802 : 1 : array[0] = g_steal_pointer (&values);
4803 : :
4804 : 1 : values = g_new0 (gchar *, 5);
4805 : 1 : values[0] = g_strdup ("-1");
4806 : 1 : values[1] = g_strdup ("3");
4807 : 1 : values[2] = g_strdup ("4");
4808 : 1 : values[3] = g_strdup ("5");
4809 : 1 : values[4] = NULL;
4810 : 1 : array[1] = g_steal_pointer (&values);
4811 : :
4812 : 1 : values = g_new0 (gchar *, 5);
4813 : 1 : values[0] = g_strdup ("-1");
4814 : 1 : values[1] = g_strdup ("6");
4815 : 1 : values[2] = g_strdup ("7");
4816 : 1 : values[3] = g_strdup ("8");
4817 : 1 : values[4] = NULL;
4818 : 1 : array[2] = g_steal_pointer (&values);
4819 : :
4820 : 1 : *array_inout = (GStrv *) array;
4821 : 1 : }
4822 : :
4823 : : /**
4824 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_inout:
4825 : : * @array_inout: (array fixed-size=3) (inout) (element-type GStrv) (transfer none):
4826 : : */
4827 : : void
4828 : 1 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_inout (GStrv **array_inout)
4829 : : {
4830 : : static const gchar *values0[] = { "-1", "0", "1", "2", NULL };
4831 : : static const gchar *values1[] = { "-1", "3", "4", "5", NULL };
4832 : : static const gchar *values2[] = { "-1", "6", "7", "8", NULL };
4833 : : static const gchar **array[] = { values0, values1, values2 };
4834 : :
4835 : 1 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_none_in (*array_inout);
4836 : :
4837 : 1 : *array_inout = (GStrv *) array;
4838 : 1 : }
4839 : :
4840 : : /**
4841 : : * gi_marshalling_tests_fixed_array_of_gstrv_transfer_container_inout:
4842 : : * @array_inout: (array fixed-size=3) (inout) (element-type GStrv) (transfer container):
4843 : : */
4844 : : void
4845 : 0 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_container_inout (GStrv **array_inout)
4846 : : {
4847 : 0 : GStrv *array = g_new0 (GStrv, 3);
4848 : : static const gchar *values0[] = { "-1", "0", "1", "2", NULL };
4849 : : static const gchar *values1[] = { "-1", "3", "4", "5", NULL };
4850 : : static const gchar *values2[] = { "-1", "6", "7", "8", NULL };
4851 : :
4852 : 0 : gi_marshalling_tests_fixed_array_of_gstrv_transfer_container_in (*array_inout);
4853 : :
4854 : 0 : array[0] = (GStrv) values0;
4855 : 0 : array[1] = (GStrv) values1;
4856 : 0 : array[2] = (GStrv) values2;
4857 : :
4858 : 0 : *array_inout = (GStrv *) array;
4859 : 0 : }
4860 : :
4861 : : /**
4862 : : * gi_marshalling_tests_glist_int_none_return:
4863 : : *
4864 : : * Returns: (element-type gint) (transfer none):
4865 : : */
4866 : : GList *
4867 : 1 : gi_marshalling_tests_glist_int_none_return (void)
4868 : : {
4869 : : static GList *list = NULL;
4870 : :
4871 [ + - ]: 1 : if (list == NULL)
4872 : : {
4873 : 1 : list = g_list_append (list, GINT_TO_POINTER (-1));
4874 : 1 : list = g_list_append (list, GINT_TO_POINTER (0));
4875 : 1 : list = g_list_append (list, GINT_TO_POINTER (1));
4876 : 1 : list = g_list_append (list, GINT_TO_POINTER (2));
4877 : : }
4878 : :
4879 : 1 : return list;
4880 : : }
4881 : :
4882 : : /**
4883 : : * gi_marshalling_tests_glist_uint32_none_return:
4884 : : *
4885 : : * Returns: (element-type guint32) (transfer none):
4886 : : */
4887 : : GList *
4888 : 1 : gi_marshalling_tests_glist_uint32_none_return (void)
4889 : : {
4890 : : static GList *list = NULL;
4891 : :
4892 [ + - ]: 1 : if (list == NULL)
4893 : : {
4894 : 1 : list = g_list_append (list, GUINT_TO_POINTER (0));
4895 : 1 : list = g_list_append (list, GUINT_TO_POINTER (G_MAXUINT32));
4896 : : }
4897 : :
4898 : 1 : return list;
4899 : : }
4900 : :
4901 : : /**
4902 : : * gi_marshalling_tests_glist_utf8_none_return:
4903 : : *
4904 : : * Returns: (element-type utf8) (transfer none):
4905 : : */
4906 : : GList *
4907 : 1 : gi_marshalling_tests_glist_utf8_none_return (void)
4908 : : {
4909 : : static GList *list = NULL;
4910 : :
4911 [ + - ]: 1 : if (list == NULL)
4912 : : {
4913 : 1 : list = g_list_append (list, (gpointer) "0");
4914 : 1 : list = g_list_append (list, (gpointer) "1");
4915 : 1 : list = g_list_append (list, (gpointer) "2");
4916 : : }
4917 : :
4918 : 1 : return list;
4919 : : }
4920 : :
4921 : : /**
4922 : : * gi_marshalling_tests_glist_utf8_container_return:
4923 : : *
4924 : : * Returns: (element-type utf8) (transfer container):
4925 : : */
4926 : : GList *
4927 : 1 : gi_marshalling_tests_glist_utf8_container_return (void)
4928 : : {
4929 : 1 : GList *list = NULL;
4930 : :
4931 : 1 : list = g_list_append (list, (gpointer) "0");
4932 : 1 : list = g_list_append (list, (gpointer) "1");
4933 : 1 : list = g_list_append (list, (gpointer) "2");
4934 : :
4935 : 1 : return list;
4936 : : }
4937 : :
4938 : : /**
4939 : : * gi_marshalling_tests_glist_utf8_full_return:
4940 : : *
4941 : : * Returns: (element-type utf8) (transfer full):
4942 : : */
4943 : : GList *
4944 : 1 : gi_marshalling_tests_glist_utf8_full_return (void)
4945 : : {
4946 : 1 : GList *list = NULL;
4947 : :
4948 : 1 : list = g_list_append (list, g_strdup ("0"));
4949 : 1 : list = g_list_append (list, g_strdup ("1"));
4950 : 1 : list = g_list_append (list, g_strdup ("2"));
4951 : :
4952 : 1 : return list;
4953 : : }
4954 : :
4955 : : /**
4956 : : * gi_marshalling_tests_glist_int_none_in:
4957 : : * @list: (element-type gint) (transfer none):
4958 : : */
4959 : : void
4960 : 1 : gi_marshalling_tests_glist_int_none_in (GList *list)
4961 : : {
4962 : 1 : g_assert_cmpint (g_list_length (list), ==, 4);
4963 : 1 : g_assert_cmpint (GPOINTER_TO_INT (g_list_nth_data (list, 0)), ==, -1);
4964 : 1 : g_assert_cmpint (GPOINTER_TO_INT (g_list_nth_data (list, 1)), ==, 0);
4965 : 1 : g_assert_cmpint (GPOINTER_TO_INT (g_list_nth_data (list, 2)), ==, 1);
4966 : 1 : g_assert_cmpint (GPOINTER_TO_INT (g_list_nth_data (list, 3)), ==, 2);
4967 : 1 : }
4968 : :
4969 : : /**
4970 : : * gi_marshalling_tests_glist_uint32_none_in:
4971 : : * @list: (element-type guint32) (transfer none):
4972 : : */
4973 : : void
4974 : 1 : gi_marshalling_tests_glist_uint32_none_in (GList *list)
4975 : : {
4976 : 1 : g_assert_cmpint (g_list_length (list), ==, 2);
4977 : 1 : g_assert_cmpint (GPOINTER_TO_UINT (g_list_nth_data (list, 0)), ==, 0);
4978 : 1 : g_assert_cmpint (GPOINTER_TO_UINT (g_list_nth_data (list, 1)), ==, G_MAXUINT32);
4979 : 1 : }
4980 : :
4981 : : /**
4982 : : * gi_marshalling_tests_glist_utf8_none_in:
4983 : : * @list: (element-type utf8) (transfer none):
4984 : : */
4985 : : void
4986 : 2 : gi_marshalling_tests_glist_utf8_none_in (GList *list)
4987 : : {
4988 : 2 : g_assert_cmpint (g_list_length (list), ==, 3);
4989 : 2 : g_assert_cmpint (strcmp (g_list_nth_data (list, 0), "0"), ==, 0);
4990 : 2 : g_assert_cmpint (strcmp (g_list_nth_data (list, 1), "1"), ==, 0);
4991 : 2 : g_assert_cmpint (strcmp (g_list_nth_data (list, 2), "2"), ==, 0);
4992 : 2 : }
4993 : :
4994 : : /**
4995 : : * gi_marshalling_tests_glist_utf8_container_in:
4996 : : * @list: (element-type utf8) (transfer container):
4997 : : */
4998 : : void
4999 : 0 : gi_marshalling_tests_glist_utf8_container_in (GList *list)
5000 : : {
5001 : 0 : gi_marshalling_tests_glist_utf8_none_in (list);
5002 : 0 : g_list_free (list);
5003 : 0 : }
5004 : :
5005 : : /**
5006 : : * gi_marshalling_tests_glist_utf8_full_in:
5007 : : * @list: (element-type utf8) (transfer full):
5008 : : */
5009 : : void
5010 : 1 : gi_marshalling_tests_glist_utf8_full_in (GList *list)
5011 : : {
5012 : 1 : gi_marshalling_tests_glist_utf8_none_in (list);
5013 : 1 : g_list_free_full (list, g_free);
5014 : 1 : }
5015 : :
5016 : : /**
5017 : : * gi_marshalling_tests_glist_utf8_none_out:
5018 : : * @list: (out) (element-type utf8) (transfer none):
5019 : : */
5020 : : void
5021 : 1 : gi_marshalling_tests_glist_utf8_none_out (GList **list)
5022 : : {
5023 : : static GList *values = NULL;
5024 : :
5025 [ + - ]: 1 : if (values == NULL)
5026 : : {
5027 : 1 : values = g_list_append (values, (gpointer) "0");
5028 : 1 : values = g_list_append (values, (gpointer) "1");
5029 : 1 : values = g_list_append (values, (gpointer) "2");
5030 : : }
5031 : :
5032 : 1 : *list = values;
5033 : 1 : }
5034 : :
5035 : : /**
5036 : : * gi_marshalling_tests_glist_utf8_none_out_uninitialized:
5037 : : * @v: (out) (element-type utf8) (transfer none):
5038 : : */
5039 : : gboolean
5040 : 1 : gi_marshalling_tests_glist_utf8_none_out_uninitialized (GList **v G_GNUC_UNUSED)
5041 : : {
5042 : 1 : return FALSE;
5043 : : }
5044 : :
5045 : : /**
5046 : : * gi_marshalling_tests_glist_utf8_container_out:
5047 : : * @list: (out) (element-type utf8) (transfer container):
5048 : : */
5049 : : void
5050 : 1 : gi_marshalling_tests_glist_utf8_container_out (GList **list)
5051 : : {
5052 : 1 : *list = NULL;
5053 : :
5054 : 1 : *list = g_list_append (*list, (gpointer) "0");
5055 : 1 : *list = g_list_append (*list, (gpointer) "1");
5056 : 1 : *list = g_list_append (*list, (gpointer) "2");
5057 : 1 : }
5058 : :
5059 : : /**
5060 : : * gi_marshalling_tests_glist_utf8_container_out_uninitialized:
5061 : : * @v: (out) (element-type utf8) (transfer container):
5062 : : */
5063 : : gboolean
5064 : 1 : gi_marshalling_tests_glist_utf8_container_out_uninitialized (GList **v G_GNUC_UNUSED)
5065 : : {
5066 : 1 : return FALSE;
5067 : : }
5068 : :
5069 : : /**
5070 : : * gi_marshalling_tests_glist_utf8_full_out:
5071 : : * @list: (out) (element-type utf8) (transfer full):
5072 : : */
5073 : : void
5074 : 1 : gi_marshalling_tests_glist_utf8_full_out (GList **list)
5075 : : {
5076 : 1 : *list = NULL;
5077 : :
5078 : 1 : *list = g_list_append (*list, g_strdup ("0"));
5079 : 1 : *list = g_list_append (*list, g_strdup ("1"));
5080 : 1 : *list = g_list_append (*list, g_strdup ("2"));
5081 : 1 : }
5082 : :
5083 : : /**
5084 : : * gi_marshalling_tests_glist_utf8_full_out_uninitialized:
5085 : : * @v: (out) (element-type utf8) (transfer full):
5086 : : */
5087 : : gboolean
5088 : 1 : gi_marshalling_tests_glist_utf8_full_out_uninitialized (GList **v G_GNUC_UNUSED)
5089 : : {
5090 : 1 : return FALSE;
5091 : : }
5092 : :
5093 : : /**
5094 : : * gi_marshalling_tests_glist_utf8_none_inout:
5095 : : * @list: (inout) (element-type utf8) (transfer none):
5096 : : */
5097 : : void
5098 : 1 : gi_marshalling_tests_glist_utf8_none_inout (GList **list)
5099 : : {
5100 : : static GList *values = NULL;
5101 : :
5102 : 1 : g_assert_cmpint (g_list_length (*list), ==, 3);
5103 : 1 : g_assert_cmpstr (g_list_nth_data (*list, 0), ==, "0");
5104 : 1 : g_assert_cmpstr (g_list_nth_data (*list, 1), ==, "1");
5105 : 1 : g_assert_cmpstr (g_list_nth_data (*list, 2), ==, "2");
5106 : :
5107 [ + - ]: 1 : if (values == NULL)
5108 : : {
5109 : 1 : values = g_list_append (values, (gpointer) "-2");
5110 : 1 : values = g_list_append (values, (gpointer) "-1");
5111 : 1 : values = g_list_append (values, (gpointer) "0");
5112 : 1 : values = g_list_append (values, (gpointer) "1");
5113 : : }
5114 : :
5115 : 1 : *list = values;
5116 : 1 : }
5117 : :
5118 : : /**
5119 : : * gi_marshalling_tests_glist_utf8_container_inout:
5120 : : * @list: (inout) (element-type utf8) (transfer container):
5121 : : */
5122 : : void
5123 : 0 : gi_marshalling_tests_glist_utf8_container_inout (GList **list)
5124 : : {
5125 : 0 : GList *result = NULL;
5126 : :
5127 : 0 : g_assert_cmpint (g_list_length (*list), ==, 3);
5128 : 0 : g_assert_cmpstr (g_list_nth_data (*list, 0), ==, "0");
5129 : 0 : g_assert_cmpstr (g_list_nth_data (*list, 1), ==, "1");
5130 : 0 : g_assert_cmpstr (g_list_nth_data (*list, 2), ==, "2");
5131 : :
5132 : 0 : result = g_list_prepend (result, (gpointer) "1");
5133 : 0 : result = g_list_prepend (result, (gpointer) "0");
5134 : 0 : result = g_list_prepend (result, (gpointer) "-1");
5135 : 0 : result = g_list_prepend (result, (gpointer) "-2");
5136 : :
5137 : 0 : g_list_free (*list);
5138 : 0 : *list = result;
5139 : 0 : }
5140 : :
5141 : : /**
5142 : : * gi_marshalling_tests_glist_utf8_full_inout:
5143 : : * @list: (inout) (element-type utf8) (transfer full):
5144 : : */
5145 : : void
5146 : 0 : gi_marshalling_tests_glist_utf8_full_inout (GList **list)
5147 : : {
5148 : 0 : GList *result = NULL;
5149 : :
5150 : 0 : g_assert_cmpint (g_list_length (*list), ==, 3);
5151 : 0 : g_assert_cmpstr (g_list_nth_data (*list, 0), ==, "0");
5152 : 0 : g_assert_cmpstr (g_list_nth_data (*list, 1), ==, "1");
5153 : 0 : g_assert_cmpstr (g_list_nth_data (*list, 2), ==, "2");
5154 : :
5155 : 0 : result = g_list_prepend (result, g_strdup ("1"));
5156 : 0 : result = g_list_prepend (result, g_strdup ("0"));
5157 : 0 : result = g_list_prepend (result, g_strdup ("-1"));
5158 : 0 : result = g_list_prepend (result, g_strdup ("-2"));
5159 : :
5160 : 0 : g_list_free_full (*list, g_free);
5161 : 0 : *list = result;
5162 : 0 : }
5163 : :
5164 : : /**
5165 : : * gi_marshalling_tests_gslist_int_none_return:
5166 : : *
5167 : : * Returns: (element-type gint) (transfer none):
5168 : : */
5169 : : GSList *
5170 : 1 : gi_marshalling_tests_gslist_int_none_return (void)
5171 : : {
5172 : : static GSList *list = NULL;
5173 : :
5174 [ + - ]: 1 : if (list == NULL)
5175 : : {
5176 : 1 : list = g_slist_prepend (list, GINT_TO_POINTER (-1));
5177 : 1 : list = g_slist_prepend (list, GINT_TO_POINTER (0));
5178 : 1 : list = g_slist_prepend (list, GINT_TO_POINTER (1));
5179 : 1 : list = g_slist_prepend (list, GINT_TO_POINTER (2));
5180 : 1 : list = g_slist_reverse (list);
5181 : : }
5182 : :
5183 : 1 : return list;
5184 : : }
5185 : :
5186 : : /**
5187 : : * gi_marshalling_tests_gslist_utf8_none_return:
5188 : : *
5189 : : * Returns: (element-type utf8) (transfer none):
5190 : : */
5191 : : GSList *
5192 : 1 : gi_marshalling_tests_gslist_utf8_none_return (void)
5193 : : {
5194 : : static GSList *list = NULL;
5195 : :
5196 [ + - ]: 1 : if (list == NULL)
5197 : : {
5198 : 1 : list = g_slist_prepend (list, (gpointer) "0");
5199 : 1 : list = g_slist_prepend (list, (gpointer) "1");
5200 : 1 : list = g_slist_prepend (list, (gpointer) "2");
5201 : 1 : list = g_slist_reverse (list);
5202 : : }
5203 : :
5204 : 1 : return list;
5205 : : }
5206 : :
5207 : : /**
5208 : : * gi_marshalling_tests_gslist_utf8_container_return:
5209 : : *
5210 : : * Returns: (element-type utf8) (transfer container):
5211 : : */
5212 : : GSList *
5213 : 1 : gi_marshalling_tests_gslist_utf8_container_return (void)
5214 : : {
5215 : 1 : GSList *list = NULL;
5216 : :
5217 : 1 : list = g_slist_prepend (list, (gpointer) "0");
5218 : 1 : list = g_slist_prepend (list, (gpointer) "1");
5219 : 1 : list = g_slist_prepend (list, (gpointer) "2");
5220 : 1 : list = g_slist_reverse (list);
5221 : :
5222 : 1 : return list;
5223 : : }
5224 : :
5225 : : /**
5226 : : * gi_marshalling_tests_gslist_utf8_full_return:
5227 : : *
5228 : : * Returns: (element-type utf8) (transfer full):
5229 : : */
5230 : : GSList *
5231 : 1 : gi_marshalling_tests_gslist_utf8_full_return (void)
5232 : : {
5233 : 1 : GSList *list = NULL;
5234 : :
5235 : 1 : list = g_slist_prepend (list, g_strdup ("0"));
5236 : 1 : list = g_slist_prepend (list, g_strdup ("1"));
5237 : 1 : list = g_slist_prepend (list, g_strdup ("2"));
5238 : 1 : list = g_slist_reverse (list);
5239 : :
5240 : 1 : return list;
5241 : : }
5242 : :
5243 : : /**
5244 : : * gi_marshalling_tests_gslist_int_none_in:
5245 : : * @list: (element-type gint) (transfer none):
5246 : : */
5247 : : void
5248 : 1 : gi_marshalling_tests_gslist_int_none_in (GSList *list)
5249 : : {
5250 : 1 : g_assert_cmpint (g_slist_length (list), ==, 4);
5251 : 1 : g_assert_cmpint (GPOINTER_TO_INT (g_slist_nth_data (list, 0)), ==, -1);
5252 : 1 : g_assert_cmpint (GPOINTER_TO_INT (g_slist_nth_data (list, 1)), ==, 0);
5253 : 1 : g_assert_cmpint (GPOINTER_TO_INT (g_slist_nth_data (list, 2)), ==, 1);
5254 : 1 : g_assert_cmpint (GPOINTER_TO_INT (g_slist_nth_data (list, 3)), ==, 2);
5255 : 1 : }
5256 : :
5257 : : /**
5258 : : * gi_marshalling_tests_gslist_utf8_none_in:
5259 : : * @list: (element-type utf8) (transfer none):
5260 : : */
5261 : : void
5262 : 2 : gi_marshalling_tests_gslist_utf8_none_in (GSList *list)
5263 : : {
5264 : 2 : g_assert_cmpint (g_slist_length (list), ==, 3);
5265 : 2 : g_assert_cmpstr (g_slist_nth_data (list, 0), ==, "0");
5266 : 2 : g_assert_cmpstr (g_slist_nth_data (list, 1), ==, "1");
5267 : 2 : g_assert_cmpstr (g_slist_nth_data (list, 2), ==, "2");
5268 : 2 : }
5269 : :
5270 : : /**
5271 : : * gi_marshalling_tests_gslist_utf8_container_in:
5272 : : * @list: (element-type utf8) (transfer container):
5273 : : */
5274 : : void
5275 : 0 : gi_marshalling_tests_gslist_utf8_container_in (GSList *list)
5276 : : {
5277 : 0 : gi_marshalling_tests_gslist_utf8_none_in (list);
5278 : 0 : g_slist_free (list);
5279 : 0 : }
5280 : :
5281 : : /**
5282 : : * gi_marshalling_tests_gslist_utf8_full_in:
5283 : : * @list: (element-type utf8) (transfer full):
5284 : : */
5285 : : void
5286 : 1 : gi_marshalling_tests_gslist_utf8_full_in (GSList *list)
5287 : : {
5288 : 1 : gi_marshalling_tests_gslist_utf8_none_in (list);
5289 : 1 : g_slist_free_full (list, g_free);
5290 : 1 : }
5291 : :
5292 : : /**
5293 : : * gi_marshalling_tests_gslist_utf8_none_out:
5294 : : * @list: (out) (element-type utf8) (transfer none):
5295 : : */
5296 : : void
5297 : 1 : gi_marshalling_tests_gslist_utf8_none_out (GSList **list)
5298 : : {
5299 : : static GSList *values = NULL;
5300 : :
5301 [ + - ]: 1 : if (values == NULL)
5302 : : {
5303 : 1 : values = g_slist_prepend (values, (gpointer) "0");
5304 : 1 : values = g_slist_prepend (values, (gpointer) "1");
5305 : 1 : values = g_slist_prepend (values, (gpointer) "2");
5306 : 1 : values = g_slist_reverse (values);
5307 : : }
5308 : :
5309 : 1 : *list = values;
5310 : 1 : }
5311 : :
5312 : : /**
5313 : : * gi_marshalling_tests_gslist_utf8_none_out_uninitialized:
5314 : : * @v: (out) (element-type utf8) (transfer none):
5315 : : */
5316 : : gboolean
5317 : 1 : gi_marshalling_tests_gslist_utf8_none_out_uninitialized (GSList **v G_GNUC_UNUSED)
5318 : : {
5319 : 1 : return FALSE;
5320 : : }
5321 : :
5322 : : /**
5323 : : * gi_marshalling_tests_gslist_utf8_container_out:
5324 : : * @list: (out) (element-type utf8) (transfer container):
5325 : : */
5326 : : void
5327 : 1 : gi_marshalling_tests_gslist_utf8_container_out (GSList **list)
5328 : : {
5329 : 1 : *list = NULL;
5330 : :
5331 : 1 : *list = g_slist_prepend (*list, (gpointer) "0");
5332 : 1 : *list = g_slist_prepend (*list, (gpointer) "1");
5333 : 1 : *list = g_slist_prepend (*list, (gpointer) "2");
5334 : 1 : *list = g_slist_reverse (*list);
5335 : 1 : }
5336 : :
5337 : : /**
5338 : : * gi_marshalling_tests_gslist_utf8_container_out_uninitialized:
5339 : : * @v: (out) (element-type utf8) (transfer container):
5340 : : */
5341 : : gboolean
5342 : 1 : gi_marshalling_tests_gslist_utf8_container_out_uninitialized (GSList **v G_GNUC_UNUSED)
5343 : : {
5344 : 1 : return FALSE;
5345 : : }
5346 : :
5347 : : /**
5348 : : * gi_marshalling_tests_gslist_utf8_full_out:
5349 : : * @list: (out) (element-type utf8) (transfer full):
5350 : : */
5351 : : void
5352 : 1 : gi_marshalling_tests_gslist_utf8_full_out (GSList **list)
5353 : : {
5354 : 1 : *list = NULL;
5355 : :
5356 : 1 : *list = g_slist_prepend (*list, g_strdup ("0"));
5357 : 1 : *list = g_slist_prepend (*list, g_strdup ("1"));
5358 : 1 : *list = g_slist_prepend (*list, g_strdup ("2"));
5359 : 1 : *list = g_slist_reverse (*list);
5360 : 1 : }
5361 : :
5362 : : /**
5363 : : * gi_marshalling_tests_gslist_utf8_full_out_uninitialized:
5364 : : * @v: (out) (element-type utf8) (transfer full):
5365 : : */
5366 : : gboolean
5367 : 1 : gi_marshalling_tests_gslist_utf8_full_out_uninitialized (GSList **v G_GNUC_UNUSED)
5368 : : {
5369 : 1 : return FALSE;
5370 : : }
5371 : :
5372 : : /**
5373 : : * gi_marshalling_tests_gslist_utf8_none_inout:
5374 : : * @list: (inout) (element-type utf8) (transfer none):
5375 : : */
5376 : : void
5377 : 1 : gi_marshalling_tests_gslist_utf8_none_inout (GSList **list)
5378 : : {
5379 : : static GSList *values = NULL;
5380 : :
5381 : 1 : g_assert_cmpint (g_slist_length (*list), ==, 3);
5382 : 1 : g_assert_cmpstr (g_slist_nth_data (*list, 0), ==, "0");
5383 : 1 : g_assert_cmpstr (g_slist_nth_data (*list, 1), ==, "1");
5384 : 1 : g_assert_cmpstr (g_slist_nth_data (*list, 2), ==, "2");
5385 : :
5386 [ + - ]: 1 : if (values == NULL)
5387 : : {
5388 : 1 : values = g_slist_prepend (values, (gpointer) "-2");
5389 : 1 : values = g_slist_prepend (values, (gpointer) "-1");
5390 : 1 : values = g_slist_prepend (values, (gpointer) "0");
5391 : 1 : values = g_slist_prepend (values, (gpointer) "1");
5392 : 1 : values = g_slist_reverse (values);
5393 : : }
5394 : :
5395 : 1 : *list = values;
5396 : 1 : }
5397 : :
5398 : : /**
5399 : : * gi_marshalling_tests_gslist_utf8_container_inout:
5400 : : * @list: (inout) (element-type utf8) (transfer container):
5401 : : */
5402 : : void
5403 : 0 : gi_marshalling_tests_gslist_utf8_container_inout (GSList **list)
5404 : : {
5405 : 0 : GSList *result = NULL;
5406 : :
5407 : 0 : g_assert_cmpint (g_slist_length (*list), ==, 3);
5408 : 0 : g_assert_cmpstr (g_slist_nth_data (*list, 0), ==, "0");
5409 : 0 : g_assert_cmpstr (g_slist_nth_data (*list, 1), ==, "1");
5410 : 0 : g_assert_cmpstr (g_slist_nth_data (*list, 2), ==, "2");
5411 : :
5412 : 0 : result = g_slist_prepend (result, (gpointer) "1");
5413 : 0 : result = g_slist_prepend (result, (gpointer) "0");
5414 : 0 : result = g_slist_prepend (result, (gpointer) "-1");
5415 : 0 : result = g_slist_prepend (result, (gpointer) "-2");
5416 : :
5417 : 0 : g_slist_free (*list);
5418 : 0 : *list = result;
5419 : 0 : }
5420 : :
5421 : : /**
5422 : : * gi_marshalling_tests_gslist_utf8_full_inout:
5423 : : * @list: (inout) (element-type utf8) (transfer full):
5424 : : */
5425 : : void
5426 : 0 : gi_marshalling_tests_gslist_utf8_full_inout (GSList **list)
5427 : : {
5428 : 0 : GSList *result = NULL;
5429 : :
5430 : 0 : g_assert_cmpint (g_slist_length (*list), ==, 3);
5431 : 0 : g_assert_cmpstr (g_slist_nth_data (*list, 0), ==, "0");
5432 : 0 : g_assert_cmpstr (g_slist_nth_data (*list, 1), ==, "1");
5433 : 0 : g_assert_cmpstr (g_slist_nth_data (*list, 2), ==, "2");
5434 : :
5435 : 0 : result = g_slist_prepend (result, g_strdup ("1"));
5436 : 0 : result = g_slist_prepend (result, g_strdup ("0"));
5437 : 0 : result = g_slist_prepend (result, g_strdup ("-1"));
5438 : 0 : result = g_slist_prepend (result, g_strdup ("-2"));
5439 : :
5440 : 0 : g_slist_free_full (*list, g_free);
5441 : 0 : *list = result;
5442 : 0 : }
5443 : :
5444 : : /**
5445 : : * gi_marshalling_tests_ghashtable_int_none_return:
5446 : : *
5447 : : * Returns: (element-type gint gint) (transfer none):
5448 : : */
5449 : : GHashTable *
5450 : 1 : gi_marshalling_tests_ghashtable_int_none_return (void)
5451 : : {
5452 : : static GHashTable *hash_table = NULL;
5453 : :
5454 [ + - ]: 1 : if (hash_table == NULL)
5455 : : {
5456 : 1 : hash_table = g_hash_table_new (NULL, NULL);
5457 : 1 : g_hash_table_insert (hash_table, GINT_TO_POINTER (-1), GINT_TO_POINTER (1));
5458 : 1 : g_hash_table_insert (hash_table, GINT_TO_POINTER (0), GINT_TO_POINTER (0));
5459 : 1 : g_hash_table_insert (hash_table, GINT_TO_POINTER (1), GINT_TO_POINTER (-1));
5460 : 1 : g_hash_table_insert (hash_table, GINT_TO_POINTER (2), GINT_TO_POINTER (-2));
5461 : : }
5462 : :
5463 : 1 : return hash_table;
5464 : : }
5465 : :
5466 : : /**
5467 : : * gi_marshalling_tests_ghashtable_utf8_none_return:
5468 : : *
5469 : : * Returns: (element-type utf8 utf8) (transfer none):
5470 : : */
5471 : : GHashTable *
5472 : 1 : gi_marshalling_tests_ghashtable_utf8_none_return (void)
5473 : : {
5474 : : static GHashTable *hash_table = NULL;
5475 : :
5476 [ + - ]: 1 : if (hash_table == NULL)
5477 : : {
5478 : 1 : hash_table = g_hash_table_new (g_str_hash, g_str_equal);
5479 : 1 : g_hash_table_insert (hash_table, (gpointer) "-1", (gpointer) "1");
5480 : 1 : g_hash_table_insert (hash_table, (gpointer) "0", (gpointer) "0");
5481 : 1 : g_hash_table_insert (hash_table, (gpointer) "1", (gpointer) "-1");
5482 : 1 : g_hash_table_insert (hash_table, (gpointer) "2", (gpointer) "-2");
5483 : : }
5484 : :
5485 : 1 : return hash_table;
5486 : : }
5487 : :
5488 : : /**
5489 : : * gi_marshalling_tests_ghashtable_utf8_container_return:
5490 : : *
5491 : : * Returns: (element-type utf8 utf8) (transfer container):
5492 : : */
5493 : : GHashTable *
5494 : 1 : gi_marshalling_tests_ghashtable_utf8_container_return (void)
5495 : : {
5496 : 1 : GHashTable *hash_table = NULL;
5497 : :
5498 : 1 : hash_table = g_hash_table_new (g_str_hash, g_str_equal);
5499 : 1 : g_hash_table_insert (hash_table, (gpointer) "-1", (gpointer) "1");
5500 : 1 : g_hash_table_insert (hash_table, (gpointer) "0", (gpointer) "0");
5501 : 1 : g_hash_table_insert (hash_table, (gpointer) "1", (gpointer) "-1");
5502 : 1 : g_hash_table_insert (hash_table, (gpointer) "2", (gpointer) "-2");
5503 : :
5504 : 1 : return hash_table;
5505 : : }
5506 : :
5507 : : /**
5508 : : * gi_marshalling_tests_ghashtable_utf8_full_return:
5509 : : *
5510 : : * Returns: (element-type utf8 utf8) (transfer full):
5511 : : */
5512 : : GHashTable *
5513 : 1 : gi_marshalling_tests_ghashtable_utf8_full_return (void)
5514 : : {
5515 : 1 : GHashTable *hash_table = NULL;
5516 : :
5517 : 1 : hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
5518 : 1 : g_hash_table_insert (hash_table, g_strdup ("-1"), g_strdup ("1"));
5519 : 1 : g_hash_table_insert (hash_table, g_strdup ("0"), g_strdup ("0"));
5520 : 1 : g_hash_table_insert (hash_table, g_strdup ("1"), g_strdup ("-1"));
5521 : 1 : g_hash_table_insert (hash_table, g_strdup ("2"), g_strdup ("-2"));
5522 : :
5523 : 1 : return hash_table;
5524 : : }
5525 : :
5526 : : /**
5527 : : * gi_marshalling_tests_ghashtable_int_none_in:
5528 : : * @hash_table: (element-type gint gint) (transfer none):
5529 : : */
5530 : : void
5531 : 2 : gi_marshalling_tests_ghashtable_int_none_in (GHashTable *hash_table)
5532 : : {
5533 : 2 : g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (-1))), ==, 1);
5534 : 2 : g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (0))), ==, 0);
5535 : 2 : g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (1))), ==, -1);
5536 : 2 : g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (2))), ==, -2);
5537 : 2 : }
5538 : :
5539 : : /**
5540 : : * gi_marshalling_tests_ghashtable_utf8_none_in:
5541 : : * @hash_table: (element-type utf8 utf8) (transfer none):
5542 : : */
5543 : : void
5544 : 2 : gi_marshalling_tests_ghashtable_utf8_none_in (GHashTable *hash_table)
5545 : : {
5546 : 2 : g_assert_cmpstr (g_hash_table_lookup (hash_table, "-1"), ==, "1");
5547 : 2 : g_assert_cmpstr (g_hash_table_lookup (hash_table, "0"), ==, "0");
5548 : 2 : g_assert_cmpstr (g_hash_table_lookup (hash_table, "1"), ==, "-1");
5549 : 2 : g_assert_cmpstr (g_hash_table_lookup (hash_table, "2"), ==, "-2");
5550 : 2 : }
5551 : :
5552 : : /**
5553 : : * gi_marshalling_tests_ghashtable_utf8_container_in:
5554 : : * @hash_table: (element-type utf8 utf8) (transfer container):
5555 : : */
5556 : : void
5557 : 0 : gi_marshalling_tests_ghashtable_utf8_container_in (GHashTable *hash_table)
5558 : : {
5559 : 0 : gi_marshalling_tests_ghashtable_utf8_none_in (hash_table);
5560 : 0 : g_hash_table_steal_all (hash_table);
5561 : 0 : g_hash_table_unref (hash_table);
5562 : 0 : }
5563 : :
5564 : : static gboolean
5565 : 4 : hash_table_free_helper (gpointer key, gpointer value, gpointer data G_GNUC_UNUSED)
5566 : : {
5567 : 4 : g_free (key);
5568 : 4 : g_free (value);
5569 : 4 : return TRUE;
5570 : : }
5571 : :
5572 : : /**
5573 : : * gi_marshalling_tests_ghashtable_utf8_full_in:
5574 : : * @hash_table: (element-type utf8 utf8) (transfer full):
5575 : : */
5576 : : void
5577 : 1 : gi_marshalling_tests_ghashtable_utf8_full_in (GHashTable *hash_table)
5578 : : {
5579 : 1 : gi_marshalling_tests_ghashtable_utf8_none_in (hash_table);
5580 : :
5581 : : /* Free the keys and values manually. Do not rely on the binding passing in a
5582 : : * GHashTable with the destroy functions set. */
5583 : 1 : g_hash_table_foreach_steal (hash_table, hash_table_free_helper, NULL);
5584 : :
5585 : 1 : g_hash_table_unref (hash_table);
5586 : 1 : }
5587 : :
5588 : : /**
5589 : : * gi_marshalling_tests_ghashtable_double_in:
5590 : : * @hash_table: (element-type utf8 double) (transfer none):
5591 : : *
5592 : : * Meant to test a value type that doesn't fit inside a pointer.
5593 : : */
5594 : : void
5595 : 1 : gi_marshalling_tests_ghashtable_double_in (GHashTable *hash_table)
5596 : : {
5597 : : double *value;
5598 : :
5599 : 1 : value = g_hash_table_lookup (hash_table, "-1");
5600 : 1 : g_assert_cmpfloat_with_epsilon (*value, -0.1, 0.01);
5601 : 1 : value = g_hash_table_lookup (hash_table, "0");
5602 : 1 : g_assert_cmpfloat (*value, ==, 0.0);
5603 : 1 : value = g_hash_table_lookup (hash_table, "1");
5604 : 1 : g_assert_cmpfloat_with_epsilon (*value, 0.1, 0.01);
5605 : 1 : value = g_hash_table_lookup (hash_table, "2");
5606 : 1 : g_assert_cmpfloat_with_epsilon (*value, 0.2, 0.01);
5607 : 1 : }
5608 : :
5609 : : /**
5610 : : * gi_marshalling_tests_ghashtable_float_in:
5611 : : * @hash_table: (element-type utf8 float) (transfer none):
5612 : : *
5613 : : * Meant to test a value type that doesn't fit inside a pointer.
5614 : : */
5615 : : void
5616 : 1 : gi_marshalling_tests_ghashtable_float_in (GHashTable *hash_table)
5617 : : {
5618 : : float *value;
5619 : :
5620 : 1 : value = g_hash_table_lookup (hash_table, "-1");
5621 : 1 : g_assert_cmpfloat_with_epsilon (*value, -0.1f, 0.01f);
5622 : 1 : value = g_hash_table_lookup (hash_table, "0");
5623 : 1 : g_assert_cmpfloat (*value, ==, 0.0f);
5624 : 1 : value = g_hash_table_lookup (hash_table, "1");
5625 : 1 : g_assert_cmpfloat_with_epsilon (*value, 0.1f, 0.01f);
5626 : 1 : value = g_hash_table_lookup (hash_table, "2");
5627 : 1 : g_assert_cmpfloat_with_epsilon (*value, 0.2f, 0.01f);
5628 : 1 : }
5629 : :
5630 : : /**
5631 : : * gi_marshalling_tests_ghashtable_int64_in:
5632 : : * @hash_table: (element-type utf8 gint64) (transfer none):
5633 : : *
5634 : : * Meant to test a value type that doesn't fit inside a pointer.
5635 : : */
5636 : : void
5637 : 1 : gi_marshalling_tests_ghashtable_int64_in (GHashTable *hash_table)
5638 : : {
5639 : : gint64 *value;
5640 : :
5641 : 1 : value = g_hash_table_lookup (hash_table, "-1");
5642 : 1 : g_assert_cmpint (*value, ==, -1);
5643 : 1 : value = g_hash_table_lookup (hash_table, "0");
5644 : 1 : g_assert_cmpint (*value, ==, 0);
5645 : 1 : value = g_hash_table_lookup (hash_table, "1");
5646 : 1 : g_assert_cmpint (*value, ==, 1);
5647 : 1 : value = g_hash_table_lookup (hash_table, "2");
5648 : 1 : g_assert_cmpint (*value, ==, (gint64) G_MAXUINT32 + 1);
5649 : 1 : }
5650 : :
5651 : : /**
5652 : : * gi_marshalling_tests_ghashtable_uint64_in:
5653 : : * @hash_table: (element-type utf8 guint64) (transfer none):
5654 : : *
5655 : : * Meant to test a value type that doesn't fit inside a pointer.
5656 : : */
5657 : : void
5658 : 1 : gi_marshalling_tests_ghashtable_uint64_in (GHashTable *hash_table)
5659 : : {
5660 : : guint64 *value;
5661 : :
5662 : 1 : value = g_hash_table_lookup (hash_table, "-1");
5663 : 1 : g_assert_cmpuint (*value, ==, (guint64) G_MAXUINT32 + 1);
5664 : 1 : value = g_hash_table_lookup (hash_table, "0");
5665 : 1 : g_assert_cmpuint (*value, ==, 0);
5666 : 1 : value = g_hash_table_lookup (hash_table, "1");
5667 : 1 : g_assert_cmpuint (*value, ==, 1);
5668 : 1 : value = g_hash_table_lookup (hash_table, "2");
5669 : 1 : g_assert_cmpuint (*value, ==, 2);
5670 : 1 : }
5671 : :
5672 : : /**
5673 : : * gi_marshalling_tests_ghashtable_utf8_none_out:
5674 : : * @hash_table: (out) (element-type utf8 utf8) (transfer none):
5675 : : */
5676 : : void
5677 : 1 : gi_marshalling_tests_ghashtable_utf8_none_out (GHashTable **hash_table)
5678 : : {
5679 : : static GHashTable *new_hash_table = NULL;
5680 : :
5681 [ + - ]: 1 : if (new_hash_table == NULL)
5682 : : {
5683 : 1 : new_hash_table = g_hash_table_new (g_str_hash, g_str_equal);
5684 : 1 : g_hash_table_insert (new_hash_table, (gpointer) "-1", (gpointer) "1");
5685 : 1 : g_hash_table_insert (new_hash_table, (gpointer) "0", (gpointer) "0");
5686 : 1 : g_hash_table_insert (new_hash_table, (gpointer) "1", (gpointer) "-1");
5687 : 1 : g_hash_table_insert (new_hash_table, (gpointer) "2", (gpointer) "-2");
5688 : : }
5689 : :
5690 : 1 : *hash_table = new_hash_table;
5691 : 1 : }
5692 : :
5693 : : /**
5694 : : * gi_marshalling_tests_ghashtable_utf8_none_out_uninitialized:
5695 : : * @v: (out) (element-type utf8 utf8) (transfer none):
5696 : : */
5697 : : gboolean
5698 : 1 : gi_marshalling_tests_ghashtable_utf8_none_out_uninitialized (GHashTable **v G_GNUC_UNUSED)
5699 : : {
5700 : 1 : return FALSE;
5701 : : }
5702 : :
5703 : : /**
5704 : : * gi_marshalling_tests_ghashtable_utf8_container_out:
5705 : : * @hash_table: (out) (element-type utf8 utf8) (transfer container):
5706 : : */
5707 : : void
5708 : 1 : gi_marshalling_tests_ghashtable_utf8_container_out (GHashTable **hash_table)
5709 : : {
5710 : 1 : *hash_table = g_hash_table_new (g_str_hash, g_str_equal);
5711 : 1 : g_hash_table_insert (*hash_table, (gpointer) "-1", (gpointer) "1");
5712 : 1 : g_hash_table_insert (*hash_table, (gpointer) "0", (gpointer) "0");
5713 : 1 : g_hash_table_insert (*hash_table, (gpointer) "1", (gpointer) "-1");
5714 : 1 : g_hash_table_insert (*hash_table, (gpointer) "2", (gpointer) "-2");
5715 : 1 : }
5716 : :
5717 : : /**
5718 : : * gi_marshalling_tests_ghashtable_utf8_container_out_uninitialized:
5719 : : * @v: (out) (element-type utf8 utf8) (transfer container):
5720 : : */
5721 : : gboolean
5722 : 1 : gi_marshalling_tests_ghashtable_utf8_container_out_uninitialized (GHashTable **v G_GNUC_UNUSED)
5723 : : {
5724 : 1 : return FALSE;
5725 : : }
5726 : :
5727 : : /**
5728 : : * gi_marshalling_tests_ghashtable_utf8_full_out:
5729 : : * @hash_table: (out) (element-type utf8 utf8) (transfer full):
5730 : : */
5731 : : void
5732 : 1 : gi_marshalling_tests_ghashtable_utf8_full_out (GHashTable **hash_table)
5733 : : {
5734 : 1 : *hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
5735 : 1 : g_hash_table_insert (*hash_table, g_strdup ("-1"), g_strdup ("1"));
5736 : 1 : g_hash_table_insert (*hash_table, g_strdup ("0"), g_strdup ("0"));
5737 : 1 : g_hash_table_insert (*hash_table, g_strdup ("1"), g_strdup ("-1"));
5738 : 1 : g_hash_table_insert (*hash_table, g_strdup ("2"), g_strdup ("-2"));
5739 : 1 : }
5740 : :
5741 : : /**
5742 : : * gi_marshalling_tests_ghashtable_utf8_full_out_uninitialized:
5743 : : * @v: (out) (element-type utf8 utf8) (transfer full):
5744 : : */
5745 : : gboolean
5746 : 1 : gi_marshalling_tests_ghashtable_utf8_full_out_uninitialized (GHashTable **v G_GNUC_UNUSED)
5747 : : {
5748 : 1 : return FALSE;
5749 : : }
5750 : :
5751 : : /**
5752 : : * gi_marshalling_tests_ghashtable_utf8_none_inout:
5753 : : * @hash_table: (inout) (element-type utf8 utf8) (transfer none):
5754 : : */
5755 : : void
5756 : 1 : gi_marshalling_tests_ghashtable_utf8_none_inout (GHashTable **hash_table)
5757 : : {
5758 : : static GHashTable *new_hash_table = NULL;
5759 : :
5760 : 1 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "-1"), ==, "1");
5761 : 1 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "0"), ==, "0");
5762 : 1 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "1"), ==, "-1");
5763 : 1 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "2"), ==, "-2");
5764 : :
5765 [ + - ]: 1 : if (new_hash_table == NULL)
5766 : : {
5767 : 1 : new_hash_table = g_hash_table_new (g_str_hash, g_str_equal);
5768 : 1 : g_hash_table_insert (new_hash_table, (gpointer) "-1", (gpointer) "1");
5769 : 1 : g_hash_table_insert (new_hash_table, (gpointer) "0", (gpointer) "0");
5770 : 1 : g_hash_table_insert (new_hash_table, (gpointer) "1", (gpointer) "1");
5771 : : }
5772 : :
5773 : 1 : *hash_table = new_hash_table;
5774 : 1 : }
5775 : :
5776 : : /**
5777 : : * gi_marshalling_tests_ghashtable_utf8_container_inout:
5778 : : * @hash_table: (inout) (element-type utf8 utf8) (transfer container):
5779 : : */
5780 : : void
5781 : 0 : gi_marshalling_tests_ghashtable_utf8_container_inout (GHashTable **hash_table)
5782 : : {
5783 : 0 : GHashTable *result = g_hash_table_new (g_str_hash, g_str_equal);
5784 : :
5785 : 0 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "-1"), ==, "1");
5786 : 0 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "0"), ==, "0");
5787 : 0 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "1"), ==, "-1");
5788 : 0 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "2"), ==, "-2");
5789 : :
5790 : 0 : g_hash_table_insert (result, (gpointer) "-1", (gpointer) "1");
5791 : 0 : g_hash_table_insert (result, (gpointer) "0", (gpointer) "0");
5792 : 0 : g_hash_table_insert (result, (gpointer) "1", (gpointer) "1");
5793 : :
5794 : 0 : g_hash_table_unref (*hash_table);
5795 : 0 : *hash_table = result;
5796 : 0 : }
5797 : :
5798 : : /**
5799 : : * gi_marshalling_tests_ghashtable_utf8_full_inout:
5800 : : * @hash_table: (inout) (element-type utf8 utf8) (transfer full):
5801 : : */
5802 : : void
5803 : 0 : gi_marshalling_tests_ghashtable_utf8_full_inout (GHashTable **hash_table)
5804 : : {
5805 : 0 : GHashTable *result = g_hash_table_new_full (g_str_hash, g_str_equal,
5806 : : g_free, g_free);
5807 : :
5808 : 0 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "-1"), ==, "1");
5809 : 0 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "0"), ==, "0");
5810 : 0 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "1"), ==, "-1");
5811 : 0 : g_assert_cmpstr (g_hash_table_lookup (*hash_table, "2"), ==, "-2");
5812 : :
5813 : 0 : g_hash_table_insert (result, g_strdup ("-1"), g_strdup ("1"));
5814 : 0 : g_hash_table_insert (result, g_strdup ("0"), g_strdup ("0"));
5815 : 0 : g_hash_table_insert (result, g_strdup ("1"), g_strdup ("1"));
5816 : :
5817 : 0 : g_hash_table_unref (*hash_table);
5818 : 0 : *hash_table = result;
5819 : 0 : }
5820 : :
5821 : : /**
5822 : : * gi_marshalling_tests_gvalue_return:
5823 : : *
5824 : : * Returns: (transfer none):
5825 : : */
5826 : : GValue *
5827 : 1 : gi_marshalling_tests_gvalue_return (void)
5828 : : {
5829 : : static GValue *value = NULL;
5830 : :
5831 [ + - ]: 1 : if (value == NULL)
5832 : : {
5833 : 1 : value = g_new0 (GValue, 1);
5834 : 1 : g_value_init (value, G_TYPE_INT);
5835 : 1 : g_value_set_int (value, 42);
5836 : : }
5837 : :
5838 : 1 : return value;
5839 : : }
5840 : :
5841 : : /**
5842 : : * gi_marshalling_tests_gvalue_noncanonical_nan_float:
5843 : : *
5844 : : * Returns: (transfer none):
5845 : : */
5846 : : GValue *
5847 : 1 : gi_marshalling_tests_gvalue_noncanonical_nan_float (void)
5848 : : {
5849 : : static GValue *value = NULL;
5850 : :
5851 [ + - ]: 1 : if (value == NULL)
5852 : : {
5853 : 1 : value = g_new0 (GValue, 1);
5854 : 1 : g_value_init (value, G_TYPE_FLOAT);
5855 : 1 : g_value_set_float (value, noncanonical_nan_float ());
5856 : : }
5857 : :
5858 : 1 : return value;
5859 : : }
5860 : :
5861 : : /**
5862 : : * gi_marshalling_tests_gvalue_noncanonical_nan_double:
5863 : : *
5864 : : * Returns: (transfer none):
5865 : : */
5866 : : GValue *
5867 : 1 : gi_marshalling_tests_gvalue_noncanonical_nan_double (void)
5868 : : {
5869 : : static GValue *value = NULL;
5870 : :
5871 [ + - ]: 1 : if (value == NULL)
5872 : : {
5873 : 1 : value = g_new0 (GValue, 1);
5874 : 1 : g_value_init (value, G_TYPE_DOUBLE);
5875 : 1 : g_value_set_double (value, noncanonical_nan_double ());
5876 : : }
5877 : :
5878 : 1 : return value;
5879 : : }
5880 : :
5881 : : /**
5882 : : * gi_marshalling_tests_gvalue_in:
5883 : : * @value: (transfer none):
5884 : : */
5885 : : void
5886 : 1 : gi_marshalling_tests_gvalue_in (GValue *value)
5887 : : {
5888 : 1 : g_assert_cmpint (g_value_get_int (value), ==, 42);
5889 : 1 : }
5890 : :
5891 : : /**
5892 : : * gi_marshalling_tests_gvalue_int64_in:
5893 : : * @value: (transfer none):
5894 : : */
5895 : : void
5896 : 1 : gi_marshalling_tests_gvalue_int64_in (GValue *value)
5897 : : {
5898 : 1 : g_assert_cmpint (g_value_get_int64 (value), ==, G_MAXINT64);
5899 : 1 : }
5900 : :
5901 : : /**
5902 : : * gi_marshalling_tests_gvalue_in_with_type:
5903 : : * @value: (transfer none):
5904 : : * @type:
5905 : : */
5906 : : void
5907 : 22 : gi_marshalling_tests_gvalue_in_with_type (GValue *value, GType type)
5908 : : {
5909 : 22 : g_assert (g_type_is_a (G_VALUE_TYPE (value), type));
5910 : 22 : }
5911 : :
5912 : : /**
5913 : : * gi_marshalling_tests_gvalue_in_with_modification:
5914 : : * @value: (transfer none):
5915 : : *
5916 : : * Expects a GValue passed by reference which is then modified by
5917 : : * this function.
5918 : : */
5919 : : void
5920 : 2 : gi_marshalling_tests_gvalue_in_with_modification (GValue *value)
5921 : : {
5922 : 2 : g_assert_cmpint (g_value_get_int (value), ==, 42);
5923 : 2 : g_value_set_int (value, 24);
5924 : 2 : }
5925 : :
5926 : : /**
5927 : : * gi_marshalling_tests_gvalue_in_enum:
5928 : : * @value: (transfer none):
5929 : : */
5930 : : void
5931 : 1 : gi_marshalling_tests_gvalue_in_enum (GValue *value)
5932 : : {
5933 [ - + + - : 1 : if (!G_VALUE_HOLDS_ENUM (value))
- + ]
5934 : 0 : g_critical ("Expected enum, got %s", G_VALUE_TYPE_NAME (value));
5935 : 1 : g_assert (g_value_get_enum (value) == GI_MARSHALLING_TESTS_ENUM_VALUE3);
5936 : 1 : }
5937 : :
5938 : : /**
5939 : : * gi_marshalling_tests_gvalue_in_flags:
5940 : : * @value: (transfer none):
5941 : : */
5942 : : void
5943 : 1 : gi_marshalling_tests_gvalue_in_flags (GValue *value)
5944 : : {
5945 [ - + - + : 1 : if (!G_VALUE_HOLDS_FLAGS (value))
- + ]
5946 : 0 : g_critical ("Expected flags, got %s", G_VALUE_TYPE_NAME (value));
5947 : 1 : g_assert_cmpint (g_value_get_flags (value), ==, GI_MARSHALLING_TESTS_FLAGS_VALUE3);
5948 : 1 : }
5949 : :
5950 : : /**
5951 : : * gi_marshalling_tests_gvalue_out:
5952 : : * @value: (out) (transfer none):
5953 : : */
5954 : : void
5955 : 1 : gi_marshalling_tests_gvalue_out (GValue **value)
5956 : : {
5957 : : static GValue *new_value = NULL;
5958 : :
5959 [ + - ]: 1 : if (new_value == NULL)
5960 : : {
5961 : 1 : new_value = g_new0 (GValue, 1);
5962 : 1 : g_value_init (new_value, G_TYPE_INT);
5963 : 1 : g_value_set_int (new_value, 42);
5964 : : }
5965 : :
5966 : 1 : *value = new_value;
5967 : 1 : }
5968 : :
5969 : : /**
5970 : : * gi_marshalling_tests_gvalue_out_uninitialized:
5971 : : * @v: (out) (transfer none):
5972 : : */
5973 : : gboolean
5974 : 1 : gi_marshalling_tests_gvalue_out_uninitialized (GValue **v G_GNUC_UNUSED)
5975 : : {
5976 : 1 : return FALSE;
5977 : : }
5978 : :
5979 : : /**
5980 : : * gi_marshalling_tests_gvalue_int64_out:
5981 : : * @value: (out) (transfer none):
5982 : : */
5983 : : void
5984 : 1 : gi_marshalling_tests_gvalue_int64_out (GValue **value)
5985 : : {
5986 : : static GValue *new_value = NULL;
5987 : :
5988 [ + - ]: 1 : if (new_value == NULL)
5989 : : {
5990 : 1 : new_value = g_new0 (GValue, 1);
5991 : 1 : g_value_init (new_value, G_TYPE_INT64);
5992 : 1 : g_value_set_int64 (new_value, G_MAXINT64);
5993 : : }
5994 : :
5995 : 1 : *value = new_value;
5996 : 1 : }
5997 : :
5998 : : /**
5999 : : * gi_marshalling_tests_gvalue_out_caller_allocates:
6000 : : * @value: (out) (transfer none):
6001 : : */
6002 : : void
6003 : 1 : gi_marshalling_tests_gvalue_out_caller_allocates (GValue *value)
6004 : : {
6005 : 1 : g_value_init (value, G_TYPE_INT);
6006 : 1 : g_value_set_int (value, 42);
6007 : 1 : }
6008 : :
6009 : : /**
6010 : : * gi_marshalling_tests_gvalue_inout:
6011 : : * @value: (inout) (transfer none):
6012 : : */
6013 : : void
6014 : 0 : gi_marshalling_tests_gvalue_inout (GValue **value)
6015 : : {
6016 : 0 : g_assert_cmpint (g_value_get_int (*value), ==, 42);
6017 : 0 : g_value_unset (*value);
6018 : 0 : g_value_init (*value, G_TYPE_STRING);
6019 : 0 : g_value_set_string (*value, "42");
6020 : 0 : }
6021 : :
6022 : : /**
6023 : : * gi_marshalling_tests_gvalue_flat_array:
6024 : : * @n_values: number of values
6025 : : * @values: (array length=n_values): an array containing values
6026 : : */
6027 : : void
6028 : 2 : gi_marshalling_tests_gvalue_flat_array (guint n_values, const GValue *values)
6029 : : {
6030 : 2 : g_assert (n_values == 3);
6031 : :
6032 : 2 : g_assert_cmpint (g_value_get_int (&values[0]), ==, 42);
6033 : 2 : g_assert_cmpstr (g_value_get_string (&values[1]), ==, "42");
6034 : 2 : g_assert_cmpint (g_value_get_boolean (&values[2]), ==, TRUE);
6035 : 2 : }
6036 : :
6037 : : /**
6038 : : * gi_marshalling_tests_return_gvalue_flat_array:
6039 : : *
6040 : : * Returns: (array fixed-size=3) (transfer full): a flat GValue array
6041 : : */
6042 : : GValue *
6043 : 1 : gi_marshalling_tests_return_gvalue_flat_array (void)
6044 : : {
6045 : 1 : GValue *array = g_new0 (GValue, 3);
6046 : :
6047 : 1 : g_value_init (&array[0], G_TYPE_INT);
6048 : 1 : g_value_set_int (&array[0], 42);
6049 : :
6050 : 1 : g_value_init (&array[1], G_TYPE_STRING);
6051 : 1 : g_value_set_static_string (&array[1], "42");
6052 : :
6053 : 1 : g_value_init (&array[2], G_TYPE_BOOLEAN);
6054 : 1 : g_value_set_boolean (&array[2], TRUE);
6055 : :
6056 : 1 : return array;
6057 : : }
6058 : :
6059 : : /**
6060 : : * gi_marshalling_tests_return_gvalue_zero_terminated_array:
6061 : : *
6062 : : * Returns: (array zero-terminated) (transfer full): a flat GValue array
6063 : : */
6064 : : GValue *
6065 : 1 : gi_marshalling_tests_return_gvalue_zero_terminated_array (void)
6066 : : {
6067 : 1 : GValue *array = g_new0 (GValue, 4);
6068 : :
6069 : 1 : g_value_init (&array[0], G_TYPE_INT);
6070 : 1 : g_value_set_int (&array[0], 42);
6071 : :
6072 : 1 : g_value_init (&array[1], G_TYPE_STRING);
6073 : 1 : g_value_set_static_string (&array[1], "42");
6074 : :
6075 : 1 : g_value_init (&array[2], G_TYPE_BOOLEAN);
6076 : 1 : g_value_set_boolean (&array[2], TRUE);
6077 : :
6078 : 1 : return array;
6079 : : }
6080 : :
6081 : : /**
6082 : : * gi_marshalling_tests_gvalue_round_trip:
6083 : : * @value: The first GValue
6084 : : *
6085 : : * Returns: (transfer none):
6086 : : */
6087 : : GValue *
6088 : 79 : gi_marshalling_tests_gvalue_round_trip (GValue *value)
6089 : : {
6090 : 79 : return value;
6091 : : }
6092 : :
6093 : : /**
6094 : : * gi_marshalling_tests_gvalue_copy:
6095 : : * @value: The first GValue
6096 : : *
6097 : : * Returns: (transfer full):
6098 : : */
6099 : : GValue *
6100 : 46 : gi_marshalling_tests_gvalue_copy (GValue *value)
6101 : : {
6102 : 46 : GValue *return_value = g_new0 (GValue, 1);
6103 : :
6104 : 46 : g_value_init (return_value, G_VALUE_TYPE (value));
6105 : 46 : g_value_copy (value, return_value);
6106 : :
6107 : 46 : return return_value;
6108 : : }
6109 : :
6110 : : /**
6111 : : * gi_marshalling_tests_gvalue_flat_array_round_trip:
6112 : : * @one: The first GValue
6113 : : * @two: The second GValue
6114 : : * @three: The third GValue
6115 : : *
6116 : : * Returns: (array fixed-size=3) (transfer full): a flat array of [@one, @two, @three]
6117 : : */
6118 : : GValue *
6119 : 0 : gi_marshalling_tests_gvalue_flat_array_round_trip (const GValue one, const GValue two, const GValue three)
6120 : : {
6121 : 0 : GValue *array = g_new (GValue, 3);
6122 : 0 : array[0] = one;
6123 : 0 : array[1] = two;
6124 : 0 : array[2] = three;
6125 : :
6126 : 0 : return array;
6127 : : }
6128 : :
6129 : : /**
6130 : : * gi_marshalling_tests_gvalue_float:
6131 : : * @float_value: A G_TYPE_FLOAT GValue
6132 : : * @double_value: A G_TYPE_DOUBLE GValue
6133 : : */
6134 : : void
6135 : 1 : gi_marshalling_tests_gvalue_float (const GValue *float_value, const GValue *double_value)
6136 : : {
6137 : 1 : g_assert_cmpfloat_with_epsilon (g_value_get_float (float_value), 3.14, 0.001);
6138 : 1 : g_assert_cmpfloat_with_epsilon (g_value_get_double (double_value), 3.14, 0.001);
6139 : 1 : }
6140 : :
6141 : : /**
6142 : : * gi_marshalling_tests_gclosure_in:
6143 : : * @closure: (transfer none):
6144 : : */
6145 : : void
6146 : 1 : gi_marshalling_tests_gclosure_in (GClosure *closure)
6147 : : {
6148 : 1 : GValue return_value = {
6149 : : 0,
6150 : : };
6151 : :
6152 : 1 : g_value_init (&return_value, G_TYPE_INT);
6153 : :
6154 : 1 : g_closure_invoke (closure, &return_value, 0, NULL, NULL);
6155 : :
6156 : 1 : g_assert_cmpint (g_value_get_int (&return_value), ==, 42);
6157 : :
6158 : 1 : g_value_unset (&return_value);
6159 : 1 : }
6160 : :
6161 : : static gint
6162 : 0 : _closure_return_42 (void)
6163 : : {
6164 : 0 : return 42;
6165 : : }
6166 : :
6167 : : static void
6168 : 0 : _marshal_INT__VOID (GClosure *closure,
6169 : : GValue *return_value,
6170 : : guint n_param_values G_GNUC_UNUSED,
6171 : : const GValue *param_values G_GNUC_UNUSED,
6172 : : gpointer invocation_hint G_GNUC_UNUSED,
6173 : : gpointer marshal_data G_GNUC_UNUSED)
6174 : : {
6175 : : typedef gint (*GMarshalFunc_INT__VOID) (void);
6176 : : register GMarshalFunc_INT__VOID callback;
6177 : 0 : register GCClosure *cc = (GCClosure *) closure;
6178 : :
6179 : 0 : callback = (GMarshalFunc_INT__VOID) cc->callback;
6180 : 0 : g_value_set_int (return_value, callback ());
6181 : 0 : }
6182 : :
6183 : : /**
6184 : : * gi_marshalling_tests_gclosure_return:
6185 : : *
6186 : : * Return: a #GClosure
6187 : : */
6188 : : GClosure *
6189 : 0 : gi_marshalling_tests_gclosure_return (void)
6190 : : {
6191 : 0 : GClosure *closure = g_cclosure_new ((GCallback) _closure_return_42,
6192 : : NULL, NULL);
6193 : 0 : g_closure_set_marshal (closure, _marshal_INT__VOID);
6194 : :
6195 : 0 : return closure;
6196 : : }
6197 : :
6198 : : /**
6199 : : * gi_marshalling_tests_callback_return_value_only:
6200 : : * @callback: (scope call):
6201 : : */
6202 : : glong
6203 : 1 : gi_marshalling_tests_callback_return_value_only (GIMarshallingTestsCallbackReturnValueOnly callback)
6204 : : {
6205 : 1 : return callback ();
6206 : : }
6207 : :
6208 : : /**
6209 : : * gi_marshalling_tests_callback_one_out_parameter:
6210 : : * @callback: (scope call):
6211 : : * @a: (out):
6212 : : */
6213 : : void
6214 : 1 : gi_marshalling_tests_callback_one_out_parameter (GIMarshallingTestsCallbackOneOutParameter callback, gfloat *a)
6215 : : {
6216 : 1 : callback (a);
6217 : 1 : }
6218 : :
6219 : : /**
6220 : : * gi_marshalling_tests_callback_multiple_out_parameters:
6221 : : * @callback: (scope call):
6222 : : * @a: (out):
6223 : : * @b: (out):
6224 : : */
6225 : : void
6226 : 1 : gi_marshalling_tests_callback_multiple_out_parameters (GIMarshallingTestsCallbackMultipleOutParameters callback, gfloat *a, gfloat *b)
6227 : : {
6228 : 1 : callback (a, b);
6229 : 1 : }
6230 : :
6231 : : /**
6232 : : * gi_marshalling_tests_callback_return_value_and_one_out_parameter:
6233 : : * @callback: (scope call):
6234 : : * @a: (out):
6235 : : */
6236 : : glong
6237 : 1 : gi_marshalling_tests_callback_return_value_and_one_out_parameter (GIMarshallingTestsCallbackReturnValueAndOneOutParameter callback, glong *a)
6238 : : {
6239 : 1 : return callback (a);
6240 : : }
6241 : :
6242 : : /**
6243 : : * gi_marshalling_tests_callback_return_value_and_multiple_out_parameters:
6244 : : * @callback: (scope call):
6245 : : * @a: (out):
6246 : : * @b: (out):
6247 : : */
6248 : : glong
6249 : 1 : gi_marshalling_tests_callback_return_value_and_multiple_out_parameters (GIMarshallingTestsCallbackReturnValueAndMultipleOutParameters callback, glong *a, glong *b)
6250 : : {
6251 : 1 : return callback (a, b);
6252 : : }
6253 : :
6254 : : /**
6255 : : * gi_marshalling_tests_pointer_in_return:
6256 : : *
6257 : : * Returns: The same pointer
6258 : : */
6259 : : gpointer
6260 : 2 : gi_marshalling_tests_pointer_in_return (gpointer pointer)
6261 : : {
6262 : 2 : return pointer;
6263 : : }
6264 : :
6265 : : GType
6266 : 20 : gi_marshalling_tests_genum_get_type (void)
6267 : : {
6268 : : static GType type = 0;
6269 [ + + ]: 20 : if (G_UNLIKELY (type == 0))
6270 : : {
6271 : : static const GEnumValue values[] = {
6272 : : { GI_MARSHALLING_TESTS_GENUM_VALUE1,
6273 : : "GI_MARSHALLING_TESTS_GENUM_VALUE1", "value1" },
6274 : : { GI_MARSHALLING_TESTS_GENUM_VALUE2,
6275 : : "GI_MARSHALLING_TESTS_GENUM_VALUE2", "value2" },
6276 : : { GI_MARSHALLING_TESTS_GENUM_VALUE3,
6277 : : "GI_MARSHALLING_TESTS_GENUM_VALUE3", "value3" },
6278 : : { 0, NULL, NULL }
6279 : : };
6280 : 3 : type = g_enum_register_static (g_intern_static_string ("GIMarshallingTestsGEnum"), values);
6281 : : }
6282 : :
6283 : 20 : return type;
6284 : : }
6285 : :
6286 : : GIMarshallingTestsGEnum
6287 : 1 : gi_marshalling_tests_genum_returnv (void)
6288 : : {
6289 : 1 : return GI_MARSHALLING_TESTS_GENUM_VALUE3;
6290 : : }
6291 : :
6292 : : void
6293 : 1 : gi_marshalling_tests_genum_in (GIMarshallingTestsGEnum v)
6294 : : {
6295 : 1 : g_assert_cmpint (v, ==, GI_MARSHALLING_TESTS_GENUM_VALUE3);
6296 : 1 : }
6297 : :
6298 : : /**
6299 : : * gi_marshalling_tests_genum_out:
6300 : : * @v: (out):
6301 : : */
6302 : : void
6303 : 1 : gi_marshalling_tests_genum_out (GIMarshallingTestsGEnum *v)
6304 : : {
6305 : 1 : *v = GI_MARSHALLING_TESTS_GENUM_VALUE3;
6306 : 1 : }
6307 : :
6308 : : /**
6309 : : * gi_marshalling_tests_genum_out_uninitialized:
6310 : : * @v: (out):
6311 : : */
6312 : : gboolean
6313 : 1 : gi_marshalling_tests_genum_out_uninitialized (GIMarshallingTestsGEnum *v G_GNUC_UNUSED)
6314 : : {
6315 : 1 : return FALSE;
6316 : : }
6317 : :
6318 : : /**
6319 : : * gi_marshalling_tests_genum_inout:
6320 : : * @v: (inout):
6321 : : */
6322 : : void
6323 : 1 : gi_marshalling_tests_genum_inout (GIMarshallingTestsGEnum *v)
6324 : : {
6325 : 1 : g_assert_cmpint (*v, ==, GI_MARSHALLING_TESTS_GENUM_VALUE3);
6326 : 1 : *v = GI_MARSHALLING_TESTS_GENUM_VALUE1;
6327 : 1 : }
6328 : :
6329 : : GIMarshallingTestsEnum
6330 : 1 : gi_marshalling_tests_enum_returnv (void)
6331 : : {
6332 : 1 : return GI_MARSHALLING_TESTS_ENUM_VALUE3;
6333 : : }
6334 : :
6335 : : void
6336 : 1 : gi_marshalling_tests_enum_in (GIMarshallingTestsEnum v)
6337 : : {
6338 : 1 : g_assert_cmpint (v, ==, GI_MARSHALLING_TESTS_ENUM_VALUE3);
6339 : 1 : }
6340 : :
6341 : : /**
6342 : : * gi_marshalling_tests_enum_out:
6343 : : * @v: (out):
6344 : : */
6345 : : void
6346 : 1 : gi_marshalling_tests_enum_out (GIMarshallingTestsEnum *v)
6347 : : {
6348 : 1 : *v = GI_MARSHALLING_TESTS_ENUM_VALUE3;
6349 : 1 : }
6350 : :
6351 : : /**
6352 : : * gi_marshalling_tests_enum_out_uninitialized:
6353 : : * @v: (out):
6354 : : */
6355 : : gboolean
6356 : 1 : gi_marshalling_tests_enum_out_uninitialized (GIMarshallingTestsEnum **v G_GNUC_UNUSED)
6357 : : {
6358 : 1 : return FALSE;
6359 : : }
6360 : :
6361 : : /**
6362 : : * gi_marshalling_tests_enum_inout:
6363 : : * @v: (inout):
6364 : : */
6365 : : void
6366 : 1 : gi_marshalling_tests_enum_inout (GIMarshallingTestsEnum *v)
6367 : : {
6368 : 1 : g_assert_cmpint (*v, ==, GI_MARSHALLING_TESTS_ENUM_VALUE3);
6369 : 1 : *v = GI_MARSHALLING_TESTS_ENUM_VALUE1;
6370 : 1 : }
6371 : :
6372 : : GType
6373 : 39 : gi_marshalling_tests_flags_get_type (void)
6374 : : {
6375 : : static GType type = 0;
6376 [ + + ]: 39 : if (G_UNLIKELY (type == 0))
6377 : : {
6378 : : static const GFlagsValue values[] = {
6379 : : { GI_MARSHALLING_TESTS_FLAGS_VALUE1,
6380 : : "GI_MARSHALLING_TESTS_FLAGS_VALUE1", "value1" },
6381 : : { GI_MARSHALLING_TESTS_FLAGS_VALUE2,
6382 : : "GI_MARSHALLING_TESTS_FLAGS_VALUE2", "value2" },
6383 : : { GI_MARSHALLING_TESTS_FLAGS_VALUE3,
6384 : : "GI_MARSHALLING_TESTS_FLAGS_VALUE3", "value3" },
6385 : : { GI_MARSHALLING_TESTS_FLAGS_MASK, "GI_MARSHALLING_TESTS_FLAGS_MASK",
6386 : : "mask" },
6387 : : { GI_MARSHALLING_TESTS_FLAGS_MASK2, "GI_MARSHALLING_TESTS_FLAGS_MASK2",
6388 : : "mask2" },
6389 : : { 0, NULL, NULL }
6390 : : };
6391 : 3 : type = g_flags_register_static (g_intern_static_string ("GIMarshallingTestsFlags"), values);
6392 : : }
6393 : :
6394 : 39 : return type;
6395 : : }
6396 : :
6397 : : GIMarshallingTestsFlags
6398 : 1 : gi_marshalling_tests_flags_returnv (void)
6399 : : {
6400 : 1 : return GI_MARSHALLING_TESTS_FLAGS_VALUE2;
6401 : : }
6402 : :
6403 : : void
6404 : 1 : gi_marshalling_tests_flags_in (GIMarshallingTestsFlags v)
6405 : : {
6406 : 1 : g_assert (v == GI_MARSHALLING_TESTS_FLAGS_VALUE2);
6407 : 1 : }
6408 : :
6409 : : void
6410 : 1 : gi_marshalling_tests_flags_in_zero (GIMarshallingTestsFlags v)
6411 : : {
6412 : 1 : g_assert (v == 0);
6413 : 1 : }
6414 : :
6415 : : /**
6416 : : * gi_marshalling_tests_flags_out:
6417 : : * @v: (out):
6418 : : */
6419 : : void
6420 : 1 : gi_marshalling_tests_flags_out (GIMarshallingTestsFlags *v)
6421 : : {
6422 : 1 : *v = GI_MARSHALLING_TESTS_FLAGS_VALUE2;
6423 : 1 : }
6424 : :
6425 : : /**
6426 : : * gi_marshalling_tests_flags_out_uninitialized:
6427 : : * @v: (out):
6428 : : */
6429 : : gboolean
6430 : 1 : gi_marshalling_tests_flags_out_uninitialized (GIMarshallingTestsFlags *v G_GNUC_UNUSED)
6431 : : {
6432 : 1 : return FALSE;
6433 : : }
6434 : :
6435 : : /**
6436 : : * gi_marshalling_tests_flags_inout:
6437 : : * @v: (inout):
6438 : : */
6439 : : void
6440 : 1 : gi_marshalling_tests_flags_inout (GIMarshallingTestsFlags *v)
6441 : : {
6442 : 1 : g_assert (*v == GI_MARSHALLING_TESTS_FLAGS_VALUE2);
6443 : 1 : *v = GI_MARSHALLING_TESTS_FLAGS_VALUE1;
6444 : 1 : }
6445 : :
6446 : : GIMarshallingTestsNoTypeFlags
6447 : 1 : gi_marshalling_tests_no_type_flags_returnv (void)
6448 : : {
6449 : 1 : return GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE2;
6450 : : }
6451 : :
6452 : : void
6453 : 1 : gi_marshalling_tests_no_type_flags_in (GIMarshallingTestsNoTypeFlags v)
6454 : : {
6455 : 1 : g_assert (v == GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE2);
6456 : 1 : }
6457 : :
6458 : : void
6459 : 1 : gi_marshalling_tests_no_type_flags_in_zero (GIMarshallingTestsNoTypeFlags v)
6460 : : {
6461 : 1 : g_assert (v == 0);
6462 : 1 : }
6463 : :
6464 : : /**
6465 : : * gi_marshalling_tests_no_type_flags_out:
6466 : : * @v: (out):
6467 : : */
6468 : : void
6469 : 1 : gi_marshalling_tests_no_type_flags_out (GIMarshallingTestsNoTypeFlags *v)
6470 : : {
6471 : 1 : *v = GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE2;
6472 : 1 : }
6473 : :
6474 : : /**
6475 : : * gi_marshalling_tests_no_type_flags_out_uninitialized:
6476 : : * @v: (out):
6477 : : */
6478 : : gboolean
6479 : 1 : gi_marshalling_tests_no_type_flags_out_uninitialized (GIMarshallingTestsNoTypeFlags **v G_GNUC_UNUSED)
6480 : : {
6481 : 1 : return FALSE;
6482 : : }
6483 : :
6484 : : /**
6485 : : * gi_marshalling_tests_no_type_flags_inout:
6486 : : * @v: (inout):
6487 : : */
6488 : : void
6489 : 1 : gi_marshalling_tests_no_type_flags_inout (GIMarshallingTestsNoTypeFlags *v)
6490 : : {
6491 : 1 : g_assert (*v == GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE2);
6492 : 1 : *v = GI_MARSHALLING_TESTS_NO_TYPE_FLAGS_VALUE1;
6493 : 1 : }
6494 : :
6495 : : /**
6496 : : * gi_marshalling_tests_simple_struct_returnv:
6497 : : *
6498 : : * Returns: (transfer none):
6499 : : */
6500 : : GIMarshallingTestsSimpleStruct *
6501 : 1 : gi_marshalling_tests_simple_struct_returnv (void)
6502 : : {
6503 : : static GIMarshallingTestsSimpleStruct *struct_ = NULL;
6504 : :
6505 [ + - ]: 1 : if (struct_ == NULL)
6506 : : {
6507 : 1 : struct_ = g_new (GIMarshallingTestsSimpleStruct, 1);
6508 : :
6509 : 1 : struct_->long_ = 6;
6510 : 1 : struct_->int8 = 7;
6511 : : }
6512 : :
6513 : 1 : return struct_;
6514 : : }
6515 : :
6516 : : /**
6517 : : * gi_marshalling_tests_simple_struct_inv:
6518 : : * @struct_: (transfer none):
6519 : : */
6520 : : void
6521 : 3 : gi_marshalling_tests_simple_struct_inv (GIMarshallingTestsSimpleStruct *struct_)
6522 : : {
6523 : 3 : g_assert_cmpint (struct_->long_, ==, 6);
6524 : 3 : g_assert_cmpint (struct_->int8, ==, 7);
6525 : 3 : }
6526 : :
6527 : : void
6528 : 1 : gi_marshalling_tests_simple_struct_method (GIMarshallingTestsSimpleStruct *struct_)
6529 : : {
6530 : 1 : g_assert_cmpint (struct_->long_, ==, 6);
6531 : 1 : g_assert_cmpint (struct_->int8, ==, 7);
6532 : 1 : }
6533 : :
6534 : : GType
6535 : 7 : gi_marshalling_tests_pointer_struct_get_type (void)
6536 : : {
6537 : : static GType type = 0;
6538 : :
6539 [ + + ]: 7 : if (type == 0)
6540 : : {
6541 : 2 : type = g_pointer_type_register_static ("GIMarshallingTestsPointerStruct");
6542 : : }
6543 : :
6544 : 7 : return type;
6545 : : }
6546 : :
6547 : : /**
6548 : : * gi_marshalling_tests_pointer_struct_returnv:
6549 : : *
6550 : : * Returns: (transfer none):
6551 : : */
6552 : : GIMarshallingTestsPointerStruct *
6553 : 1 : gi_marshalling_tests_pointer_struct_returnv (void)
6554 : : {
6555 : : static GIMarshallingTestsPointerStruct *struct_ = NULL;
6556 : :
6557 [ + - ]: 1 : if (struct_ == NULL)
6558 : : {
6559 : 1 : struct_ = g_new (GIMarshallingTestsPointerStruct, 1);
6560 : :
6561 : 1 : struct_->long_ = 42;
6562 : : }
6563 : :
6564 : 1 : return struct_;
6565 : : }
6566 : :
6567 : : /**
6568 : : * gi_marshalling_tests_pointer_struct_inv:
6569 : : * @struct_: (transfer none):
6570 : : */
6571 : : void
6572 : 2 : gi_marshalling_tests_pointer_struct_inv (GIMarshallingTestsPointerStruct *struct_)
6573 : : {
6574 : 2 : g_assert_cmpint (struct_->long_, ==, 42);
6575 : 2 : }
6576 : :
6577 : : static GIMarshallingTestsBoxedStruct *
6578 : 301 : gi_marshalling_tests_boxed_struct_copy (GIMarshallingTestsBoxedStruct *struct_)
6579 : : {
6580 : : GIMarshallingTestsBoxedStruct *new_struct;
6581 : :
6582 [ + + ]: 301 : if (struct_ == NULL)
6583 : 168 : return NULL;
6584 : :
6585 : 133 : new_struct = g_slice_new (GIMarshallingTestsBoxedStruct);
6586 : :
6587 : 133 : *new_struct = *struct_;
6588 : 133 : new_struct->string_ = g_strdup (struct_->string_);
6589 : 133 : new_struct->g_strv = g_strdupv (struct_->g_strv);
6590 : :
6591 : 133 : return new_struct;
6592 : : }
6593 : :
6594 : : static void
6595 : 395 : gi_marshalling_tests_boxed_struct_free (GIMarshallingTestsBoxedStruct *struct_)
6596 : : {
6597 [ + + ]: 395 : if (struct_ != NULL)
6598 : : {
6599 : 206 : g_free (struct_->string_);
6600 [ + + ]: 206 : g_clear_pointer (&struct_->g_strv, g_strfreev);
6601 : 206 : g_slice_free (GIMarshallingTestsBoxedStruct, struct_);
6602 : : }
6603 : 395 : }
6604 : :
6605 : : GType
6606 : 110 : gi_marshalling_tests_boxed_struct_get_type (void)
6607 : : {
6608 : : static GType type = 0;
6609 : :
6610 [ + + ]: 110 : if (type == 0)
6611 : : {
6612 : 4 : type = g_boxed_type_register_static ("GIMarshallingTestsBoxedStruct",
6613 : : (GBoxedCopyFunc)
6614 : : gi_marshalling_tests_boxed_struct_copy,
6615 : : (GBoxedFreeFunc) gi_marshalling_tests_boxed_struct_free);
6616 : : }
6617 : :
6618 : 110 : return type;
6619 : : }
6620 : :
6621 : : static GType
6622 : 5 : gi_marshalling_tests_boxed_glist_get_type (void)
6623 : : {
6624 : : static GType type = 0;
6625 : :
6626 [ + + ]: 5 : if (type == 0)
6627 : : {
6628 : 3 : type = g_boxed_type_register_static ("GIMarshallingTestsBoxedGList",
6629 : : (GBoxedCopyFunc) g_list_copy, (GBoxedFreeFunc) g_list_free);
6630 : : }
6631 : :
6632 : 5 : return type;
6633 : : }
6634 : :
6635 : : GIMarshallingTestsBoxedStruct *
6636 : 73 : gi_marshalling_tests_boxed_struct_new (void)
6637 : : {
6638 : 73 : return g_slice_new0 (GIMarshallingTestsBoxedStruct);
6639 : : }
6640 : :
6641 : : /**
6642 : : * gi_marshalling_tests_boxed_struct_returnv:
6643 : : *
6644 : : * Returns: (transfer none):
6645 : : */
6646 : : GIMarshallingTestsBoxedStruct *
6647 : 7 : gi_marshalling_tests_boxed_struct_returnv (void)
6648 : : {
6649 : : static GIMarshallingTestsBoxedStruct *struct_ = NULL;
6650 : :
6651 [ + + ]: 7 : if (struct_ == NULL)
6652 : : {
6653 : 1 : struct_ = g_new (GIMarshallingTestsBoxedStruct, 1);
6654 : :
6655 : 1 : struct_->long_ = 42;
6656 : 1 : struct_->string_ = g_strdup ("hello");
6657 : 1 : struct_->g_strv = g_new0 (gchar *, 4);
6658 : 1 : struct_->g_strv[0] = g_strdup ("0");
6659 : 1 : struct_->g_strv[1] = g_strdup ("1");
6660 : 1 : struct_->g_strv[2] = g_strdup ("2");
6661 : 1 : struct_->g_strv[3] = NULL;
6662 : : }
6663 : :
6664 : 7 : return struct_;
6665 : : }
6666 : :
6667 : : /**
6668 : : * gi_marshalling_tests_boxed_struct_inv:
6669 : : * @struct_: (transfer none):
6670 : : */
6671 : : void
6672 : 3 : gi_marshalling_tests_boxed_struct_inv (GIMarshallingTestsBoxedStruct *struct_)
6673 : : {
6674 : 3 : g_assert_cmpint (struct_->long_, ==, 42);
6675 : 3 : }
6676 : :
6677 : : /**
6678 : : * gi_marshalling_tests_boxed_struct_out:
6679 : : * @struct_: (out) (transfer none):
6680 : : */
6681 : : void
6682 : 1 : gi_marshalling_tests_boxed_struct_out (GIMarshallingTestsBoxedStruct **struct_)
6683 : : {
6684 : : static GIMarshallingTestsBoxedStruct *new_struct = NULL;
6685 : :
6686 [ + - ]: 1 : if (new_struct == NULL)
6687 : : {
6688 : 1 : new_struct = g_new0 (GIMarshallingTestsBoxedStruct, 1);
6689 : :
6690 : 1 : new_struct->long_ = 42;
6691 : : }
6692 : :
6693 : 1 : *struct_ = new_struct;
6694 : 1 : }
6695 : :
6696 : : /**
6697 : : * gi_marshalling_tests_boxed_struct_out_uninitialized:
6698 : : * @v: (out) (transfer none):
6699 : : */
6700 : : gboolean
6701 : 1 : gi_marshalling_tests_boxed_struct_out_uninitialized (GIMarshallingTestsBoxedStruct **v G_GNUC_UNUSED)
6702 : : {
6703 : 1 : return FALSE;
6704 : : }
6705 : :
6706 : : /**
6707 : : * gi_marshalling_tests_boxed_struct_inout:
6708 : : * @struct_: (inout) (transfer full):
6709 : : */
6710 : : void
6711 : 1 : gi_marshalling_tests_boxed_struct_inout (GIMarshallingTestsBoxedStruct **struct_)
6712 : : {
6713 : 1 : g_assert_cmpint ((*struct_)->long_, ==, 42);
6714 : :
6715 : 1 : g_boxed_free (gi_marshalling_tests_boxed_struct_get_type (), *struct_);
6716 : 1 : (*struct_) = g_slice_new0 (GIMarshallingTestsBoxedStruct);
6717 : 1 : (*struct_)->long_ = 0;
6718 : 1 : }
6719 : :
6720 : : static GIMarshallingTestsUnion *
6721 : 12 : gi_marshalling_tests_union_copy (GIMarshallingTestsUnion *union_)
6722 : : {
6723 : : GIMarshallingTestsUnion *new_union;
6724 : :
6725 : 12 : new_union = g_slice_new (GIMarshallingTestsUnion);
6726 : :
6727 : 12 : *new_union = *union_;
6728 : :
6729 : 12 : return new_union;
6730 : : }
6731 : :
6732 : : static void
6733 : 12 : gi_marshalling_tests_union_free (GIMarshallingTestsUnion *union_)
6734 : : {
6735 : 12 : g_slice_free (GIMarshallingTestsUnion, union_);
6736 : 12 : }
6737 : :
6738 : : GType
6739 : 18 : gi_marshalling_tests_union_get_type (void)
6740 : : {
6741 : : static GType type = 0;
6742 : :
6743 [ + + ]: 18 : if (type == 0)
6744 : : {
6745 : 2 : type = g_boxed_type_register_static ("GIMarshallingTestsUnion",
6746 : : (GBoxedCopyFunc)
6747 : : gi_marshalling_tests_union_copy,
6748 : : (GBoxedFreeFunc) gi_marshalling_tests_union_free);
6749 : : }
6750 : :
6751 : 18 : return type;
6752 : : }
6753 : :
6754 : : /**
6755 : : * gi_marshalling_tests_union_returnv:
6756 : : *
6757 : : * Returns: (transfer none):
6758 : : */
6759 : : GIMarshallingTestsUnion *
6760 : 10 : gi_marshalling_tests_union_returnv (void)
6761 : : {
6762 : : static GIMarshallingTestsUnion *union_ = NULL;
6763 : :
6764 [ + + ]: 10 : if (union_ == NULL)
6765 : : {
6766 : 1 : union_ = g_new (GIMarshallingTestsUnion, 1);
6767 : :
6768 : 1 : union_->long_ = 42;
6769 : : }
6770 : :
6771 : 10 : return union_;
6772 : : }
6773 : :
6774 : : /**
6775 : : * gi_marshalling_tests_union_inv:
6776 : : * @union_: (transfer none):
6777 : : */
6778 : : void
6779 : 3 : gi_marshalling_tests_union_inv (GIMarshallingTestsUnion *union_)
6780 : : {
6781 : 3 : g_assert_cmpint (union_->long_, ==, 42);
6782 : 3 : }
6783 : :
6784 : : void
6785 : 2 : gi_marshalling_tests_union_method (GIMarshallingTestsUnion *union_)
6786 : : {
6787 : 2 : g_assert_cmpint (union_->long_, ==, 42);
6788 : 2 : }
6789 : :
6790 : : /**
6791 : : * gi_marshalling_tests_structured_union_new:
6792 : : * @type: Type of #GIMarshallingTestsStructuredUnion to create
6793 : : */
6794 : : GIMarshallingTestsStructuredUnion *
6795 : 35 : gi_marshalling_tests_structured_union_new (GIMarshallingTestsStructuredUnionType type)
6796 : : {
6797 : : GIMarshallingTestsStructuredUnion *new_union;
6798 : :
6799 : 35 : new_union = g_new0 (GIMarshallingTestsStructuredUnion, 1);
6800 : 35 : new_union->type = type;
6801 : :
6802 [ + + + + : 35 : switch (type)
+ + + - ]
6803 : : {
6804 : 5 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_NONE:
6805 : 5 : break;
6806 : :
6807 : 5 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_SIMPLE_STRUCT:
6808 : 5 : new_union->simple_struct.parent.long_ = 6;
6809 : 5 : new_union->simple_struct.parent.int8 = 7;
6810 : 5 : break;
6811 : :
6812 : 5 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_NESTED_STRUCT:
6813 : 5 : new_union->nested_struct.parent.simple_struct.long_ = 6;
6814 : 5 : new_union->nested_struct.parent.simple_struct.int8 = 7;
6815 : 5 : break;
6816 : :
6817 : 5 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_BOXED_STRUCT:
6818 : 5 : new_union->boxed_struct.parent.long_ = 42;
6819 : 5 : new_union->boxed_struct.parent.string_ = g_strdup ("hello");
6820 : 5 : new_union->boxed_struct.parent.g_strv = g_new0 (gchar *, 4);
6821 : 5 : new_union->boxed_struct.parent.g_strv[0] = g_strdup ("0");
6822 : 5 : new_union->boxed_struct.parent.g_strv[1] = g_strdup ("1");
6823 : 5 : new_union->boxed_struct.parent.g_strv[2] = g_strdup ("2");
6824 : 5 : new_union->boxed_struct.parent.g_strv[3] = NULL;
6825 : 5 : break;
6826 : :
6827 : 5 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_BOXED_STRUCT_PTR:
6828 : 5 : new_union->boxed_struct_ptr.parent = g_boxed_copy (
6829 : : gi_marshalling_tests_boxed_struct_get_type (),
6830 : 5 : gi_marshalling_tests_boxed_struct_returnv ());
6831 : 5 : break;
6832 : :
6833 : 5 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_POINTER_STRUCT:
6834 : 5 : new_union->pointer_struct.parent.long_ = 42;
6835 : 5 : break;
6836 : :
6837 : 5 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_SINGLE_UNION:
6838 : 5 : new_union->single_union.parent.union_.long_ = 42;
6839 : 5 : break;
6840 : :
6841 : 0 : default:
6842 : 0 : g_free (new_union);
6843 : : g_return_val_if_reached (NULL);
6844 : : }
6845 : :
6846 : 35 : return new_union;
6847 : : }
6848 : :
6849 : : static GIMarshallingTestsStructuredUnion *
6850 : 35 : gi_marshalling_tests_structured_union_copy (GIMarshallingTestsStructuredUnion *union_)
6851 : : {
6852 : : GIMarshallingTestsStructuredUnion *new_union;
6853 : :
6854 : 35 : new_union = g_new (GIMarshallingTestsStructuredUnion, 1);
6855 : 35 : *new_union = *union_;
6856 : :
6857 [ + + + - ]: 35 : switch (union_->type)
6858 : : {
6859 : 5 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_BOXED_STRUCT:
6860 : 5 : new_union->boxed_struct.parent.string_ = g_strdup (union_->boxed_struct.parent.string_);
6861 [ + - ]: 5 : if (union_->boxed_struct.parent.g_strv)
6862 : : {
6863 : 5 : guint length = g_strv_length (union_->boxed_struct.parent.g_strv);
6864 : : guint i;
6865 : :
6866 : 5 : new_union->boxed_struct.parent.g_strv = g_new0 (gchar *, length + 1);
6867 [ + + ]: 20 : for (i = 0; i < length; i++)
6868 : 30 : new_union->boxed_struct.parent.g_strv[i] = g_strdup (union_->boxed_struct.parent.g_strv[i]);
6869 : 5 : new_union->boxed_struct.parent.g_strv[i] = NULL;
6870 : : }
6871 : 5 : break;
6872 : :
6873 : 5 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_BOXED_STRUCT_PTR:
6874 : 10 : new_union->boxed_struct_ptr.parent = g_boxed_copy (
6875 : 5 : gi_marshalling_tests_boxed_struct_get_type (), union_->boxed_struct_ptr.parent);
6876 : 5 : break;
6877 : :
6878 : 25 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_NONE:
6879 : : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_SINGLE_UNION:
6880 : : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_POINTER_STRUCT:
6881 : : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_SIMPLE_STRUCT:
6882 : : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_NESTED_STRUCT:
6883 : 25 : break;
6884 : :
6885 : 0 : default:
6886 : : g_return_val_if_reached (new_union);
6887 : : }
6888 : :
6889 : 35 : return new_union;
6890 : : }
6891 : :
6892 : : static void
6893 : 70 : gi_marshalling_tests_structured_union_free (GIMarshallingTestsStructuredUnion *union_)
6894 : : {
6895 [ + + + - ]: 70 : switch (union_->type)
6896 : : {
6897 : 10 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_BOXED_STRUCT:
6898 : 10 : g_free (union_->boxed_struct.parent.string_);
6899 : 10 : g_strfreev (union_->boxed_struct.parent.g_strv);
6900 : 10 : break;
6901 : :
6902 : 10 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_BOXED_STRUCT_PTR:
6903 : 10 : g_boxed_free (gi_marshalling_tests_boxed_struct_get_type (), union_->boxed_struct_ptr.parent);
6904 : 10 : break;
6905 : :
6906 : 50 : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_NONE:
6907 : : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_SINGLE_UNION:
6908 : : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_POINTER_STRUCT:
6909 : : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_SIMPLE_STRUCT:
6910 : : case GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_NESTED_STRUCT:
6911 : 50 : break;
6912 : :
6913 : 0 : default:
6914 : : g_assert_not_reached ();
6915 : : }
6916 : :
6917 : 70 : g_free (union_);
6918 : 70 : }
6919 : :
6920 : : GType
6921 : 75 : gi_marshalling_tests_structured_union_get_type (void)
6922 : : {
6923 : : static GType type = 0;
6924 : :
6925 [ + + ]: 75 : if (type == 0)
6926 : : {
6927 : 2 : type = g_boxed_type_register_static ("GIMarshallingTestsStructuredUnion",
6928 : : (GBoxedCopyFunc)
6929 : : gi_marshalling_tests_structured_union_copy,
6930 : : (GBoxedFreeFunc) gi_marshalling_tests_structured_union_free);
6931 : : }
6932 : :
6933 : 75 : return type;
6934 : : }
6935 : :
6936 : : GIMarshallingTestsStructuredUnionType
6937 : 58 : gi_marshalling_tests_structured_union_type (GIMarshallingTestsStructuredUnion *structured_union)
6938 : : {
6939 : 58 : return structured_union->type;
6940 : : }
6941 : :
6942 : : enum
6943 : : {
6944 : : PROP_0,
6945 : : PROP_INT_
6946 : : };
6947 : :
6948 : : static void
6949 : : gi_marshalling_tests_object_real_method_with_default_implementation (GIMarshallingTestsObject *self, gint8 in);
6950 : :
6951 [ + + + - : 424 : G_DEFINE_TYPE (GIMarshallingTestsObject, gi_marshalling_tests_object, G_TYPE_OBJECT);
+ + ]
6952 : :
6953 : : static void
6954 : 81 : gi_marshalling_tests_object_init (GIMarshallingTestsObject *self G_GNUC_UNUSED)
6955 : : {
6956 : 81 : }
6957 : :
6958 : : static void
6959 : 78 : gi_marshalling_tests_object_finalize (GObject *object)
6960 : : {
6961 : 78 : G_OBJECT_CLASS (gi_marshalling_tests_object_parent_class)->finalize (object);
6962 : 78 : }
6963 : :
6964 : : static void
6965 : 91 : gi_marshalling_tests_object_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
6966 : : {
6967 : 91 : g_return_if_fail (GI_MARSHALLING_TESTS_IS_OBJECT (object));
6968 : :
6969 [ + - ]: 91 : switch (prop_id)
6970 : : {
6971 : 91 : case PROP_INT_:
6972 : 91 : GI_MARSHALLING_TESTS_OBJECT (object)->int_ = g_value_get_int (value);
6973 : 91 : break;
6974 : 0 : default:
6975 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
6976 : 0 : break;
6977 : : }
6978 : : }
6979 : :
6980 : : static void
6981 : 17 : gi_marshalling_tests_object_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
6982 : : {
6983 : 17 : g_return_if_fail (GI_MARSHALLING_TESTS_IS_OBJECT (object));
6984 : :
6985 [ + - ]: 17 : switch (prop_id)
6986 : : {
6987 : 17 : case PROP_INT_:
6988 : 17 : g_value_set_int (value, GI_MARSHALLING_TESTS_OBJECT (object)->int_);
6989 : 17 : break;
6990 : 0 : default:
6991 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
6992 : 0 : break;
6993 : : }
6994 : : }
6995 : :
6996 : : static void
6997 : 2 : gi_marshalling_tests_object_class_init (GIMarshallingTestsObjectClass *klass)
6998 : : {
6999 : 2 : GObjectClass *object_class = G_OBJECT_CLASS (klass);
7000 : : #if 0
7001 : : GObjectClass *parent_class = G_OBJECT_CLASS (klass);
7002 : : #endif
7003 : :
7004 : 2 : object_class->finalize = gi_marshalling_tests_object_finalize;
7005 : 2 : object_class->set_property = gi_marshalling_tests_object_set_property;
7006 : 2 : object_class->get_property = gi_marshalling_tests_object_get_property;
7007 : :
7008 : 2 : g_object_class_install_property (object_class, PROP_INT_,
7009 : : g_param_spec_int ("int", "Integer",
7010 : : "An integer", G_MININT,
7011 : : G_MAXINT, 0,
7012 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
7013 : :
7014 : 2 : klass->method_with_default_implementation = gi_marshalling_tests_object_real_method_with_default_implementation;
7015 : 2 : }
7016 : :
7017 : : void
7018 : 1 : gi_marshalling_tests_object_static_method (void)
7019 : : {
7020 : 1 : }
7021 : :
7022 : : void
7023 : 3 : gi_marshalling_tests_object_method (GIMarshallingTestsObject *object)
7024 : : {
7025 : 3 : g_return_if_fail (GI_MARSHALLING_TESTS_IS_OBJECT (object));
7026 : 3 : g_assert_cmpint (object->int_, ==, 42);
7027 : : }
7028 : :
7029 : : void
7030 : 1 : gi_marshalling_tests_object_overridden_method (GIMarshallingTestsObject *object)
7031 : : {
7032 : 1 : g_return_if_fail (GI_MARSHALLING_TESTS_IS_OBJECT (object));
7033 : 1 : g_assert_cmpint (object->int_, ==, 0);
7034 : : }
7035 : :
7036 : : GIMarshallingTestsObject *
7037 : 3 : gi_marshalling_tests_object_new (gint int_)
7038 : : {
7039 : 3 : return g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, "int", int_, NULL);
7040 : : }
7041 : :
7042 : : GIMarshallingTestsObject *
7043 : 1 : gi_marshalling_tests_object_new_fail (gint int_ G_GNUC_UNUSED,
7044 : : GError **error)
7045 : : {
7046 : 1 : g_return_val_if_fail (error == NULL || *error == NULL, NULL);
7047 : :
7048 : 1 : g_set_error_literal (error,
7049 : : g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN),
7050 : : GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE,
7051 : : GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
7052 : :
7053 : 1 : return NULL;
7054 : : }
7055 : :
7056 : : /**
7057 : : * gi_marshalling_tests_object_method_array_in:
7058 : : * @ints: (array length=length):
7059 : : */
7060 : : void
7061 : 1 : gi_marshalling_tests_object_method_array_in (GIMarshallingTestsObject *self G_GNUC_UNUSED,
7062 : : const gint *ints,
7063 : : gint length)
7064 : : {
7065 : 1 : g_assert_cmpint (length, ==, 4);
7066 : 1 : g_assert_cmpint (ints[0], ==, -1);
7067 : 1 : g_assert_cmpint (ints[1], ==, 0);
7068 : 1 : g_assert_cmpint (ints[2], ==, 1);
7069 : 1 : g_assert_cmpint (ints[3], ==, 2);
7070 : 1 : }
7071 : :
7072 : : /**
7073 : : * gi_marshalling_tests_object_method_array_out:
7074 : : * @ints: (out) (array length=length) (transfer none):
7075 : : */
7076 : : void
7077 : 1 : gi_marshalling_tests_object_method_array_out (GIMarshallingTestsObject *self G_GNUC_UNUSED,
7078 : : gint **ints,
7079 : : gint *length)
7080 : : {
7081 : : static gint values[] = { -1, 0, 1, 2 };
7082 : :
7083 : 1 : *length = 4;
7084 : 1 : *ints = values;
7085 : 1 : }
7086 : :
7087 : : /**
7088 : : * gi_marshalling_tests_object_method_array_inout:
7089 : : * @ints: (inout) (array length=length) (transfer none):
7090 : : * @length: (inout):
7091 : : */
7092 : : void
7093 : 1 : gi_marshalling_tests_object_method_array_inout (GIMarshallingTestsObject *self G_GNUC_UNUSED,
7094 : : gint **ints,
7095 : : gint *length)
7096 : : {
7097 : : static gint values[] = { -2, -1, 0, 1, 2 };
7098 : :
7099 : 1 : g_assert_cmpint (*length, ==, 4);
7100 : 1 : g_assert_cmpint ((*ints)[0], ==, -1);
7101 : 1 : g_assert_cmpint ((*ints)[1], ==, 0);
7102 : 1 : g_assert_cmpint ((*ints)[2], ==, 1);
7103 : 1 : g_assert_cmpint ((*ints)[3], ==, 2);
7104 : :
7105 : 1 : *length = 5;
7106 : 1 : *ints = values;
7107 : 1 : }
7108 : :
7109 : : /**
7110 : : * gi_marshalling_tests_object_method_array_return:
7111 : : *
7112 : : * Returns: (array length=length):
7113 : : */
7114 : : const gint *
7115 : 1 : gi_marshalling_tests_object_method_array_return (GIMarshallingTestsObject *self G_GNUC_UNUSED,
7116 : : gint *length)
7117 : : {
7118 : : static gint ints[] = { -1, 0, 1, 2 };
7119 : :
7120 : 1 : *length = 4;
7121 : 1 : return ints;
7122 : : }
7123 : :
7124 : : /**
7125 : : * gi_marshalling_tests_object_method_int8_in:
7126 : : * @in: (in):
7127 : : */
7128 : : void
7129 : 2 : gi_marshalling_tests_object_method_int8_in (GIMarshallingTestsObject *self, gint8 in)
7130 : : {
7131 : 2 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_int8_in (self, in);
7132 : 2 : }
7133 : :
7134 : : /**
7135 : : * gi_marshalling_tests_object_method_int8_out:
7136 : : * @out: (out):
7137 : : */
7138 : : void
7139 : 2 : gi_marshalling_tests_object_method_int8_out (GIMarshallingTestsObject *self, gint8 *out)
7140 : : {
7141 : 2 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_int8_out (self, out);
7142 : 2 : }
7143 : :
7144 : : /**
7145 : : * gi_marshalling_tests_object_method_int8_arg_and_out_caller:
7146 : : * @out: (out):
7147 : : */
7148 : : void
7149 : 1 : gi_marshalling_tests_object_method_int8_arg_and_out_caller (GIMarshallingTestsObject *self, gint8 arg, gint8 *out)
7150 : : {
7151 : 1 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_int8_arg_and_out_caller (self, arg, out);
7152 : 1 : }
7153 : :
7154 : : /**
7155 : : * gi_marshalling_tests_object_method_int8_arg_and_out_callee:
7156 : : * @out: (out):
7157 : : */
7158 : : void
7159 : 1 : gi_marshalling_tests_object_method_int8_arg_and_out_callee (GIMarshallingTestsObject *self, gint8 arg, gint8 **out)
7160 : : {
7161 : 1 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_int8_arg_and_out_callee (self, arg, out);
7162 : 1 : }
7163 : :
7164 : : /**
7165 : : * gi_marshalling_tests_object_method_str_arg_out_ret:
7166 : : * @out: (out):
7167 : : *
7168 : : * Returns: (transfer none)
7169 : : */
7170 : : const gchar *
7171 : 2 : gi_marshalling_tests_object_method_str_arg_out_ret (GIMarshallingTestsObject *self, const gchar *arg, guint *out)
7172 : : {
7173 : 2 : return GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_str_arg_out_ret (self, arg, out);
7174 : : }
7175 : :
7176 : : /**
7177 : : * gi_marshalling_tests_object_method_with_default_implementation:
7178 : : * @in: (in):
7179 : : */
7180 : : void
7181 : 4 : gi_marshalling_tests_object_method_with_default_implementation (GIMarshallingTestsObject *self, gint8 in)
7182 : : {
7183 : 4 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_with_default_implementation (self, in);
7184 : 4 : }
7185 : :
7186 : : static void
7187 : 3 : gi_marshalling_tests_object_real_method_with_default_implementation (GIMarshallingTestsObject *self, gint8 in)
7188 : : {
7189 : 3 : GValue val = {
7190 : : 0,
7191 : : };
7192 : 3 : g_value_init (&val, G_TYPE_INT);
7193 : 3 : g_value_set_int (&val, in);
7194 : 3 : g_object_set_property (G_OBJECT (self), "int", &val);
7195 : 3 : }
7196 : :
7197 : : /**
7198 : : * gi_marshalling_tests_object_vfunc_with_callback: (virtual vfunc_with_callback)
7199 : : * @callback: (scope call) (closure callback_data):
7200 : : * @callback_data: (allow-none):
7201 : : */
7202 : : void
7203 : 0 : gi_marshalling_tests_object_vfunc_with_callback (GIMarshallingTestsObject *self G_GNUC_UNUSED,
7204 : : GIMarshallingTestsCallbackIntInt callback G_GNUC_UNUSED,
7205 : : void *callback_data G_GNUC_UNUSED)
7206 : : {
7207 : 0 : }
7208 : :
7209 : : static int
7210 : 0 : _callback (int val, void *user_data)
7211 : : {
7212 : 0 : g_assert (user_data == (gpointer) 0xdeadbeef);
7213 : 0 : return val;
7214 : : }
7215 : :
7216 : : void
7217 : 0 : gi_marshalling_tests_object_call_vfunc_with_callback (GIMarshallingTestsObject *object)
7218 : : {
7219 : 0 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (object)->vfunc_with_callback (object, _callback, (void *) 0xdeadbeef);
7220 : 0 : }
7221 : :
7222 : : /**
7223 : : * gi_marshalling_tests_object_none_return:
7224 : : *
7225 : : * Returns: (transfer none):
7226 : : */
7227 : : GIMarshallingTestsObject *
7228 : 1 : gi_marshalling_tests_object_none_return (void)
7229 : : {
7230 : : static GIMarshallingTestsObject *object = NULL;
7231 : :
7232 [ + - ]: 1 : if (object == NULL)
7233 : : {
7234 : 1 : object = g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
7235 : : }
7236 : :
7237 : 1 : return object;
7238 : : }
7239 : :
7240 : : /**
7241 : : * gi_marshalling_tests_object_full_return:
7242 : : *
7243 : : * Returns: (transfer full):
7244 : : */
7245 : : GIMarshallingTestsObject *
7246 : 1 : gi_marshalling_tests_object_full_return (void)
7247 : : {
7248 : 1 : return g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
7249 : : }
7250 : :
7251 : : /**
7252 : : * gi_marshalling_tests_object_none_in:
7253 : : * @object: (transfer none):
7254 : : */
7255 : : void
7256 : 1 : gi_marshalling_tests_object_none_in (GIMarshallingTestsObject *object)
7257 : : {
7258 : 1 : g_assert_cmpint (object->int_, ==, 42);
7259 : 1 : }
7260 : :
7261 : : /**
7262 : : * gi_marshalling_tests_object_none_out:
7263 : : * @object: (out) (transfer none):
7264 : : */
7265 : : void
7266 : 1 : gi_marshalling_tests_object_none_out (GIMarshallingTestsObject **object)
7267 : : {
7268 : : static GIMarshallingTestsObject *new_object = NULL;
7269 : :
7270 [ + - ]: 1 : if (new_object == NULL)
7271 : : {
7272 : 1 : new_object = g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
7273 : : }
7274 : :
7275 : 1 : *object = new_object;
7276 : 1 : }
7277 : :
7278 : : /**
7279 : : * gi_marshalling_tests_object_none_out_uninitialized:
7280 : : * @v: (out) (transfer none):
7281 : : */
7282 : : gboolean
7283 : 1 : gi_marshalling_tests_object_none_out_uninitialized (GIMarshallingTestsObject **v G_GNUC_UNUSED)
7284 : : {
7285 : 1 : return FALSE;
7286 : : }
7287 : :
7288 : : /**
7289 : : * gi_marshalling_tests_object_full_out:
7290 : : * @object: (out) (transfer full):
7291 : : */
7292 : : void
7293 : 1 : gi_marshalling_tests_object_full_out (GIMarshallingTestsObject **object)
7294 : : {
7295 : 1 : *object = g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
7296 : 1 : }
7297 : :
7298 : : /**
7299 : : * gi_marshalling_tests_object_full_out_uninitialized:
7300 : : * @v: (out) (transfer full):
7301 : : */
7302 : : gboolean
7303 : 1 : gi_marshalling_tests_object_full_out_uninitialized (GIMarshallingTestsObject **v G_GNUC_UNUSED)
7304 : : {
7305 : 1 : return FALSE;
7306 : : }
7307 : :
7308 : : /**
7309 : : * gi_marshalling_tests_object_none_inout:
7310 : : * @object: (inout) (transfer none):
7311 : : */
7312 : : void
7313 : 1 : gi_marshalling_tests_object_none_inout (GIMarshallingTestsObject **object)
7314 : : {
7315 : : static GIMarshallingTestsObject *new_object = NULL;
7316 : :
7317 : 1 : g_assert_cmpint ((*object)->int_, ==, 42);
7318 : :
7319 [ + - ]: 1 : if (new_object == NULL)
7320 : : {
7321 : 1 : new_object = g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
7322 : 1 : new_object->int_ = 0;
7323 : : }
7324 : :
7325 : 1 : *object = new_object;
7326 : 1 : }
7327 : :
7328 : : /**
7329 : : * gi_marshalling_tests_object_full_inout:
7330 : : * @object: (inout) (transfer full):
7331 : : */
7332 : : void
7333 : 1 : gi_marshalling_tests_object_full_inout (GIMarshallingTestsObject **object)
7334 : : {
7335 : 1 : g_assert_cmpint ((*object)->int_, ==, 42);
7336 : :
7337 : 1 : g_object_unref (*object);
7338 : 1 : *object = g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, NULL);
7339 : 1 : }
7340 : :
7341 : : /**
7342 : : * gi_marshalling_tests_object_int8_in:
7343 : : * @in: (in):
7344 : : */
7345 : : void
7346 : 1 : gi_marshalling_tests_object_int8_in (GIMarshallingTestsObject *object, gint8 in)
7347 : : {
7348 : 1 : gi_marshalling_tests_object_method_int8_in (object, in);
7349 : 1 : }
7350 : :
7351 : : /**
7352 : : * gi_marshalling_tests_object_int8_out:
7353 : : * @out: (out):
7354 : : */
7355 : : void
7356 : 1 : gi_marshalling_tests_object_int8_out (GIMarshallingTestsObject *object, gint8 *out)
7357 : : {
7358 : 1 : gi_marshalling_tests_object_method_int8_out (object, out);
7359 : 1 : }
7360 : :
7361 : : /**
7362 : : * gi_marshalling_tests_object_vfunc_return_value_only:
7363 : : */
7364 : : glong
7365 : 1 : gi_marshalling_tests_object_vfunc_return_value_only (GIMarshallingTestsObject *self)
7366 : : {
7367 : : /* make sure that local variables don't get smashed */
7368 : : glong return_value;
7369 : 1 : gulong local = 0x12345678;
7370 : 1 : return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_only (self);
7371 : 1 : g_assert_cmpint (local, ==, 0x12345678);
7372 : 1 : return return_value;
7373 : : }
7374 : :
7375 : : /**
7376 : : * gi_marshalling_tests_object_vfunc_one_out_parameter:
7377 : : * @a: (out):
7378 : : */
7379 : : void
7380 : 1 : gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObject *self, gfloat *a)
7381 : : {
7382 : : /* make sure that local variables don't get smashed */
7383 : 1 : gulong local = 0x12345678;
7384 : 1 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_one_out_parameter (self, a);
7385 : 1 : g_assert_cmpint (local, ==, 0x12345678);
7386 : 1 : }
7387 : :
7388 : : /**
7389 : : * gi_marshalling_tests_object_vfunc_one_inout_parameter:
7390 : : * @a: (inout):
7391 : : */
7392 : : void
7393 : 1 : gi_marshalling_tests_object_vfunc_one_inout_parameter (GIMarshallingTestsObject *self, gfloat *a)
7394 : : {
7395 : : /* make sure that local variables don't get smashed */
7396 : 1 : gulong local = 0x12345678;
7397 : 1 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_one_inout_parameter (self, a);
7398 : 1 : g_assert_cmpint (local, ==, 0x12345678);
7399 : 1 : }
7400 : :
7401 : : /**
7402 : : * gi_marshalling_tests_object_vfunc_multiple_inout_parameters:
7403 : : * @a: (inout):
7404 : : * @b: (inout):
7405 : : */
7406 : : void
7407 : 1 : gi_marshalling_tests_object_vfunc_multiple_inout_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b)
7408 : : {
7409 : : /* make sure that local variables don't get smashed */
7410 : 1 : gulong local = 0x12345678;
7411 : 1 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_multiple_inout_parameters (self, a, b);
7412 : 1 : g_assert_cmpint (local, ==, 0x12345678);
7413 : 1 : }
7414 : :
7415 : : /**
7416 : : * gi_marshalling_tests_object_vfunc_multiple_out_parameters:
7417 : : * @a: (out):
7418 : : * @b: (out):
7419 : : */
7420 : : void
7421 : 2 : gi_marshalling_tests_object_vfunc_multiple_out_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b)
7422 : : {
7423 : : /* make sure that local variables don't get smashed */
7424 : 2 : gulong local = 0x12345678;
7425 : 2 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_multiple_out_parameters (self, a, b);
7426 : 2 : g_assert_cmpint (local, ==, 0x12345678);
7427 : 2 : }
7428 : :
7429 : : /**
7430 : : * gi_marshalling_tests_object_vfunc_caller_allocated_out_parameter:
7431 : : * @a: (out):
7432 : : */
7433 : : void
7434 : 1 : gi_marshalling_tests_object_vfunc_caller_allocated_out_parameter (GIMarshallingTestsObject *self, GValue *a)
7435 : : {
7436 : : /* make sure that local variables don't get smashed */
7437 : 1 : gulong local = 0x12345678;
7438 : 1 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_caller_allocated_out_parameter (self, a);
7439 : 1 : g_assert_cmpint (local, ==, 0x12345678);
7440 : 1 : }
7441 : :
7442 : : /**
7443 : : * gi_marshalling_tests_object_vfunc_array_out_parameter:
7444 : : * @a: (out) (array zero-terminated):
7445 : : */
7446 : : void
7447 : 2 : gi_marshalling_tests_object_vfunc_array_out_parameter (GIMarshallingTestsObject *self, gfloat **a)
7448 : : {
7449 : : /* make sure that local variables don't get smashed */
7450 : 2 : gulong local = 0x12345678;
7451 : 2 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_array_out_parameter (self, a);
7452 : 2 : g_assert_cmpint (local, ==, 0x12345678);
7453 : 2 : }
7454 : :
7455 : : /**
7456 : : * gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter:
7457 : : * @a: (out):
7458 : : */
7459 : : glong
7460 : 2 : gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter (GIMarshallingTestsObject *self, glong *a)
7461 : : {
7462 : : /* make sure that local variables don't get smashed */
7463 : : gulong return_value;
7464 : 2 : gulong local = 0x12345678;
7465 : 2 : return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_one_out_parameter (self, a);
7466 : 2 : g_assert_cmpint (local, ==, 0x12345678);
7467 : 2 : return return_value;
7468 : : }
7469 : :
7470 : : /**
7471 : : * gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters:
7472 : : * @a: (out):
7473 : : * @b: (out):
7474 : : */
7475 : : glong
7476 : 2 : gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters (GIMarshallingTestsObject *self, glong *a, glong *b)
7477 : : {
7478 : : gulong return_value;
7479 : 2 : gulong local = 0x12345678;
7480 : 2 : return_value =
7481 : 2 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_multiple_out_parameters (self, a, b);
7482 : 2 : g_assert_cmpint (local, ==, 0x12345678);
7483 : 2 : return return_value;
7484 : : }
7485 : :
7486 : : /**
7487 : : * gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter:
7488 : : * @a: (inout):
7489 : : */
7490 : : glong
7491 : 1 : gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter (GIMarshallingTestsObject *self, glong *a)
7492 : : {
7493 : : /* make sure that local variables don't get smashed */
7494 : : gulong return_value;
7495 : 1 : gulong local = 0x12345678;
7496 : 1 : return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_one_inout_parameter (self, a);
7497 : 1 : g_assert_cmpint (local, ==, 0x12345678);
7498 : 1 : return return_value;
7499 : : }
7500 : :
7501 : : /**
7502 : : * gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters:
7503 : : * @a: (inout):
7504 : : * @b: (inout):
7505 : : */
7506 : : glong
7507 : 1 : gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters (GIMarshallingTestsObject *self, glong *a, glong *b)
7508 : : {
7509 : : gulong return_value;
7510 : 1 : gulong local = 0x12345678;
7511 : 1 : return_value =
7512 : 1 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_multiple_inout_parameters (self, a, b);
7513 : 1 : g_assert_cmpint (local, ==, 0x12345678);
7514 : 1 : return return_value;
7515 : : }
7516 : :
7517 : : /**
7518 : : * gi_marshalling_tests_callback_owned_boxed:
7519 : : * @callback: (scope call) (closure callback_data):
7520 : : * @callback_data: (allow-none):
7521 : : */
7522 : : glong
7523 : 1 : gi_marshalling_tests_callback_owned_boxed (GIMarshallingTestsCallbackOwnedBoxed callback,
7524 : : void *callback_data)
7525 : : {
7526 : : static GIMarshallingTestsBoxedStruct *box = NULL;
7527 : : glong ret;
7528 : :
7529 [ + - ]: 1 : if (!box)
7530 : 1 : box = gi_marshalling_tests_boxed_struct_new ();
7531 : 1 : box->long_++;
7532 : 1 : callback (box, callback_data);
7533 : 1 : ret = box->long_;
7534 : 1 : return ret;
7535 : : }
7536 : :
7537 : : gboolean
7538 : 16 : gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *self, gint x, GError **error)
7539 : : {
7540 : 16 : gulong local = 0x12345678;
7541 : 16 : gboolean ret = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_meth_with_err (self,
7542 : : x,
7543 : : error);
7544 : 16 : g_assert_cmpint (local, ==, 0x12345678);
7545 : 16 : return ret;
7546 : : }
7547 : :
7548 : : /**
7549 : : * gi_marshalling_tests_object_vfunc_return_enum:
7550 : : */
7551 : : GIMarshallingTestsEnum
7552 : 2 : gi_marshalling_tests_object_vfunc_return_enum (GIMarshallingTestsObject *self)
7553 : : {
7554 : : /* make sure that local variables don't get smashed */
7555 : : GIMarshallingTestsEnum return_value;
7556 : 2 : glong local = 0x12345678;
7557 : 2 : return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_enum (self);
7558 : 2 : g_assert_cmpint (local, ==, 0x12345678);
7559 : 2 : return return_value;
7560 : : }
7561 : :
7562 : : /**
7563 : : * gi_marshalling_tests_object_vfunc_out_enum:
7564 : : * @_enum: (out):
7565 : : */
7566 : : void
7567 : 2 : gi_marshalling_tests_object_vfunc_out_enum (GIMarshallingTestsObject *self, GIMarshallingTestsEnum *_enum)
7568 : : {
7569 : : /* make sure that local variables don't get smashed */
7570 : 2 : gulong local = 0x12345678;
7571 : 2 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_out_enum (self, _enum);
7572 : 2 : g_assert_cmpint (local, ==, 0x12345678);
7573 : 2 : }
7574 : :
7575 : : /**
7576 : : * gi_marshalling_tests_object_vfunc_return_flags:
7577 : : */
7578 : : GIMarshallingTestsFlags
7579 : 2 : gi_marshalling_tests_object_vfunc_return_flags (GIMarshallingTestsObject *self)
7580 : : {
7581 : : /* make sure that local variables don't get smashed */
7582 : : GIMarshallingTestsFlags return_value;
7583 : 2 : glong local = 0x12345678;
7584 : 2 : return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_flags (self);
7585 : 2 : g_assert_cmpint (local, ==, 0x12345678);
7586 : 2 : return return_value;
7587 : : }
7588 : :
7589 : : /**
7590 : : * gi_marshalling_tests_object_vfunc_static_name:
7591 : : */
7592 : : gchar *
7593 : 1 : gi_marshalling_tests_object_vfunc_static_name (void)
7594 : : {
7595 : : GIMarshallingTestsObjectClass *klass;
7596 : 1 : klass = g_type_class_peek_static (GI_MARSHALLING_TESTS_TYPE_OBJECT);
7597 [ - + ]: 1 : if (klass->vfunc_static_name)
7598 : 0 : return klass->vfunc_static_name ();
7599 : :
7600 : 2 : return g_strdup (g_type_name (GI_MARSHALLING_TESTS_TYPE_OBJECT));
7601 : : }
7602 : :
7603 : : /**
7604 : : * gi_marshalling_tests_object_vfunc_static_typed_name:
7605 : : * @gtype:
7606 : : */
7607 : : gchar *
7608 : 1 : gi_marshalling_tests_object_vfunc_static_typed_name (GType gtype)
7609 : : {
7610 : : GIMarshallingTestsObjectClass *klass;
7611 : :
7612 : 1 : g_return_val_if_fail (g_type_is_a (gtype, GI_MARSHALLING_TESTS_TYPE_OBJECT),
7613 : : NULL);
7614 : :
7615 : 1 : klass = g_type_class_peek_static (gtype);
7616 [ - + ]: 1 : if (klass->vfunc_static_name)
7617 : 0 : return klass->vfunc_static_name ();
7618 : :
7619 : 2 : return g_strdup (g_type_name (GI_MARSHALLING_TESTS_TYPE_OBJECT));
7620 : : }
7621 : :
7622 : : /**
7623 : : * gi_marshalling_tests_object_vfunc_static_create_new:
7624 : : * @gtype:
7625 : : * @int_:
7626 : : */
7627 : : GIMarshallingTestsObject *
7628 : 1 : gi_marshalling_tests_object_vfunc_static_create_new (GType gtype, gint int_)
7629 : : {
7630 : : GIMarshallingTestsObjectClass *klass;
7631 : :
7632 : 1 : g_return_val_if_fail (g_type_is_a (gtype, GI_MARSHALLING_TESTS_TYPE_OBJECT),
7633 : : NULL);
7634 : :
7635 : 1 : klass = g_type_class_peek (gtype);
7636 [ - + ]: 1 : if (klass->vfunc_static_create_new)
7637 : 0 : return klass->vfunc_static_create_new (int_);
7638 : :
7639 : 1 : return gi_marshalling_tests_object_new (int_);
7640 : : }
7641 : :
7642 : : /**
7643 : : * gi_marshalling_tests_object_vfunc_static_create_new_out:
7644 : : * @out: (out): We keep this as first parameter to ensure it's parsed properly
7645 : : * @gtype:
7646 : : * @int_:
7647 : : */
7648 : : void
7649 : 1 : gi_marshalling_tests_object_vfunc_static_create_new_out (GIMarshallingTestsObject **out,
7650 : : GType gtype,
7651 : : gint int_)
7652 : : {
7653 : : GIMarshallingTestsObjectClass *klass;
7654 : :
7655 : 1 : g_return_if_fail (g_type_is_a (gtype, GI_MARSHALLING_TESTS_TYPE_OBJECT));
7656 : :
7657 : 1 : klass = g_type_class_peek (gtype);
7658 [ - + ]: 1 : if (klass->vfunc_static_create_new_out)
7659 : 0 : return klass->vfunc_static_create_new_out (out, int_);
7660 : :
7661 : 1 : *out = gi_marshalling_tests_object_new (int_);
7662 : : }
7663 : :
7664 : : /**
7665 : : * gi_marshalling_tests_object_vfunc_out_flags:
7666 : : * @flags: (out):
7667 : : */
7668 : : void
7669 : 2 : gi_marshalling_tests_object_vfunc_out_flags (GIMarshallingTestsObject *self, GIMarshallingTestsFlags *flags)
7670 : : {
7671 : : /* make sure that local variables don't get smashed */
7672 : 2 : gulong local = 0x12345678;
7673 : 2 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_out_flags (self, flags);
7674 : 2 : g_assert_cmpuint (local, ==, 0x12345678);
7675 : 2 : }
7676 : :
7677 : : /* NOTE:
7678 : : *
7679 : : * The following (get_ref_info_for_*) methods are designed to call vfuncs related
7680 : : * to object argument marshaling. They do not pass the resulting objects through them
7681 : : * as regular vfunc wrapper method do, but rather return reference count and floating
7682 : : * information back to the callers. This is useful because callers can do testing of
7683 : : * expected reference counts in isolation and from the perspective of C. This is important
7684 : : * because if there are bugs in the reverse marshaling, they can obfuscate or compound
7685 : : * bugs in marshaling from the vfuncs.
7686 : : */
7687 : :
7688 : : /**
7689 : : * gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_none:
7690 : : * @ref_count: (out): Ref count of the object returned from the vfunc directly after vfunc call.
7691 : : * @is_floating: (out): Floating state object returned from the vfunc directly after vfunc call.
7692 : : */
7693 : : void
7694 : 1 : gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_none (GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating)
7695 : : {
7696 : 1 : GObject *object = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_object_transfer_none (self);
7697 : 1 : *ref_count = object->ref_count;
7698 : 1 : *is_floating = g_object_is_floating (object);
7699 : :
7700 : : /* Attempt to sink and unref the returned object and avoid any potential leaks */
7701 : 1 : g_object_ref_sink (object);
7702 : 1 : g_object_unref (object);
7703 : 1 : }
7704 : :
7705 : : /**
7706 : : * gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_full:
7707 : : * @ref_count: (out): Ref count of the object returned from the vfunc directly after vfunc call.
7708 : : * @is_floating: (out): Floating state object returned from the vfunc directly after vfunc call.
7709 : : */
7710 : : void
7711 : 1 : gi_marshalling_tests_object_get_ref_info_for_vfunc_return_object_transfer_full (GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating)
7712 : : {
7713 : 1 : GObject *object = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_object_transfer_full (self);
7714 : 1 : *ref_count = object->ref_count;
7715 : 1 : *is_floating = g_object_is_floating (object);
7716 : 1 : g_object_unref (object);
7717 : 1 : }
7718 : :
7719 : : /**
7720 : : * gi_marshalling_tests_object_get_ref_info_for_vfunc_out_object_transfer_none:
7721 : : * @ref_count: (out): Ref count of the object returned from the vfunc directly after vfunc call.
7722 : : * @is_floating: (out): Floating state object returned from the vfunc directly after vfunc call.
7723 : : */
7724 : : void
7725 : 1 : gi_marshalling_tests_object_get_ref_info_for_vfunc_out_object_transfer_none (GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating)
7726 : : {
7727 : 1 : GObject *object = NULL;
7728 : 1 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_out_object_transfer_none (self, &object);
7729 : 1 : *ref_count = object->ref_count;
7730 : 1 : *is_floating = g_object_is_floating (object);
7731 : :
7732 : : /* Attempt to sink and unref the returned object and avoid any potential leaks */
7733 : 1 : g_object_ref_sink (object);
7734 : 1 : g_object_unref (object);
7735 : 1 : }
7736 : :
7737 : : /**
7738 : : * gi_marshalling_tests_object_get_ref_info_for_vfunc_out_object_transfer_full:
7739 : : * @ref_count: (out): Ref count of the object returned from the vfunc directly after vfunc call.
7740 : : * @is_floating: (out): Floating state object returned from the vfunc directly after vfunc call.
7741 : : */
7742 : : void
7743 : 1 : gi_marshalling_tests_object_get_ref_info_for_vfunc_out_object_transfer_full (GIMarshallingTestsObject *self, guint *ref_count, gboolean *is_floating)
7744 : : {
7745 : 1 : GObject *object = NULL;
7746 : 1 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_out_object_transfer_full (self, &object);
7747 : 1 : *ref_count = object->ref_count;
7748 : 1 : *is_floating = g_object_is_floating (object);
7749 : 1 : g_object_unref (object);
7750 : 1 : }
7751 : :
7752 : : static void
7753 : 1 : _vfunc_in_object_destroy_callback (gboolean *destroy_called,
7754 : : GObject *where_the_object_was G_GNUC_UNUSED)
7755 : : {
7756 : 1 : *destroy_called = TRUE;
7757 : 1 : }
7758 : :
7759 : : /**
7760 : : * gi_marshalling_tests_object_get_ref_info_for_vfunc_in_object_transfer_none:
7761 : : * @type: GType of object to create and pass as in argument to the vfunc
7762 : : * @ref_count: (out): Ref count of the in object directly after vfunc call.
7763 : : * @is_floating: (out): Floating state of in object directly after vfunc call.
7764 : : *
7765 : : * Calls vfunc_in_object_transfer_none with a new object of the given type.
7766 : : */
7767 : : void
7768 : 1 : gi_marshalling_tests_object_get_ref_info_for_vfunc_in_object_transfer_none (GIMarshallingTestsObject *self, GType type, guint *ref_count, gboolean *is_floating)
7769 : : {
7770 : : static gboolean destroy_called;
7771 : : GObject *object;
7772 : 1 : destroy_called = FALSE;
7773 : :
7774 : 1 : object = g_object_new (type, NULL);
7775 : 1 : g_object_weak_ref (object, (GWeakNotify) _vfunc_in_object_destroy_callback, &destroy_called);
7776 : :
7777 : 1 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_in_object_transfer_none (self, object);
7778 [ - + ]: 1 : if (destroy_called)
7779 : : {
7780 : 0 : *ref_count = 0;
7781 : 0 : *is_floating = FALSE;
7782 : : }
7783 : : else
7784 : : {
7785 : 1 : *ref_count = object->ref_count;
7786 : 1 : *is_floating = g_object_is_floating (object);
7787 : 1 : g_object_unref (object);
7788 : : }
7789 : 1 : }
7790 : :
7791 : : /**
7792 : : * gi_marshalling_tests_object_get_ref_info_for_vfunc_in_object_transfer_full:
7793 : : * @type: GType of object to create and pass as in argument to the vfunc
7794 : : * @ref_count: (out): Ref count of the in object directly after vfunc call.
7795 : : * @is_floating: (out): Floating state of in object directly after vfunc call.
7796 : : */
7797 : : void
7798 : 0 : gi_marshalling_tests_object_get_ref_info_for_vfunc_in_object_transfer_full (GIMarshallingTestsObject *self, GType type, guint *ref_count, gboolean *is_floating)
7799 : : {
7800 : : static gboolean destroy_called;
7801 : : GObject *object;
7802 : 0 : destroy_called = FALSE;
7803 : :
7804 : 0 : object = g_object_new (type, NULL);
7805 : 0 : g_object_weak_ref (object, (GWeakNotify) _vfunc_in_object_destroy_callback, &destroy_called);
7806 : :
7807 : : /* Calling the vfunc takes ownership of the object, so we use a weak_ref to determine
7808 : : * if the object gets destroyed after the call and appropriately return 0 as the ref count.
7809 : : */
7810 : 0 : GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_in_object_transfer_full (self, object);
7811 [ # # ]: 0 : if (destroy_called)
7812 : : {
7813 : 0 : *ref_count = 0;
7814 : 0 : *is_floating = FALSE;
7815 : : }
7816 : : else
7817 : : {
7818 : 0 : *ref_count = object->ref_count;
7819 : 0 : *is_floating = g_object_is_floating (object);
7820 : : }
7821 : 0 : }
7822 : :
7823 [ + + + - : 14 : G_DEFINE_TYPE (GIMarshallingTestsSubObject, gi_marshalling_tests_sub_object, GI_MARSHALLING_TESTS_TYPE_OBJECT);
+ + ]
7824 : :
7825 : : static void
7826 : 12 : gi_marshalling_tests_sub_object_init (GIMarshallingTestsSubObject *self G_GNUC_UNUSED)
7827 : : {
7828 : 12 : }
7829 : :
7830 : : static void
7831 : 12 : gi_marshalling_tests_sub_object_finalize (GObject *object)
7832 : : {
7833 : 12 : G_OBJECT_CLASS (gi_marshalling_tests_sub_object_parent_class)->finalize (object);
7834 : 12 : }
7835 : :
7836 : : static void
7837 : 2 : method_deep_hierarchy (GIMarshallingTestsObject *self, gint8 in)
7838 : : {
7839 : 2 : GValue val = {
7840 : : 0,
7841 : : };
7842 : 2 : g_value_init (&val, G_TYPE_INT);
7843 : 2 : g_value_set_int (&val, in);
7844 : 2 : g_object_set_property (G_OBJECT (self), "int", &val);
7845 : 2 : }
7846 : :
7847 : : static void
7848 : 2 : gi_marshalling_tests_sub_object_class_init (GIMarshallingTestsSubObjectClass *klass)
7849 : : {
7850 : 2 : G_OBJECT_CLASS (klass)->finalize = gi_marshalling_tests_sub_object_finalize;
7851 : 2 : GI_MARSHALLING_TESTS_OBJECT_CLASS (klass)->method_deep_hierarchy = method_deep_hierarchy;
7852 : 2 : }
7853 : :
7854 : : void
7855 : 2 : gi_marshalling_tests_sub_object_sub_method (GIMarshallingTestsSubObject *object)
7856 : : {
7857 : 2 : g_assert_cmpint (GI_MARSHALLING_TESTS_OBJECT (object)->int_, ==, 0);
7858 : 2 : }
7859 : :
7860 : : void
7861 : 2 : gi_marshalling_tests_sub_object_overwritten_method (GIMarshallingTestsSubObject *object)
7862 : : {
7863 : 2 : g_assert_cmpint (GI_MARSHALLING_TESTS_OBJECT (object)->int_, ==, 0);
7864 : 2 : }
7865 : :
7866 [ + + + - : 6 : G_DEFINE_TYPE (GIMarshallingTestsSubSubObject,
+ - ]
7867 : : gi_marshalling_tests_sub_sub_object,
7868 : : GI_MARSHALLING_TESTS_TYPE_SUB_OBJECT);
7869 : :
7870 : : static void
7871 : 6 : gi_marshalling_tests_sub_sub_object_init (GIMarshallingTestsSubSubObject *self G_GNUC_UNUSED)
7872 : : {
7873 : 6 : }
7874 : :
7875 : : static void
7876 : 2 : gi_marshalling_tests_sub_sub_object_class_init (GIMarshallingTestsSubSubObjectClass *klass G_GNUC_UNUSED)
7877 : : {
7878 : 2 : }
7879 : :
7880 : : /* Interfaces */
7881 : :
7882 : : static void
7883 : 3 : gi_marshalling_tests_interface_class_init (void *g_iface G_GNUC_UNUSED,
7884 : : void *data G_GNUC_UNUSED)
7885 : : {
7886 : 3 : }
7887 : :
7888 : : GType
7889 : 19 : gi_marshalling_tests_interface_get_type (void)
7890 : : {
7891 : : static GType type = 0;
7892 [ + + ]: 19 : if (type == 0)
7893 : : {
7894 : : /* Not adding prerequisite here for test purposes */
7895 : 3 : type = g_type_register_static_simple (G_TYPE_INTERFACE,
7896 : : "GIMarshallingTestsInterface",
7897 : : sizeof (GIMarshallingTestsInterfaceIface),
7898 : : (GClassInitFunc) gi_marshalling_tests_interface_class_init, 0, NULL, 0);
7899 : : }
7900 : :
7901 : 19 : return type;
7902 : : }
7903 : :
7904 : : /**
7905 : : * gi_marshalling_tests_interface_test_int8_in:
7906 : : * @in: (in):
7907 : : */
7908 : : void
7909 : 2 : gi_marshalling_tests_interface_test_int8_in (GIMarshallingTestsInterface *self, gint8 in)
7910 : : {
7911 : 2 : GI_MARSHALLING_TESTS_INTERFACE_GET_IFACE (self)->test_int8_in (self, in);
7912 : 2 : }
7913 : :
7914 : : /**
7915 : : * gi_marshalling_tests_test_interface_test_int8_in:
7916 : : * @in: (in):
7917 : : */
7918 : : void
7919 : 1 : gi_marshalling_tests_test_interface_test_int8_in (GIMarshallingTestsInterface *test_iface, gint8 in)
7920 : : {
7921 : 1 : gi_marshalling_tests_interface_test_int8_in (test_iface, in);
7922 : 1 : }
7923 : :
7924 : : static void test_interface_init (GIMarshallingTestsInterfaceIface *iface);
7925 : :
7926 [ + + + - : 9 : G_DEFINE_TYPE_WITH_CODE (GIMarshallingTestsInterfaceImpl, gi_marshalling_tests_interface_impl, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (GI_MARSHALLING_TESTS_TYPE_INTERFACE, test_interface_init))
+ + ]
7927 : :
7928 : : static void
7929 : 2 : gi_marshalling_tests_interface_impl_test_int8_in (GIMarshallingTestsInterface *self G_GNUC_UNUSED,
7930 : : gint8 in G_GNUC_UNUSED)
7931 : : {
7932 : 2 : }
7933 : :
7934 : : static void
7935 : 2 : test_interface_init (GIMarshallingTestsInterfaceIface *iface)
7936 : : {
7937 : 2 : iface->test_int8_in = gi_marshalling_tests_interface_impl_test_int8_in;
7938 : 2 : }
7939 : :
7940 : : static void
7941 : 2 : gi_marshalling_tests_interface_impl_init (GIMarshallingTestsInterfaceImpl *self G_GNUC_UNUSED)
7942 : : {
7943 : 2 : }
7944 : :
7945 : : static void
7946 : 2 : gi_marshalling_tests_interface_impl_class_init (GIMarshallingTestsInterfaceImplClass *klass G_GNUC_UNUSED)
7947 : : {
7948 : 2 : }
7949 : :
7950 : : /**
7951 : : * gi_marshalling_tests_interface_impl_get_as_interface:
7952 : : *
7953 : : * Returns: (transfer none):
7954 : : */
7955 : : GIMarshallingTestsInterface *
7956 : 1 : gi_marshalling_tests_interface_impl_get_as_interface (GIMarshallingTestsInterfaceImpl *self)
7957 : : {
7958 : 1 : return (GIMarshallingTestsInterface *) self;
7959 : : }
7960 : :
7961 : : static void
7962 : 2 : gi_marshalling_tests_interface2_class_init (void *g_iface G_GNUC_UNUSED,
7963 : : void *data G_GNUC_UNUSED)
7964 : : {
7965 : 2 : }
7966 : :
7967 : : GType
7968 : 2 : gi_marshalling_tests_interface2_get_type (void)
7969 : : {
7970 : : static GType type = 0;
7971 [ + - ]: 2 : if (type == 0)
7972 : : {
7973 : 2 : type = g_type_register_static_simple (G_TYPE_INTERFACE,
7974 : : "GIMarshallingTestsInterface2",
7975 : : sizeof (GIMarshallingTestsInterface2Iface),
7976 : : (GClassInitFunc) gi_marshalling_tests_interface2_class_init, 0, NULL, 0);
7977 : : }
7978 : :
7979 : 2 : return type;
7980 : : }
7981 : :
7982 : : static void
7983 : 2 : gi_marshalling_tests_interface3_class_init (void *g_iface G_GNUC_UNUSED,
7984 : : void *data G_GNUC_UNUSED)
7985 : : {
7986 : 2 : }
7987 : :
7988 : : GType
7989 : 8 : gi_marshalling_tests_interface3_get_type (void)
7990 : : {
7991 : : static GType type = 0;
7992 [ + + ]: 8 : if (type == 0)
7993 : : {
7994 : 2 : type = g_type_register_static_simple (G_TYPE_INTERFACE,
7995 : : "GIMarshallingTestsInterface3",
7996 : : sizeof (GIMarshallingTestsInterface3Iface),
7997 : : (GClassInitFunc) gi_marshalling_tests_interface3_class_init, 0, NULL, 0);
7998 : : }
7999 : :
8000 : 8 : return type;
8001 : : }
8002 : :
8003 : : /**
8004 : : * gi_marshalling_tests_interface3_test_variant_array_in:
8005 : : * @in: (array length=n_in):
8006 : : * @n_in:
8007 : : */
8008 : : void
8009 : 2 : gi_marshalling_tests_interface3_test_variant_array_in (GIMarshallingTestsInterface3 *self, GVariant **in, gsize n_in)
8010 : : {
8011 : 2 : GI_MARSHALLING_TESTS_INTERFACE3_GET_IFACE (self)->test_variant_array_in (self, in, n_in);
8012 : 2 : }
8013 : :
8014 : : /**
8015 : : * gi_marshalling_tests_int_out_out:
8016 : : * @int0: (out):
8017 : : * @int1: (out):
8018 : : */
8019 : : void
8020 : 1 : gi_marshalling_tests_int_out_out (gint *int0, gint *int1)
8021 : : {
8022 : 1 : *int0 = 6;
8023 : 1 : *int1 = 7;
8024 : 1 : }
8025 : :
8026 : : /**
8027 : : * gi_marshalling_tests_int_three_in_three_out:
8028 : : * @a: (in):
8029 : : * @b: (in):
8030 : : * @c: (in):
8031 : : * @out0: (out):
8032 : : * @out1: (out):
8033 : : * @out2: (out):
8034 : : */
8035 : : void
8036 : 1 : gi_marshalling_tests_int_three_in_three_out (gint a, gint b, gint c, gint *out0, gint *out1, gint *out2)
8037 : : {
8038 : 1 : *out0 = a;
8039 : 1 : *out1 = b;
8040 : 1 : *out2 = c;
8041 : 1 : }
8042 : :
8043 : : /**
8044 : : * gi_marshalling_tests_int_return_out:
8045 : : * @int_: (out):
8046 : : */
8047 : : gint
8048 : 1 : gi_marshalling_tests_int_return_out (gint *int_)
8049 : : {
8050 : 1 : *int_ = 7;
8051 : 1 : return 6;
8052 : : }
8053 : :
8054 : : /**
8055 : : * gi_marshalling_tests_int_two_in_utf8_two_in_with_allow_none:
8056 : : * @a: (in): Must be 1
8057 : : * @b: (in): Must be 2
8058 : : * @c: (in) (allow-none): Must be "3" or NULL
8059 : : * @d: (in) (allow-none): Must be "4" or NULL
8060 : : */
8061 : : void
8062 : 4 : gi_marshalling_tests_int_two_in_utf8_two_in_with_allow_none (gint a, gint b, const gchar *c, const gchar *d)
8063 : : {
8064 : 4 : g_assert_cmpint (a, ==, 1);
8065 : 4 : g_assert_cmpint (b, ==, 2);
8066 [ + + ]: 4 : if (c != NULL)
8067 : 2 : g_assert_cmpstr (c, ==, "3");
8068 [ + + ]: 4 : if (d != NULL)
8069 : 2 : g_assert_cmpstr (d, ==, "4");
8070 : 4 : }
8071 : :
8072 : : /**
8073 : : * gi_marshalling_tests_int_one_in_utf8_two_in_one_allows_none:
8074 : : * @a: (in): Must be 1
8075 : : * @b: (in) (allow-none): Must be "2" or NULL
8076 : : * @c: (in): Must be "3"
8077 : : */
8078 : : void
8079 : 2 : gi_marshalling_tests_int_one_in_utf8_two_in_one_allows_none (gint a, const gchar *b, const gchar *c)
8080 : : {
8081 : 2 : g_assert_cmpint (a, ==, 1);
8082 [ + + ]: 2 : if (b != NULL)
8083 : 1 : g_assert_cmpstr (b, ==, "2");
8084 : 2 : g_assert_cmpstr (c, ==, "3");
8085 : 2 : }
8086 : :
8087 : : /**
8088 : : * gi_marshalling_tests_array_in_utf8_two_in:
8089 : : * @ints: (array length=length):
8090 : : * @length:
8091 : : * @a: (in) (allow-none): Must be "1" or NULL
8092 : : * @b: (in) (allow-none): Must be "2" or NULL
8093 : : */
8094 : : void
8095 : 4 : gi_marshalling_tests_array_in_utf8_two_in (const gint *ints, gint length, const gchar *a, const gchar *b)
8096 : : {
8097 : 4 : g_assert_cmpint (length, ==, 4);
8098 : 4 : g_assert_cmpint (ints[0], ==, -1);
8099 : 4 : g_assert_cmpint (ints[1], ==, 0);
8100 : 4 : g_assert_cmpint (ints[2], ==, 1);
8101 : 4 : g_assert_cmpint (ints[3], ==, 2);
8102 : :
8103 [ + + ]: 4 : if (a != NULL)
8104 : 2 : g_assert_cmpstr (a, ==, "1");
8105 [ + + ]: 4 : if (b != NULL)
8106 : 2 : g_assert_cmpstr (b, ==, "2");
8107 : 4 : }
8108 : :
8109 : : /**
8110 : : * gi_marshalling_tests_array_in_utf8_two_in_out_of_order:
8111 : : * @length:
8112 : : * @a: (in) (allow-none): Must be "1" or NULL
8113 : : * @ints: (array length=length):
8114 : : * @b: (in) (allow-none): Must be "2" or NULL
8115 : : */
8116 : : void
8117 : 4 : gi_marshalling_tests_array_in_utf8_two_in_out_of_order (gint length, const gchar *a, const gint *ints, const gchar *b)
8118 : : {
8119 : 4 : g_assert_cmpint (length, ==, 4);
8120 : 4 : g_assert_cmpint (ints[0], ==, -1);
8121 : 4 : g_assert_cmpint (ints[1], ==, 0);
8122 : 4 : g_assert_cmpint (ints[2], ==, 1);
8123 : 4 : g_assert_cmpint (ints[3], ==, 2);
8124 : :
8125 [ + + ]: 4 : if (a != NULL)
8126 : 2 : g_assert_cmpstr (a, ==, "1");
8127 [ + + ]: 4 : if (b != NULL)
8128 : 2 : g_assert_cmpstr (b, ==, "2");
8129 : 4 : }
8130 : :
8131 : : /* GError */
8132 : :
8133 : : void
8134 : 1 : gi_marshalling_tests_gerror (GError **error)
8135 : : {
8136 : 1 : GQuark quark = g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
8137 : 1 : g_set_error_literal (error, quark,
8138 : : GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE, GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
8139 : 1 : }
8140 : :
8141 : : /**
8142 : : * gi_marshalling_tests_gerror_array_in:
8143 : : * @in_ints: (array zero-terminated):
8144 : : */
8145 : : void
8146 : 1 : gi_marshalling_tests_gerror_array_in (gint *in_ints G_GNUC_UNUSED,
8147 : : GError **error)
8148 : : {
8149 : 1 : GQuark quark = g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
8150 : 1 : g_set_error_literal (error, quark,
8151 : : GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE, GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
8152 : 1 : }
8153 : :
8154 : : /**
8155 : : * gi_marshalling_tests_gerror_out:
8156 : : * @error: (out) (allow-none) (transfer full): location for the GError.
8157 : : * @debug: (out) (allow-none) (transfer full): location for the debug message
8158 : : *
8159 : : * Inspired by gst_message_parse_error.
8160 : : */
8161 : : void
8162 : 1 : gi_marshalling_tests_gerror_out (GError **error, gchar **debug)
8163 : : {
8164 : 1 : GQuark quark = g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
8165 : 1 : g_set_error_literal (error, quark,
8166 : : GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE, GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
8167 : :
8168 [ + - ]: 1 : if (debug != NULL)
8169 : : {
8170 : 1 : *debug = g_strdup (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DEBUG_MESSAGE);
8171 : : }
8172 : 1 : }
8173 : :
8174 : : /**
8175 : : * gi_marshalling_tests_gerror_out_uninitialized:
8176 : : * @v: (out) (allow-none) (transfer full):
8177 : : * @v2: (out) (allow-none) (transfer full):
8178 : : */
8179 : : gboolean
8180 : 1 : gi_marshalling_tests_gerror_out_uninitialized (GError **v G_GNUC_UNUSED, gchar **v2 G_GNUC_UNUSED)
8181 : : {
8182 : 1 : return FALSE;
8183 : : }
8184 : :
8185 : : /**
8186 : : * gi_marshalling_tests_gerror_out_transfer_none:
8187 : : * @err: (out) (allow-none) (transfer none): location for the GError.
8188 : : * @debug: (out) (allow-none) (transfer none): location for the debug message
8189 : : *
8190 : : * A variant of gi_marshalling_tests_gerror_out() which returns data the caller
8191 : : * must not free.
8192 : : */
8193 : : void
8194 : 1 : gi_marshalling_tests_gerror_out_transfer_none (GError **err, const gchar **debug)
8195 : : {
8196 : : static GError error = { 0,
8197 : : GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE,
8198 : : (gchar *) GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE };
8199 : 1 : error.domain = g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
8200 : 1 : *err = &error;
8201 : 1 : *debug = GI_MARSHALLING_TESTS_CONSTANT_GERROR_DEBUG_MESSAGE;
8202 : 1 : }
8203 : :
8204 : : /**
8205 : : * gi_marshalling_tests_gerror_out_transfer_none_uninitialized:
8206 : : * @v: (out) (allow-none) (transfer none):
8207 : : * @v2: (out) (allow-none) (transfer none):
8208 : : */
8209 : : gboolean
8210 : 1 : gi_marshalling_tests_gerror_out_transfer_none_uninitialized (GError **v G_GNUC_UNUSED, const gchar **v2 G_GNUC_UNUSED)
8211 : : {
8212 : 1 : return FALSE;
8213 : : }
8214 : :
8215 : : /**
8216 : : * gi_marshalling_tests_gerror_return:
8217 : : *
8218 : : * Yet another variant of gi_marshalling_tests_gerror_out().
8219 : : *
8220 : : * Returns: (transfer full): a GError
8221 : : */
8222 : : GError *
8223 : 2 : gi_marshalling_tests_gerror_return (void)
8224 : : {
8225 : 2 : GQuark quark = g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN);
8226 : :
8227 : 2 : return g_error_new_literal (quark, GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE, GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
8228 : : }
8229 : :
8230 : : static GIMarshallingTestsOverridesStruct *
8231 : 1 : gi_marshalling_tests_overrides_struct_copy (GIMarshallingTestsOverridesStruct *struct_)
8232 : : {
8233 : : GIMarshallingTestsOverridesStruct *new_struct;
8234 : :
8235 : 1 : new_struct = g_slice_new (GIMarshallingTestsOverridesStruct);
8236 : :
8237 : 1 : *new_struct = *struct_;
8238 : :
8239 : 1 : return new_struct;
8240 : : }
8241 : :
8242 : : static void
8243 : 3 : gi_marshalling_tests_overrides_struct_free (GIMarshallingTestsOverridesStruct *struct_)
8244 : : {
8245 : 3 : g_slice_free (GIMarshallingTestsOverridesStruct, struct_);
8246 : 3 : }
8247 : :
8248 : : GType
8249 : 8 : gi_marshalling_tests_overrides_struct_get_type (void)
8250 : : {
8251 : : static GType type = 0;
8252 : :
8253 [ + + ]: 8 : if (type == 0)
8254 : : {
8255 : 2 : type =
8256 : 2 : g_boxed_type_register_static ("GIMarshallingTestsOverridesStruct",
8257 : : (GBoxedCopyFunc)
8258 : : gi_marshalling_tests_overrides_struct_copy,
8259 : : (GBoxedFreeFunc) gi_marshalling_tests_overrides_struct_free);
8260 : : }
8261 : :
8262 : 8 : return type;
8263 : : }
8264 : :
8265 : : GIMarshallingTestsOverridesStruct *
8266 : 2 : gi_marshalling_tests_overrides_struct_new (void)
8267 : : {
8268 : 2 : return g_slice_new (GIMarshallingTestsOverridesStruct);
8269 : : }
8270 : :
8271 : : glong
8272 : 1 : gi_marshalling_tests_overrides_struct_method (GIMarshallingTestsOverridesStruct *self G_GNUC_UNUSED)
8273 : : {
8274 : 1 : return 42;
8275 : : }
8276 : :
8277 : : /**
8278 : : * gi_marshalling_tests_overrides_struct_returnv:
8279 : : *
8280 : : * Returns: (transfer full):
8281 : : */
8282 : : GIMarshallingTestsOverridesStruct *
8283 : 1 : gi_marshalling_tests_overrides_struct_returnv (void)
8284 : : {
8285 : 1 : return gi_marshalling_tests_overrides_struct_new ();
8286 : : }
8287 : :
8288 [ + + + - : 15 : G_DEFINE_TYPE (GIMarshallingTestsOverridesObject, gi_marshalling_tests_overrides_object, G_TYPE_OBJECT);
+ + ]
8289 : :
8290 : : static void
8291 : 4 : gi_marshalling_tests_overrides_object_init (GIMarshallingTestsOverridesObject *self G_GNUC_UNUSED)
8292 : : {
8293 : 4 : }
8294 : :
8295 : : static void
8296 : 4 : gi_marshalling_tests_overrides_object_finalize (GObject *object)
8297 : : {
8298 : 4 : G_OBJECT_CLASS (gi_marshalling_tests_overrides_object_parent_class)->finalize (object);
8299 : 4 : }
8300 : :
8301 : : static void
8302 : 2 : gi_marshalling_tests_overrides_object_class_init (GIMarshallingTestsOverridesObjectClass *klass)
8303 : : {
8304 : 2 : GObjectClass *object_class = G_OBJECT_CLASS (klass);
8305 : : #if 0
8306 : : GObjectClass *parent_class = G_OBJECT_CLASS (klass);
8307 : : #endif
8308 : :
8309 : 2 : object_class->finalize = gi_marshalling_tests_overrides_object_finalize;
8310 : 2 : }
8311 : :
8312 : : GIMarshallingTestsOverridesObject *
8313 : 1 : gi_marshalling_tests_overrides_object_new (void)
8314 : : {
8315 : 1 : return g_object_new (GI_MARSHALLING_TESTS_TYPE_OVERRIDES_OBJECT, NULL);
8316 : : }
8317 : :
8318 : : glong
8319 : 1 : gi_marshalling_tests_overrides_object_method (GIMarshallingTestsOverridesObject *self G_GNUC_UNUSED)
8320 : : {
8321 : 1 : return 42;
8322 : : }
8323 : :
8324 : : /**
8325 : : * gi_marshalling_tests_overrides_object_returnv:
8326 : : *
8327 : : * Returns: (transfer full):
8328 : : */
8329 : : GIMarshallingTestsOverridesObject *
8330 : 1 : gi_marshalling_tests_overrides_object_returnv (void)
8331 : : {
8332 : 1 : return g_object_new (GI_MARSHALLING_TESTS_TYPE_OVERRIDES_OBJECT, NULL);
8333 : : }
8334 : :
8335 : : /**
8336 : : * gi_marshalling_tests_filename_list_return:
8337 : : *
8338 : : * Returns: (transfer none) (element-type filename): List of filenames
8339 : : */
8340 : : GSList *
8341 : 1 : gi_marshalling_tests_filename_list_return (void)
8342 : : {
8343 : 1 : return NULL;
8344 : : }
8345 : :
8346 : : /**
8347 : : * gi_marshalling_tests_param_spec_in_bool:
8348 : : */
8349 : : void
8350 : 1 : gi_marshalling_tests_param_spec_in_bool (const GParamSpec *param)
8351 : : {
8352 : 1 : g_assert (G_IS_PARAM_SPEC (param));
8353 : 1 : g_assert_cmpint (G_PARAM_SPEC_VALUE_TYPE (param), ==, G_TYPE_BOOLEAN);
8354 : 1 : g_assert_cmpstr (g_param_spec_get_name ((GParamSpec *) param), ==, "mybool");
8355 : 1 : }
8356 : :
8357 : : /**
8358 : : * gi_marshalling_tests_param_spec_return:
8359 : : *
8360 : : * Returns: (transfer full): a #GParamSpec
8361 : : */
8362 : : GParamSpec *
8363 : 1 : gi_marshalling_tests_param_spec_return (void)
8364 : : {
8365 : 1 : return g_param_spec_string ("test-param", "test", "This is a test", "42", G_PARAM_READABLE);
8366 : : }
8367 : :
8368 : : /**
8369 : : * gi_marshalling_tests_param_spec_out:
8370 : : * @param: (out):
8371 : : */
8372 : : void
8373 : 1 : gi_marshalling_tests_param_spec_out (GParamSpec **param)
8374 : : {
8375 : 1 : *param = g_param_spec_string ("test-param", "test", "This is a test", "42", G_PARAM_READABLE);
8376 : 1 : }
8377 : :
8378 : : /**
8379 : : * gi_marshalling_tests_param_spec_out_uninitialized:
8380 : : * @v: (out):
8381 : : */
8382 : : gboolean
8383 : 1 : gi_marshalling_tests_param_spec_out_uninitialized (GParamSpec **v G_GNUC_UNUSED)
8384 : : {
8385 : 1 : return FALSE;
8386 : : }
8387 : :
8388 : : enum
8389 : : {
8390 : : DUMMY_PROPERTY,
8391 : : SOME_BOOLEAN_PROPERTY,
8392 : : SOME_CHAR_PROPERTY,
8393 : : SOME_UCHAR_PROPERTY,
8394 : : SOME_INT_PROPERTY,
8395 : : SOME_UINT_PROPERTY,
8396 : : SOME_LONG_PROPERTY,
8397 : : SOME_ULONG_PROPERTY,
8398 : : SOME_INT64_PROPERTY,
8399 : : SOME_UINT64_PROPERTY,
8400 : : SOME_FLOAT_PROPERTY,
8401 : : SOME_STRING_PROPERTY,
8402 : : SOME_DOUBLE_PROPERTY,
8403 : : SOME_STRV_PROPERTY,
8404 : : SOME_BOXED_STRUCT_PROPERTY,
8405 : : SOME_VARIANT_PROPERTY,
8406 : : SOME_BOXED_GLIST_PROPERTY,
8407 : : SOME_GVALUE_PROPERTY,
8408 : : SOME_OBJECT_PROPERTY,
8409 : : SOME_FLAGS_PROPERTY,
8410 : : SOME_ENUM_PROPERTY,
8411 : : SOME_BYTE_ARRAY_PROPERTY,
8412 : : SOME_READONLY_PROPERTY,
8413 : : SOME_DEPRECATED_INT_PROPERTY,
8414 : : N_PROPERTIES
8415 : : };
8416 : :
8417 [ + + + - : 2918 : G_DEFINE_TYPE (GIMarshallingTestsPropertiesObject, gi_marshalling_tests_properties_object, G_TYPE_OBJECT);
+ + ]
8418 : :
8419 : : static void
8420 : 111 : gi_marshalling_tests_properties_object_init (GIMarshallingTestsPropertiesObject *self G_GNUC_UNUSED)
8421 : : {
8422 : 111 : }
8423 : :
8424 : : static void
8425 : 111 : gi_marshalling_tests_properties_object_finalize (GObject *obj)
8426 : : {
8427 : : GIMarshallingTestsPropertiesObject *self;
8428 : 111 : self = GI_MARSHALLING_TESTS_PROPERTIES_OBJECT (obj);
8429 : :
8430 [ + + ]: 111 : if (self->some_gvalue)
8431 : : {
8432 : 22 : g_boxed_free (G_TYPE_VALUE, self->some_gvalue);
8433 : 22 : self->some_gvalue = NULL;
8434 : : }
8435 : :
8436 [ + + ]: 111 : g_clear_pointer (&self->some_string, g_free);
8437 [ + + ]: 111 : g_clear_pointer (&self->some_strv, g_strfreev);
8438 [ + + ]: 111 : g_clear_pointer (&self->some_boxed_struct, gi_marshalling_tests_boxed_struct_free);
8439 [ + + ]: 111 : g_clear_pointer (&self->some_byte_array, g_byte_array_unref);
8440 [ + + ]: 111 : g_clear_pointer (&self->some_variant, g_variant_unref);
8441 [ - + ]: 111 : g_clear_pointer (&self->some_boxed_glist, g_list_free);
8442 [ + + ]: 111 : g_clear_object (&self->some_object);
8443 : :
8444 : 111 : G_OBJECT_CLASS (gi_marshalling_tests_properties_object_parent_class)->finalize (obj);
8445 : 111 : }
8446 : :
8447 : : static void
8448 : 181 : gi_marshalling_tests_properties_object_get_property (GObject *object,
8449 : : guint property_id,
8450 : : GValue *value,
8451 : : GParamSpec *pspec)
8452 : : {
8453 : : GIMarshallingTestsPropertiesObject *self;
8454 : 181 : self = GI_MARSHALLING_TESTS_PROPERTIES_OBJECT (object);
8455 [ + + + + : 181 : switch (property_id)
+ + + + +
+ + + + +
+ + + + +
+ + + +
- ]
8456 : : {
8457 : 6 : case SOME_BOOLEAN_PROPERTY:
8458 : 6 : g_value_set_boolean (value, self->some_boolean);
8459 : 6 : break;
8460 : 6 : case SOME_CHAR_PROPERTY:
8461 : 6 : g_value_set_schar (value, self->some_char);
8462 : 6 : break;
8463 : 6 : case SOME_UCHAR_PROPERTY:
8464 : 6 : g_value_set_uchar (value, self->some_uchar);
8465 : 6 : break;
8466 : 10 : case SOME_INT_PROPERTY:
8467 : 10 : g_value_set_int (value, self->some_int);
8468 : 10 : break;
8469 : 6 : case SOME_UINT_PROPERTY:
8470 : 6 : g_value_set_uint (value, self->some_uint);
8471 : 6 : break;
8472 : 6 : case SOME_LONG_PROPERTY:
8473 : 6 : g_value_set_long (value, self->some_long);
8474 : 6 : break;
8475 : 6 : case SOME_ULONG_PROPERTY:
8476 : 6 : g_value_set_ulong (value, self->some_ulong);
8477 : 6 : break;
8478 : 14 : case SOME_INT64_PROPERTY:
8479 : 14 : g_value_set_int64 (value, self->some_int64);
8480 : 14 : break;
8481 : 10 : case SOME_UINT64_PROPERTY:
8482 : 10 : g_value_set_uint64 (value, self->some_uint64);
8483 : 10 : break;
8484 : 2 : case SOME_FLOAT_PROPERTY:
8485 : 2 : g_value_set_float (value, self->some_float);
8486 : 2 : break;
8487 : 2 : case SOME_DOUBLE_PROPERTY:
8488 : 2 : g_value_set_double (value, self->some_double);
8489 : 2 : break;
8490 : 19 : case SOME_STRING_PROPERTY:
8491 : 19 : g_value_set_string (value, self->some_string);
8492 : 19 : break;
8493 : 6 : case SOME_STRV_PROPERTY:
8494 : 6 : g_value_set_boxed (value, self->some_strv);
8495 : 6 : break;
8496 : 12 : case SOME_BOXED_STRUCT_PROPERTY:
8497 : 12 : g_value_set_boxed (value, self->some_boxed_struct);
8498 : 12 : break;
8499 : 6 : case SOME_BOXED_GLIST_PROPERTY:
8500 : 6 : g_value_set_boxed (value, self->some_boxed_glist);
8501 : 6 : break;
8502 : 8 : case SOME_GVALUE_PROPERTY:
8503 : 8 : g_value_set_boxed (value, self->some_gvalue);
8504 : 8 : break;
8505 : 18 : case SOME_VARIANT_PROPERTY:
8506 : 18 : g_value_set_variant (value, self->some_variant);
8507 : 18 : break;
8508 : 12 : case SOME_OBJECT_PROPERTY:
8509 : 12 : g_value_set_object (value, self->some_object);
8510 : 12 : break;
8511 : 6 : case SOME_FLAGS_PROPERTY:
8512 : 6 : g_value_set_flags (value, self->some_flags);
8513 : 6 : break;
8514 : 6 : case SOME_ENUM_PROPERTY:
8515 : 6 : g_value_set_enum (value, self->some_enum);
8516 : 6 : break;
8517 : 12 : case SOME_BYTE_ARRAY_PROPERTY:
8518 : 12 : g_value_set_boxed (value, self->some_byte_array);
8519 : 12 : break;
8520 : 1 : case SOME_READONLY_PROPERTY:
8521 : 1 : g_value_set_int (value, 42);
8522 : 1 : break;
8523 : 1 : case SOME_DEPRECATED_INT_PROPERTY:
8524 : 1 : g_value_set_int (value, self->some_deprecated_int);
8525 : 1 : break;
8526 : 0 : default:
8527 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
8528 : 0 : break;
8529 : : }
8530 : 181 : }
8531 : :
8532 : : static void
8533 : 2614 : gi_marshalling_tests_properties_object_set_property (GObject *object,
8534 : : guint property_id,
8535 : : const GValue *value,
8536 : : GParamSpec *pspec)
8537 : : {
8538 : : GIMarshallingTestsPropertiesObject *self;
8539 : 2614 : self = GI_MARSHALLING_TESTS_PROPERTIES_OBJECT (object);
8540 [ + + + + : 2614 : switch (property_id)
+ + + + +
+ + + + +
+ + + + +
+ + + - ]
8541 : : {
8542 : 117 : case SOME_BOOLEAN_PROPERTY:
8543 : 117 : self->some_boolean = g_value_get_boolean (value);
8544 : 117 : break;
8545 : 117 : case SOME_CHAR_PROPERTY:
8546 : 117 : self->some_char = g_value_get_schar (value);
8547 : 117 : break;
8548 : 117 : case SOME_UCHAR_PROPERTY:
8549 : 117 : self->some_uchar = g_value_get_uchar (value);
8550 : 117 : break;
8551 : 118 : case SOME_INT_PROPERTY:
8552 : 118 : self->some_int = g_value_get_int (value);
8553 : 118 : break;
8554 : 117 : case SOME_UINT_PROPERTY:
8555 : 117 : self->some_uint = g_value_get_uint (value);
8556 : 117 : break;
8557 : 117 : case SOME_LONG_PROPERTY:
8558 : 117 : self->some_long = g_value_get_long (value);
8559 : 117 : break;
8560 : 117 : case SOME_ULONG_PROPERTY:
8561 : 117 : self->some_ulong = g_value_get_ulong (value);
8562 : 117 : break;
8563 : 125 : case SOME_INT64_PROPERTY:
8564 : 125 : self->some_int64 = g_value_get_int64 (value);
8565 : 125 : break;
8566 : 121 : case SOME_UINT64_PROPERTY:
8567 : 121 : self->some_uint64 = g_value_get_uint64 (value);
8568 : 121 : break;
8569 : 113 : case SOME_FLOAT_PROPERTY:
8570 : 113 : self->some_float = g_value_get_float (value);
8571 : 113 : break;
8572 : 113 : case SOME_DOUBLE_PROPERTY:
8573 : 113 : self->some_double = g_value_get_double (value);
8574 : 113 : break;
8575 : 125 : case SOME_STRING_PROPERTY:
8576 [ + + ]: 125 : g_clear_pointer (&self->some_string, g_free);
8577 : 125 : self->some_string = g_value_dup_string (value);
8578 : 125 : break;
8579 : 117 : case SOME_STRV_PROPERTY:
8580 : 117 : g_strfreev (self->some_strv);
8581 : 117 : self->some_strv = g_strdupv (g_value_get_boxed (value));
8582 : 117 : break;
8583 : 123 : case SOME_BOXED_STRUCT_PROPERTY:
8584 : 123 : gi_marshalling_tests_boxed_struct_free (self->some_boxed_struct);
8585 : 123 : self->some_boxed_struct = gi_marshalling_tests_boxed_struct_copy (g_value_get_boxed (value));
8586 : 123 : break;
8587 : 117 : case SOME_BOXED_GLIST_PROPERTY:
8588 : 117 : g_list_free (self->some_boxed_glist);
8589 : 117 : self->some_boxed_glist = g_list_copy (g_value_get_boxed (value));
8590 : 117 : break;
8591 : 119 : case SOME_GVALUE_PROPERTY:
8592 [ + + ]: 119 : if (self->some_gvalue)
8593 : 4 : g_boxed_free (G_TYPE_VALUE, self->some_gvalue);
8594 : 119 : self->some_gvalue = g_value_dup_boxed (value);
8595 : 119 : break;
8596 : 129 : case SOME_VARIANT_PROPERTY:
8597 [ + + ]: 129 : if (self->some_variant != NULL)
8598 : 9 : g_variant_unref (self->some_variant);
8599 : 129 : self->some_variant = g_value_get_variant (value);
8600 [ + + ]: 129 : if (self->some_variant != NULL)
8601 : 36 : g_variant_ref (self->some_variant);
8602 : 129 : break;
8603 : 123 : case SOME_OBJECT_PROPERTY:
8604 [ + + ]: 123 : if (self->some_object != NULL)
8605 : 6 : g_object_unref (self->some_object);
8606 : 123 : self->some_object = g_value_dup_object (value);
8607 : 123 : break;
8608 : 117 : case SOME_FLAGS_PROPERTY:
8609 : 117 : self->some_flags = g_value_get_flags (value);
8610 : 117 : break;
8611 : 117 : case SOME_ENUM_PROPERTY:
8612 : 117 : self->some_enum = g_value_get_enum (value);
8613 : 117 : break;
8614 : 123 : case SOME_BYTE_ARRAY_PROPERTY:
8615 [ + + ]: 123 : if (self->some_byte_array != NULL)
8616 : 6 : g_byte_array_unref (self->some_byte_array);
8617 : 123 : self->some_byte_array = g_value_dup_boxed (value);
8618 : 123 : break;
8619 : 112 : case SOME_DEPRECATED_INT_PROPERTY:
8620 : 112 : self->some_deprecated_int = g_value_get_int (value);
8621 : 112 : break;
8622 : 0 : default:
8623 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
8624 : 0 : break;
8625 : : }
8626 : 2614 : }
8627 : :
8628 : : static GParamSpec *properties_object_properties[N_PROPERTIES] = {
8629 : : NULL,
8630 : : };
8631 : :
8632 : : static void
8633 : 3 : gi_marshalling_tests_properties_object_class_init (GIMarshallingTestsPropertiesObjectClass *klass)
8634 : : {
8635 : 3 : GObjectClass *object_class = G_OBJECT_CLASS (klass);
8636 : :
8637 : 3 : object_class->finalize = gi_marshalling_tests_properties_object_finalize;
8638 : 3 : object_class->get_property = gi_marshalling_tests_properties_object_get_property;
8639 : 3 : object_class->set_property = gi_marshalling_tests_properties_object_set_property;
8640 : :
8641 : 3 : properties_object_properties[SOME_BOOLEAN_PROPERTY] =
8642 : 3 : g_param_spec_boolean ("some-boolean",
8643 : : "some-boolean",
8644 : : "some-boolean",
8645 : : FALSE,
8646 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8647 : :
8648 : 3 : properties_object_properties[SOME_CHAR_PROPERTY] =
8649 : 3 : g_param_spec_char ("some-char",
8650 : : "some-char",
8651 : : "some-char", G_MININT8,
8652 : : G_MAXINT8, 0,
8653 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8654 : :
8655 : 3 : properties_object_properties[SOME_UCHAR_PROPERTY] =
8656 : 3 : g_param_spec_uchar ("some-uchar",
8657 : : "some-uchar",
8658 : : "some-uchar", 0,
8659 : : G_MAXUINT8, 0,
8660 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8661 : :
8662 : 3 : properties_object_properties[SOME_INT_PROPERTY] =
8663 : 3 : g_param_spec_int ("some-int", "some-int",
8664 : : "some-int", G_MININT,
8665 : : G_MAXINT, 0,
8666 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8667 : :
8668 : 3 : properties_object_properties[SOME_UINT_PROPERTY] =
8669 : 3 : g_param_spec_uint ("some-uint",
8670 : : "some-uint",
8671 : : "some-uint", 0,
8672 : : G_MAXUINT, 0,
8673 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8674 : :
8675 : 3 : properties_object_properties[SOME_LONG_PROPERTY] =
8676 : 3 : g_param_spec_long ("some-long",
8677 : : "some-long",
8678 : : "some-long", G_MINLONG,
8679 : : G_MAXLONG, 0,
8680 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8681 : :
8682 : 3 : properties_object_properties[SOME_ULONG_PROPERTY] =
8683 : 3 : g_param_spec_ulong ("some-ulong",
8684 : : "some-ulong",
8685 : : "some-ulong", 0,
8686 : : G_MAXULONG, 0,
8687 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8688 : :
8689 : 3 : properties_object_properties[SOME_INT64_PROPERTY] =
8690 : 3 : g_param_spec_int64 ("some-int64",
8691 : : "some-int64",
8692 : : "some-int64",
8693 : : G_MININT64, G_MAXINT64,
8694 : : 0, G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8695 : :
8696 : 3 : properties_object_properties[SOME_UINT64_PROPERTY] =
8697 : 3 : g_param_spec_uint64 ("some-uint64",
8698 : : "some-uint64",
8699 : : "some-uint64", 0,
8700 : : G_MAXUINT64, 0,
8701 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8702 : :
8703 : 3 : properties_object_properties[SOME_FLOAT_PROPERTY] =
8704 : 3 : g_param_spec_float ("some-float",
8705 : : "some-float",
8706 : : "some-float",
8707 : : -1 * G_MAXFLOAT,
8708 : : G_MAXFLOAT, 0,
8709 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8710 : :
8711 : 3 : properties_object_properties[SOME_DOUBLE_PROPERTY] =
8712 : 3 : g_param_spec_double ("some-double",
8713 : : "some-double",
8714 : : "some-double",
8715 : : -1 * G_MAXDOUBLE,
8716 : : G_MAXDOUBLE, 0,
8717 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8718 : :
8719 : 3 : properties_object_properties[SOME_STRING_PROPERTY] =
8720 : 3 : g_param_spec_string ("some-string",
8721 : : "some-string",
8722 : : "some-string",
8723 : : NULL,
8724 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8725 : :
8726 : 3 : properties_object_properties[SOME_STRV_PROPERTY] =
8727 : 3 : g_param_spec_boxed ("some-strv",
8728 : : "some-strv",
8729 : : "some-strv",
8730 : : G_TYPE_STRV,
8731 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8732 : :
8733 : 3 : properties_object_properties[SOME_BOXED_STRUCT_PROPERTY] =
8734 : 3 : g_param_spec_boxed ("some-boxed-struct",
8735 : : "some-boxed-struct",
8736 : : "some-boxed-struct",
8737 : : gi_marshalling_tests_boxed_struct_get_type (), G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8738 : :
8739 : : /**
8740 : : * GIMarshallingTestsPropertiesObject:some-boxed-glist: (type GLib.List(gint)) (transfer none):
8741 : : */
8742 : 3 : properties_object_properties[SOME_BOXED_GLIST_PROPERTY] =
8743 : 3 : g_param_spec_boxed ("some-boxed-glist",
8744 : : "some-boxed-glist",
8745 : : "some-boxed-glist",
8746 : : gi_marshalling_tests_boxed_glist_get_type (), G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8747 : :
8748 : 3 : properties_object_properties[SOME_GVALUE_PROPERTY] =
8749 : 3 : g_param_spec_boxed ("some-gvalue",
8750 : : "some-gvalue",
8751 : : "some-gvalue",
8752 : : G_TYPE_VALUE,
8753 : : G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
8754 : :
8755 : 3 : properties_object_properties[SOME_VARIANT_PROPERTY] =
8756 : 3 : g_param_spec_variant ("some-variant",
8757 : : "some-variant",
8758 : : "some-variant",
8759 : : G_VARIANT_TYPE_ANY,
8760 : : NULL,
8761 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8762 : :
8763 : 3 : properties_object_properties[SOME_OBJECT_PROPERTY] =
8764 : 3 : g_param_spec_object ("some-object",
8765 : : "some-object",
8766 : : "some-object",
8767 : : G_TYPE_OBJECT,
8768 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8769 : :
8770 : 3 : properties_object_properties[SOME_FLAGS_PROPERTY] =
8771 : 3 : g_param_spec_flags ("some-flags",
8772 : : "some-flags",
8773 : : "some-flags",
8774 : : GI_MARSHALLING_TESTS_TYPE_FLAGS,
8775 : : GI_MARSHALLING_TESTS_FLAGS_VALUE1,
8776 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8777 : :
8778 : 3 : properties_object_properties[SOME_ENUM_PROPERTY] =
8779 : 3 : g_param_spec_enum ("some-enum",
8780 : : "some-enum",
8781 : : "some-enum",
8782 : : GI_MARSHALLING_TESTS_TYPE_GENUM,
8783 : : GI_MARSHALLING_TESTS_GENUM_VALUE1,
8784 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
8785 : :
8786 : 3 : properties_object_properties[SOME_BYTE_ARRAY_PROPERTY] =
8787 : 3 : g_param_spec_boxed ("some-byte-array",
8788 : : "some-byte-array",
8789 : : "some-byte-array",
8790 : : G_TYPE_BYTE_ARRAY,
8791 : : G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
8792 : :
8793 : 3 : properties_object_properties[SOME_READONLY_PROPERTY] =
8794 : 3 : g_param_spec_int ("some-readonly",
8795 : : "some-readonly",
8796 : : "some-readonly",
8797 : : G_MININT, G_MAXINT, 0,
8798 : : G_PARAM_READABLE);
8799 : :
8800 : 3 : properties_object_properties[SOME_DEPRECATED_INT_PROPERTY] =
8801 : 3 : g_param_spec_int ("some-deprecated-int", "some-deprecated-int",
8802 : : "some-deprecated-int", G_MININT,
8803 : : G_MAXINT, 0,
8804 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT | G_PARAM_DEPRECATED);
8805 : :
8806 : 3 : g_object_class_install_properties (object_class, N_PROPERTIES, properties_object_properties);
8807 : 3 : }
8808 : :
8809 : : GIMarshallingTestsPropertiesObject *
8810 : 1 : gi_marshalling_tests_properties_object_new (void)
8811 : : {
8812 : 1 : return g_object_new (GI_MARSHALLING_TESTS_TYPE_PROPERTIES_OBJECT, NULL);
8813 : : }
8814 : :
8815 [ + + + - : 1602 : G_DEFINE_FINAL_TYPE (GIMarshallingTestsPropertiesAccessorsObject,
+ + ]
8816 : : gi_marshalling_tests_properties_accessors_object,
8817 : : G_TYPE_OBJECT)
8818 : :
8819 : : GIMarshallingTestsPropertiesAccessorsObject *
8820 : 0 : gi_marshalling_tests_properties_accessors_object_new (void)
8821 : : {
8822 : 0 : return g_object_new (GI_MARSHALLING_TESTS_TYPE_ACCESSORS_TESTS_PROPERTIES_OBJECT, NULL);
8823 : : }
8824 : :
8825 : : static void
8826 : 72 : gi_marshalling_tests_properties_accessors_object_init (GIMarshallingTestsPropertiesAccessorsObject *self G_GNUC_UNUSED)
8827 : : {
8828 : 72 : }
8829 : :
8830 : : static void
8831 : 6 : gi_marshalling_tests_properties_accessors_object_get_property (GObject *object,
8832 : : guint property_id,
8833 : : GValue *value,
8834 : : GParamSpec *pspec)
8835 : : {
8836 : : GIMarshallingTestsPropertiesAccessorsObject *self;
8837 : 6 : self = GI_MARSHALLING_TESTS_PROPERTIES_ACCESSORS_OBJECT (object);
8838 : :
8839 [ - - - - : 6 : switch (property_id)
- - - - -
- - - - -
- - - - -
- + - -
- ]
8840 : : {
8841 : 0 : case SOME_BOOLEAN_PROPERTY:
8842 : 0 : g_value_set_boolean (value, self->some_boolean);
8843 : 0 : break;
8844 : 0 : case SOME_CHAR_PROPERTY:
8845 : 0 : g_value_set_schar (value, self->some_char);
8846 : 0 : break;
8847 : 0 : case SOME_UCHAR_PROPERTY:
8848 : 0 : g_value_set_uchar (value, self->some_uchar);
8849 : 0 : break;
8850 : 0 : case SOME_INT_PROPERTY:
8851 : 0 : g_value_set_int (value, self->some_int);
8852 : 0 : break;
8853 : 0 : case SOME_UINT_PROPERTY:
8854 : 0 : g_value_set_uint (value, self->some_uint);
8855 : 0 : break;
8856 : 0 : case SOME_LONG_PROPERTY:
8857 : 0 : g_value_set_long (value, self->some_long);
8858 : 0 : break;
8859 : 0 : case SOME_ULONG_PROPERTY:
8860 : 0 : g_value_set_ulong (value, self->some_ulong);
8861 : 0 : break;
8862 : 0 : case SOME_INT64_PROPERTY:
8863 : 0 : g_value_set_int64 (value, self->some_int64);
8864 : 0 : break;
8865 : 0 : case SOME_UINT64_PROPERTY:
8866 : 0 : g_value_set_uint64 (value, self->some_uint64);
8867 : 0 : break;
8868 : 0 : case SOME_FLOAT_PROPERTY:
8869 : 0 : g_value_set_float (value, self->some_float);
8870 : 0 : break;
8871 : 0 : case SOME_DOUBLE_PROPERTY:
8872 : 0 : g_value_set_double (value, self->some_double);
8873 : 0 : break;
8874 : 0 : case SOME_STRING_PROPERTY:
8875 : 0 : g_value_set_string (value, self->some_string);
8876 : 0 : break;
8877 : 0 : case SOME_STRV_PROPERTY:
8878 : 0 : g_value_set_boxed (value, self->some_strv);
8879 : 0 : break;
8880 : 0 : case SOME_BOXED_STRUCT_PROPERTY:
8881 : 0 : g_value_set_boxed (value, self->some_boxed_struct);
8882 : 0 : break;
8883 : 0 : case SOME_BOXED_GLIST_PROPERTY:
8884 : 0 : g_value_set_boxed (value, self->some_boxed_glist);
8885 : 0 : break;
8886 : 0 : case SOME_GVALUE_PROPERTY:
8887 : 0 : g_value_set_boxed (value, self->some_gvalue);
8888 : 0 : break;
8889 : 0 : case SOME_VARIANT_PROPERTY:
8890 : 0 : g_value_set_variant (value, self->some_variant);
8891 : 0 : break;
8892 : 0 : case SOME_OBJECT_PROPERTY:
8893 : 0 : g_value_set_object (value, self->some_object);
8894 : 0 : break;
8895 : 0 : case SOME_FLAGS_PROPERTY:
8896 : 0 : g_value_set_flags (value, self->some_flags);
8897 : 0 : break;
8898 : 0 : case SOME_ENUM_PROPERTY:
8899 : 0 : g_value_set_enum (value, self->some_enum);
8900 : 0 : break;
8901 : 6 : case SOME_BYTE_ARRAY_PROPERTY:
8902 : 6 : g_value_set_boxed (value, self->some_byte_array);
8903 : 6 : break;
8904 : 0 : case SOME_READONLY_PROPERTY:
8905 : 0 : g_value_set_int (value, 42);
8906 : 0 : break;
8907 : 0 : case SOME_DEPRECATED_INT_PROPERTY:
8908 : 0 : g_value_set_int (value, self->some_deprecated_int);
8909 : 0 : break;
8910 : 0 : default:
8911 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
8912 : 0 : break;
8913 : : }
8914 : 6 : }
8915 : :
8916 : : static void
8917 : 1518 : gi_marshalling_tests_properties_accessors_object_set_property (GObject *object,
8918 : : guint property_id,
8919 : : const GValue *value,
8920 : : GParamSpec *pspec)
8921 : : {
8922 : : GIMarshallingTestsPropertiesAccessorsObject *self;
8923 : 1518 : self = GI_MARSHALLING_TESTS_PROPERTIES_ACCESSORS_OBJECT (object);
8924 : :
8925 [ + + + + : 1518 : switch (property_id)
+ + + + +
+ + + + +
+ + + + +
+ + - - ]
8926 : : {
8927 : 72 : case SOME_BOOLEAN_PROPERTY:
8928 : 72 : self->some_boolean = g_value_get_boolean (value);
8929 : 72 : break;
8930 : 72 : case SOME_CHAR_PROPERTY:
8931 : 72 : self->some_char = g_value_get_schar (value);
8932 : 72 : break;
8933 : 72 : case SOME_UCHAR_PROPERTY:
8934 : 72 : self->some_uchar = g_value_get_uchar (value);
8935 : 72 : break;
8936 : 72 : case SOME_INT_PROPERTY:
8937 : 72 : self->some_int = g_value_get_int (value);
8938 : 72 : break;
8939 : 72 : case SOME_UINT_PROPERTY:
8940 : 72 : self->some_uint = g_value_get_uint (value);
8941 : 72 : break;
8942 : 72 : case SOME_LONG_PROPERTY:
8943 : 72 : self->some_long = g_value_get_long (value);
8944 : 72 : break;
8945 : 72 : case SOME_ULONG_PROPERTY:
8946 : 72 : self->some_ulong = g_value_get_ulong (value);
8947 : 72 : break;
8948 : 72 : case SOME_INT64_PROPERTY:
8949 : 72 : self->some_int64 = g_value_get_int64 (value);
8950 : 72 : break;
8951 : 72 : case SOME_UINT64_PROPERTY:
8952 : 72 : self->some_uint64 = g_value_get_uint64 (value);
8953 : 72 : break;
8954 : 72 : case SOME_FLOAT_PROPERTY:
8955 : 72 : self->some_float = g_value_get_float (value);
8956 : 72 : break;
8957 : 72 : case SOME_DOUBLE_PROPERTY:
8958 : 72 : self->some_double = g_value_get_double (value);
8959 : 72 : break;
8960 : 72 : case SOME_STRING_PROPERTY:
8961 [ - + ]: 72 : g_clear_pointer (&self->some_string, g_free);
8962 : 72 : self->some_string = g_value_dup_string (value);
8963 : 72 : break;
8964 : 72 : case SOME_STRV_PROPERTY:
8965 : 72 : g_strfreev (self->some_strv);
8966 : 72 : self->some_strv = g_strdupv (g_value_get_boxed (value));
8967 : 72 : break;
8968 : 72 : case SOME_BOXED_STRUCT_PROPERTY:
8969 : 72 : gi_marshalling_tests_boxed_struct_free (self->some_boxed_struct);
8970 : 72 : self->some_boxed_struct = gi_marshalling_tests_boxed_struct_copy (g_value_get_boxed (value));
8971 : 72 : break;
8972 : 72 : case SOME_BOXED_GLIST_PROPERTY:
8973 : 72 : g_list_free (self->some_boxed_glist);
8974 : 72 : self->some_boxed_glist = g_list_copy (g_value_get_boxed (value));
8975 : 72 : break;
8976 : 72 : case SOME_GVALUE_PROPERTY:
8977 [ - + ]: 72 : if (self->some_gvalue)
8978 : 0 : g_boxed_free (G_TYPE_VALUE, self->some_gvalue);
8979 : 72 : self->some_gvalue = g_value_dup_boxed (value);
8980 : 72 : break;
8981 : 72 : case SOME_VARIANT_PROPERTY:
8982 [ - + ]: 72 : if (self->some_variant != NULL)
8983 : 0 : g_variant_unref (self->some_variant);
8984 : 72 : self->some_variant = g_value_get_variant (value);
8985 [ - + ]: 72 : if (self->some_variant != NULL)
8986 : 0 : g_variant_ref (self->some_variant);
8987 : 72 : break;
8988 : 72 : case SOME_OBJECT_PROPERTY:
8989 [ - + ]: 72 : if (self->some_object != NULL)
8990 : 0 : g_object_unref (self->some_object);
8991 : 72 : self->some_object = g_value_dup_object (value);
8992 : 72 : break;
8993 : 72 : case SOME_FLAGS_PROPERTY:
8994 : 72 : self->some_flags = g_value_get_flags (value);
8995 : 72 : break;
8996 : 72 : case SOME_ENUM_PROPERTY:
8997 : 72 : self->some_enum = g_value_get_enum (value);
8998 : 72 : break;
8999 : 78 : case SOME_BYTE_ARRAY_PROPERTY:
9000 [ + + ]: 78 : if (self->some_byte_array != NULL)
9001 : 3 : g_byte_array_unref (self->some_byte_array);
9002 : 78 : self->some_byte_array = g_value_dup_boxed (value);
9003 : 78 : break;
9004 : 0 : case SOME_DEPRECATED_INT_PROPERTY:
9005 : 0 : self->some_deprecated_int = g_value_get_int (value);
9006 : 0 : break;
9007 : 0 : default:
9008 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
9009 : 0 : break;
9010 : : }
9011 : 1518 : }
9012 : :
9013 : : static void
9014 : 72 : gi_marshalling_tests_properties_accessors_object_dispose (GObject *obj)
9015 : : {
9016 : : GIMarshallingTestsPropertiesAccessorsObject *self;
9017 : 72 : self = GI_MARSHALLING_TESTS_PROPERTIES_ACCESSORS_OBJECT (obj);
9018 : :
9019 [ + + ]: 72 : if (self->some_gvalue)
9020 : : {
9021 : 4 : g_boxed_free (G_TYPE_VALUE, self->some_gvalue);
9022 : 4 : self->some_gvalue = NULL;
9023 : : }
9024 : :
9025 [ + + ]: 72 : g_clear_pointer (&self->some_string, g_free);
9026 [ + + ]: 72 : g_clear_pointer (&self->some_strv, g_strfreev);
9027 [ + + ]: 72 : g_clear_pointer (&self->some_boxed_struct, gi_marshalling_tests_boxed_struct_free);
9028 [ + + ]: 72 : g_clear_pointer (&self->some_byte_array, g_byte_array_unref);
9029 [ + + ]: 72 : g_clear_pointer (&self->some_variant, g_variant_unref);
9030 [ - + ]: 72 : g_clear_pointer (&self->some_boxed_glist, g_list_free);
9031 [ + + ]: 72 : g_clear_object (&self->some_object);
9032 : :
9033 : 72 : G_OBJECT_CLASS (gi_marshalling_tests_properties_accessors_object_parent_class)->dispose (obj);
9034 : 72 : }
9035 : :
9036 : : static GParamSpec *accessors_object_properties[N_PROPERTIES] = {
9037 : : NULL,
9038 : : };
9039 : :
9040 : : static void
9041 : 2 : gi_marshalling_tests_properties_accessors_object_class_init (GIMarshallingTestsPropertiesAccessorsObjectClass *klass)
9042 : : {
9043 : 2 : GObjectClass *object_class = G_OBJECT_CLASS (klass);
9044 : :
9045 : 2 : object_class->dispose = gi_marshalling_tests_properties_accessors_object_dispose;
9046 : 2 : object_class->get_property = gi_marshalling_tests_properties_accessors_object_get_property;
9047 : 2 : object_class->set_property = gi_marshalling_tests_properties_accessors_object_set_property;
9048 : :
9049 : : /**
9050 : : * GIMarshallingTestsPropertiesAccessorsObject:some-boolean: (setter set_boolean) (getter get_boolean):
9051 : : */
9052 : 2 : accessors_object_properties[SOME_BOOLEAN_PROPERTY] =
9053 : 2 : g_param_spec_boolean ("some-boolean",
9054 : : "some-boolean",
9055 : : "some-boolean",
9056 : : FALSE,
9057 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9058 : :
9059 : : /**
9060 : : * GIMarshallingTestsPropertiesAccessorsObject:some-char: (setter set_char) (getter get_char):
9061 : : */
9062 : 2 : accessors_object_properties[SOME_CHAR_PROPERTY] =
9063 : 2 : g_param_spec_char ("some-char",
9064 : : "some-char",
9065 : : "some-char",
9066 : : G_MININT8,
9067 : : G_MAXINT8, 0,
9068 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9069 : :
9070 : : /**
9071 : : * GIMarshallingTestsPropertiesAccessorsObject:some-uchar: (setter set_uchar) (getter get_uchar):
9072 : : */
9073 : 2 : accessors_object_properties[SOME_UCHAR_PROPERTY] =
9074 : 2 : g_param_spec_uchar ("some-uchar",
9075 : : "some-uchar",
9076 : : "some-uchar", 0,
9077 : : G_MAXUINT8, 0,
9078 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9079 : :
9080 : : /**
9081 : : * GIMarshallingTestsPropertiesAccessorsObject:some-int: (setter set_int) (getter get_int):
9082 : : */
9083 : 2 : accessors_object_properties[SOME_INT_PROPERTY] =
9084 : 2 : g_param_spec_int ("some-int", "some-int",
9085 : : "some-int", G_MININT,
9086 : : G_MAXINT, 0,
9087 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9088 : :
9089 : : /**
9090 : : * GIMarshallingTestsPropertiesAccessorsObject:some-uint: (setter set_uint) (getter get_uint):
9091 : : */
9092 : 2 : accessors_object_properties[SOME_UINT_PROPERTY] =
9093 : 2 : g_param_spec_uint ("some-uint",
9094 : : "some-uint",
9095 : : "some-uint", 0,
9096 : : G_MAXUINT, 0,
9097 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9098 : :
9099 : : /**
9100 : : * GIMarshallingTestsPropertiesAccessorsObject:some-long: (setter set_long) (getter get_long):
9101 : : */
9102 : 2 : accessors_object_properties[SOME_LONG_PROPERTY] =
9103 : 2 : g_param_spec_long ("some-long",
9104 : : "some-long",
9105 : : "some-long", G_MINLONG,
9106 : : G_MAXLONG, 0,
9107 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9108 : :
9109 : : /**
9110 : : * GIMarshallingTestsPropertiesAccessorsObject:some-ulong: (setter set_ulong) (getter get_ulong):
9111 : : */
9112 : 2 : accessors_object_properties[SOME_ULONG_PROPERTY] =
9113 : 2 : g_param_spec_ulong ("some-ulong",
9114 : : "some-ulong",
9115 : : "some-ulong", 0,
9116 : : G_MAXULONG, 0,
9117 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9118 : :
9119 : : /**
9120 : : * GIMarshallingTestsPropertiesAccessorsObject:some-int64: (setter set_int64) (getter get_int64):
9121 : : */
9122 : 2 : accessors_object_properties[SOME_INT64_PROPERTY] =
9123 : 2 : g_param_spec_int64 ("some-int64",
9124 : : "some-int64",
9125 : : "some-int64",
9126 : : G_MININT64, G_MAXINT64,
9127 : : 0, G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9128 : :
9129 : : /**
9130 : : * GIMarshallingTestsPropertiesAccessorsObject:some-uint64: (setter set_uint64) (getter get_uint64):
9131 : : */
9132 : 2 : accessors_object_properties[SOME_UINT64_PROPERTY] =
9133 : 2 : g_param_spec_uint64 ("some-uint64",
9134 : : "some-uint64",
9135 : : "some-uint64", 0,
9136 : : G_MAXUINT64, 0,
9137 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9138 : :
9139 : : /**
9140 : : * GIMarshallingTestsPropertiesAccessorsObject:some-float: (setter set_float) (getter get_float):
9141 : : */
9142 : 2 : accessors_object_properties[SOME_FLOAT_PROPERTY] =
9143 : 2 : g_param_spec_float ("some-float",
9144 : : "some-float",
9145 : : "some-float",
9146 : : -1 * G_MAXFLOAT,
9147 : : G_MAXFLOAT, 0,
9148 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9149 : :
9150 : : /**
9151 : : * GIMarshallingTestsPropertiesAccessorsObject:some-double: (setter set_double) (getter get_double):
9152 : : */
9153 : 2 : accessors_object_properties[SOME_DOUBLE_PROPERTY] =
9154 : 2 : g_param_spec_double ("some-double",
9155 : : "some-double",
9156 : : "some-double",
9157 : : -1 * G_MAXDOUBLE,
9158 : : G_MAXDOUBLE, 0,
9159 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9160 : :
9161 : : /**
9162 : : * GIMarshallingTestsPropertiesAccessorsObject:some-string: (setter set_string) (getter get_string):
9163 : : */
9164 : 2 : accessors_object_properties[SOME_STRING_PROPERTY] =
9165 : 2 : g_param_spec_string ("some-string",
9166 : : "some-string",
9167 : : "some-string",
9168 : : NULL,
9169 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9170 : :
9171 : : /**
9172 : : * GIMarshallingTestsPropertiesAccessorsObject:some-strv: (setter set_strv) (getter get_strv):
9173 : : */
9174 : 2 : accessors_object_properties[SOME_STRV_PROPERTY] =
9175 : 2 : g_param_spec_boxed ("some-strv",
9176 : : "some-strv",
9177 : : "some-strv",
9178 : : G_TYPE_STRV,
9179 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9180 : :
9181 : : /**
9182 : : * GIMarshallingTestsPropertiesAccessorsObject:some-boxed-struct: (setter set_boxed_struct) (getter get_boxed_struct):
9183 : : */
9184 : 2 : accessors_object_properties[SOME_BOXED_STRUCT_PROPERTY] =
9185 : 2 : g_param_spec_boxed ("some-boxed-struct",
9186 : : "some-boxed-struct",
9187 : : "some-boxed-struct",
9188 : : gi_marshalling_tests_boxed_struct_get_type (),
9189 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9190 : :
9191 : : /**
9192 : : * GIMarshallingTestsPropertiesAccessorsObject:some-boxed-glist: (type GLib.List(gint)) (transfer none) (setter set_boxed_glist) (getter get_boxed_glist):
9193 : : */
9194 : 2 : accessors_object_properties[SOME_BOXED_GLIST_PROPERTY] =
9195 : 2 : g_param_spec_boxed ("some-boxed-glist",
9196 : : "some-boxed-glist",
9197 : : "some-boxed-glist",
9198 : : gi_marshalling_tests_boxed_glist_get_type (),
9199 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9200 : :
9201 : : /**
9202 : : * GIMarshallingTestsPropertiesAccessorsObject:some-gvalue: (setter set_gvalue) (getter get_gvalue):
9203 : : */
9204 : 2 : accessors_object_properties[SOME_GVALUE_PROPERTY] =
9205 : 2 : g_param_spec_boxed ("some-gvalue",
9206 : : "some-gvalue",
9207 : : "some-gvalue",
9208 : : G_TYPE_VALUE,
9209 : : G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
9210 : :
9211 : : /**
9212 : : * GIMarshallingTestsPropertiesAccessorsObject:some-variant: (setter set_variant) (getter get_variant):
9213 : : */
9214 : 2 : accessors_object_properties[SOME_VARIANT_PROPERTY] =
9215 : 2 : g_param_spec_variant ("some-variant",
9216 : : "some-variant",
9217 : : "some-variant",
9218 : : G_VARIANT_TYPE_ANY,
9219 : : NULL,
9220 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9221 : :
9222 : : /**
9223 : : * GIMarshallingTestsPropertiesAccessorsObject:some-object: (setter set_object) (getter get_object):
9224 : : */
9225 : 2 : accessors_object_properties[SOME_OBJECT_PROPERTY] =
9226 : 2 : g_param_spec_object ("some-object",
9227 : : "some-object",
9228 : : "some-object",
9229 : : G_TYPE_OBJECT,
9230 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9231 : :
9232 : : /**
9233 : : * GIMarshallingTestsPropertiesAccessorsObject:some-flags: (setter set_flags) (getter get_flags):
9234 : : */
9235 : 2 : accessors_object_properties[SOME_FLAGS_PROPERTY] =
9236 : 2 : g_param_spec_flags ("some-flags",
9237 : : "some-flags",
9238 : : "some-flags",
9239 : : GI_MARSHALLING_TESTS_TYPE_FLAGS,
9240 : : GI_MARSHALLING_TESTS_FLAGS_VALUE1,
9241 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9242 : :
9243 : : /**
9244 : : * GIMarshallingTestsPropertiesAccessorsObject:some-enum: (setter set_enum) (getter get_enum):
9245 : : */
9246 : 2 : accessors_object_properties[SOME_ENUM_PROPERTY] =
9247 : 2 : g_param_spec_enum ("some-enum",
9248 : : "some-enum",
9249 : : "some-enum",
9250 : : GI_MARSHALLING_TESTS_TYPE_GENUM,
9251 : : GI_MARSHALLING_TESTS_GENUM_VALUE1,
9252 : : G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
9253 : :
9254 : : /**
9255 : : * GIMarshallingTestsPropertiesAccessorsObject:some-byte_array: (setter set_byte_array) (getter get_byte_array):
9256 : : */
9257 : 2 : accessors_object_properties[SOME_BYTE_ARRAY_PROPERTY] =
9258 : 2 : g_param_spec_boxed ("some-byte-array",
9259 : : "some-byte-array",
9260 : : "some-byte-array",
9261 : : G_TYPE_BYTE_ARRAY,
9262 : : G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
9263 : :
9264 : : /**
9265 : : * GIMarshallingTestsPropertiesAccessorsObject:some-readonly: (getter get_readonly):
9266 : : */
9267 : 2 : accessors_object_properties[SOME_READONLY_PROPERTY] =
9268 : 2 : g_param_spec_int ("some-readonly",
9269 : : "some-readonly",
9270 : : "some-readonly",
9271 : : G_MININT, G_MAXINT, 0,
9272 : : G_PARAM_READABLE);
9273 : :
9274 : : /**
9275 : : * GIMarshallingTestsPropertiesAccessorsObject:some-deprecated-int: (setter set_deprecated_int) (getter get_deprecated_int):
9276 : : * Deprecated: 0.1
9277 : : */
9278 : 2 : accessors_object_properties[SOME_DEPRECATED_INT_PROPERTY] =
9279 : 2 : g_param_spec_int ("some-deprecated-int",
9280 : : "some-deprecated-int",
9281 : : "some-deprecated-int",
9282 : : G_MININT, G_MAXINT, 0,
9283 : : G_PARAM_READWRITE |
9284 : : G_PARAM_DEPRECATED);
9285 : :
9286 : 2 : g_object_class_install_properties (object_class, N_PROPERTIES, accessors_object_properties);
9287 : 2 : }
9288 : :
9289 : : /**
9290 : : * gi_marshalling_tests_properties_accessors_object_set_boolean: (set-property some-boolean)
9291 : : * @self:
9292 : : * @some_boolean:
9293 : : */
9294 : : void
9295 : 6 : gi_marshalling_tests_properties_accessors_object_set_boolean (GIMarshallingTestsPropertiesAccessorsObject *self, gboolean some_boolean)
9296 : : {
9297 [ - + ]: 6 : if (self->some_boolean == some_boolean)
9298 : 0 : return;
9299 : :
9300 : 6 : self->some_boolean = some_boolean;
9301 : 6 : g_object_notify (G_OBJECT (self), "some-boolean");
9302 : : }
9303 : :
9304 : : /**
9305 : : * gi_marshalling_tests_properties_accessors_object_set_char: (set-property some-char)
9306 : : * @self:
9307 : : * @some_char:
9308 : : */
9309 : : void
9310 : 6 : gi_marshalling_tests_properties_accessors_object_set_char (GIMarshallingTestsPropertiesAccessorsObject *self, gchar some_char)
9311 : : {
9312 [ - + ]: 6 : if (self->some_char == some_char)
9313 : 0 : return;
9314 : :
9315 : 6 : self->some_char = some_char;
9316 : 6 : g_object_notify (G_OBJECT (self), "some-char");
9317 : : }
9318 : :
9319 : : /**
9320 : : * gi_marshalling_tests_properties_accessors_object_set_uchar: (set-property some-uchar)
9321 : : * @self:
9322 : : * @some_uchar:
9323 : : */
9324 : : void
9325 : 6 : gi_marshalling_tests_properties_accessors_object_set_uchar (GIMarshallingTestsPropertiesAccessorsObject *self, guchar some_uchar)
9326 : : {
9327 [ - + ]: 6 : if (self->some_uchar == some_uchar)
9328 : 0 : return;
9329 : :
9330 : 6 : self->some_uchar = some_uchar;
9331 : 6 : g_object_notify (G_OBJECT (self), "some-uchar");
9332 : : }
9333 : :
9334 : : /**
9335 : : * gi_marshalling_tests_properties_accessors_object_set_int: (set-property some-int)
9336 : : * @self:
9337 : : * @some_int:
9338 : : */
9339 : : void
9340 : 6 : gi_marshalling_tests_properties_accessors_object_set_int (GIMarshallingTestsPropertiesAccessorsObject *self, gint some_int)
9341 : : {
9342 [ - + ]: 6 : if (self->some_int == some_int)
9343 : 0 : return;
9344 : :
9345 : 6 : self->some_int = some_int;
9346 : 6 : g_object_notify (G_OBJECT (self), "some-int");
9347 : : }
9348 : :
9349 : : /**
9350 : : * gi_marshalling_tests_properties_accessors_object_set_uint: (set-property some-uint)
9351 : : * @self:
9352 : : * @some_uint:
9353 : : */
9354 : : void
9355 : 6 : gi_marshalling_tests_properties_accessors_object_set_uint (GIMarshallingTestsPropertiesAccessorsObject *self, guint some_uint)
9356 : : {
9357 [ - + ]: 6 : if (self->some_uint == some_uint)
9358 : 0 : return;
9359 : :
9360 : 6 : self->some_uint = some_uint;
9361 : 6 : g_object_notify (G_OBJECT (self), "some-uint");
9362 : : }
9363 : :
9364 : : /**
9365 : : * gi_marshalling_tests_properties_accessors_object_set_long: (set-property some-long)
9366 : : * @self:
9367 : : * @some_long:
9368 : : */
9369 : : void
9370 : 6 : gi_marshalling_tests_properties_accessors_object_set_long (GIMarshallingTestsPropertiesAccessorsObject *self, glong some_long)
9371 : : {
9372 [ - + ]: 6 : if (self->some_long == some_long)
9373 : 0 : return;
9374 : :
9375 : 6 : self->some_long = some_long;
9376 : 6 : g_object_notify (G_OBJECT (self), "some-long");
9377 : : }
9378 : :
9379 : : /**
9380 : : * gi_marshalling_tests_properties_accessors_object_set_ulong: (set-property some-ulong)
9381 : : * @self:
9382 : : * @some_ulong:
9383 : : */
9384 : : void
9385 : 6 : gi_marshalling_tests_properties_accessors_object_set_ulong (GIMarshallingTestsPropertiesAccessorsObject *self, gulong some_ulong)
9386 : : {
9387 [ - + ]: 6 : if (self->some_ulong == some_ulong)
9388 : 0 : return;
9389 : :
9390 : 6 : self->some_ulong = some_ulong;
9391 : 6 : g_object_notify (G_OBJECT (self), "some-ulong");
9392 : : }
9393 : :
9394 : : /**
9395 : : * gi_marshalling_tests_properties_accessors_object_set_int64: (set-property some-int64)
9396 : : * @self:
9397 : : * @some_int64:
9398 : : */
9399 : : void
9400 : 14 : gi_marshalling_tests_properties_accessors_object_set_int64 (GIMarshallingTestsPropertiesAccessorsObject *self, gint64 some_int64)
9401 : : {
9402 [ - + ]: 14 : if (self->some_int64 == some_int64)
9403 : 0 : return;
9404 : :
9405 : 14 : self->some_int64 = some_int64;
9406 : 14 : g_object_notify (G_OBJECT (self), "some-int64");
9407 : : }
9408 : :
9409 : : /**
9410 : : * gi_marshalling_tests_properties_accessors_object_set_uint64: (set-property some-uint64)
9411 : : * @self:
9412 : : * @some_uint64:
9413 : : */
9414 : : void
9415 : 8 : gi_marshalling_tests_properties_accessors_object_set_uint64 (GIMarshallingTestsPropertiesAccessorsObject *self, guint64 some_uint64)
9416 : : {
9417 [ - + ]: 8 : if (self->some_uint64 == some_uint64)
9418 : 0 : return;
9419 : :
9420 : 8 : self->some_uint64 = some_uint64;
9421 : 8 : g_object_notify (G_OBJECT (self), "some-uint64");
9422 : : }
9423 : :
9424 : : /**
9425 : : * gi_marshalling_tests_properties_accessors_object_set_float: (set-property some-float)
9426 : : * @self:
9427 : : * @some_float:
9428 : : */
9429 : : void
9430 : 2 : gi_marshalling_tests_properties_accessors_object_set_float (GIMarshallingTestsPropertiesAccessorsObject *self, gfloat some_float)
9431 : : {
9432 [ - + ]: 2 : if (self->some_float == some_float)
9433 : 0 : return;
9434 : :
9435 : 2 : self->some_float = some_float;
9436 : 2 : g_object_notify (G_OBJECT (self), "some-float");
9437 : : }
9438 : :
9439 : : /**
9440 : : * gi_marshalling_tests_properties_accessors_object_set_double: (set-property some-double)
9441 : : * @self:
9442 : : * @some_double:
9443 : : */
9444 : : void
9445 : 2 : gi_marshalling_tests_properties_accessors_object_set_double (GIMarshallingTestsPropertiesAccessorsObject *self, gdouble some_double)
9446 : : {
9447 [ - + ]: 2 : if (self->some_double == some_double)
9448 : 0 : return;
9449 : :
9450 : 2 : self->some_double = some_double;
9451 : 2 : g_object_notify (G_OBJECT (self), "some-double");
9452 : : }
9453 : :
9454 : : /**
9455 : : * gi_marshalling_tests_properties_accessors_object_set_string: (set-property some-string)
9456 : : * @self:
9457 : : * @some_string:
9458 : : */
9459 : : void
9460 : 6 : gi_marshalling_tests_properties_accessors_object_set_string (GIMarshallingTestsPropertiesAccessorsObject *self, gchar *some_string)
9461 : : {
9462 [ - + ]: 6 : if (g_strcmp0 (self->some_string, some_string) == 0)
9463 : 0 : return;
9464 : :
9465 : 6 : g_set_str (&self->some_string, some_string);
9466 : 6 : g_object_notify (G_OBJECT (self), "some-string");
9467 : : }
9468 : :
9469 : : /**
9470 : : * gi_marshalling_tests_properties_accessors_object_set_strv: (set-property some-strv)
9471 : : * @self:
9472 : : * @some_strv:
9473 : : */
9474 : : void
9475 : 6 : gi_marshalling_tests_properties_accessors_object_set_strv (GIMarshallingTestsPropertiesAccessorsObject *self, GStrv some_strv)
9476 : : {
9477 [ - + ]: 6 : if (self->some_strv == some_strv)
9478 : 0 : return;
9479 : :
9480 [ + + + - : 9 : if (self->some_strv && some_strv &&
- + ]
9481 : 3 : g_strv_equal ((const char **) self->some_strv, (const char **) some_strv))
9482 : 0 : return;
9483 : :
9484 [ + + ]: 6 : g_clear_pointer (&self->some_strv, g_strfreev);
9485 : 6 : self->some_strv = g_strdupv (some_strv);
9486 : 6 : g_object_notify (G_OBJECT (self), "some-strv");
9487 : : }
9488 : :
9489 : : /**
9490 : : * gi_marshalling_tests_properties_accessors_object_set_boxed_struct: (set-property some-boxed-struct)
9491 : : * @self:
9492 : : * @some_boxed_struct:
9493 : : */
9494 : : void
9495 : 6 : gi_marshalling_tests_properties_accessors_object_set_boxed_struct (GIMarshallingTestsPropertiesAccessorsObject *self, GIMarshallingTestsBoxedStruct *some_boxed_struct)
9496 : : {
9497 [ - + ]: 6 : if (self->some_boxed_struct == some_boxed_struct)
9498 : 0 : return;
9499 : :
9500 [ + + ]: 6 : g_clear_pointer (&self->some_boxed_struct, gi_marshalling_tests_boxed_struct_free);
9501 : 6 : self->some_boxed_struct = gi_marshalling_tests_boxed_struct_copy (some_boxed_struct);
9502 : 6 : g_object_notify (G_OBJECT (self), "some-boxed-struct");
9503 : : }
9504 : :
9505 : : /**
9506 : : * gi_marshalling_tests_properties_accessors_object_set_boxed_glist: (set-property some-boxed-glist)
9507 : : * @self:
9508 : : * @some_boxed_glist: (element-type int):
9509 : : */
9510 : : void
9511 : 0 : gi_marshalling_tests_properties_accessors_object_set_boxed_glist (GIMarshallingTestsPropertiesAccessorsObject *self, GList *some_boxed_glist)
9512 : : {
9513 [ # # ]: 0 : if (self->some_boxed_glist == some_boxed_glist)
9514 : 0 : return;
9515 : :
9516 [ # # ]: 0 : g_clear_pointer (&self->some_boxed_glist, g_list_free);
9517 : 0 : self->some_boxed_glist = g_list_copy (some_boxed_glist);
9518 : 0 : g_object_notify (G_OBJECT (self), "some-boxed-glist");
9519 : : }
9520 : :
9521 : : /**
9522 : : * gi_marshalling_tests_properties_accessors_object_set_gvalue: (set-property some-gvalue)
9523 : : * @self:
9524 : : * @some_gvalue:
9525 : : */
9526 : : void
9527 : 8 : gi_marshalling_tests_properties_accessors_object_set_gvalue (GIMarshallingTestsPropertiesAccessorsObject *self, GValue *some_gvalue)
9528 : : {
9529 [ - + ]: 8 : if (self->some_gvalue == some_gvalue)
9530 : 0 : return;
9531 : :
9532 [ + + ]: 8 : if (self->some_gvalue)
9533 : 4 : g_boxed_free (G_TYPE_VALUE, self->some_gvalue);
9534 : :
9535 : 8 : self->some_gvalue = g_boxed_copy (G_TYPE_VALUE, some_gvalue);
9536 : 8 : g_object_notify (G_OBJECT (self), "some-gvalue");
9537 : : }
9538 : :
9539 : : /**
9540 : : * gi_marshalling_tests_properties_accessors_object_set_variant: (set-property some-variant)
9541 : : * @self:
9542 : : * @some_variant:
9543 : : */
9544 : : void
9545 : 18 : gi_marshalling_tests_properties_accessors_object_set_variant (GIMarshallingTestsPropertiesAccessorsObject *self, GVariant *some_variant)
9546 : : {
9547 [ - + ]: 18 : if (self->some_variant == some_variant)
9548 : 0 : return;
9549 : :
9550 [ + + ]: 18 : g_clear_pointer (&self->some_variant, g_variant_unref);
9551 : 18 : self->some_variant = g_variant_ref_sink (some_variant);
9552 : 18 : g_object_notify (G_OBJECT (self), "some-variant");
9553 : : }
9554 : :
9555 : : /**
9556 : : * gi_marshalling_tests_properties_accessors_object_set_object: (set-property some-object)
9557 : : * @self:
9558 : : * @some_object:
9559 : : */
9560 : : void
9561 : 6 : gi_marshalling_tests_properties_accessors_object_set_object (GIMarshallingTestsPropertiesAccessorsObject *self, GObject *some_object)
9562 : : {
9563 [ - + ]: 6 : if (self->some_object == some_object)
9564 : 0 : return;
9565 : :
9566 : 6 : g_set_object (&self->some_object, some_object);
9567 : 6 : g_object_notify (G_OBJECT (self), "some-object");
9568 : : }
9569 : :
9570 : : /**
9571 : : * gi_marshalling_tests_properties_accessors_object_set_flags: (set-property some-flags)
9572 : : * @self:
9573 : : * @some_flags:
9574 : : */
9575 : : void
9576 : 6 : gi_marshalling_tests_properties_accessors_object_set_flags (GIMarshallingTestsPropertiesAccessorsObject *self, GIMarshallingTestsFlags some_flags)
9577 : : {
9578 [ - + ]: 6 : if (self->some_flags == some_flags)
9579 : 0 : return;
9580 : :
9581 : 6 : self->some_flags = some_flags;
9582 : 6 : g_object_notify (G_OBJECT (self), "some-flags");
9583 : : }
9584 : :
9585 : : /**
9586 : : * gi_marshalling_tests_properties_accessors_object_set_enum: (set-property some-enum)
9587 : : * @self:
9588 : : * @some_enum:
9589 : : */
9590 : : void
9591 : 6 : gi_marshalling_tests_properties_accessors_object_set_enum (GIMarshallingTestsPropertiesAccessorsObject *self, GIMarshallingTestsGEnum some_enum)
9592 : : {
9593 [ - + ]: 6 : if (self->some_enum == some_enum)
9594 : 0 : return;
9595 : :
9596 : 6 : self->some_enum = some_enum;
9597 : 6 : g_object_notify (G_OBJECT (self), "some-enum");
9598 : : }
9599 : :
9600 : : /**
9601 : : * gi_marshalling_tests_properties_accessors_object_set_byte_array: (set-property some-byte-array)
9602 : : * @self:
9603 : : * @some_byte_array:
9604 : : */
9605 : : void
9606 : 0 : gi_marshalling_tests_properties_accessors_object_set_byte_array (GIMarshallingTestsPropertiesAccessorsObject *self, GByteArray *some_byte_array)
9607 : : {
9608 [ # # ]: 0 : if (self->some_byte_array == some_byte_array)
9609 : 0 : return;
9610 : :
9611 [ # # ]: 0 : g_clear_pointer (&self->some_byte_array, g_byte_array_unref);
9612 : 0 : self->some_byte_array = g_byte_array_ref (some_byte_array);
9613 : 0 : g_object_notify (G_OBJECT (self), "some-byte-array");
9614 : : }
9615 : :
9616 : : /**
9617 : : * gi_marshalling_tests_properties_accessors_object_set_deprecated_int: (set-property some-deprecated-int)
9618 : : * @self:
9619 : : * @some_deprecated_int:
9620 : : */
9621 : : void
9622 : 1 : gi_marshalling_tests_properties_accessors_object_set_deprecated_int (GIMarshallingTestsPropertiesAccessorsObject *self, gint some_deprecated_int)
9623 : : {
9624 [ - + ]: 1 : if (self->some_deprecated_int == some_deprecated_int)
9625 : 0 : return;
9626 : :
9627 : 1 : self->some_deprecated_int = some_deprecated_int;
9628 : 1 : g_object_notify (G_OBJECT (self), "some-deprecated-int");
9629 : : }
9630 : :
9631 : : /**
9632 : : * gi_marshalling_tests_properties_accessors_object_get_boolean: (get-property some-boolean)
9633 : : * @self:
9634 : : */
9635 : : gboolean
9636 : 6 : gi_marshalling_tests_properties_accessors_object_get_boolean (GIMarshallingTestsPropertiesAccessorsObject *self)
9637 : : {
9638 : 6 : return self->some_boolean;
9639 : : }
9640 : :
9641 : : /**
9642 : : * gi_marshalling_tests_properties_accessors_object_get_char: (get-property some-char)
9643 : : * @self:
9644 : : */
9645 : : gchar
9646 : 6 : gi_marshalling_tests_properties_accessors_object_get_char (GIMarshallingTestsPropertiesAccessorsObject *self)
9647 : : {
9648 : 6 : return self->some_char;
9649 : : }
9650 : :
9651 : : /**
9652 : : * gi_marshalling_tests_properties_accessors_object_get_uchar: (get-property some-uchar)
9653 : : * @self:
9654 : : */
9655 : : guchar
9656 : 6 : gi_marshalling_tests_properties_accessors_object_get_uchar (GIMarshallingTestsPropertiesAccessorsObject *self)
9657 : : {
9658 : 6 : return self->some_uchar;
9659 : : }
9660 : :
9661 : : /**
9662 : : * gi_marshalling_tests_properties_accessors_object_get_int: (get-property some-int)
9663 : : * @self:
9664 : : */
9665 : : gint
9666 : 6 : gi_marshalling_tests_properties_accessors_object_get_int (GIMarshallingTestsPropertiesAccessorsObject *self)
9667 : : {
9668 : 6 : return self->some_int;
9669 : : }
9670 : :
9671 : : /**
9672 : : * gi_marshalling_tests_properties_accessors_object_get_uint: (get-property some-uint)
9673 : : * @self:
9674 : : */
9675 : : guint
9676 : 6 : gi_marshalling_tests_properties_accessors_object_get_uint (GIMarshallingTestsPropertiesAccessorsObject *self)
9677 : : {
9678 : 6 : return self->some_uint;
9679 : : }
9680 : :
9681 : : /**
9682 : : * gi_marshalling_tests_properties_accessors_object_get_long: (get-property some-long)
9683 : : * @self:
9684 : : */
9685 : : glong
9686 : 6 : gi_marshalling_tests_properties_accessors_object_get_long (GIMarshallingTestsPropertiesAccessorsObject *self)
9687 : : {
9688 : 6 : return self->some_long;
9689 : : }
9690 : :
9691 : : /**
9692 : : * gi_marshalling_tests_properties_accessors_object_get_ulong: (get-property some-ulong)
9693 : : * @self:
9694 : : */
9695 : : gulong
9696 : 6 : gi_marshalling_tests_properties_accessors_object_get_ulong (GIMarshallingTestsPropertiesAccessorsObject *self)
9697 : : {
9698 : 6 : return self->some_ulong;
9699 : : }
9700 : :
9701 : : /**
9702 : : * gi_marshalling_tests_properties_accessors_object_get_int64: (get-property some-int64)
9703 : : * @self:
9704 : : */
9705 : : gint64
9706 : 14 : gi_marshalling_tests_properties_accessors_object_get_int64 (GIMarshallingTestsPropertiesAccessorsObject *self)
9707 : : {
9708 : 14 : return self->some_int64;
9709 : : }
9710 : :
9711 : : /**
9712 : : * gi_marshalling_tests_properties_accessors_object_get_uint64: (get-property some-uint64)
9713 : : * @self:
9714 : : */
9715 : : guint64
9716 : 8 : gi_marshalling_tests_properties_accessors_object_get_uint64 (GIMarshallingTestsPropertiesAccessorsObject *self)
9717 : : {
9718 : 8 : return self->some_uint64;
9719 : : }
9720 : :
9721 : : /**
9722 : : * gi_marshalling_tests_properties_accessors_object_get_float: (get-property some-float)
9723 : : * @self:
9724 : : */
9725 : : gfloat
9726 : 2 : gi_marshalling_tests_properties_accessors_object_get_float (GIMarshallingTestsPropertiesAccessorsObject *self)
9727 : : {
9728 : 2 : return self->some_float;
9729 : : }
9730 : :
9731 : : /**
9732 : : * gi_marshalling_tests_properties_accessors_object_get_double: (get-property some-double)
9733 : : * @self:
9734 : : */
9735 : : gdouble
9736 : 2 : gi_marshalling_tests_properties_accessors_object_get_double (GIMarshallingTestsPropertiesAccessorsObject *self)
9737 : : {
9738 : 2 : return self->some_double;
9739 : : }
9740 : :
9741 : : /**
9742 : : * gi_marshalling_tests_properties_accessors_object_get_string: (get-property some-string)
9743 : : * @self:
9744 : : */
9745 : : const gchar *
9746 : 6 : gi_marshalling_tests_properties_accessors_object_get_string (GIMarshallingTestsPropertiesAccessorsObject *self)
9747 : : {
9748 : 6 : return self->some_string;
9749 : : }
9750 : :
9751 : : /**
9752 : : * gi_marshalling_tests_properties_accessors_object_get_strv: (get-property some-strv)
9753 : : * @self:
9754 : : *
9755 : : * Returns: (transfer none):
9756 : : */
9757 : : gchar **
9758 : 6 : gi_marshalling_tests_properties_accessors_object_get_strv (GIMarshallingTestsPropertiesAccessorsObject *self)
9759 : : {
9760 : 6 : return self->some_strv;
9761 : : }
9762 : :
9763 : : /**
9764 : : * gi_marshalling_tests_properties_accessors_object_get_boxed_struct: (get-property some-boxed-struct)
9765 : : * @self:
9766 : : *
9767 : : * Returns: (transfer none):
9768 : : */
9769 : : GIMarshallingTestsBoxedStruct *
9770 : 6 : gi_marshalling_tests_properties_accessors_object_get_boxed_struct (GIMarshallingTestsPropertiesAccessorsObject *self)
9771 : : {
9772 : 6 : return self->some_boxed_struct;
9773 : : }
9774 : :
9775 : : /**
9776 : : * gi_marshalling_tests_properties_accessors_object_get_boxed_glist: (get-property some-boxed-glist)
9777 : : * @self:
9778 : : *
9779 : : * Returns: (element-type int) (transfer none):
9780 : : */
9781 : : GList *
9782 : 0 : gi_marshalling_tests_properties_accessors_object_get_boxed_glist (GIMarshallingTestsPropertiesAccessorsObject *self)
9783 : : {
9784 : 0 : return self->some_boxed_glist;
9785 : : }
9786 : :
9787 : : /**
9788 : : * gi_marshalling_tests_properties_accessors_object_get_gvalue: (get-property some-gvalue)
9789 : : * @self:
9790 : : *
9791 : : * Returns: (transfer none):
9792 : : */
9793 : : GValue *
9794 : 8 : gi_marshalling_tests_properties_accessors_object_get_gvalue (GIMarshallingTestsPropertiesAccessorsObject *self)
9795 : : {
9796 : 8 : return self->some_gvalue;
9797 : : }
9798 : :
9799 : : /**
9800 : : * gi_marshalling_tests_properties_accessors_object_get_variant: (get-property some-variant)
9801 : : * @self:
9802 : : *
9803 : : * Returns: (transfer none):
9804 : : */
9805 : : GVariant *
9806 : 18 : gi_marshalling_tests_properties_accessors_object_get_variant (GIMarshallingTestsPropertiesAccessorsObject *self)
9807 : : {
9808 : 18 : return self->some_variant;
9809 : : }
9810 : :
9811 : : /**
9812 : : * gi_marshalling_tests_properties_accessors_object_get_object: (get-property some-object)
9813 : : * @self:
9814 : : *
9815 : : * Returns: (transfer none):
9816 : : */
9817 : : GObject *
9818 : 6 : gi_marshalling_tests_properties_accessors_object_get_object (GIMarshallingTestsPropertiesAccessorsObject *self)
9819 : : {
9820 : 6 : return self->some_object;
9821 : : }
9822 : :
9823 : : /**
9824 : : * gi_marshalling_tests_properties_accessors_object_get_flags: (get-property some-flags)
9825 : : * @self:
9826 : : */
9827 : : GIMarshallingTestsFlags
9828 : 6 : gi_marshalling_tests_properties_accessors_object_get_flags (GIMarshallingTestsPropertiesAccessorsObject *self)
9829 : : {
9830 : 6 : return self->some_flags;
9831 : : }
9832 : :
9833 : : /**
9834 : : * gi_marshalling_tests_properties_accessors_object_get_enum: (get-property some-enum)
9835 : : * @self:
9836 : : */
9837 : : GIMarshallingTestsGEnum
9838 : 6 : gi_marshalling_tests_properties_accessors_object_get_enum (GIMarshallingTestsPropertiesAccessorsObject *self)
9839 : : {
9840 : 6 : return self->some_enum;
9841 : : }
9842 : :
9843 : : /**
9844 : : * gi_marshalling_tests_properties_accessors_object_get_byte_array: (get-property some-byte-array)
9845 : : * @self:
9846 : : *
9847 : : * Returns: (transfer none):
9848 : : */
9849 : : GByteArray *
9850 : 0 : gi_marshalling_tests_properties_accessors_object_get_byte_array (GIMarshallingTestsPropertiesAccessorsObject *self)
9851 : : {
9852 : 0 : return self->some_byte_array;
9853 : : }
9854 : :
9855 : : /**
9856 : : * gi_marshalling_tests_properties_accessors_object_get_readonly: (get-property some-readonly)
9857 : : * @self:
9858 : : */
9859 : : gint
9860 : 1 : gi_marshalling_tests_properties_accessors_object_get_readonly (GIMarshallingTestsPropertiesAccessorsObject *self G_GNUC_UNUSED)
9861 : : {
9862 : 1 : return 42;
9863 : : }
9864 : :
9865 : : /**
9866 : : * gi_marshalling_tests_properties_accessors_object_get_deprecated_int: (get-property some-deprecated-int)
9867 : : * @self:
9868 : : */
9869 : : gint
9870 : 1 : gi_marshalling_tests_properties_accessors_object_get_deprecated_int (GIMarshallingTestsPropertiesAccessorsObject *self)
9871 : : {
9872 : 1 : return self->some_deprecated_int;
9873 : : }
9874 : :
9875 [ + + + - : 39 : G_DEFINE_TYPE (GIMarshallingTestsSignalsObject, gi_marshalling_tests_signals_object, G_TYPE_OBJECT);
+ + ]
9876 : :
9877 : : static void
9878 : 14 : gi_marshalling_tests_signals_object_init (GIMarshallingTestsSignalsObject *object G_GNUC_UNUSED)
9879 : : {
9880 : 14 : }
9881 : :
9882 : : static void
9883 : 14 : gi_marshalling_tests_signals_object_finalize (GObject *object)
9884 : : {
9885 : 14 : G_OBJECT_CLASS (gi_marshalling_tests_signals_object_parent_class)->finalize (object);
9886 : 14 : }
9887 : :
9888 : : static void
9889 : 2 : gi_marshalling_tests_signals_object_class_init (GIMarshallingTestsSignalsObjectClass *klass)
9890 : : {
9891 : 2 : GObjectClass *object_class = G_OBJECT_CLASS (klass);
9892 : :
9893 : 2 : object_class->finalize = gi_marshalling_tests_signals_object_finalize;
9894 : :
9895 : : /**
9896 : : * GIMarshallingTestsSignalsObject::some-boxed-gptrarray-utf8:
9897 : : * @self:
9898 : : * @arg: (element-type utf8):
9899 : : */
9900 : 2 : g_signal_new ("some-boxed-gptrarray-utf8",
9901 : : G_TYPE_FROM_CLASS (klass),
9902 : : G_SIGNAL_RUN_LAST,
9903 : : 0, NULL, NULL, NULL,
9904 : : G_TYPE_NONE, 1,
9905 : : G_TYPE_PTR_ARRAY);
9906 : :
9907 : : /**
9908 : : * GIMarshallingTestsSignalsObject::some-boxed-gptrarray-utf8-container:
9909 : : * @self:
9910 : : * @arg: (element-type utf8) (transfer container):
9911 : : */
9912 : 2 : g_signal_new ("some-boxed-gptrarray-utf8-container",
9913 : : G_TYPE_FROM_CLASS (klass),
9914 : : G_SIGNAL_RUN_LAST,
9915 : : 0, NULL, NULL, NULL,
9916 : : G_TYPE_NONE, 1,
9917 : : G_TYPE_PTR_ARRAY);
9918 : :
9919 : : /**
9920 : : * GIMarshallingTestsSignalsObject::some-boxed-gptrarray-utf8-full:
9921 : : * @self:
9922 : : * @arg: (element-type utf8) (transfer full):
9923 : : */
9924 : 2 : g_signal_new ("some-boxed-gptrarray-utf8-full",
9925 : : G_TYPE_FROM_CLASS (klass),
9926 : : G_SIGNAL_RUN_LAST,
9927 : : 0, NULL, NULL, NULL,
9928 : : G_TYPE_NONE, 1,
9929 : : G_TYPE_PTR_ARRAY);
9930 : :
9931 : : /**
9932 : : * GIMarshallingTestsSignalsObject::some-boxed-gptrarray-boxed-struct:
9933 : : * @self:
9934 : : * @arg: (element-type GIMarshallingTestsBoxedStruct):
9935 : : */
9936 : 2 : g_signal_new ("some-boxed-gptrarray-boxed-struct",
9937 : : G_TYPE_FROM_CLASS (klass),
9938 : : G_SIGNAL_RUN_LAST,
9939 : : 0, NULL, NULL, NULL,
9940 : : G_TYPE_NONE, 1,
9941 : : G_TYPE_PTR_ARRAY);
9942 : :
9943 : : /**
9944 : : * GIMarshallingTestsSignalsObject::some-boxed-gptrarray-boxed-struct-container:
9945 : : * @self:
9946 : : * @arg: (element-type GIMarshallingTestsBoxedStruct) (transfer container):
9947 : : */
9948 : 2 : g_signal_new ("some-boxed-gptrarray-boxed-struct-container",
9949 : : G_TYPE_FROM_CLASS (klass),
9950 : : G_SIGNAL_RUN_LAST,
9951 : : 0, NULL, NULL, NULL,
9952 : : G_TYPE_NONE, 1,
9953 : : G_TYPE_PTR_ARRAY);
9954 : : /**
9955 : : * GIMarshallingTestsSignalsObject::some-boxed-gptrarray-boxed-struct-full:
9956 : : * @self:
9957 : : * @arg: (element-type GIMarshallingTestsBoxedStruct) (transfer full):
9958 : : */
9959 : 2 : g_signal_new ("some-boxed-gptrarray-boxed-struct-full",
9960 : : G_TYPE_FROM_CLASS (klass),
9961 : : G_SIGNAL_RUN_LAST,
9962 : : 0, NULL, NULL, NULL,
9963 : : G_TYPE_NONE, 1,
9964 : : G_TYPE_PTR_ARRAY);
9965 : :
9966 : : /**
9967 : : * GIMarshallingTestsSignalsObject::some-hash-table-utf8-int:
9968 : : * @self:
9969 : : * @arg: (type GHashTable) (element-type utf8 int):
9970 : : */
9971 : 2 : g_signal_new ("some-hash-table-utf8-int",
9972 : : G_TYPE_FROM_CLASS (klass),
9973 : : G_SIGNAL_RUN_LAST,
9974 : : 0, NULL, NULL, NULL,
9975 : : G_TYPE_NONE, 1,
9976 : : G_TYPE_HASH_TABLE);
9977 : :
9978 : : /**
9979 : : * GIMarshallingTestsSignalsObject::some-hash-table-utf8-int-container:
9980 : : * @self:
9981 : : * @arg: (type GHashTable) (element-type utf8 int) (transfer container):
9982 : : */
9983 : 2 : g_signal_new ("some-hash-table-utf8-int-container",
9984 : : G_TYPE_FROM_CLASS (klass),
9985 : : G_SIGNAL_RUN_LAST,
9986 : : 0, NULL, NULL, NULL,
9987 : : G_TYPE_NONE, 1,
9988 : : G_TYPE_HASH_TABLE);
9989 : :
9990 : : /**
9991 : : * GIMarshallingTestsSignalsObject::some-hash-table-utf8-int-full:
9992 : : * @self:
9993 : : * @arg: (type GHashTable) (element-type utf8 int) (transfer full):
9994 : : */
9995 : 2 : g_signal_new ("some-hash-table-utf8-int-full",
9996 : : G_TYPE_FROM_CLASS (klass),
9997 : : G_SIGNAL_RUN_LAST,
9998 : : 0, NULL, NULL, NULL,
9999 : : G_TYPE_NONE, 1,
10000 : : G_TYPE_HASH_TABLE);
10001 : :
10002 : : /**
10003 : : * GIMarshallingTestsSignalsObject::some-boxed-struct:
10004 : : * @self:
10005 : : * @arg:
10006 : : */
10007 : 2 : g_signal_new ("some-boxed-struct",
10008 : : G_TYPE_FROM_CLASS (klass),
10009 : : G_SIGNAL_RUN_LAST,
10010 : : 0, NULL, NULL, NULL,
10011 : : G_TYPE_NONE, 1,
10012 : : gi_marshalling_tests_boxed_struct_get_type ());
10013 : :
10014 : : /**
10015 : : * GIMarshallingTestsSignalsObject::some-boxed-struct-full:
10016 : : * @self:
10017 : : * @arg: (transfer full):
10018 : : */
10019 : 2 : g_signal_new ("some-boxed-struct-full",
10020 : : G_TYPE_FROM_CLASS (klass),
10021 : : G_SIGNAL_RUN_LAST,
10022 : : 0, NULL, NULL, NULL,
10023 : : G_TYPE_NONE, 1,
10024 : : gi_marshalling_tests_boxed_struct_get_type ());
10025 : 2 : }
10026 : :
10027 : : GIMarshallingTestsSignalsObject *
10028 : 1 : gi_marshalling_tests_signals_object_new (void)
10029 : : {
10030 : 1 : return g_object_new (GI_MARSHALLING_TESTS_TYPE_SIGNALS_OBJECT, NULL);
10031 : : }
10032 : :
10033 : : void
10034 : 1 : gi_marshalling_tests_signals_object_emit_boxed_gptrarray_utf8 (GIMarshallingTestsSignalsObject *object)
10035 : : {
10036 : : GPtrArray *ptrarray;
10037 : :
10038 : 1 : ptrarray = gi_marshalling_tests_gptrarray_utf8_container_return ();
10039 : 1 : g_signal_emit_by_name (object, "some-boxed-gptrarray-utf8",
10040 : : ptrarray);
10041 : 1 : g_ptr_array_unref (ptrarray);
10042 : 1 : }
10043 : :
10044 : : void
10045 : 1 : gi_marshalling_tests_signals_object_emit_boxed_gptrarray_utf8_container (GIMarshallingTestsSignalsObject *object)
10046 : : {
10047 : 1 : g_signal_emit_by_name (object, "some-boxed-gptrarray-utf8-container",
10048 : : gi_marshalling_tests_gptrarray_utf8_container_return ());
10049 : 1 : }
10050 : :
10051 : : void
10052 : 1 : gi_marshalling_tests_signals_object_emit_boxed_gptrarray_utf8_full (GIMarshallingTestsSignalsObject *object)
10053 : : {
10054 : 1 : g_signal_emit_by_name (object, "some-boxed-gptrarray-utf8-full",
10055 : : gi_marshalling_tests_gptrarray_utf8_full_return ());
10056 : 1 : }
10057 : :
10058 : : void
10059 : 1 : gi_marshalling_tests_signals_object_emit_boxed_gptrarray_boxed_struct (GIMarshallingTestsSignalsObject *object)
10060 : : {
10061 : : GPtrArray *ptrarray;
10062 : :
10063 : 1 : ptrarray = gi_marshalling_tests_gptrarray_boxed_struct_full_return ();
10064 : 1 : g_signal_emit_by_name (object, "some-boxed-gptrarray-boxed-struct",
10065 : : ptrarray);
10066 : 1 : g_ptr_array_set_free_func (ptrarray, (GDestroyNotify) gi_marshalling_tests_boxed_struct_free);
10067 : 1 : g_ptr_array_unref (ptrarray);
10068 : 1 : }
10069 : :
10070 : : void
10071 : 1 : gi_marshalling_tests_signals_object_emit_boxed_gptrarray_boxed_struct_container (GIMarshallingTestsSignalsObject *object)
10072 : : {
10073 : : GPtrArray *ptrarray;
10074 : :
10075 : 1 : ptrarray = gi_marshalling_tests_gptrarray_boxed_struct_full_return ();
10076 : 1 : g_ptr_array_set_free_func (ptrarray, (GDestroyNotify) gi_marshalling_tests_boxed_struct_free);
10077 : 1 : g_signal_emit_by_name (object, "some-boxed-gptrarray-boxed-struct-container",
10078 : 1 : g_steal_pointer (&ptrarray));
10079 : 1 : }
10080 : :
10081 : : void
10082 : 1 : gi_marshalling_tests_signals_object_emit_boxed_gptrarray_boxed_struct_full (GIMarshallingTestsSignalsObject *object)
10083 : : {
10084 : 1 : g_signal_emit_by_name (object, "some-boxed-gptrarray-boxed-struct-full",
10085 : : gi_marshalling_tests_gptrarray_boxed_struct_full_return ());
10086 : 1 : }
10087 : :
10088 : : void
10089 : 1 : gi_marshalling_tests_signals_object_emit_hash_table_utf8_int (GIMarshallingTestsSignalsObject *object)
10090 : : {
10091 : : GHashTable *hash_table;
10092 : :
10093 : 1 : hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
10094 : 1 : g_hash_table_insert (hash_table, g_strdup ("-1"), GINT_TO_POINTER (1));
10095 : 1 : g_hash_table_insert (hash_table, g_strdup ("0"), GINT_TO_POINTER (0));
10096 : 1 : g_hash_table_insert (hash_table, g_strdup ("1"), GINT_TO_POINTER (-1));
10097 : 1 : g_hash_table_insert (hash_table, g_strdup ("2"), GINT_TO_POINTER (-2));
10098 : :
10099 : 1 : g_signal_emit_by_name (object, "some-hash-table-utf8-int", hash_table);
10100 : 1 : g_hash_table_unref (hash_table);
10101 : 1 : }
10102 : :
10103 : : void
10104 : 1 : gi_marshalling_tests_signals_object_emit_hash_table_utf8_int_container (GIMarshallingTestsSignalsObject *object)
10105 : : {
10106 : : GHashTable *hash_table;
10107 : :
10108 : 1 : hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
10109 : 1 : g_hash_table_insert (hash_table, g_strdup ("-1"), GINT_TO_POINTER (1));
10110 : 1 : g_hash_table_insert (hash_table, g_strdup ("0"), GINT_TO_POINTER (0));
10111 : 1 : g_hash_table_insert (hash_table, g_strdup ("1"), GINT_TO_POINTER (-1));
10112 : 1 : g_hash_table_insert (hash_table, g_strdup ("2"), GINT_TO_POINTER (-2));
10113 : :
10114 : 1 : g_signal_emit_by_name (object, "some-hash-table-utf8-int-container",
10115 : 1 : g_steal_pointer (&hash_table));
10116 : 1 : }
10117 : :
10118 : : void
10119 : 1 : gi_marshalling_tests_signals_object_emit_hash_table_utf8_int_full (GIMarshallingTestsSignalsObject *object)
10120 : : {
10121 : : GHashTable *hash_table;
10122 : :
10123 : 1 : hash_table = g_hash_table_new (g_str_hash, g_str_equal);
10124 : 1 : g_hash_table_insert (hash_table, g_strdup ("-1"), GINT_TO_POINTER (1));
10125 : 1 : g_hash_table_insert (hash_table, g_strdup ("0"), GINT_TO_POINTER (0));
10126 : 1 : g_hash_table_insert (hash_table, g_strdup ("1"), GINT_TO_POINTER (-1));
10127 : 1 : g_hash_table_insert (hash_table, g_strdup ("2"), GINT_TO_POINTER (-2));
10128 : :
10129 : 1 : g_signal_emit_by_name (object, "some-hash-table-utf8-int-full",
10130 : 1 : g_steal_pointer (&hash_table));
10131 : 1 : }
10132 : :
10133 : : void
10134 : 1 : gi_marshalling_tests_signals_object_emit_boxed_struct (GIMarshallingTestsSignalsObject *object)
10135 : : {
10136 : 1 : GIMarshallingTestsBoxedStruct *boxed = gi_marshalling_tests_boxed_struct_new ();
10137 : 1 : boxed->long_ = 99;
10138 : 1 : boxed->string_ = g_strdup ("a string");
10139 : 1 : boxed->g_strv = g_strdupv ((GStrv) (const char *[]){ "foo", "bar", "baz", NULL });
10140 : :
10141 : 1 : g_signal_emit_by_name (object, "some-boxed-struct", boxed);
10142 [ + - ]: 1 : g_clear_pointer (&boxed, gi_marshalling_tests_boxed_struct_free);
10143 : 1 : }
10144 : :
10145 : : void
10146 : 0 : gi_marshalling_tests_signals_object_emit_boxed_struct_full (GIMarshallingTestsSignalsObject *object)
10147 : : {
10148 : 0 : GIMarshallingTestsBoxedStruct *boxed = gi_marshalling_tests_boxed_struct_new ();
10149 : :
10150 : 0 : boxed->long_ = 99;
10151 : 0 : boxed->string_ = g_strdup ("a string");
10152 : 0 : boxed->g_strv = g_strdupv ((GStrv) (const char *[]){ "foo", "bar", "baz", NULL });
10153 : 0 : g_signal_emit_by_name (object, "some-boxed-struct-full", g_steal_pointer (&boxed));
10154 : 0 : }
|