summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-08-23 20:56:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-08-23 20:56:42 (GMT)
commit0f95a9d5ab47a609f50c7554e46f60b625df07e8 (patch)
tree2137e981bc20f6e3f40176487780a9032936d228
parent65996f2921391c653d05ad92b7b62ba27f3c2bdd (diff)
downloadhdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.zip
hdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.tar.gz
hdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.tar.bz2
[svn-r19278] Description:
More fixes to memory allocation, etc. exposed by valgrind. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
-rw-r--r--src/H5Dfill.c3
-rw-r--r--src/H5F.c8
-rw-r--r--src/H5Gdeprec.c4
-rw-r--r--src/H5Gnode.c12
-rw-r--r--src/H5Gtraverse.c14
-rw-r--r--src/H5HLcache.c14
-rw-r--r--src/H5Omtime.c43
-rw-r--r--test/links.c198
-rw-r--r--test/mtime.c12
-rw-r--r--test/tvlstr.c75
10 files changed, 199 insertions, 184 deletions
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index cf78b94..4474661 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -585,7 +585,8 @@ H5D_fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed")
/* Replicate the fill value into the cached buffer */
- H5V_array_fill((void *)((unsigned char *)fb_info->fill_buf + fb_info->mem_elmt_size), fb_info->fill_buf, fb_info->mem_elmt_size, (nelmts - 1));
+ if(nelmts > 1)
+ H5V_array_fill((void *)((unsigned char *)fb_info->fill_buf + fb_info->mem_elmt_size), fb_info->fill_buf, fb_info->mem_elmt_size, (nelmts - 1));
/* Reset the entire background buffer, if necessary */
if(H5T_path_bkg(fb_info->mem_to_dset_tpath))
diff --git a/src/H5F.c b/src/H5F.c
index f1a4b0c..f15a0cd 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1198,16 +1198,24 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) {
if(tent_flags == flags) {
+#ifndef H5_USING_MEMCHECKER
time_t mytime = HDtime(NULL);
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', tent_flags = %x", HDctime(&mytime), name, tent_flags)
+#else /* H5_USING_MEMCHECKER */
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags)
+#endif /* H5_USING_MEMCHECKER */
} /* end if */
H5E_clear_stack(NULL);
tent_flags = flags;
if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) {
+#ifndef H5_USING_MEMCHECKER
time_t mytime = HDtime(NULL);
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', tent_flags = %x", HDctime(&mytime), name, tent_flags)
+#else /* H5_USING_MEMCHECKER */
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags)
+#endif /* H5_USING_MEMCHECKER */
} /* end if */
} /* end if */
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index e9e124f..6629934 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -1142,7 +1142,7 @@ H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
htri_t linfo_exists; /* Whether the link info message exists */
H5G_obj_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5G_obj_get_type_by_idx, H5G_UNKNOWN)
+ FUNC_ENTER_NOAPI_TAG(H5G_obj_get_type_by_idx, dxpl_id, oloc->addr, H5G_UNKNOWN)
/* Sanity check */
HDassert(oloc);
@@ -1169,7 +1169,7 @@ H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value, H5G_UNKNOWN)
} /* end H5G_obj_get_type_by_idx() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index fb07c63..2b793a9 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -778,7 +778,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* "Normal" removal of a single entry from the symbol table node */
if(udata->common.name != NULL) {
H5O_link_t lnk; /* Constructed link for replacement */
- size_t len; /* Length of string in local heap */
+ size_t link_name_len; /* Length of string in local heap */
const char *base; /* Base of heap */
/* Get base address of heap */
@@ -804,6 +804,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Get a pointer to the name of the link */
if(NULL == (lnk.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name")
+ link_name_len = HDstrlen(lnk.name) + 1;
/* Set up rest of link structure */
lnk.corder_valid = FALSE;
@@ -837,15 +838,16 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
else {
/* Remove the soft link's value from the local heap */
if(lnk.u.soft.name) {
- len = HDstrlen(lnk.u.soft.name) + 1;
- if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, len) < 0)
+ size_t soft_link_len; /* Length of string in local heap */
+
+ soft_link_len = HDstrlen(lnk.u.soft.name) + 1;
+ if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, soft_link_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove soft link from local heap")
} /* end if */
} /* end else */
/* Remove the link's name from the local heap */
- len = HDstrlen(lnk.name) + 1;
- if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].name_off, len) < 0)
+ if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].name_off, link_name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove link name from local heap")
/* Remove the entry from the symbol table node */
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 61c08fa..742e2bc 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -807,6 +807,17 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
if(grp_loc.oloc->holding_file)
if(H5O_loc_hold_file(obj_loc.oloc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open")
+
+ /* Reset any non-default object header messages */
+ if(ginfo != &def_ginfo)
+ if(H5O_msg_reset(H5O_GINFO_ID, ginfo) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset group info message")
+ if(linfo != &def_linfo)
+ if(H5O_msg_reset(H5O_LINFO_ID, linfo) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link info message")
+ if(pline != &def_pline)
+ if(H5O_msg_reset(H5O_PLINE_ID, pline) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset I/O pipeline message")
} /* end if */
else
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found")
@@ -857,7 +868,8 @@ done:
/* If there's valid information in the link, reset it */
if(link_valid)
- H5O_msg_reset(H5O_LINK_ID, &lnk);
+ if(H5O_msg_reset(H5O_LINK_ID, &lnk) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link message")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_traverse_real() */
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 51d60f9..56d9919 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -440,10 +440,16 @@ H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Check if the local heap is a single object in cache */
if(heap->single_cache_obj) {
- /* Set p to the start of the data block. This is necessary because
- * there may be a gap between the used portion of the prefix and the
- * data block due to alignment constraints. */
- p = buf + heap->prfx_size;
+ if((p - buf) < heap->prfx_size) {
+ size_t gap; /* Size of gap between prefix and data block */
+
+ /* Set p to the start of the data block. This is necessary because
+ * there may be a gap between the used portion of the prefix and the
+ * data block due to alignment constraints. */
+ gap = heap->prfx_size - (p - buf);
+ HDmemset(p, 0, gap);
+ p += gap;
+ } /* end if */
/* Serialize the free list into the heap data's image */
H5HL_fl_serialize(heap);
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index e71fb50..731d833 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -96,7 +96,7 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{
#define H5O_MTIME_VERSION 1
/* Track whether tzset routine was called */
-static int ntzset=0;
+static hbool_t ntzset = FALSE;
/* Declare a free list to manage the time_t struct */
H5FL_DEFINE(time_t);
@@ -180,23 +180,22 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
struct tm tm;
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_decode);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_decode)
/* check args */
- assert(f);
- assert(p);
+ HDassert(f);
+ HDassert(p);
/* Initialize time zone information */
- if (!ntzset) {
+ if(!ntzset) {
HDtzset();
- ntzset=1;
+ ntzset = TRUE;
} /* end if */
/* decode */
- for (i=0; i<14; i++) {
- if (!HDisdigit(p[i]))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message");
- }
+ for(i = 0; i < 14; i++)
+ if(!HDisdigit(p[i]))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")
/*
* Convert YYYYMMDDhhmmss UTC to a time_t. This is a little problematic
@@ -213,8 +212,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
tm.tm_min = (p[10]-'0')*10 + (p[11]-'0');
tm.tm_sec = (p[12]-'0')*10 + (p[13]-'0');
tm.tm_isdst = -1; /*figure it out*/
- if ((time_t)-1==(the_time=HDmktime(&tm)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message");
+ if((time_t)-1 == (the_time = HDmktime(&tm)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")
#if defined(H5_HAVE_TM_GMTOFF)
/* FreeBSD, OSF 4.0 */
@@ -230,8 +229,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
{
struct timezone tz;
- if (HDBSDgettimeofday(NULL, &tz)<0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information");
+ if(HDBSDgettimeofday(NULL, &tz) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
}
#elif defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) && defined(H5_GETTIMEOFDAY_GIVES_TZ)
@@ -239,8 +238,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
struct timezone tz;
struct timeval tv; /* Used as a placebo; some systems don't like NULL */
- if (HDgettimeofday(&tv, &tz) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information");
+ if(HDgettimeofday(&tv, &tz) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
}
@@ -254,20 +253,20 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
*/
/* Irix64 */
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
#endif
/* The return value */
- if (NULL==(mesg = H5FL_MALLOC(time_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ if(NULL == (mesg = H5FL_MALLOC(time_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
*mesg = the_time;
/* Set return value */
- ret_value=mesg;
+ ret_value = mesg;
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_mtime_decode() */
/*-------------------------------------------------------------------------
diff --git a/test/links.c b/test/links.c
index 321b9b4..12b8ba4 100644
--- a/test/links.c
+++ b/test/links.c
@@ -2944,7 +2944,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -2957,8 +2957,8 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -2966,7 +2966,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -2977,7 +2977,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file from absolute path set for main file */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in tmp directory.");
goto error;
@@ -3123,7 +3123,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/* set up name for target file: "extlinks5" */
h5_fixname(FILENAME[22], fapl, filename2, sizeof filename2);
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3135,8 +3135,8 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* Create the target file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3144,7 +3144,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -3155,7 +3155,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file from the current working directory */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in current working directory");
goto error;
@@ -3216,7 +3216,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3231,8 +3231,8 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[23], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3240,7 +3240,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -3251,7 +3251,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file with abolute path */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in tmp directory.");
goto error;
@@ -3313,7 +3313,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3325,8 +3325,8 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3334,7 +3334,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -3595,8 +3595,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
else
TESTING("H5Pset/get_elink_fapl() with different physical layouts")
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
- (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3623,10 +3622,10 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
HDmemset(memb_addr, 0, sizeof memb_addr);
HDmemset(sv, 0, sizeof sv);
- for (mt = 0; mt < H5FD_MEM_NTYPES; mt++) {
+ for(mt = 0; mt < H5FD_MEM_NTYPES; mt++) {
memb_map[mt] = H5FD_MEM_SUPER;
memb_fapl[mt] = H5P_DEFAULT;
- }
+ } /* end for */
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE;
@@ -3637,7 +3636,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
- sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
+ sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE];
memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6;
@@ -3795,8 +3794,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
else
TESTING("H5Pset/get_elink_fapl() with same physical layout")
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
- (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -4393,7 +4391,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "/CWD/tmp/extlinks10" */
@@ -4406,8 +4404,8 @@ external_link_win1(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4415,7 +4413,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4426,7 +4424,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's CWD*/
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in CWD.");
goto error;
@@ -4487,7 +4485,7 @@ external_link_win2(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/* set up name for target link: "/CWD/tmp/extlinks11" */
@@ -4500,8 +4498,8 @@ external_link_win2(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[31], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4509,7 +4507,7 @@ external_link_win2(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4520,7 +4518,7 @@ external_link_win2(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file directly */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in tmp.");
goto error;
@@ -4760,7 +4758,7 @@ external_link_win5(hid_t fapl, hbool_t new_format)
else
TESTING("external links via main file's rel drive/abs path (windows)")
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
drive = HDgetdrive();
@@ -4778,8 +4776,8 @@ external_link_win5(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[35], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4787,7 +4785,7 @@ external_link_win5(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4798,7 +4796,7 @@ external_link_win5(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's rel drive/abs path */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in CWD.");
goto error;
@@ -4945,7 +4943,7 @@ external_link_win7(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */
@@ -4958,8 +4956,8 @@ external_link_win7(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4967,7 +4965,7 @@ external_link_win7(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4978,10 +4976,10 @@ external_link_win7(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's local host/main drive*/
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in local host/main drive.");
- goto error;
+ if(gid < 0) {
+ H5_FAILED();
+ puts(" Should have found the file in local host/main drive.");
+ goto error;
}
/* closing for main file */
@@ -5034,11 +5032,11 @@ external_link_win8(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
/* set up name for target link: "<drive-letter>:\CWD\extlinks10" */
@@ -5050,8 +5048,8 @@ external_link_win8(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[30], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -5059,7 +5057,7 @@ external_link_win8(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -5070,10 +5068,10 @@ external_link_win8(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file directly */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp.");
- goto error;
+ if(gid < 0) {
+ H5_FAILED();
+ puts(" Should have found the file in tmp.");
+ goto error;
}
/* closing for main file */
@@ -5124,7 +5122,7 @@ external_link_win9(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */
@@ -5137,8 +5135,8 @@ external_link_win9(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -5146,7 +5144,7 @@ external_link_win9(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -5157,10 +5155,10 @@ external_link_win9(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's local host/main drive*/
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in local host/main drive.");
- goto error;
+ if(gid < 0) {
+ H5_FAILED();
+ puts(" Should have found the file in local host/main drive.");
+ goto error;
}
/* closing for main file */
@@ -6434,7 +6432,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
TEST_ERROR
if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- if(NULL == HDgetcwd(cwdpath, NAME_BUF_SIZE))
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* Set up names for files in the subdirectories */
@@ -6784,14 +6782,30 @@ done:
if(H5Gclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATASET:
if(H5Dclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATATYPE:
if(H5Tclose(target_obj) < 0)
ret_value = -1;
break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
return -1;
} /* end switch */
@@ -6855,14 +6869,30 @@ done:
if(H5Gclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATASET:
if(H5Dclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATATYPE:
if(H5Tclose(target_obj) < 0)
ret_value = -1;
break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
return -1;
} /* end switch */
@@ -6928,7 +6958,7 @@ ud_hard_links(hid_t fapl)
/* Create a user-defined "hard link" to the group using the address we got
* from H5Lget_info */
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close and re-open file to ensure that data is written to disk */
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -7829,9 +7859,9 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
/* Try to create internally defined links with H5Lcreate_ud */
H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, 0, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0)
TEST_ERROR
- if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", 4, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0)
TEST_ERROR
} H5E_END_TRY
@@ -9064,7 +9094,7 @@ link_filters(hid_t fapl, hbool_t new_format)
|| filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
| H5Z_FILTER_CONFIG_DECODE_ENABLED))
TEST_ERROR
- if(H5Pget_filter2(gcpl2, nfilters - 1, &flags_out, &cd_nelmts,
+ if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts,
&cd_value_out, (size_t)24, name_out, &filter_config_out) < 0)
TEST_ERROR
if(flags_out != 0 || cd_value_out != cd_value
@@ -12163,15 +12193,10 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
/* Work through main & soft link groups */
for(v = 0; v < 2; v++) {
/* Choose appropriate group to open links within */
- switch(v) {
- case 0:
- group_id = main_group_id;
- break;
-
- case 1:
- group_id = soft_group_id;
- break;
- } /* end switch */
+ if(0 == v)
+ group_id = main_group_id;
+ else
+ group_id = soft_group_id;
/* Open each object in main group by index and check that it's the correct one */
for(u = 0; u < max_links; u++) {
@@ -12628,15 +12653,10 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
/* Work through main & soft link groups */
for(v = 0; v < 2; v++) {
/* Choose appropriate group to open links within */
- switch(v) {
- case 0:
- group_id = main_group_id;
- break;
-
- case 1:
- group_id = soft_group_id;
- break;
- } /* end switch */
+ if(0 == v)
+ group_id = main_group_id;
+ else
+ group_id = soft_group_id;
/* Open each object in group by name and check that it's the correct one */
for(u = 0; u < max_links; u++) {
diff --git a/test/mtime.c b/test/mtime.c
index cc04e42..83e8354 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -99,7 +99,7 @@ main(void)
if(H5Fclose(file) < 0) TEST_ERROR;
/* Compare addresses & times from the two ways of calling H5Oget_info() */
- if(oi1.addr != oi2.addr || oi1.mtime != oi2.mtime) {
+ if(oi1.addr != oi2.addr || oi1.ctime != oi2.ctime) {
H5_FAILED();
puts(" Calling H5Oget_info() with the dataset ID returned");
puts(" different values than calling it with a file and dataset");
@@ -108,15 +108,15 @@ main(void)
}
/* Compare times -- they must be within 60 seconds of one another */
- if(0 == oi1.mtime) {
+ if(0 == oi1.ctime) {
SKIPPED();
puts(" The modification time could not be decoded on this OS.");
puts(" Modification times will be mantained in the file but");
puts(" cannot be queried on this system. See H5O_mtime_decode().");
return 0;
- } else if(HDfabs(HDdifftime(now, oi1.mtime)) > 60.0) {
+ } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0) {
H5_FAILED();
- tm = HDlocaltime(&(oi1.mtime));
+ tm = HDlocaltime(&(oi1.ctime));
HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm);
tm = HDlocaltime(&now);
HDstrftime((char*)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm);
@@ -138,7 +138,7 @@ main(void)
if(file >= 0){
if(H5Oget_info_by_name(file, "/Dataset1", &oi1, H5P_DEFAULT) < 0)
TEST_ERROR;
- if(oi1.mtime != MTIME1) {
+ if(oi1.ctime != MTIME1) {
H5_FAILED();
/* If this fails, examine H5Omtime.c. Modification time is very
* system dependant (e.g., on Windows DST must be hardcoded). */
@@ -168,7 +168,7 @@ main(void)
if(file >= 0){
if(H5Oget_info_by_name(file, "/Dataset1", &oi2, H5P_DEFAULT) < 0)
TEST_ERROR;
- if(oi2.mtime != MTIME2) {
+ if(oi2.ctime != MTIME2) {
H5_FAILED();
puts(" Modification time incorrect.");
goto error;
diff --git a/test/tvlstr.c b/test/tvlstr.c
index fbced5f..87008aa 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -29,16 +29,9 @@
#define DATAFILE2 "tvlstr2.h5"
/* 1-D dataset with fixed dimensions */
-#define SPACE1_NAME "Space1"
#define SPACE1_RANK 1
#define SPACE1_DIM1 4
-/* 2-D dataset with fixed dimensions */
-#define SPACE2_NAME "Space2"
-#define SPACE2_RANK 2
-#define SPACE2_DIM1 10
-#define SPACE2_DIM2 10
-
#define VLSTR_TYPE "vl_string_type"
/* Definitions for the VL re-writing test */
@@ -599,21 +592,14 @@ static void test_write_vl_string_attribute(void)
ret = H5Awrite(att, type, &string_att);
CHECK(ret, FAIL, "H5Awrite");
- /* Allocate memory for read buffer */
- if(string_att)
- string_att_check = (char*)HDmalloc((strlen(string_att) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
-
- if(string_att_check) {
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
+ if(HDstrcmp(string_att_check,string_att) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- HDfree(string_att_check);
- string_att_check = NULL;
- }
+ HDfree(string_att_check);
+ string_att_check = NULL;
ret = H5Aclose(att);
CHECK(ret, FAIL, "HAclose");
@@ -628,22 +614,14 @@ static void test_write_vl_string_attribute(void)
ret = H5Awrite(att, type, &string_att_write);
CHECK(ret, FAIL, "H5Awrite");
- /* Allocate memory for read buffer */
- if(string_att_write)
- string_att_check = (char*)HDmalloc((strlen(string_att_write) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(string_att_check) {
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ if(HDstrcmp(string_att_check,string_att_write) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- if(HDstrcmp(string_att_check,string_att_write)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
-
- /* The attribute string written is freed below, in the
- *test_read_vl_string_attribute() test */
- HDfree(string_att_check);
- }
+ HDfree(string_att_check);
+ string_att_check = NULL;
/* The attribute string written is freed below, in the test_read_vl_string_attribute() test */
/* HDfree(string_att_write); */
@@ -697,21 +675,14 @@ static void test_read_vl_string_attribute(void)
att = H5Aopen(root, "test_scalar", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
- /* Allocate memory for read buffer */
- if(string_att)
- string_att_check = (char*)HDmalloc((strlen(string_att) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(string_att_check) {
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ if(HDstrcmp(string_att_check,string_att) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- if(HDstrcmp(string_att_check,string_att)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
-
- HDfree(string_att_check);
- string_att_check = NULL;
- }
+ HDfree(string_att_check);
+ string_att_check = NULL;
ret = H5Aclose(att);
CHECK(ret, FAIL, "HAclose");
@@ -720,19 +691,15 @@ static void test_read_vl_string_attribute(void)
att = H5Aopen(root, "test_scalar_large", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
- /* Allocate memory for read buffer */
- if(string_att_write)
- string_att_check = (char*)HDmalloc((strlen(string_att_write) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
-
- if(string_att_check) {
+ if(string_att_write) {
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write)!=0)
+ if(HDstrcmp(string_att_check,string_att_write) != 0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
HDfree(string_att_check);
+ string_att_check = NULL;
}
/* Free string allocated in test_write_vl_string_attribute */