mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Correct name of CMake option to HDF5_ENABLE_DEPRECATED_SYMBOLS (#5587)
This commit is contained in:
@@ -3,6 +3,12 @@
|
||||
This example shows how to create intermediate groups with
|
||||
a single call to H5Gcreate.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
This example shows how to iterate over group members using
|
||||
H5Literate.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
||||
@@ -9,10 +9,16 @@
|
||||
implements the structure described in the User's Guide,
|
||||
chapter 4, figure 26.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define FILENAME "h5ex_g_traverse.h5"
|
||||
|
||||
@@ -25,33 +31,34 @@
|
||||
struct opdata {
|
||||
unsigned recurs; /* Recursion level. 0=root */
|
||||
struct opdata *prev; /* Pointer to previous opdata */
|
||||
haddr_t addr; /* Group address */
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
H5O_token_t token; /* Group token */
|
||||
#else
|
||||
haddr_t addr; /* Group address */
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Operator function to be called by H5Literate.
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
herr_t op_func(hid_t loc_id, const char *name, const H5L_info1_t *info, void *operator_data);
|
||||
#else
|
||||
herr_t op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_data);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function to check for duplicate groups in a path.
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
/* Function to check for duplicate groups in a path. */
|
||||
int group_check(hid_t loc_id, struct opdata *od, H5O_token_t target_token);
|
||||
|
||||
#else
|
||||
/* Function to check for duplicate groups in a path. */
|
||||
int group_check(struct opdata *od, haddr_t target_addr);
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
hid_t file; /* Handle */
|
||||
herr_t status;
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
H5O_info1_t infobuf;
|
||||
#else
|
||||
H5O_info_t infobuf;
|
||||
#endif
|
||||
hid_t file; /* Handle */
|
||||
herr_t status;
|
||||
H5O_info_t infobuf;
|
||||
struct opdata od;
|
||||
|
||||
/*
|
||||
@@ -59,23 +66,20 @@ main(void)
|
||||
*/
|
||||
file = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Oget_info2(file, &infobuf, H5O_INFO_ALL);
|
||||
status = H5Oget_info(file, &infobuf, H5O_INFO_ALL);
|
||||
memcpy(&od.token, &infobuf.token, sizeof(H5O_token_t));
|
||||
#else
|
||||
status = H5Oget_info(file, &infobuf);
|
||||
status = H5Oget_info(file, &infobuf);
|
||||
od.addr = infobuf.addr;
|
||||
#endif
|
||||
od.recurs = 0;
|
||||
od.prev = NULL;
|
||||
od.addr = infobuf.addr;
|
||||
|
||||
/*
|
||||
* Print the root group and formatting, begin iteration.
|
||||
*/
|
||||
printf("/ {\n");
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Literate1(file, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func, (void *)&od);
|
||||
#else
|
||||
status = H5Literate(file, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func, (void *)&od);
|
||||
#endif
|
||||
printf("}\n");
|
||||
|
||||
/*
|
||||
@@ -97,33 +101,22 @@ main(void)
|
||||
circular path in the file.
|
||||
|
||||
************************************************************/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
herr_t
|
||||
op_func(hid_t loc_id, const char *name, const H5L_info1_t *info, void *operator_data)
|
||||
#else
|
||||
herr_t
|
||||
op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_data)
|
||||
#endif
|
||||
{
|
||||
herr_t status, return_val = 0;
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
H5O_info1_t infobuf;
|
||||
#else
|
||||
H5O_info_t infobuf;
|
||||
#endif
|
||||
struct opdata *od = (struct opdata *)operator_data;
|
||||
/* Type conversion */
|
||||
unsigned spaces = 2 * (od->recurs + 1);
|
||||
/* Number of whitespaces to prepend
|
||||
to output */
|
||||
herr_t status;
|
||||
herr_t return_val = 0;
|
||||
struct opdata *od = (struct opdata *)operator_data; /* Type conversion */
|
||||
unsigned spaces = 2 * (od->recurs + 1); /* Number of whitespaces to prepend to output */
|
||||
|
||||
/*
|
||||
* Get type of the object and display its name and type.
|
||||
* The name of the object is passed to this function by
|
||||
* the Library.
|
||||
*/
|
||||
H5O_info_t infobuf;
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Oget_info_by_name2(loc_id, name, &infobuf, H5O_INFO_ALL, H5P_DEFAULT);
|
||||
status = H5Oget_info_by_name(loc_id, name, &infobuf, H5O_INFO_ALL, H5P_DEFAULT);
|
||||
#else
|
||||
status = H5Oget_info_by_name(loc_id, name, &infobuf, H5P_DEFAULT);
|
||||
#endif
|
||||
@@ -133,7 +126,7 @@ op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_d
|
||||
printf("Group: %s {\n", name);
|
||||
|
||||
/*
|
||||
* Check group address against linked list of operator
|
||||
* Check group address/token against linked list of operator
|
||||
* data structures. We will always run the check, as the
|
||||
* reference count cannot be relied upon if there are
|
||||
* symbolic links, and H5Oget_info_by_name always follows
|
||||
@@ -143,10 +136,16 @@ op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_d
|
||||
* reference count was manually manipulated with
|
||||
* H5Odecr_refcount.
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
if (group_check(loc_id, od, infobuf.token)) {
|
||||
#else
|
||||
if (group_check(od, infobuf.addr)) {
|
||||
#endif
|
||||
printf("%*s Warning: Loop detected!\n", spaces, "");
|
||||
}
|
||||
else {
|
||||
if (od->recurs + 1 > 7)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Initialize new operator data structure and
|
||||
@@ -157,14 +156,13 @@ op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_d
|
||||
struct opdata nextod;
|
||||
nextod.recurs = od->recurs + 1;
|
||||
nextod.prev = od;
|
||||
nextod.addr = infobuf.addr;
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
return_val = H5Literate_by_name1(loc_id, name, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func,
|
||||
(void *)&nextod, H5P_DEFAULT);
|
||||
memcpy(&nextod.token, &infobuf.token, sizeof(H5O_token_t));
|
||||
#else
|
||||
nextod.addr = infobuf.addr;
|
||||
#endif
|
||||
return_val = H5Literate_by_name(loc_id, name, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func,
|
||||
(void *)&nextod, H5P_DEFAULT);
|
||||
#endif
|
||||
}
|
||||
printf("%*s}\n", spaces, "");
|
||||
break;
|
||||
@@ -184,11 +182,30 @@ op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_d
|
||||
/************************************************************
|
||||
|
||||
This function recursively searches the linked list of
|
||||
opdata structures for one whose address matches
|
||||
target_addr. Returns 1 if a match is found, and 0
|
||||
opdata structures for one whose address/token matches
|
||||
target_addr/token. Returns 1 if a match is found, and 0
|
||||
otherwise.
|
||||
|
||||
************************************************************/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
int
|
||||
group_check(hid_t loc_id, struct opdata *od, H5O_token_t target_token)
|
||||
{
|
||||
int token_cmp;
|
||||
|
||||
if (H5Otoken_cmp(loc_id, &od->token, &target_token, &token_cmp) < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (!token_cmp) {
|
||||
return 1; /* Tokens match */
|
||||
}
|
||||
else if (!od->recurs)
|
||||
return 0; /* Root group reached with no matches */
|
||||
else { /* Recursively examine the next node */
|
||||
return group_check(loc_id, od->prev, target_token);
|
||||
}
|
||||
}
|
||||
#else
|
||||
int
|
||||
group_check(struct opdata *od, haddr_t target_addr)
|
||||
{
|
||||
@@ -196,7 +213,8 @@ group_check(struct opdata *od, haddr_t target_addr)
|
||||
return 1; /* Addresses match */
|
||||
else if (!od->recurs)
|
||||
return 0; /* Root group reached with no matches */
|
||||
else
|
||||
else { /* Recursively examine the next node */
|
||||
return group_check(od->prev, target_addr);
|
||||
/* Recursively examine the next node */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
example implements the structure described in the User's
|
||||
Guide, chapter 4, figure 26.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
then closes the file. Next, it reopens the file, reads
|
||||
back the data, and outputs it to the screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
@@ -148,7 +154,11 @@ main(void)
|
||||
* traverse the structure and free any vlen data (strings in this
|
||||
* case).
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Treclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#else
|
||||
status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#endif
|
||||
free(rdata);
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
DIM0, then closes the file. Next, it reopens the file,
|
||||
reads back the data, and outputs it to the screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
@@ -158,7 +164,11 @@ main(void)
|
||||
* traverse the structure and free any vlen data (strings in this
|
||||
* case).
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Treclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#else
|
||||
status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#endif
|
||||
free(rdata);
|
||||
status = H5Aclose(attr);
|
||||
status = H5Dclose(dset);
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
datatype, and outputs the names of its fields to the
|
||||
screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
compound type contains an int, variable-length string and
|
||||
two doubles.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
@@ -305,7 +311,11 @@ main(void)
|
||||
* traverse the structure and free any vlen data (including
|
||||
* strings).
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Treclaim(rvehicletype, space, H5P_DEFAULT, rdata);
|
||||
#else
|
||||
status = H5Dvlen_reclaim(rvehicletype, space, H5P_DEFAULT, rdata);
|
||||
#endif
|
||||
free(rdata);
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
compound type contains an int, variable-length string and
|
||||
two doubles.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
@@ -316,7 +322,11 @@ main(void)
|
||||
* traverse the structure and free any vlen data (including
|
||||
* strings).
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Treclaim(rvehicletype, space, H5P_DEFAULT, rdata);
|
||||
#else
|
||||
status = H5Dvlen_reclaim(rvehicletype, space, H5P_DEFAULT, rdata);
|
||||
#endif
|
||||
free(rdata);
|
||||
status = H5Aclose(attr);
|
||||
status = H5Dclose(dset);
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
reopens the file, dereferences the references, and outputs
|
||||
the names of their targets to the screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
Next, it reopens the file, dereferences the references,
|
||||
and outputs the names of their targets to the screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
Next, it reopens the file, reads back the data, and
|
||||
outputs it to the screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
file. Next, it reopens the file, reads back the data, and
|
||||
outputs it to the screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
dereferences the references, and outputs the referenced
|
||||
regions to the screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
dereferences the references, and outputs the referenced
|
||||
regions to the screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
the file. Next, it reopens the file, reads back the data,
|
||||
and outputs it to the screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
@@ -75,7 +81,11 @@ main(void)
|
||||
* removes the need to manually free() the previously malloc'ed
|
||||
* data.
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Treclaim(memtype, space, H5P_DEFAULT, wdata);
|
||||
#else
|
||||
status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, wdata);
|
||||
#endif
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
status = H5Tclose(filetype);
|
||||
@@ -133,7 +143,11 @@ main(void)
|
||||
* top-level pointer "rdata", as H5Dvlen_reclaim only frees the
|
||||
* actual variable-length data, and not the structures themselves.
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Treclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#else
|
||||
status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#endif
|
||||
free(rdata);
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
closes the file. Next, it reopens the file, reads back
|
||||
the data, and outputs it to the screen.
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
@@ -83,7 +89,11 @@ main(void)
|
||||
* removes the need to manually free() the previously malloc'ed
|
||||
* data.
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Treclaim(memtype, space, H5P_DEFAULT, wdata);
|
||||
#else
|
||||
status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, wdata);
|
||||
#endif
|
||||
status = H5Aclose(attr);
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
@@ -143,7 +153,11 @@ main(void)
|
||||
* top-level pointer "rdata", as H5Dvlen_reclaim only frees the
|
||||
* actual variable-length data, and not the structures themselves.
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Treclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#else
|
||||
status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#endif
|
||||
free(rdata);
|
||||
status = H5Aclose(attr);
|
||||
status = H5Dclose(dset);
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
|
||||
This file is intended for use with HDF5 Library version 1.8
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
@@ -108,13 +114,17 @@ main(void)
|
||||
for (i = 0; i < dims[0]; i++)
|
||||
printf("%s[%d]: %s\n", DATASET, i, rdata[i]);
|
||||
|
||||
/*
|
||||
* Close and release resources. Note that H5Dvlen_reclaim works
|
||||
* for variable-length strings as well as variable-length arrays.
|
||||
* Also note that we must still free the array of pointers stored
|
||||
* in rdata, as H5Tvlen_reclaim only frees the data these point to.
|
||||
*/
|
||||
/*
|
||||
* Close and release resources. Note that H5Dvlen_reclaim works
|
||||
* for variable-length strings as well as variable-length arrays.
|
||||
* Also note that we must still free the array of pointers stored
|
||||
* in rdata, as H5Tvlen_reclaim only frees the data these point to.
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Treclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#else
|
||||
status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#endif
|
||||
free(rdata);
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
|
||||
This file is intended for use with HDF5 Library version 1.8
|
||||
|
||||
Note: This example includes older cases from previous versions
|
||||
of HDF5 for historical reference and to illustrate how to
|
||||
migrate older code to newer functions. However, readers are
|
||||
encouraged to avoid using deprecated functions and earlier
|
||||
schemas from those versions.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
@@ -119,13 +125,17 @@ main(void)
|
||||
for (i = 0; i < dims[0]; i++)
|
||||
printf("%s[%d]: %s\n", ATTRIBUTE, i, rdata[i]);
|
||||
|
||||
/*
|
||||
* Close and release resources. Note that H5Dvlen_reclaim works
|
||||
* for variable-length strings as well as variable-length arrays.
|
||||
* Also note that we must still free the array of pointers stored
|
||||
* in rdata, as H5Tvlen_reclaim only frees the data these point to.
|
||||
*/
|
||||
/*
|
||||
* Close and release resources. Note that H5Dvlen_reclaim works
|
||||
* for variable-length strings as well as variable-length arrays.
|
||||
* Also note that we must still free the array of pointers stored
|
||||
* in rdata, as H5Tvlen_reclaim only frees the data these point to.
|
||||
*/
|
||||
#if H5_VERSION_GE(1, 12, 0) && !defined(H5_USE_110_API) && !defined(H5_USE_18_API) && !defined(H5_USE_16_API)
|
||||
status = H5Treclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#else
|
||||
status = H5Dvlen_reclaim(memtype, space, H5P_DEFAULT, rdata);
|
||||
#endif
|
||||
free(rdata);
|
||||
status = H5Aclose(attr);
|
||||
status = H5Dclose(dset);
|
||||
|
||||
Reference in New Issue
Block a user