summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c++/src/H5CommonFG.cpp5
-rw-r--r--hl/src/H5LT.c9
-rw-r--r--hl/src/H5TB.c63
-rw-r--r--hl/test/test_lite.c19
-rw-r--r--src/H5E.c67
-rw-r--r--src/H5Edeprec.c36
-rw-r--r--src/H5Eint.c24
-rw-r--r--src/H5FD.c33
-rw-r--r--src/H5FL.c55
-rw-r--r--src/H5FS.c12
-rw-r--r--src/H5FSsection.c12
-rw-r--r--src/H5Lexternal.c4
-rw-r--r--src/H5Shyper.c119
-rw-r--r--test/cache.c122
-rw-r--r--test/dt_arith.c2
-rw-r--r--test/dtypes.c148
-rw-r--r--tools/h5dump/h5dump.c24
-rw-r--r--tools/lib/h5tools_filters.c120
18 files changed, 456 insertions, 418 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index dd4a419..8c1237d 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -249,7 +249,7 @@ DataSet CommonFG::openDataSet( const H5std_string& name ) const
//--------------------------------------------------------------------------
void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* new_name ) const
{
- herr_t ret_value;
+ herr_t ret_value = -1;
switch(link_type) {
case H5L_TYPE_HARD:
@@ -265,8 +265,7 @@ void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* ne
break;
} /* end switch */
- if( ret_value < 0 )
- {
+ if( ret_value < 0 ) {
throwException("link", "creating link failed");
}
}
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index c38d383..d118942 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -1749,14 +1749,15 @@ print_enum(hid_t type, char* str, int indt)
free(value);
H5Tclose(super);
+ return ret;
+
+out:
+
if(0 == nmembs) {
sprintf(tmp_str, "\n%*s <empty>", indt + 4, "");
strcat(str, tmp_str);
} /* end if */
-
- return ret;
-
-out:
+
/* Release resources */
if(name) {
for(i = 0; i < nmembs; i++)
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index a035319..b9cb73c 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -3213,16 +3213,12 @@ herr_t H5TBget_field_info( hid_t loc_id,
size_t *field_offsets,
size_t *type_size )
{
- hid_t did; /* dataset ID */
- hid_t tid; /* file type ID */
- hid_t n_tid; /* native type ID */
- hid_t m_tid; /* member type ID */
- hid_t nm_tid; /* native member ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t tid = -1; /* file type ID */
+ hid_t n_tid = -1; /* native type ID */
+ hid_t m_tid = -1; /* member type ID */
+ hid_t nm_tid = -1; /* native member ID */
hssize_t nfields;
- char *member_name;
- size_t member_size;
- size_t member_offset;
- size_t size;
hssize_t i;
/* open the dataset. */
@@ -3233,62 +3229,47 @@ herr_t H5TBget_field_info( hid_t loc_id,
if (( tid = H5Dget_type( did )) < 0)
goto out;
- if ((n_tid = H5Tget_native_type(tid,H5T_DIR_DEFAULT)) < 0)
+ if ((n_tid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
goto out;
/* get the type size */
- size = H5Tget_size( n_tid );
-
- if ( type_size )
- {
- *type_size = size;
- }
+ if(type_size)
+ *type_size = H5Tget_size(n_tid);
/* get the number of members */
if (( nfields = H5Tget_nmembers( tid )) < 0)
goto out;
/* iterate tru the members */
- for ( i = 0; i < nfields; i++)
- {
+ for ( i = 0; i < nfields; i++) {
/* get the member name */
- member_name = H5Tget_member_name( tid, (unsigned)i );
+ if(field_names) {
+ char *member_name;
- if (field_names )
- {
- strcpy( field_names[i], member_name );
- }
+ member_name = H5Tget_member_name(tid, (unsigned)i);
+ strcpy(field_names[i], member_name);
+ free(member_name);
+ } /* end if */
/* get the member type */
- if (( m_tid = H5Tget_member_type( tid,(unsigned) i )) < 0)
+ if(( m_tid = H5Tget_member_type( tid,(unsigned) i )) < 0)
goto out;
- if ((nm_tid = H5Tget_native_type(m_tid,H5T_DIR_DEFAULT)) < 0)
+ if((nm_tid = H5Tget_native_type(m_tid,H5T_DIR_DEFAULT)) < 0)
goto out;
/* get the member size */
- member_size = H5Tget_size( nm_tid );
-
- if(field_sizes )
- {
- field_sizes[i] = member_size;
- }
+ if(field_sizes)
+ field_sizes[i] = H5Tget_size(nm_tid);
/* get the member offset */
- member_offset = H5Tget_member_offset( n_tid,(unsigned) i );
-
- if(field_offsets )
- {
- field_offsets[i] = member_offset;
- }
+ if(field_offsets)
+ field_offsets[i] = H5Tget_member_offset(n_tid, (unsigned) i);
/* close the member types */
if (H5Tclose( m_tid ) < 0)
goto out;
if (H5Tclose( nm_tid ) < 0)
goto out;
-
- free( member_name );
-
} /* i */
/* close */
@@ -3308,6 +3289,8 @@ out:
H5Dclose(did);
H5Tclose(tid);
H5Tclose(n_tid);
+ H5Tclose(m_tid);
+ H5Tclose(nm_tid);
} H5E_END_TRY;
return -1;
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index ad12fb2..9234344 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -1535,17 +1535,16 @@ static int test_complicated_compound(void)
hid_t dtype;
int nmembs;
H5T_class_t type_class;
- char* line=NULL;
- FILE *fp;
+ char *line = NULL;
+ FILE *fp = NULL;
size_t size = 1024;
- char *srcdir = getenv("srcdir"); /* the source directory */
+ char *srcdir = getenv("srcdir"); /* the source directory */
char filename[1024]="";
TESTING3(" text for complicated compound types");
/* compose the name of the file to open, using the srcdir, if appropriate */
- if(srcdir)
- {
+ if(srcdir) {
strcpy(filename, srcdir);
strcat(filename, "/");
}
@@ -1553,8 +1552,7 @@ static int test_complicated_compound(void)
/* Open input file */
fp = fopen(filename, "r");
- if(fp == NULL)
- {
+ if(fp == NULL) {
printf( "Could not find file %s. Try set $srcdir \n", filename);
goto out;
}
@@ -1580,6 +1578,7 @@ static int test_complicated_compound(void)
}
fclose(fp);
+ fp = NULL;
if((dtype = H5LTtext_to_dtype(line, H5LT_DDL))<0)
goto out;
@@ -1602,6 +1601,12 @@ static int test_complicated_compound(void)
return 0;
out:
+
+ if(line)
+ free(line);
+ if(fp)
+ fclose(fp);
+
H5_FAILED();
return -1;
}
diff --git a/src/H5E.c b/src/H5E.c
index 5a80787..4591223 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -361,6 +361,36 @@ H5E_get_stack(void)
/*-------------------------------------------------------------------------
+ * Function: H5E_free_class
+ *
+ * Purpose: Private function to free an error class.
+ *
+ * Return: Non-negative value on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, January 22, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5E_free_class(H5E_cls_t *cls)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_free_class)
+
+ /* Check arguments */
+ HDassert(cls);
+
+ /* Free error class structure */
+ cls->cls_name = (char *)H5MM_xfree((void*)cls->cls_name);
+ cls->lib_name = (char *)H5MM_xfree((void*)cls->lib_name);
+ cls->lib_vers = (char *)H5MM_xfree((void*)cls->lib_vers);
+ cls = H5FL_FREE(H5E_cls_t, cls);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5E_free_class() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Eregister_class
*
* Purpose: Registers an error class.
@@ -413,7 +443,7 @@ done:
static H5E_cls_t *
H5E_register_class(const char *cls_name, const char *lib_name, const char *version)
{
- H5E_cls_t *cls; /* Pointer to error class */
+ H5E_cls_t *cls = NULL; /* Pointer to error class */
H5E_cls_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5E_register_class)
@@ -424,7 +454,7 @@ H5E_register_class(const char *cls_name, const char *lib_name, const char *versi
HDassert(version);
/* Allocate space for new error class */
- if(NULL == (cls = H5FL_MALLOC(H5E_cls_t)))
+ if(NULL == (cls = H5FL_CALLOC(H5E_cls_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Duplicate string information */
@@ -439,6 +469,10 @@ H5E_register_class(const char *cls_name, const char *lib_name, const char *versi
ret_value = cls;
done:
+ if(!ret_value)
+ if(cls && H5E_free_class(cls) < 0)
+ HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_register_class() */
@@ -494,7 +528,9 @@ done:
static herr_t
H5E_unregister_class(H5E_cls_t *cls)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_unregister_class)
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5E_unregister_class)
/* Check arguments */
HDassert(cls);
@@ -504,15 +540,11 @@ H5E_unregister_class(H5E_cls_t *cls)
(void)H5I_search(H5I_ERROR_MSG, H5E_close_msg_cb, cls, FALSE);
/* Free error class structure */
- if(cls->cls_name)
- H5MM_xfree((void*)cls->cls_name);
- if(cls->lib_name)
- H5MM_xfree((void*)cls->lib_name);
- if(cls->lib_vers)
- H5MM_xfree((void*)cls->lib_vers);
- (void)H5FL_FREE(H5E_cls_t, cls);
+ if(H5E_free_class(cls) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "unable to free error class")
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_unregister_class() */
@@ -680,11 +712,10 @@ H5E_close_msg(H5E_msg_t *err)
/* Check arguments */
HDassert(err);
- if(err->msg)
- H5MM_xfree((void*)err->msg);
+ /* Release message */
+ err->msg = (char *)H5MM_xfree((void *)err->msg);
/* Don't free err->cls here */
-
- (void)H5FL_FREE(H5E_msg_t, err);
+ err = H5FL_FREE(H5E_msg_t, err);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5E_close_msg() */
@@ -749,7 +780,7 @@ done:
static H5E_msg_t *
H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str)
{
- H5E_msg_t *msg; /* Pointer to new error message */
+ H5E_msg_t *msg = NULL; /* Pointer to new error message */
H5E_msg_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5E_create_msg)
@@ -773,6 +804,10 @@ H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str)
ret_value = msg;
done:
+ if(!ret_value)
+ if(msg && H5E_close_msg(msg) < 0)
+ HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_create_msg() */
diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c
index 0997f3c..30f3ae9 100644
--- a/src/H5Edeprec.c
+++ b/src/H5Edeprec.c
@@ -122,10 +122,10 @@ char *
H5Eget_major(H5E_major_t maj)
{
H5E_msg_t *msg; /* Pointer to error message */
- ssize_t size = 0; /* Return value */
+ ssize_t size;
H5E_type_t type;
- char *msg_str;
- char *ret_value = NULL;
+ char *msg_str = NULL;
+ char *ret_value; /* Return value */
FUNC_ENTER_API_NOCLEAR(H5Eget_major, NULL)
@@ -133,22 +133,26 @@ H5Eget_major(H5E_major_t maj)
if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(maj, H5I_ERROR_MSG)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID")
- /* Get the message's text */
+ /* Get the size & type of the message's text */
if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
-
if(type != H5E_MAJOR)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one")
- /* Don't know who is going to free it */
- msg_str = (char *)H5MM_malloc((size_t)(++size) * sizeof(char));
+ /* Application will free this */
+ size++;
+ msg_str = (char *)H5MM_malloc((size_t)size);
+ /* Get the text for the message */
if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
ret_value = msg_str;
done:
+ if(!ret_value)
+ msg_str = (char *)H5MM_xfree(msg_str);
+
FUNC_LEAVE_API(ret_value)
} /* end H5Eget_major() */
@@ -170,10 +174,10 @@ char *
H5Eget_minor(H5E_minor_t min)
{
H5E_msg_t *msg; /* Pointer to error message */
- ssize_t size = 0; /* Return value */
+ ssize_t size;
H5E_type_t type;
- char *msg_str;
- char *ret_value = NULL;
+ char *msg_str = NULL;
+ char *ret_value; /* Return value */
FUNC_ENTER_API_NOCLEAR(H5Eget_minor, NULL)
@@ -181,22 +185,26 @@ H5Eget_minor(H5E_minor_t min)
if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(min, H5I_ERROR_MSG)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID")
- /* Get the message's text */
+ /* Get the size & type of the message's text */
if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
-
if(type != H5E_MINOR)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one")
- /* Don't know who is going to free it */
- msg_str = (char *)H5MM_malloc((size_t)(++size) * sizeof(char));
+ /* Application will free this */
+ size++;
+ msg_str = (char *)H5MM_malloc((size_t)size);
+ /* Get the text for the message */
if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
ret_value = msg_str;
done:
+ if(!ret_value)
+ msg_str = (char *)H5MM_xfree(msg_str);
+
FUNC_LEAVE_API(ret_value)
} /* end H5Eget_minor() */
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 831d51b..d64fcbd 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -225,8 +225,9 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
const char *maj_str = "No major description"; /* Major error description */
const char *min_str = "No minor description"; /* Minor error description */
unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk1_cb)
+ FUNC_ENTER_NOAPI_NOINIT(H5E_walk1_cb)
/* Check arguments */
HDassert(err_desc);
@@ -240,7 +241,11 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
/* Get descriptions for the major and minor error numbers */
maj_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->maj_num, H5I_ERROR_MSG);
min_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG);
- HDassert(maj_ptr && min_ptr);
+
+ /* Check for bad pointer(s), but can't issue error, just leave */
+ if(!maj_ptr || !min_ptr)
+ HGOTO_DONE(FAIL)
+
if(maj_ptr->msg)
maj_str = maj_ptr->msg;
if(min_ptr->msg)
@@ -294,7 +299,8 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str);
fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_walk1_cb() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -341,8 +347,9 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
const char *maj_str = "No major description"; /* Major error description */
const char *min_str = "No minor description"; /* Minor error description */
unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk2_cb)
+ FUNC_ENTER_NOAPI_NOINIT(H5E_walk2_cb)
/* Check arguments */
HDassert(err_desc);
@@ -356,7 +363,11 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
/* Get descriptions for the major and minor error numbers */
maj_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->maj_num, H5I_ERROR_MSG);
min_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG);
- HDassert(maj_ptr && min_ptr);
+
+ /* Check for bad pointer(s), but can't issue error, just leave */
+ if(!maj_ptr || !min_ptr)
+ HGOTO_DONE(FAIL)
+
if(maj_ptr->msg)
maj_str = maj_ptr->msg;
if(min_ptr->msg)
@@ -411,7 +422,8 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str);
fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_walk2_cb() */
diff --git a/src/H5FD.c b/src/H5FD.c
index 4c0da40..99f2e3c 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -730,8 +730,8 @@ done:
herr_t
H5FD_fapl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
{
- void *copied_driver_info; /* Temporary VFL driver info */
- herr_t ret_value=SUCCEED; /* Return value */
+ void *copied_driver_info = NULL; /* Temporary VFL driver info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_fapl_open, FAIL)
@@ -739,15 +739,20 @@ H5FD_fapl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
if(H5I_inc_ref(driver_id, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver")
if(H5FD_fapl_copy(driver_id, driver_info, &copied_driver_info) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VFL driver info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "can't copy VFL driver info")
/* Set the driver properties for the list */
if(H5P_set(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set driver ID")
if(H5P_set(plist, H5F_ACS_FILE_DRV_INFO_NAME, &copied_driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set driver info")
+ copied_driver_info = NULL;
done:
+ if(ret_value < 0)
+ if(copied_driver_info && H5FD_fapl_close(driver_id, copied_driver_info) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_fapl_open() */
@@ -847,24 +852,28 @@ done:
herr_t
H5FD_dxpl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
{
- void *copied_driver_info; /* Temporary VFL driver info */
- herr_t ret_value=SUCCEED; /* Return value */
+ void *copied_driver_info = NULL; /* Temporary VFL driver info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_dxpl_open, FAIL)
/* Increment the reference count on the driver and copy the driver info */
if(H5I_inc_ref(driver_id, FALSE) < 0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINC, FAIL, "can't increment VFL driver ID")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "can't increment VFL driver ID")
if(H5FD_dxpl_copy(driver_id, driver_info, &copied_driver_info) < 0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy VFL driver")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "can't copy VFL driver")
/* Set the driver information for the new property list */
if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "can't set VFL driver ID")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VFL driver ID")
if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &copied_driver_info) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "can't set VFL driver info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VFL driver info")
done:
+ if(ret_value < 0)
+ if(copied_driver_info && H5FD_dxpl_close(driver_id, copied_driver_info) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_dxpl_open() */
@@ -1060,7 +1069,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/* Get file access property list */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
/* Get the VFD to open the file with */
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
diff --git a/src/H5FL.c b/src/H5FL.c
index c72491d..8ac442a 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -380,7 +380,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Make certain the list is initialized first */
if(!head->init)
if(H5FL_reg_init(head)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks")
/* Check for nodes available on the free list first */
if(head->list!=NULL) {
@@ -399,7 +399,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Otherwise allocate a node */
else {
if (NULL==(ret_value = H5FL_malloc(head->size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment the number of blocks allocated in list */
head->allocated++;
@@ -456,7 +456,7 @@ H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Allocate the block */
if (NULL==(ret_value = H5FL_reg_malloc(head H5FL_TRACK_INFO_INT)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Clear to zeros */
/* (Accomodate tracking information, if present) */
@@ -864,7 +864,7 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
/* Make certain the list is initialized first */
if(!head->init)
if(H5FL_blk_init(head)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list")
/* check if there is a free list for blocks of this size */
/* and if there are any blocks available on the list */
@@ -953,7 +953,7 @@ H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
/* Allocate the block */
if (NULL==(ret_value = H5FL_blk_malloc(head,size H5FL_TRACK_INFO_INT)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Clear the block to zeros */
HDmemset(ret_value,0,size);
@@ -1335,7 +1335,7 @@ H5FL_arr_init(H5FL_arr_head_t *head)
/* Allocate a new garbage collection node */
if(NULL == (new_node = (H5FL_gc_arr_node_t *)H5MM_malloc(sizeof(H5FL_gc_arr_node_t))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize the new garbage collection node */
new_node->list = head;
@@ -1346,7 +1346,7 @@ H5FL_arr_init(H5FL_arr_head_t *head)
/* Allocate room for the free lists */
if(NULL == (head->list_arr = (H5FL_arr_node_t *)H5MM_calloc((size_t)head->maxelem*sizeof(H5FL_arr_node_t))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize the size of each array */
for(u = 0; u < (size_t)head->maxelem; u++)
@@ -1469,7 +1469,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem)
/* Make certain the list is initialized first */
if(!head->init)
if(H5FL_arr_init(head)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks")
/* Sanity check that the number of elements is supported */
HDassert(elem<=(unsigned) head->maxelem);
@@ -1496,7 +1496,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem)
/* Otherwise allocate a node */
else {
if(NULL == (new_obj = (H5FL_arr_list_t *)H5FL_malloc(sizeof(H5FL_arr_list_t)+mem_size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment the number of blocks allocated in list */
head->allocated++;
@@ -1540,11 +1540,11 @@ H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem)
HDassert(elem);
/* Allocate the array */
- if (NULL==(ret_value = H5FL_arr_malloc(head,elem)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (ret_value = H5FL_arr_malloc(head, elem)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Clear to zeros */
- HDmemset(ret_value,0,head->list_arr[elem].size);
+ HDmemset(ret_value, 0, head->list_arr[elem].size);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1938,21 +1938,21 @@ done:
H5FL_fac_head_t *
H5FL_fac_init(size_t size)
{
- H5FL_fac_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */
- H5FL_fac_head_t *factory; /* Pointer to new block factory */
+ H5FL_fac_gc_node_t *new_node = NULL; /* Pointer to the node for the new list to garbage collect */
+ H5FL_fac_head_t *factory = NULL; /* Pointer to new block factory */
H5FL_fac_head_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5FL_fac_init, NULL)
/* Sanity check */
- HDassert(size>0);
+ HDassert(size > 0);
/* Allocate room for the new factory */
if(NULL == (factory = (H5FL_fac_head_t *)H5FL_CALLOC(H5FL_fac_head_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for factory object")
/* Set size of blocks for factory */
- factory->size=size;
+ factory->size = size;
/* Allocate a new garbage collection node */
if(NULL == (new_node = (H5FL_fac_gc_node_t *)H5FL_MALLOC(H5FL_fac_gc_node_t)))
@@ -1962,15 +1962,15 @@ H5FL_fac_init(size_t size)
new_node->list = factory;
/* Link in to the garbage collection list */
- new_node->next=H5FL_fac_gc_head.first;
- H5FL_fac_gc_head.first=new_node;
+ new_node->next = H5FL_fac_gc_head.first;
+ H5FL_fac_gc_head.first = new_node;
if(new_node->next)
new_node->next->list->prev_gc=new_node;
/* The new factory's prev_gc field will be set to NULL */
/* Make certain that the space allocated is large enough to store a free list pointer (eventually) */
- if(factory->size<sizeof(H5FL_fac_node_t))
- factory->size=sizeof(H5FL_fac_node_t);
+ if(factory->size < sizeof(H5FL_fac_node_t))
+ factory->size = sizeof(H5FL_fac_node_t);
/* Make certain there's room for tracking information, if any */
#ifdef H5FL_TRACK
@@ -1978,12 +1978,19 @@ H5FL_fac_init(size_t size)
#endif /* H5FL_TRACK */
/* Indicate that the free list is initialized */
- factory->init=1;
+ factory->init = 1;
/* Set return value */
- ret_value=factory;
+ ret_value = factory;
done:
+ if(!ret_value) {
+ if(factory)
+ factory = H5FL_FREE(H5FL_fac_head_t, factory);
+ if(new_node)
+ new_node = H5FL_FREE(H5FL_fac_gc_node_t, new_node);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FL_fac_init() */
@@ -2123,7 +2130,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS)
/* Otherwise allocate a node */
else {
if (NULL==(ret_value = H5FL_malloc(head->size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment the number of blocks allocated in list */
head->allocated++;
@@ -2184,7 +2191,7 @@ H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS)
/* Allocate the block */
if (NULL==(ret_value = H5FL_fac_malloc(head H5FL_TRACK_INFO_INT)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Clear to zeros */
/* (Accomodate tracking information, if present) */
diff --git a/src/H5FS.c b/src/H5FS.c
index 5e3392e..015c485 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -508,7 +508,7 @@ H5FS_t *
H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
void *cls_init_udata)
{
- H5FS_t *fspace; /* Free space manager */
+ H5FS_t *fspace = NULL; /* Free space manager */
size_t u; /* Local index variable */
H5FS_t *ret_value; /* Return value */
@@ -556,6 +556,16 @@ H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
ret_value = fspace;
done:
+ if(!ret_value)
+ if(fspace) {
+ /* Should probably call the class 'term' callback for all classes
+ * that have had their 'init' callback called... -QAK
+ */
+ if(fspace->sect_cls)
+ fspace->sect_cls = (H5FS_section_class_t *)H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls);
+ fspace = H5FL_FREE(H5FS_t, fspace);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_new() */
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 30885a9..26aac37 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -939,7 +939,8 @@ static herr_t
H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
H5FS_section_info_t *sect)
{
- H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */
+ H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */
+ hbool_t fspace_node_alloc = FALSE; /* Whether the free space node was allocated */
unsigned bin; /* Bin to put the free space section in */
herr_t ret_value = SUCCEED; /* Return value */
@@ -971,6 +972,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s
/* Allocate new free list size node */
if(NULL == (fspace_node = H5FL_MALLOC(H5FS_node_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for free space node")
+ fspace_node_alloc = TRUE;
/* Initialize the free list size node */
fspace_node->sect_size = sect->size;
@@ -981,6 +983,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s
/* Insert new free space size node into bin's list */
if(H5SL_insert(sinfo->bins[bin].bin_list, fspace_node, &fspace_node->sect_size) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into skip list")
+ fspace_node_alloc = FALSE; /* (owned by the bin skip list now, don't need to free on error) */
/* Increment number of section sizes */
sinfo->tot_size_count++;
@@ -1016,6 +1019,13 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into skip list")
done:
+ if(ret_value < 0)
+ if(fspace_node && fspace_node_alloc) {
+ if(fspace_node->sect_list && H5SL_close(fspace_node->sect_list) < 0)
+ HDONE_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy size free space node's skip list")
+ fspace_node = H5FL_FREE(H5FS_node_t, fspace_node);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_sect_link_size() */
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index ad8f8e1..db762cf 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -594,8 +594,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
- if(norm_obj_name)
- H5MM_free(ext_link_buf);
+ H5MM_xfree(ext_link_buf);
+ H5MM_xfree(norm_obj_name);
FUNC_LEAVE_API(ret_value)
} /* end H5Lcreate_external() */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index f86a743..bdcdc28 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -3531,6 +3531,7 @@ done:
herr_t
H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hsize_t *coords)
{
+ H5S_hyper_span_info_t *head = NULL; /* Pointer to new head of span tree */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_add_span_element)
@@ -3541,8 +3542,6 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hsize_t *coords)
/* Check if this is the first element in the selection */
if(NULL == space->select.sel_info.hslab) {
- H5S_hyper_span_info_t *head; /* Pointer to new head of span tree */
-
/* Allocate a span info node */
if(NULL == (head = H5FL_MALLOC(H5S_hyper_span_info_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
@@ -3574,7 +3573,7 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hsize_t *coords)
space->select.num_elem = 1;
} /* end if */
else {
- if(H5S_hyper_add_span_element_helper(space->select.sel_info.hslab->span_lst,rank,coords) < 0)
+ if(H5S_hyper_add_span_element_helper(space->select.sel_info.hslab->span_lst, rank, coords) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Increment # of elements in selection */
@@ -3582,6 +3581,10 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hsize_t *coords)
} /* end else */
done:
+ if(ret_value < 0)
+ if(head)
+ H5S_hyper_free_span_info(head);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_add_span_element() */
@@ -5421,85 +5424,109 @@ static H5S_hyper_span_info_t *
H5S_hyper_make_spans (unsigned rank, const hsize_t *start, const hsize_t *stride,
const hsize_t *count, const hsize_t *block)
{
- H5S_hyper_span_info_t *down;/* Pointer to spans in next dimension down */
- H5S_hyper_span_t *span; /* New hyperslab span */
- H5S_hyper_span_t *last_span;/* Current position in hyperslab span list */
- H5S_hyper_span_t *head; /* Head of new hyperslab span list */
- hsize_t stride_iter; /* Iterator over the stride values */
- int i; /* Counters */
- unsigned u; /* Counters */
- H5S_hyper_span_info_t *ret_value;
+ H5S_hyper_span_info_t *down; /* Pointer to spans in next dimension down */
+ H5S_hyper_span_t *span; /* New hyperslab span */
+ H5S_hyper_span_t *last_span; /* Current position in hyperslab span list */
+ H5S_hyper_span_t *head; /* Head of new hyperslab span list */
+ hsize_t stride_iter; /* Iterator over the stride values */
+ int i; /* Counters */
+ unsigned u; /* Counters */
+ H5S_hyper_span_info_t *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_make_spans);
/* Check args */
- assert (rank>0);
- assert (start);
- assert (stride);
- assert (count);
- assert (block);
+ HDassert(rank > 0);
+ HDassert(start);
+ HDassert(stride);
+ HDassert(count);
+ HDassert(block);
/* Start creating spans in fastest changing dimension */
- down=NULL;
- for(i=(rank-1); i>=0; i--) {
+ down = NULL;
+ for(i = (rank - 1); i >= 0; i--) {
/* Start a new list in this dimension */
- head=last_span=NULL;
+ head = NULL;
+ last_span = NULL;
- /* Generate all the spans segments for this dimension */
- for(u=0, stride_iter=0; u<count[i]; u++,stride_iter+=stride[i]) {
+ /* Generate all the span segments for this dimension */
+ for(u = 0, stride_iter = 0; u < count[i]; u++, stride_iter += stride[i]) {
/* Allocate a span node */
- if((span = H5FL_MALLOC(H5S_hyper_span_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ if(NULL == (span = H5FL_MALLOC(H5S_hyper_span_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Set the span's basic information */
- span->low=start[i]+stride_iter;
- span->high=span->low+(block[i]-1);
- span->nelem=block[i];
- span->pstride=stride[i];
- span->next=NULL;
+ span->low = start[i] + stride_iter;
+ span->high = span->low + (block[i]-1);
+ span->nelem = block[i];
+ span->pstride = stride[i];
+ span->next = NULL;
/* Append to the list of spans in this dimension */
- if(head==NULL)
- head=span;
+ if(head == NULL)
+ head = span;
else
- last_span->next=span;
+ last_span->next = span;
/* Move current pointer */
- last_span=span;
+ last_span = span;
/* Set the information for the next dimension down's spans, if appropriate */
- if(down!=NULL) {
- span->down=down;
+ if(down != NULL) {
+ span->down = down;
down->count++; /* Increment reference count for shared span */
} /* end if */
else {
- span->down=NULL;
+ span->down = NULL;
} /* end else */
} /* end for */
/* Allocate a span info node */
- if((down = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
+ if(NULL == (down = H5FL_MALLOC(H5S_hyper_span_info_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
/* Set the reference count */
- down->count=0;
+ down->count = 0;
/* Reset the scratch pad space */
- down->scratch=0;
+ down->scratch = 0;
/* Keep the pointer to the next dimension down's completed list */
- down->head=head;
+ down->head = head;
} /* end for */
/* Indicate that there is a pointer to this tree */
- down->count=1;
+ down->count = 1;
/* Success! Return the head of the list in the slowest changing dimension */
- ret_value=down;
+ ret_value = down;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ /* cleanup if error (ret_value will be NULL) */
+ if(!ret_value) {
+ if(head || down) {
+ if(head && down)
+ if(down->head != head)
+ down = NULL;
+
+ do {
+ if(down) {
+ head = down->head;
+ (void)H5FL_FREE(H5S_hyper_span_info_t, down);
+ } /* end if */
+ down = head->down;
+
+ while(head) {
+ last_span = head->next;
+ (void)H5FL_FREE(H5S_hyper_span_t, head);
+ head = last_span;
+ } /* end while */
+ } while(down);
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_make_spans() */
@@ -6959,7 +6986,7 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
/* Copy the first dataspace */
if (NULL == (new_space = H5S_copy (space, TRUE, TRUE)))
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
/* Go modify the selection in the new dataspace */
if (H5S_select_hyperslab(new_space, op, start, stride, count, block)<0)
@@ -6967,7 +6994,7 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
/* Atomize */
if ((ret_value=H5I_register (H5I_DATASPACE, new_space, TRUE))<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
done:
if (ret_value<0 && new_space)
@@ -7015,7 +7042,7 @@ H5S_combine_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
/* Copy the first dataspace */
if (NULL == (new_space = H5S_copy (space1, TRUE, TRUE)))
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
/* Free the current selection for the new dataspace */
if(H5S_SELECT_RELEASE(new_space)<0)
@@ -7095,7 +7122,7 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
/* Atomize */
if ((ret_value=H5I_register (H5I_DATASPACE, new_space, TRUE))<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
done:
if (ret_value<0 && new_space)
diff --git a/test/cache.c b/test/cache.c
index 734fc3b..7828725 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -13769,45 +13769,53 @@ check_expunge_entry(void)
* it without marking it dirty.
*/
- protect_entry(cache_ptr, 0, 0);
+ if ( pass ) {
- unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET);
+ protect_entry(cache_ptr, 0, 0);
+
+ unprotect_entry(cache_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET);
+
+ }
if ( pass ) {
result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size,
&in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL);
- if ( result < 0 ) {
+ if ( result < 0 ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 2.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "H5AC_get_entry_status() reports failure 2.");
+ failure_mssg = msg;
- } else if ( !in_cache || is_dirty || is_protected || is_pinned ) {
+ } else if ( !in_cache || is_dirty || is_protected || is_pinned ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128, "Unexpected status 2.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128, "Unexpected status 2.");
+ failure_mssg = msg;
- } else if ( ( ! entry_ptr->loaded ) ||
- ( entry_ptr->cleared ) ||
- ( entry_ptr->flushed ) ||
- ( entry_ptr->destroyed ) ) {
+ } else if ( ( ! entry_ptr->loaded ) ||
+ ( entry_ptr->cleared ) ||
+ ( entry_ptr->flushed ) ||
+ ( entry_ptr->destroyed ) ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128, "Unexpected entry history 2.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128, "Unexpected entry history 2.");
+ failure_mssg = msg;
- }
+ }
}
/* Expunge the entry and then verify that it is no longer in the cache.
* Also verify that the entry was loaded, cleared, and destroyed, but
* not flushed.
*/
- expunge_entry(cache_ptr, 0, 0);
+ if ( pass ) {
+
+ expunge_entry(cache_ptr, 0, 0);
+
+ }
if ( pass ) {
@@ -13818,29 +13826,29 @@ check_expunge_entry(void)
result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size,
&in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL);
- if ( result < 0 ) {
+ if ( result < 0 ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 3.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "H5AC_get_entry_status() reports failure 3.");
+ failure_mssg = msg;
- } else if ( in_cache ) {
+ } else if ( in_cache ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128, "Unexpected status 3.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128, "Unexpected status 3.");
+ failure_mssg = msg;
- } else if ( ( ! entry_ptr->loaded ) ||
- ( ! entry_ptr->cleared ) ||
- ( entry_ptr->flushed ) ||
- ( ! entry_ptr->destroyed ) ) {
+ } else if ( ( ! entry_ptr->loaded ) ||
+ ( ! entry_ptr->cleared ) ||
+ ( entry_ptr->flushed ) ||
+ ( ! entry_ptr->destroyed ) ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128, "Unexpected entry history 3.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128, "Unexpected entry history 3.");
+ failure_mssg = msg;
- }
+ }
}
/* now repeat the process with a different entry. On unprotect
@@ -13860,14 +13868,14 @@ check_expunge_entry(void)
&in_cache, &is_dirty, &is_protected,
&is_pinned, NULL, NULL);
- if ( result < 0 ) {
+ if ( result < 0 ) {
- pass = FALSE;
- HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 4.");
- failure_mssg = msg;
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "H5AC_get_entry_status() reports failure 4.");
+ failure_mssg = msg;
- } else if ( in_cache ) {
+ } else if ( in_cache ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 4.");
@@ -13882,16 +13890,20 @@ check_expunge_entry(void)
HDsnprintf(msg, (size_t)128, "Unexpected entry history 4.");
failure_mssg = msg;
- }
+ }
}
/* protect the entry to force the cache to load it, and then unprotect
* it with the dirty flag set.
*/
- protect_entry(cache_ptr, 0, 1);
+ if ( pass ) {
+
+ protect_entry(cache_ptr, 0, 1);
+
+ unprotect_entry(cache_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET);
- unprotect_entry(cache_ptr, 0, 1, TRUE, H5C__NO_FLAGS_SET);
+ }
if ( pass ) {
@@ -13899,14 +13911,14 @@ check_expunge_entry(void)
&in_cache, &is_dirty, &is_protected,
&is_pinned, NULL, NULL);
- if ( result < 0 ) {
+ if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"H5AC_get_entry_status() reports failure 5.");
failure_mssg = msg;
- } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) {
+ } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 5.");
@@ -13921,14 +13933,18 @@ check_expunge_entry(void)
HDsnprintf(msg, (size_t)128, "Unexpected entry history 5.");
failure_mssg = msg;
- }
+ }
}
/* Expunge the entry and then verify that it is no longer in the cache.
* Also verify that the entry was loaded, cleared and destroyed, but not
* flushed.
*/
- expunge_entry(cache_ptr, 0, 1);
+ if ( pass ) {
+
+ expunge_entry(cache_ptr, 0, 1);
+
+ }
if ( pass ) {
@@ -13940,14 +13956,14 @@ check_expunge_entry(void)
&in_cache, &is_dirty, &is_protected,
&is_pinned, NULL, NULL);
- if ( result < 0 ) {
+ if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"H5AC_get_entry_status() reports failure 6.");
failure_mssg = msg;
- } else if ( in_cache ) {
+ } else if ( in_cache ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected status 6.");
@@ -13962,7 +13978,7 @@ check_expunge_entry(void)
HDsnprintf(msg, (size_t)128, "Unexpected entry history 6.");
failure_mssg = msg;
- }
+ }
}
if ( pass ) {
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 13cf5ba..ff6b4e0 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -1334,7 +1334,6 @@ test_derived_integer(void)
char filename[1024];
size_t src_size, dst_size;
unsigned char *buf=NULL, *saved_buf=NULL;
- int *aligned=NULL;
int endian; /*endianess */
size_t nelmts = NTESTELEM;
unsigned int fails_this_test = 0;
@@ -1597,7 +1596,6 @@ test_derived_integer(void)
error:
if (buf) free(buf);
if (saved_buf) free(saved_buf);
- if (aligned) free(aligned);
HDfflush(stdout);
H5E_BEGIN_TRY {
H5Tclose (tid1);
diff --git a/test/dtypes.c b/test/dtypes.c
index 020a603..f32afe5 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -515,39 +515,37 @@ test_compound_1(void)
H5T_str_t strpad;
H5T_order_t order;
H5T_sign_t sign;
- char* tag;
+ char *tag = NULL;
int offset;
herr_t ret;
+ int retval = 1;
TESTING("compound datatypes");
/* Create the empty type */
- if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t))) < 0) goto error;
+ if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t))) < 0)
+ goto error;
/* Attempt to add the new compound datatype as a field within itself */
H5E_BEGIN_TRY {
ret=H5Tinsert(complex_id, "compound", 0, complex_id);
} H5E_END_TRY;
if (ret>=0) {
- H5_FAILED();
- printf("Inserted compound datatype into itself?\n");
- goto error;
+ FAIL_PUTS_ERROR("Inserted compound datatype into itself?");
} /* end if */
/* Add a couple fields */
- if (H5Tinsert(complex_id, "real", HOFFSET(complex_t, re),
- H5T_NATIVE_DOUBLE) < 0) goto error;
- if (H5Tinsert(complex_id, "imaginary", HOFFSET(complex_t, im),
- H5T_NATIVE_DOUBLE) < 0) goto error;
+ if(H5Tinsert(complex_id, "real", HOFFSET(complex_t, re), H5T_NATIVE_DOUBLE) < 0)
+ goto error;
+ if(H5Tinsert(complex_id, "imaginary", HOFFSET(complex_t, im), H5T_NATIVE_DOUBLE) < 0)
+ goto error;
/* Test some functions that aren't supposed to work for compound type */
H5E_BEGIN_TRY {
size=H5Tget_precision(complex_id);
} H5E_END_TRY;
if (size>0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
size = 128;
@@ -555,108 +553,89 @@ test_compound_1(void)
ret = H5Tset_precision(complex_id, size);
} H5E_END_TRY;
if (ret>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
ret = H5Tget_pad(complex_id, &lsb, &msb);
} H5E_END_TRY;
if (ret>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
size = H5Tget_ebias(complex_id);
} H5E_END_TRY;
if (size>0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
lsb = H5Tget_inpad(complex_id);
} H5E_END_TRY;
if (lsb>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
cset = H5Tget_cset(complex_id);
} H5E_END_TRY;
if (cset>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
strpad = H5Tget_strpad(complex_id);
} H5E_END_TRY;
if (strpad>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
offset = H5Tget_offset(complex_id);
} H5E_END_TRY;
if (offset>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
order = H5Tget_order(complex_id);
} H5E_END_TRY;
if (order>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
sign = H5Tget_sign(complex_id);
} H5E_END_TRY;
if (sign>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
tag = H5Tget_tag(complex_id);
} H5E_END_TRY;
if (tag) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
super = H5Tget_super(complex_id);
} H5E_END_TRY;
if (super>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- if (H5Tclose (complex_id) < 0) goto error;
+ if (H5Tclose (complex_id) < 0)
+ goto error;
PASSED();
- return 0;
+ retval = 0;
- error:
- return 1;
+error:
+ if(tag)
+ HDfree(tag);
+ return retval;
}
@@ -1068,6 +1047,7 @@ test_compound_5(void)
dst_type_t *dst;
void *buf = calloc(2, sizeof(dst_type_t));
void *bkg = calloc(2, sizeof(dst_type_t));
+ int retval = 1;
#if 1
TESTING("optimized struct converter");
@@ -1124,14 +1104,17 @@ test_compound_5(void)
src[1].coll_ids[2]!=dst[1].coll_ids[2] ||
src[1].coll_ids[3]!=dst[1].coll_ids[3]) {
H5_FAILED();
- return 1;
+ } else {
+ PASSED();
+ retval = 0;
}
/* Free memory buffers */
- free(buf);
- free(bkg);
- PASSED();
- return 0;
+ if(buf)
+ HDfree(buf);
+ if(bkg)
+ HDfree(bkg);
+ return retval;
}
@@ -2054,10 +2037,11 @@ test_compound_11(void)
hid_t big_tid, little_tid; /* Datatype IDs for type conversion */
hid_t big_tid2, little_tid2; /* Datatype IDs for type conversion */
hid_t opaq_src_tid, opaq_dst_tid; /* Datatype IDs for type conversion */
- void *buf, /* Conversion buffer */
- *buf_orig, /* Copy of original conversion buffer */
- *bkg; /* Background buffer */
+ void *buf = NULL; /* Conversion buffer */
+ void *buf_orig = NULL; /* Copy of original conversion buffer */
+ void *bkg = NULL; /* Background buffer */
size_t u; /* Local index variable */
+ int retval = 1;
TESTING("registering type conversion routine with compound conversions");
@@ -2216,18 +2200,21 @@ test_compound_11(void)
if(H5Tclose(opaq_src_tid) < 0) TEST_ERROR
if(H5Tclose(little_tid2) < 0) TEST_ERROR
if(H5Tclose(big_tid2) < 0) TEST_ERROR
- HDfree(bkg);
- HDfree(buf_orig);
- HDfree(buf);
if(H5Tclose(little_tid) < 0) TEST_ERROR
if(H5Tclose(big_tid) < 0) TEST_ERROR
if(H5Tclose(var_string_tid) < 0) TEST_ERROR
PASSED();
- return 0;
+ retval = 0;
- error:
- return 1;
+error:
+ if(buf)
+ HDfree(buf);
+ if(buf_orig)
+ HDfree(buf_orig);
+ if(bkg)
+ HDfree(bkg);
+ return retval;
}
@@ -4133,7 +4120,7 @@ test_conv_str_3(void)
int size;
H5T_pad_t inpad;
H5T_sign_t sign;
- char* tag;
+ char *tag = NULL;
herr_t ret;
TESTING("some type functions for string");
@@ -4163,63 +4150,54 @@ test_conv_str_3(void)
ret=H5Tset_precision(type, nelmts);
} H5E_END_TRY;
if (ret>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
size = H5Tget_ebias(type);
} H5E_END_TRY;
if (size>0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
inpad=H5Tget_inpad(type);
} H5E_END_TRY;
if (inpad>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
sign=H5Tget_sign(type);
} H5E_END_TRY;
if (sign>-1) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
tag = H5Tget_tag(type);
} H5E_END_TRY;
if (tag) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
super = H5Tget_super(type);
} H5E_END_TRY;
if (super>=0) {
- H5_FAILED();
- printf("Operation not allowed for this type.\n");
- goto error;
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
PASSED();
ret_value = 0;
- error:
- if (buf) HDfree(buf);
+error:
+ if(buf)
+ HDfree(buf);
+ if(tag)
+ HDfree(tag);
reset_hdf5();
- return ret_value;
+ return ret_value; /* Number of errors */
}
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index cdc9c6a..0f25efe 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -5839,19 +5839,19 @@ xml_dump_group(hid_t gid, const char *name)
t_objname, parentxid, par_name);
free(t_objname);
free(par_name);
- }
- indentation(indent + COL);
- t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */
- par_name = xml_escape_the_name(par);
- xml_name_to_XID(found_obj->objname, ptrstr, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
- printf("<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
- xmlnsprefix,
- ptrstr, t_objname, parentxid, par_name);
- free(t_objname);
- free(par_name);
+ indentation(indent + COL);
+ t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */
+ par_name = xml_escape_the_name(par);
+ xml_name_to_XID(found_obj->objname, ptrstr, 100, 1);
+ xml_name_to_XID(par, parentxid, 100, 1);
+ printf("<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
+ xmlnsprefix,
+ ptrstr, t_objname, parentxid, par_name);
+ free(t_objname);
+ free(par_name);
+ }
free(ptrstr);
} else {
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 325023d..341a5c9 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -49,31 +49,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
int nfilters; /* number of filters */
H5Z_filter_t filtn; /* filter identification number */
int i; /* index */
- int have_deflate=0; /* assume initially we do not have filters */
- int have_szip=0;
- int have_shuffle=0;
- int have_fletcher=0;
- int have_nbit=0;
- int have_scaleoffset=0;
-
-#ifdef H5_HAVE_FILTER_DEFLATE
- have_deflate=1;
-#endif
-#ifdef H5_HAVE_FILTER_SZIP
- have_szip=1;
-#endif
-#ifdef H5_HAVE_FILTER_SHUFFLE
- have_shuffle=1;
-#endif
-#ifdef H5_HAVE_FILTER_FLETCHER32
- have_fletcher=1;
-#endif
-#ifdef H5_HAVE_FILTER_NBIT
- have_nbit=1;
-#endif
-#ifdef H5_HAVE_FILTER_SCALEOFFSET
- have_scaleoffset=1;
-#endif
/* get information about filters */
@@ -106,72 +81,66 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_DEFLATE:
- if (!have_deflate)
- {
+#ifndef H5_HAVE_FILTER_DEFLATE
if (name)
print_warning(name,"deflate");
return 0;
- }
+#endif
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_SZIP 4 , szip compression
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_SZIP:
- if (!have_szip)
- {
+#ifndef H5_HAVE_FILTER_SZIP
if (name)
print_warning(name,"SZIP");
return 0;
- }
+#endif
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_SHUFFLE 2 , shuffle the data
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_SHUFFLE:
- if (!have_shuffle)
- {
+#ifndef H5_HAVE_FILTER_SHUFFLE
if (name)
print_warning(name,"shuffle");
return 0;
- }
+#endif
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_FLETCHER32:
- if (!have_fletcher)
- {
+#ifndef H5_HAVE_FILTER_FLETCHER32
if (name)
print_warning(name,"fletcher32");
return 0;
- }
+#endif
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_NBIT
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_NBIT:
- if (!have_nbit)
- {
+#ifndef H5_HAVE_FILTER_NBIT
if (name)
print_warning(name,"nbit");
return 0;
- }
+#endif
break;
/*-------------------------------------------------------------------------
* H5Z_FILTER_SCALEOFFSET
*-------------------------------------------------------------------------
*/
case H5Z_FILTER_SCALEOFFSET:
- if (!have_scaleoffset)
- {
+#ifndef H5_HAVE_FILTER_SCALEOFFSET
if (name)
print_warning(name,"scaleoffset");
return 0;
- }
+#endif
break;
}/*switch*/
}/*for*/
@@ -197,34 +166,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
*/
int h5tools_can_encode( H5Z_filter_t filtn)
{
-
- int have_deflate=0; /* assume initially we do not have filters */
- int have_szip=0;
- int have_shuffle=0;
- int have_fletcher=0;
- int have_nbit=0;
- int have_scaleoffset=0;
- unsigned int filter_config_flags;
-
-#ifdef H5_HAVE_FILTER_DEFLATE
- have_deflate=1;
-#endif
-#ifdef H5_HAVE_FILTER_SZIP
- have_szip=1;
-#endif
-#ifdef H5_HAVE_FILTER_SHUFFLE
- have_shuffle=1;
-#endif
-#ifdef H5_HAVE_FILTER_FLETCHER32
- have_fletcher=1;
-#endif
-#ifdef H5_HAVE_FILTER_NBIT
- have_nbit=1;
-#endif
-#ifdef H5_HAVE_FILTER_SCALEOFFSET
- have_scaleoffset=1;
-#endif
-
switch (filtn)
{
/* user defined filter */
@@ -232,16 +173,17 @@ int h5tools_can_encode( H5Z_filter_t filtn)
return 0;
case H5Z_FILTER_DEFLATE:
- if (!have_deflate)
- {
- return 0;
- }
+#ifndef H5_HAVE_FILTER_DEFLATE
+ return 0;
+#endif
break;
case H5Z_FILTER_SZIP:
- if (!have_szip)
+#ifndef H5_HAVE_FILTER_SZIP
+ return 0;
+#else
{
- return 0;
- }
+ unsigned int filter_config_flags;
+
if(H5Zget_filter_info(filtn, &filter_config_flags)<0)
return -1;
if ((filter_config_flags &
@@ -263,30 +205,28 @@ int h5tools_can_encode( H5Z_filter_t filtn)
(H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
return 1;
}
+ }
+#endif
break;
case H5Z_FILTER_SHUFFLE:
- if (!have_shuffle)
- {
+#ifndef H5_HAVE_FILTER_SHUFFLE
return 0;
- }
+#endif
break;
case H5Z_FILTER_FLETCHER32:
- if (!have_fletcher)
- {
+#ifndef H5_HAVE_FILTER_FLETCHER32
return 0;
- }
+#endif
break;
case H5Z_FILTER_NBIT:
- if (!have_nbit)
- {
+#ifndef H5_HAVE_FILTER_NBIT
return 0;
- }
+#endif
break;
case H5Z_FILTER_SCALEOFFSET:
- if (!have_scaleoffset)
- {
+#ifndef H5_HAVE_FILTER_SCALEOFFSET
return 0;
- }
+#endif
break;
}/*switch*/