summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perform/chunk.c2
-rw-r--r--perform/zip_perf.c6
-rw-r--r--src/H5Dpublic.h8
-rw-r--r--src/H5Epublic.h10
-rw-r--r--src/H5F.c2
-rw-r--r--src/H5P.c43
-rw-r--r--src/H5Ppublic.h8
-rw-r--r--src/H5Tpublic.h8
-rw-r--r--src/H5Zpublic.h8
-rw-r--r--src/H5private.h5
-rw-r--r--test/ttbbt.c6
-rw-r--r--tools/h5dump/h5dumpgentest.c2
12 files changed, 74 insertions, 34 deletions
diff --git a/perform/chunk.c b/perform/chunk.c
index f74397b..717858b 100644
--- a/perform/chunk.c
+++ b/perform/chunk.c
@@ -33,7 +33,7 @@
#endif
-#ifndef H5_HAVE_ATTRIBUTE
+#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus
# undef __attribute__
# define __attribute__(X) /*void*/
# define UNUSED /*void*/
diff --git a/perform/zip_perf.c b/perform/zip_perf.c
index 9514dc0..d5ea5cb 100644
--- a/perform/zip_perf.c
+++ b/perform/zip_perf.c
@@ -324,7 +324,7 @@ uncompress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source,
static void
get_unique_name(void)
{
- const char *prefix = "/tmp", *template = "/zip_perf_XXXXXX";
+ const char *prefix = "/tmp", *templte = "/zip_perf_XXXXXX";
const char *env = getenv("HDF5_PREFIX");
if (env)
@@ -333,13 +333,13 @@ get_unique_name(void)
if (option_prefix)
prefix = option_prefix;
- filename = calloc(1, strlen(prefix) + strlen(template) + 1);
+ filename = calloc(1, strlen(prefix) + strlen(templte) + 1);
if (!filename)
error("out of memory");
strcpy(filename, prefix);
- strcat(filename, template);
+ strcat(filename, templte);
output = mkstemp(filename);
if (output == -1)
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 3e969a3..0035c0a 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -62,14 +62,14 @@ typedef enum H5D_fill_value_t {
H5D_FILL_VALUE_USER_DEFINED =2
} H5D_fill_value_t;
-/* Define the operator function pointer for H5Diterate() */
-typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, hsize_t ndim,
- hssize_t *point, void *operator_data);
-
#ifdef __cplusplus
extern "C" {
#endif
+/* Define the operator function pointer for H5Diterate() */
+typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, hsize_t ndim,
+ hssize_t *point, void *operator_data);
+
H5_DLL hid_t H5Dcreate (hid_t file_id, const char *name, hid_t type_id,
hid_t space_id, hid_t plist_id);
H5_DLL hid_t H5Dopen (hid_t file_id, const char *name);
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 607bbf2..c6ab38a 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -39,7 +39,7 @@
* the error reporting won't be properly restored!
*/
#define H5E_BEGIN_TRY { \
- herr_t (*H5E_saved_efunc)(void*); \
+ H5E_auto_t H5E_saved_efunc; \
void *H5E_saved_edata; \
H5Eget_auto (&H5E_saved_efunc, &H5E_saved_edata); \
H5Eset_auto (NULL, NULL);
@@ -225,14 +225,14 @@ typedef enum H5E_direction_t {
H5E_WALK_DOWNWARD = 1 /*begin at API function, end deep */
} H5E_direction_t;
-/* Error stack traversal callback function */
-typedef herr_t (*H5E_walk_t)(int n, H5E_error_t *err_desc, void *client_data);
-typedef herr_t (*H5E_auto_t)(void *client_data);
-
#ifdef __cplusplus
extern "C" {
#endif
+/* Error stack traversal callback function */
+typedef herr_t (*H5E_walk_t)(int n, H5E_error_t *err_desc, void *client_data);
+typedef herr_t (*H5E_auto_t)(void *client_data);
+
H5_DLL herr_t H5Eset_auto (H5E_auto_t func, void *client_data);
H5_DLL herr_t H5Eget_auto (H5E_auto_t *func, void **client_data);
H5_DLL herr_t H5Eclear (void);
diff --git a/src/H5F.c b/src/H5F.c
index 29ce3ac..34c0dc0 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2916,7 +2916,7 @@ done:
*/
static herr_t
H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child,
- const hid_t UNUSED plist_id)
+ hid_t UNUSED plist_id)
{
H5G_t *mount_point = NULL; /*mount point group */
H5G_entry_t *mp_ent = NULL; /*mount point symbol table entry*/
diff --git a/src/H5P.c b/src/H5P.c
index 895812b..ffbadaf 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -88,7 +88,8 @@ static H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class,
H5P_cls_close_func_t cls_close, void *close_data);
static herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name);
static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type);
-static void H5P_free_prop(H5P_genprop_t *prop);
+static herr_t H5P_free_prop(H5P_genprop_t *prop);
+static void H5P_free_prop_void(void *_prop);
/*--------------------------------------------------------------------------
@@ -1054,7 +1055,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static void
+static herr_t
H5P_free_prop(H5P_genprop_t *prop)
{
FUNC_ENTER_NOINIT(H5P_free_prop);
@@ -1071,12 +1072,46 @@ H5P_free_prop(H5P_genprop_t *prop)
H5FL_FREE(H5P_genprop_t,prop);
- FUNC_LEAVE_NOAPI_VOID;
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5P_free_prop() */
/*--------------------------------------------------------------------------
NAME
+ H5P_free_prop_void
+ PURPOSE
+ Internal routine to destroy a property node (Wrapper for compatibility
+ with H5TB_dfree)
+ USAGE
+ void H5P_free_prop(prop)
+ void *prop; IN: Pointer to property to destroy
+ RETURNS
+ No return value
+ DESCRIPTION
+ Releases all the memory for a property list. Does _not_ call the
+ properties 'close' callback, that should already have been done.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static void
+H5P_free_prop_void(void *_prop)
+{
+ H5P_genprop_t *prop=(H5P_genprop_t *)_prop;
+
+ FUNC_ENTER_NOINIT(H5P_free_prop_void);
+
+ assert(prop);
+
+ H5P_free_prop(prop);
+
+ FUNC_LEAVE_NOAPI_VOID;
+} /* H5P_free_prop_void() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5P_free_all_prop
PURPOSE
Internal routine to remove all properties from a property TBBT
@@ -5138,7 +5173,7 @@ H5P_close(void *_plist)
H5TB_dfree(plist->del,free,NULL);
/* Free the property tree itself */
- H5TB_dfree(plist->props,H5P_free_prop,NULL);
+ H5TB_dfree(plist->props,H5P_free_prop_void,NULL);
/* Destroy property list object */
H5FL_FREE(H5P_genplist_t,plist);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 3ac1029..abe8e63 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -50,6 +50,10 @@ typedef hid_t H5P_class_t; /* Alias H5P_class_t to hid_t */
#define H5P_DATA_XFER H5P_DATASET_XFER
#endif /* H5_WANT_H5_V1_4_COMPAT */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Define property list class callback function pointer types */
typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data);
typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id,
@@ -69,10 +73,6 @@ typedef H5P_prp_cb1_t H5P_prp_close_func_t;
/* Define property list iteration function type */
typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data);
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/*
* The library created property list classes
*
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index a96d2bb..cd7bc9b 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -174,6 +174,10 @@ typedef struct {
/* Variable Length String information */
#define H5T_VARIABLE ((size_t)(-1)) /* Indicate that a string is variable length (null-terminated in C, instead of fixed length) */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* All data type conversion functions are... */
typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf,
@@ -192,10 +196,6 @@ typedef herr_t (*H5T_overflow_t)(hid_t src_id, hid_t dst_id,
void *src_buf, void *dst_buf);
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* When this header is included from H5Tprivate.h, don't make calls to H5open() */
#undef H5OPEN
#ifndef _H5Tprivate_H
diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h
index 0b9a0bf..67b1fe9 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -31,6 +31,10 @@ typedef int H5Z_filter_t;
#define H5Z_FLAG_INVMASK 0xff00 /*invocation flag mask */
#define H5Z_FLAG_REVERSE 0x0100 /*reverse direction; read */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* A filter gets definition flags and invocation flags (defined above), the
* client data array and size defined when the filter was added to the
@@ -50,10 +54,6 @@ typedef size_t (*H5Z_func_t)(unsigned int flags, size_t cd_nelmts,
const unsigned int cd_values[], size_t nbytes,
size_t *buf_size, void **buf);
-#ifdef __cplusplus
-extern "C" {
-#endif
-
H5_DLL herr_t H5Zregister(H5Z_filter_t id, const char *comment,
H5Z_func_t filter);
diff --git a/src/H5private.h b/src/H5private.h
index f479d4b..836e929 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -186,12 +186,17 @@
* suppresses warnings about unused function arguments. It's no big deal if
* we don't.
*/
+#ifdef __cplusplus
+# define __attribute__(X) /*void*/
+# define UNUSED /*void*/
+#else /* __cplusplus */
#ifdef H5_HAVE_ATTRIBUTE
# define UNUSED __attribute__((unused))
#else
# define __attribute__(X) /*void*/
# define UNUSED /*void*/
#endif
+#endif /* __cplusplus */
/*
* Does the compiler expand __FUNCTION__ to be the name of the function
diff --git a/test/ttbbt.c b/test/ttbbt.c
index 6861afa..bef7db2 100644
--- a/test/ttbbt.c
+++ b/test/ttbbt.c
@@ -42,7 +42,7 @@
#define RandInt(a,b) ((rand()%(((b)-(a))+1))+(a))
-int tcompare (void * k1, void * k2, int cmparg);
+int tcompare (const void * k1, const void * k2, int cmparg);
static void swap_arr(int *arr, int a, int b)
{
@@ -57,11 +57,11 @@ static void swap_arr(int *arr, int a, int b)
} /* end swap_arr() */
int
-tcompare(void * k1, void * k2, int cmparg)
+tcompare(const void * k1, const void * k2, int cmparg)
{
/* shut compiler up */
cmparg=cmparg;
- return ((int) ((*(int *) k1) - (*(int *) k2)));
+ return ((int) ((*(const int *) k1) - (*(const int *) k2)));
}
void
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 593dc8d..d220b8b 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -2794,7 +2794,7 @@ void gent_multi(void)
assert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
- for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; ++mt) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
memb_fapl[mt] = H5P_DEFAULT;
sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];