Coverage Report

Created: 2026-11-22 17:17

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hdf5/src/H5Pgcpl.c
Line
Count
Source
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
 * Copyright by The HDF Group.                                               *
3
 * All rights reserved.                                                      *
4
 *                                                                           *
5
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
6
 * terms governing use, modification, and redistribution, is contained in    *
7
 * the LICENSE file, which can be found at the root of the source code       *
8
 * distribution tree, or in https://www.hdfgroup.org/licenses.               *
9
 * If you do not have access to either file, you may request a copy from     *
10
 * help@hdfgroup.org.                                                        *
11
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12
13
/*-------------------------------------------------------------------------
14
 *
15
 * Created:   H5Pgcpl.c
16
 *
17
 * Purpose:   Group creation property list class routines
18
 *
19
 *-------------------------------------------------------------------------
20
 */
21
22
/****************/
23
/* Module Setup */
24
/****************/
25
26
#include "H5Pmodule.h" /* This source code file is part of the H5P module */
27
28
/***********/
29
/* Headers */
30
/***********/
31
#include "H5private.h"  /* Generic Functions                        */
32
#include "H5Eprivate.h" /* Error handling                           */
33
#include "H5Gprivate.h" /* Groups                                   */
34
#include "H5Oprivate.h" /* Object headers                           */
35
#include "H5Ppkg.h"     /* Property lists                           */
36
37
/****************/
38
/* Local Macros */
39
/****************/
40
41
/* ========= Group Creation properties ============ */
42
1
#define H5G_CRT_GROUP_INFO_ENC H5P__gcrt_group_info_enc
43
1
#define H5G_CRT_GROUP_INFO_DEC H5P__gcrt_group_info_dec
44
1
#define H5G_CRT_LINK_INFO_ENC  H5P__gcrt_link_info_enc
45
1
#define H5G_CRT_LINK_INFO_DEC  H5P__gcrt_link_info_dec
46
47
/******************/
48
/* Local Typedefs */
49
/******************/
50
51
/********************/
52
/* Package Typedefs */
53
/********************/
54
55
/********************/
56
/* Local Prototypes */
57
/********************/
58
59
/* Property class callbacks */
60
static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass);
61
62
/* Property callbacks */
63
static herr_t H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size);
64
static herr_t H5P__gcrt_group_info_dec(const void **_pp, void *value);
65
static herr_t H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size);
66
static herr_t H5P__gcrt_link_info_dec(const void **_pp, void *value);
67
68
/*********************/
69
/* Package Variables */
70
/*********************/
71
72
/* Group creation property list class library initialization object */
73
const H5P_libclass_t H5P_CLS_GCRT[1] = {{
74
    "group create",        /* Class name for debugging     */
75
    H5P_TYPE_GROUP_CREATE, /* Class type                   */
76
77
    &H5P_CLS_OBJECT_CREATE_g,   /* Parent class                 */
78
    &H5P_CLS_GROUP_CREATE_g,    /* Pointer to class             */
79
    &H5P_CLS_GROUP_CREATE_ID_g, /* Pointer to class ID          */
80
    &H5P_LST_GROUP_CREATE_ID_g, /* Pointer to default property list ID */
81
    H5P__gcrt_reg_prop,         /* Default property registration routine */
82
83
    NULL, /* Class creation callback      */
84
    NULL, /* Class creation callback info */
85
    NULL, /* Class copy callback          */
86
    NULL, /* Class copy callback info     */
87
    NULL, /* Class close callback         */
88
    NULL  /* Class close callback info    */
89
}};
90
91
/*****************************/
92
/* Library Private Variables */
93
/*****************************/
94
95
/*******************/
96
/* Local Variables */
97
/*******************/
98
99
/* Property value defaults */
100
static const H5O_ginfo_t H5G_def_ginfo_g = H5G_CRT_GROUP_INFO_DEF; /* Default group info settings */
101
static const H5O_linfo_t H5G_def_linfo_g = H5G_CRT_LINK_INFO_DEF;  /* Default link info settings */
102
103
/*-------------------------------------------------------------------------
104
 * Function:    H5P__gcrt_reg_prop
105
 *
106
 * Purpose:     Initialize the group creation property list class
107
 *
108
 * Return:      Non-negative on success/Negative on failure
109
 *
110
 *-------------------------------------------------------------------------
111
 */
112
static herr_t
113
H5P__gcrt_reg_prop(H5P_genclass_t *pclass)
114
1
{
115
1
    herr_t ret_value = SUCCEED; /* Return value */
116
117
1
    FUNC_ENTER_PACKAGE
118
119
    /* Register group info property */
120
1
    if (H5P__register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g, NULL,
121
1
                           NULL, NULL, H5G_CRT_GROUP_INFO_ENC, H5G_CRT_GROUP_INFO_DEC, NULL, NULL, NULL,
122
1
                           NULL) < 0)
123
0
        HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
124
125
    /* Register link info property */
126
1
    if (H5P__register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g, NULL,
127
1
                           NULL, NULL, H5G_CRT_LINK_INFO_ENC, H5G_CRT_LINK_INFO_DEC, NULL, NULL, NULL,
128
1
                           NULL) < 0)
129
0
        HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
130
131
1
done:
132
1
    FUNC_LEAVE_NOAPI(ret_value)
133
1
} /* end H5P__gcrt_reg_prop() */
134
135
/*-------------------------------------------------------------------------
136
 * Function:    H5Pset_local_heap_size_hint
137
 *
138
 * Purpose:     Set the "size hint" for creating local heaps for a group.
139
 *
140
 * Return:      Non-negative on success/Negative on failure
141
 *
142
 *-------------------------------------------------------------------------
143
 */
144
herr_t
145
H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint)
146
0
{
147
0
    H5P_genplist_t *plist;               /* Property list pointer */
148
0
    H5O_ginfo_t     ginfo;               /* Group information structure */
149
0
    herr_t          ret_value = SUCCEED; /* Return value */
150
151
0
    FUNC_ENTER_API(FAIL)
152
153
    /* Get the plist structure */
154
0
    if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE, false)))
155
0
        HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
156
157
    /* Get value */
158
0
    if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
159
0
        HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info");
160
161
    /* Update field */
162
0
    H5_CHECKED_ASSIGN(ginfo.lheap_size_hint, uint32_t, size_hint, size_t);
163
164
    /* Set value */
165
0
    if (H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
166
0
        HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info");
167
168
0
done:
169
0
    FUNC_LEAVE_API(ret_value)
170
0
} /* end H5Pset_local_heap_size_hint() */
171
172
/*-------------------------------------------------------------------------
173
 * Function:    H5Pget_local_heap_size_hint
174
 *
175
 * Purpose:     Returns the local heap size hint, which is used for creating
176
 *              groups
177
 *
178
 * Return:      Non-negative on success/Negative on failure
179
 *
180
 *-------------------------------------------------------------------------
181
 */
182
herr_t
183
H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/)
184
0
{
185
0
    herr_t ret_value = SUCCEED; /* return value */
186
187
0
    FUNC_ENTER_API(FAIL)
188
189
0
    if (size_hint) {
190
0
        H5P_genplist_t *plist; /* Property list pointer */
191
0
        H5O_ginfo_t     ginfo; /* Group information structure */
192
193
        /* Get the plist structure */
194
0
        if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE, true)))
195
0
            HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
196
197
        /* Get value */
198
0
        if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
199
0
            HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info");
200
201
        /* Update field */
202
0
        *size_hint = ginfo.lheap_size_hint;
203
0
    } /* end if */
204
205
0
done:
206
0
    FUNC_LEAVE_API(ret_value)
207
0
} /* end H5Pget_local_heap_size_hint() */
208
209
/*-------------------------------------------------------------------------
210
 * Function:    H5Pset_link_phase_change
211
 *
212
 * Purpose:     Set the maximum # of links to store "compactly" and the
213
 *              minimum # of links to store "densely".  (These should
214
 *              overlap).
215
 *
216
 * Note:        Currently both of these must be updated at the same time.
217
 *
218
 * Note:        Come up with better name & description! -QAK
219
 *
220
 * Return:      Non-negative on success/Negative on failure
221
 *
222
 *-------------------------------------------------------------------------
223
 */
224
herr_t
225
H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense)
226
0
{
227
0
    H5P_genplist_t *plist;               /* Property list pointer */
228
0
    H5O_ginfo_t     ginfo;               /* Group information structure */
229
0
    herr_t          ret_value = SUCCEED; /* Return value */
230
231
0
    FUNC_ENTER_API(FAIL)
232
233
    /* Range check values */
234
0
    if (max_compact < min_dense)
235
0
        HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be >= min dense value");
236
0
    if (max_compact > 65535)
237
0
        HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be < 65536");
238
0
    if (min_dense > 65535)
239
0
        HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min dense value must be < 65536");
240
241
    /* Get the plist structure */
242
0
    if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE, false)))
243
0
        HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
244
245
    /* Get group info */
246
0
    if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
247
0
        HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info");
248
249
    /* Update fields */
250
0
    if (max_compact != H5G_CRT_GINFO_MAX_COMPACT || min_dense != H5G_CRT_GINFO_MIN_DENSE)
251
0
        ginfo.store_link_phase_change = true;
252
0
    else
253
0
        ginfo.store_link_phase_change = false;
254
0
    ginfo.max_compact = (uint16_t)max_compact;
255
0
    ginfo.min_dense   = (uint16_t)min_dense;
256
257
    /* Set group info */
258
0
    if (H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
259
0
        HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info");
260
261
0
done:
262
0
    FUNC_LEAVE_API(ret_value)
263
0
} /* end H5Pset_link_phase_change() */
264
265
/*-------------------------------------------------------------------------
266
 * Function:    H5Pget_link_phase_change
267
 *
268
 * Purpose:     Returns the max. # of compact links & the min. # of dense
269
 *              links, which are used for storing groups
270
 *
271
 * Return:      Non-negative on success/Negative on failure
272
 *
273
 *-------------------------------------------------------------------------
274
 */
275
herr_t
276
H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned *min_dense /*out*/)
277
0
{
278
0
    herr_t ret_value = SUCCEED; /* return value */
279
280
0
    FUNC_ENTER_API(FAIL)
281
282
    /* Get values */
283
0
    if (max_compact || min_dense) {
284
0
        H5P_genplist_t *plist; /* Property list pointer */
285
0
        H5O_ginfo_t     ginfo; /* Group information structure */
286
287
        /* Get the plist structure */
288
0
        if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE, true)))
289
0
            HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
290
291
        /* Get group info */
292
0
        if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
293
0
            HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info");
294
295
0
        if (max_compact)
296
0
            *max_compact = ginfo.max_compact;
297
0
        if (min_dense)
298
0
            *min_dense = ginfo.min_dense;
299
0
    } /* end if */
300
301
0
done:
302
0
    FUNC_LEAVE_API(ret_value)
303
0
} /* end H5Pget_link_phase_change() */
304
305
/*-------------------------------------------------------------------------
306
 * Function:    H5Pset_est_link_info
307
 *
308
 * Purpose:     Set the estimates for the number of entries and length of each
309
 *              entry name in a group.
310
 *
311
 * Note:        Currently both of these must be updated at the same time.
312
 *
313
 * Note:        EST_NUM_ENTRIES applies only when the number of entries is less
314
 *              than the MAX_COMPACT # of entries (from H5Pset_link_phase_change).
315
 *
316
 * Note:        Come up with better name & description? -QAK
317
 *
318
 * Return:      Non-negative on success/Negative on failure
319
 *
320
 *-------------------------------------------------------------------------
321
 */
322
herr_t
323
H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name_len)
324
0
{
325
0
    H5P_genplist_t *plist;               /* Property list pointer */
326
0
    H5O_ginfo_t     ginfo;               /* Group information structure */
327
0
    herr_t          ret_value = SUCCEED; /* Return value */
328
329
0
    FUNC_ENTER_API(FAIL)
330
331
    /* Range check values */
332
0
    if (est_num_entries > 65535)
333
0
        HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "est. number of entries must be < 65536");
334
0
    if (est_name_len > 65535)
335
0
        HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "est. name length must be < 65536");
336
337
    /* Get the plist structure */
338
0
    if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE, false)))
339
0
        HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
340
341
    /* Get group info */
342
0
    if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
343
0
        HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info");
344
345
    /* Update fields */
346
0
    if (est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES || est_name_len != H5G_CRT_GINFO_EST_NAME_LEN)
347
0
        ginfo.store_est_entry_info = true;
348
0
    else
349
0
        ginfo.store_est_entry_info = false;
350
0
    ginfo.est_num_entries = (uint16_t)est_num_entries;
351
0
    ginfo.est_name_len    = (uint16_t)est_name_len;
352
353
    /* Set group info */
354
0
    if (H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
355
0
        HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info");
356
357
0
done:
358
0
    FUNC_LEAVE_API(ret_value)
359
0
} /* end H5Pset_est_link_info() */
360
361
/*-------------------------------------------------------------------------
362
 * Function:    H5Pget_est_link_info
363
 *
364
 * Purpose:     Returns the est. # of links in a group & the est. length of
365
 *              the name of each link.
366
 *
367
 * Return:      Non-negative on success/Negative on failure
368
 *
369
 *-------------------------------------------------------------------------
370
 */
371
herr_t
372
H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*out*/, unsigned *est_name_len /*out*/)
373
0
{
374
0
    herr_t ret_value = SUCCEED; /* return value */
375
376
0
    FUNC_ENTER_API(FAIL)
377
378
    /* Get values */
379
0
    if (est_num_entries || est_name_len) {
380
0
        H5P_genplist_t *plist; /* Property list pointer */
381
0
        H5O_ginfo_t     ginfo; /* Group information structure */
382
383
        /* Get the plist structure */
384
0
        if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE, true)))
385
0
            HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
386
387
        /* Get group info */
388
0
        if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
389
0
            HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info");
390
391
0
        if (est_num_entries)
392
0
            *est_num_entries = ginfo.est_num_entries;
393
0
        if (est_name_len)
394
0
            *est_name_len = ginfo.est_name_len;
395
0
    } /* end if */
396
397
0
done:
398
0
    FUNC_LEAVE_API(ret_value)
399
0
} /* end H5Pget_est_link_info() */
400
401
/*-------------------------------------------------------------------------
402
 * Function:    H5Pset_link_creation_order
403
 *
404
 * Purpose:     Set the flags for creation order of links in a group
405
 *
406
 * Return:      Non-negative on success/Negative on failure
407
 *
408
 *-------------------------------------------------------------------------
409
 */
410
herr_t
411
H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags)
412
0
{
413
0
    H5P_genplist_t *plist;               /* Property list pointer */
414
0
    H5O_linfo_t     linfo;               /* Link information structure */
415
0
    herr_t          ret_value = SUCCEED; /* Return value */
416
417
0
    FUNC_ENTER_API(FAIL)
418
419
    /* Check for bad combination of flags */
420
0
    if (!(crt_order_flags & H5P_CRT_ORDER_TRACKED) && (crt_order_flags & H5P_CRT_ORDER_INDEXED))
421
0
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tracking creation order is required for index");
422
423
    /* Get the plist structure */
424
0
    if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE, false)))
425
0
        HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
426
427
    /* Get link info */
428
0
    if (H5P_get(plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
429
0
        HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info");
430
431
    /* Update fields */
432
0
    linfo.track_corder = (bool)((crt_order_flags & H5P_CRT_ORDER_TRACKED) ? true : false);
433
0
    linfo.index_corder = (bool)((crt_order_flags & H5P_CRT_ORDER_INDEXED) ? true : false);
434
435
    /* Set link info */
436
0
    if (H5P_set(plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
437
0
        HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link info");
438
439
0
done:
440
0
    FUNC_LEAVE_API(ret_value)
441
0
} /* end H5Pset_link_creation_order() */
442
443
/*-------------------------------------------------------------------------
444
 * Function:    H5Pget_link_creation_order
445
 *
446
 * Purpose:     Returns the flag indicating that creation order is tracked
447
 *              for links in a group.
448
 *
449
 * Return:      Non-negative on success/Negative on failure
450
 *
451
 *-------------------------------------------------------------------------
452
 */
453
herr_t
454
H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/)
455
0
{
456
0
    herr_t ret_value = SUCCEED; /* return value */
457
458
0
    FUNC_ENTER_API(FAIL)
459
460
    /* Get values */
461
0
    if (crt_order_flags) {
462
0
        H5P_genplist_t *plist; /* Property list pointer */
463
0
        H5O_linfo_t     linfo; /* Link information structure */
464
465
        /* Reset the value to return */
466
0
        *crt_order_flags = 0;
467
468
        /* Get the plist structure */
469
0
        if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE, true)))
470
0
            HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
471
472
        /* Get link info */
473
0
        if (H5P_get(plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
474
0
            HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info");
475
476
0
        *crt_order_flags |= linfo.track_corder ? H5P_CRT_ORDER_TRACKED : 0;
477
0
        *crt_order_flags |= linfo.index_corder ? H5P_CRT_ORDER_INDEXED : 0;
478
0
    } /* end if */
479
480
0
done:
481
0
    FUNC_LEAVE_API(ret_value)
482
0
} /* end H5Pget_link_creation_order() */
483
484
/*-------------------------------------------------------------------------
485
 * Function:       H5P__gcrt_group_info_enc
486
 *
487
 * Purpose:        Callback routine which is called whenever the group
488
 *                 info property in the dataset access property list is
489
 *                 encoded.
490
 *
491
 * Return:     Success: Non-negative
492
 *       Failure: Negative
493
 *
494
 *-------------------------------------------------------------------------
495
 */
496
static herr_t
497
H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size)
498
0
{
499
0
    const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)value; /* Create local aliases for values */
500
0
    uint8_t          **pp    = (uint8_t **)_pp;
501
502
0
    FUNC_ENTER_PACKAGE_NOERR
503
504
0
    if (NULL != *pp) {
505
0
        UINT32ENCODE(*pp, ginfo->lheap_size_hint);
506
0
        UINT16ENCODE(*pp, ginfo->max_compact);
507
0
        UINT16ENCODE(*pp, ginfo->min_dense);
508
0
        UINT16ENCODE(*pp, ginfo->est_num_entries);
509
0
        UINT16ENCODE(*pp, ginfo->est_name_len);
510
0
    } /* end if */
511
512
0
    *size += sizeof(uint16_t) * 4 + sizeof(uint32_t);
513
514
0
    FUNC_LEAVE_NOAPI(SUCCEED)
515
0
} /* end H5P__gcrt_group_info_enc() */
516
517
/*-------------------------------------------------------------------------
518
 * Function:       H5P__gcrt_group_info_dec
519
 *
520
 * Purpose:        Callback routine which is called whenever the group info
521
 *                 property in the dataset access property list is
522
 *                 decoded.
523
 *
524
 * Return:     Success: Non-negative
525
 *       Failure: Negative
526
 *
527
 *-------------------------------------------------------------------------
528
 */
529
static herr_t
530
H5P__gcrt_group_info_dec(const void **_pp, void *_value)
531
0
{
532
0
    H5O_ginfo_t    *ginfo     = (H5O_ginfo_t *)_value; /* Group info settings */
533
0
    const uint8_t **pp        = (const uint8_t **)_pp;
534
0
    herr_t          ret_value = SUCCEED; /* Return value */
535
536
0
    FUNC_ENTER_PACKAGE_NOERR
537
538
    /* Set property to default value */
539
0
    memset(ginfo, 0, sizeof(H5O_ginfo_t));
540
0
    *ginfo = H5G_def_ginfo_g;
541
542
0
    UINT32DECODE(*pp, ginfo->lheap_size_hint);
543
0
    UINT16DECODE(*pp, ginfo->max_compact);
544
0
    UINT16DECODE(*pp, ginfo->min_dense);
545
0
    UINT16DECODE(*pp, ginfo->est_num_entries);
546
0
    UINT16DECODE(*pp, ginfo->est_name_len);
547
548
    /* Update fields */
549
0
    if (ginfo->max_compact != H5G_CRT_GINFO_MAX_COMPACT || ginfo->min_dense != H5G_CRT_GINFO_MIN_DENSE)
550
0
        ginfo->store_link_phase_change = true;
551
0
    else
552
0
        ginfo->store_link_phase_change = false;
553
554
0
    if (ginfo->est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES ||
555
0
        ginfo->est_name_len != H5G_CRT_GINFO_EST_NAME_LEN)
556
0
        ginfo->store_est_entry_info = true;
557
0
    else
558
0
        ginfo->store_est_entry_info = false;
559
560
0
    FUNC_LEAVE_NOAPI(ret_value)
561
0
} /* end H5P__gcrt_group_info_dec() */
562
563
/*-------------------------------------------------------------------------
564
 * Function:       H5P__gcrt_link_info_enc
565
 *
566
 * Purpose:        Callback routine which is called whenever the link
567
 *                 info property in the dataset access property list is
568
 *                 encoded.
569
 *
570
 * Return:     Success: Non-negative
571
 *       Failure: Negative
572
 *
573
 *-------------------------------------------------------------------------
574
 */
575
static herr_t
576
H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size)
577
0
{
578
0
    const H5O_linfo_t *linfo = (const H5O_linfo_t *)value; /* Create local aliases for values */
579
0
    uint8_t          **pp    = (uint8_t **)_pp;
580
581
0
    FUNC_ENTER_PACKAGE_NOERR
582
583
0
    if (NULL != *pp) {
584
0
        unsigned crt_order_flags = 0;
585
586
0
        crt_order_flags |= linfo->track_corder ? H5P_CRT_ORDER_TRACKED : 0;
587
0
        crt_order_flags |= linfo->index_corder ? H5P_CRT_ORDER_INDEXED : 0;
588
589
        /* Encode the size of unsigned*/
590
0
        *(*pp)++ = (uint8_t)sizeof(unsigned);
591
592
        /* Encode the value */
593
0
        H5_ENCODE_UNSIGNED(*pp, crt_order_flags);
594
0
    } /* end if */
595
596
0
    *size += (1 + sizeof(unsigned));
597
598
0
    FUNC_LEAVE_NOAPI(SUCCEED)
599
0
} /* end H5P__gcrt_link_info_enc() */
600
601
/*-------------------------------------------------------------------------
602
 * Function:       H5P__gcrt_link_info_dec
603
 *
604
 * Purpose:        Callback routine which is called whenever the link info
605
 *                 property in the dataset access property list is
606
 *                 decoded.
607
 *
608
 * Return:     Success: Non-negative
609
 *       Failure: Negative
610
 *
611
 *-------------------------------------------------------------------------
612
 */
613
static herr_t
614
H5P__gcrt_link_info_dec(const void **_pp, void *_value)
615
0
{
616
0
    H5O_linfo_t    *linfo = (H5O_linfo_t *)_value; /* Link info settings */
617
0
    const uint8_t **pp    = (const uint8_t **)_pp;
618
0
    unsigned        crt_order_flags;
619
0
    unsigned        enc_size;
620
0
    herr_t          ret_value = SUCCEED; /* Return value */
621
622
0
    FUNC_ENTER_PACKAGE
623
624
0
    enc_size = *(*pp)++;
625
0
    if (enc_size != sizeof(unsigned))
626
0
        HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded");
627
628
    /* Set property to default value */
629
0
    memset(linfo, 0, sizeof(H5O_linfo_t));
630
0
    *linfo = H5G_def_linfo_g;
631
632
0
    H5_DECODE_UNSIGNED(*pp, crt_order_flags);
633
634
    /* Update fields */
635
0
    linfo->track_corder = (bool)((crt_order_flags & H5P_CRT_ORDER_TRACKED) ? true : false);
636
0
    linfo->index_corder = (bool)((crt_order_flags & H5P_CRT_ORDER_INDEXED) ? true : false);
637
638
0
done:
639
0
    FUNC_LEAVE_NOAPI(ret_value)
640
0
} /* end H5P__gcrt_link_info_dec() */