Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduces overly-pedantic casting in the public headers #644

Merged
merged 32 commits into from
May 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ba9deae
Committing clang-format changes
github-actions[bot] Mar 19, 2021
00f9750
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 21, 2021
e997283
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 22, 2021
3eac585
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 23, 2021
71643b7
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 24, 2021
d242911
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 24, 2021
bc70f95
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 26, 2021
3d7ad8e
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 26, 2021
aeb16b7
Merge branch 'develop' of https://github.com/derobins/hdf5 into develop
derobins Mar 26, 2021
765cb5b
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 27, 2021
18401fc
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 29, 2021
222242c
Merge branch 'develop' of https://github.com/derobins/hdf5 into develop
derobins Mar 29, 2021
8d0cafa
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 30, 2021
d3694d1
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 2, 2021
1c7bcc2
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 15, 2021
70551e3
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 16, 2021
2dfc7db
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 20, 2021
71d2fbf
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 21, 2021
c8925f8
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 22, 2021
dd3e970
Merge branch 'develop' of https://github.com/derobins/hdf5 into develop
derobins Apr 22, 2021
bb61990
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 23, 2021
2c2b368
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 25, 2021
be2ada6
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 27, 2021
439f3a8
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 28, 2021
649aa9b
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 29, 2021
3fa627f
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 29, 2021
0df36ec
Merge remote-tracking branch 'canonical/develop' into develop
derobins May 3, 2021
d65c841
Merge remote-tracking branch 'canonical/develop' into develop
derobins May 6, 2021
fc7eb21
Merge branch 'develop' of https://github.com/derobins/hdf5 into develop
derobins May 6, 2021
130d491
Merge remote-tracking branch 'canonical/develop' into develop
derobins May 8, 2021
544b320
Merge remote-tracking branch 'canonical/develop' into develop
derobins May 15, 2021
0fecdf6
Fixes overly pedantic casting in public headers
derobins May 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/H5Dpublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
/*****************/

/* Macros used to "unset" chunk cache configuration parameters */
#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT ((size_t)-1)
#define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t)-1)
#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0f)
#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT SIZE_MAX
#define H5D_CHUNK_CACHE_NBYTES_DEFAULT SIZE_MAX
#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting -1 to an unsigned integral type is an unnatural subversion of the type system and unnecessary. It's more intentional to use SIZE_MAX, etc.

/* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */
#define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u)
Expand All @@ -46,11 +46,11 @@
typedef enum H5D_layout_t {
H5D_LAYOUT_ERROR = -1,

H5D_COMPACT = 0, /**< raw data is very small */
H5D_CONTIGUOUS = 1, /**< the default */
H5D_CHUNKED = 2, /**< slow and fancy */
H5D_VIRTUAL = 3, /**< actual data is stored in other datasets */
H5D_NLAYOUTS = 4 /**< this one must be last! */
H5D_COMPACT = 0, /**< raw data is very small */
H5D_CONTIGUOUS = 1, /**< the default */
H5D_CHUNKED = 2, /**< slow and fancy */
H5D_VIRTUAL = 3, /**< actual data is stored in other datasets */
H5D_NLAYOUTS = 4 /**< this one must be last! */
} H5D_layout_t;
//! <!-- [H5D_layout_t_snip] -->

Expand Down
2 changes: 1 addition & 1 deletion src/H5ESpublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/*****************/

/* Default value for "no event set" / synchronous execution */
#define H5ES_NONE (hid_t)0
#define H5ES_NONE 0 /* (hid_t) */

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the type in a comment so that the integer is less of a magic number.

/* Special "wait" timeout values */
#define H5ES_WAIT_FOREVER (UINT64_MAX) /* Wait until all operations complete */
Expand Down
2 changes: 1 addition & 1 deletion src/H5Epublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "H5Ipublic.h"

/* Value for the default error stack */
#define H5E_DEFAULT (hid_t)0
#define H5E_DEFAULT 0 /* (hid_t) */

/**
* Different kinds of error information
Expand Down
4 changes: 2 additions & 2 deletions src/H5Fpublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
(0x0020u) /**< Restrict search to objects opened through current file ID \
(as opposed to objects opened through any file ID accessing this file) */

#define H5F_FAMILY_DEFAULT (hsize_t)0
#define H5F_FAMILY_DEFAULT 0 /* (hsize_t) */

#ifdef H5_HAVE_PARALLEL
/**
Expand All @@ -108,7 +108,7 @@ typedef enum H5F_scope_t {
/**
* Unlimited file size for H5Pset_external()
*/
#define H5F_UNLIMITED ((hsize_t)(-1L))
#define H5F_UNLIMITED HSIZE_UNDEF

/**
* How does file close behave?
Expand Down
4 changes: 2 additions & 2 deletions src/H5Lpublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
*
* The maximum length of a link's name is encoded in a 32-bit unsigned integer.
*/
#define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */
#define H5L_MAX_LINK_NAME_LEN UINT32_MAX

/**
* \brief Macro to indicate operation occurs on same location
*/
#define H5L_SAME_LOC (hid_t)0
#define H5L_SAME_LOC 0 /* (hid_t) */

/**
* \brief Current version of the H5L_class_t struct
Expand Down
2 changes: 1 addition & 1 deletion src/H5Ppublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
#define H5P_CRT_ORDER_INDEXED 0x0002

/* Default value for all property list classes */
#define H5P_DEFAULT (hid_t)0
#define H5P_DEFAULT 0 /* (hid_t) */

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion src/H5Spublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "H5Ipublic.h"

/* Define atomic datatypes */
#define H5S_ALL (hid_t)0
#define H5S_ALL 0 /* (hid_t) */
#define H5S_UNLIMITED HSIZE_UNDEF

/* Define user-level maximum number of dimensions */
Expand Down
2 changes: 1 addition & 1 deletion src/H5Tpublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ typedef struct {
* Indicate that a string is variable length (null-terminated in C, instead of
* fixed length)
*/
#define H5T_VARIABLE ((size_t)(-1))
#define H5T_VARIABLE SIZE_MAX

/* Opaque information */
/**
Expand Down