summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJerome Soumagne <jsoumagne@hdfgroup.org>2015-08-21 18:52:30 (GMT)
committerJerome Soumagne <jsoumagne@hdfgroup.org>2015-08-21 18:52:30 (GMT)
commit7ce2d52cf69f6f6477e0f16e9d85d67cc54d5949 (patch)
treedf01935167a5d011693bb791e582b60f375669d7 /src
parent1b2b0bd5a30cbc4227457abd08f563a8fd8c8b68 (diff)
downloadhdf5-7ce2d52cf69f6f6477e0f16e9d85d67cc54d5949.zip
hdf5-7ce2d52cf69f6f6477e0f16e9d85d67cc54d5949.tar.gz
hdf5-7ce2d52cf69f6f6477e0f16e9d85d67cc54d5949.tar.bz2
[svn-r27545] Add first support for _Bool and make hbool_t a "real" _Bool if available
Fix tests accordingly
Diffstat (limited to 'src')
-rw-r--r--src/H5Pgcpl.c2
-rw-r--r--src/H5T.c2
-rw-r--r--src/H5config.h.in6
-rw-r--r--src/H5private.h4
-rw-r--r--src/H5public.h15
5 files changed, 24 insertions, 5 deletions
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
index 1e3a278..e33fb6e 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -690,7 +690,7 @@ H5P__gcrt_link_info_dec(const void **_pp, void *_value)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded")
/* Set property to default value */
- *linfo = H5G_def_linfo_g;
+ memcpy(linfo, &H5G_def_linfo_g, sizeof(H5O_linfo_t));
H5_DECODE_UNSIGNED(*pp, crt_order_flags)
diff --git a/src/H5T.c b/src/H5T.c
index 5f6c8e3..977ac22 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -850,7 +850,7 @@ H5T_init_interface(void)
H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HERR_g,COPY,native_int,SET,sizeof(herr_t))
/* hbool_t */
- H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HBOOL_g,COPY,native_int,SET,sizeof(hbool_t))
+ H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HBOOL_g,COPY,native_uint,SET,sizeof(hbool_t))
/*------------------------------------------------------------
* IEEE Types
diff --git a/src/H5config.h.in b/src/H5config.h.in
index ad8dcf9..96e2df5 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -293,6 +293,9 @@
/* Define if `struct stat' has the `st_blocks' field */
#undef HAVE_STAT_ST_BLOCKS
+/* Define to 1 if you have the <stdbool.h> header file. */
+#undef HAVE_STDBOOL_H
+
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
@@ -469,6 +472,9 @@
/* Width for printf() for type `long long' or `__int64', use `ll' */
#undef PRINTF_LL_WIDTH
+/* The size of `bool', as computed by sizeof. */
+#undef SIZEOF_BOOL
+
/* The size of `char', as computed by sizeof. */
#undef SIZEOF_CHAR
diff --git a/src/H5private.h b/src/H5private.h
index 9efd145..b0880a1 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -353,10 +353,10 @@
* HDF Boolean type.
*/
#ifndef FALSE
-# define FALSE 0
+ #define FALSE false
#endif
#ifndef TRUE
-# define TRUE 1
+ #define TRUE true
#endif
/*
diff --git a/src/H5public.h b/src/H5public.h
index 1b3711b..858e67f 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -141,7 +141,20 @@ typedef int herr_t;
* printf("error determining whether data type is committed\n");
* }
*/
-typedef unsigned int hbool_t;
+#ifdef H5_HAVE_STDBOOL_H
+ #include <stdbool.h>
+#else /* H5_HAVE_STDBOOL_H */
+ #ifndef __cplusplus
+ #if defined(H5_SIZEOF_BOOL) && (H5_SIZEOF_BOOL != 0)
+ #define bool _Bool
+ #else
+ #define bool unsigned int
+ #endif
+ #define true 1
+ #define false 0
+ #endif /* __cplusplus */
+#endif /* H5_HAVE_STDBOOL_H */
+typedef bool hbool_t;
typedef int htri_t;
/* Define the ssize_t type if it not is defined */