summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2019-11-13 19:29:59 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2019-11-13 19:29:59 (GMT)
commitb505226ad581f50804ee0a8cb5cb63b85d698dc7 (patch)
tree57dc3df32efa7da2251fe440f04ed2d3e0972594 /src
parent695c62bafe07cf6213135f439b122ea7c4755a39 (diff)
downloadhdf5-b505226ad581f50804ee0a8cb5cb63b85d698dc7.zip
hdf5-b505226ad581f50804ee0a8cb5cb63b85d698dc7.tar.gz
hdf5-b505226ad581f50804ee0a8cb5cb63b85d698dc7.tar.bz2
Change hdset_reg_ref_t and H5R_ref_t from arrays of unsigned char to
structs containing those arrays. Encapsulating the arrays in this way makes it easier to write and think about pointers to these types, casts to/from these types, etc. An interesting side-effect that we probably should *not* rely on is that the struct-encapsulation changes the alignment so that some GCC warnings about casts that increase the alignment requirement of the operand go away. Warnings like that have to be taken seriously: I will add -Werror=cast-align to the default compiler flags so that they stop the build quickly. GCC warnings led me to some surprising casts in test/trefer.c. I found that it was possible to make many simplifications after introducing the struct-encapsulation that I described, above.
Diffstat (limited to 'src')
-rw-r--r--src/H5Rpublic.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index ce54ac4..045e04a 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -70,14 +70,18 @@ typedef haddr_t hobj_ref_t;
* machine (8 bytes currently) plus an int.
* Note! This type can only be used with the "native" HDF5 VOL connector.
*/
-typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];
+typedef struct {
+ unsigned char content[H5R_DSET_REG_REF_BUF_SIZE];
+} hdset_reg_ref_t;
/**
* Opaque reference type. The same reference type is used for object,
* dataset region and attribute references. This is the type that
* should always be used with the current reference API.
*/
-typedef unsigned char H5R_ref_t[H5R_REF_BUF_SIZE];
+typedef struct {
+ unsigned char content[H5R_REF_BUF_SIZE];
+} H5R_ref_t;
/********************/
/* Public Variables */