[svn-r6269] Purpose:

Code cleanup

Description:
    Various code cleanups to allow the development branch to be compiled with
    a C++ compiler (i.e. CC=g++ )

Platforms tested:
    Tested h5committest {arabica (fortran), eirene (fortran, C++)
	modi4 (parallel, fortran)}
    FreeBSD 4.7 (sleipnir) C++
This commit is contained in:
Quincey Koziol 2003-01-13 08:15:49 -05:00
parent c3a1173026
commit 8e391ad35a
12 changed files with 74 additions and 34 deletions

View File

@ -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*/

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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*/

View File

@ -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,9 +1072,43 @@ 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
@ -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);

View File

@ -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
*

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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];