summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/h5test.c100
1 files changed, 55 insertions, 45 deletions
diff --git a/test/h5test.c b/test/h5test.c
index 6267137..aea5dc7 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -782,21 +782,18 @@ h5_rmprefix(const char *filename)
/*-------------------------------------------------------------------------
- * Function: h5_fileaccess
+ * Function: h5_fileaccess
*
- * Purpose: Returns a file access template which is the default template
- * but with a file driver set according to the constant or
- * environment variable HDF5_DRIVER
+ * Purpose: Returns a file access template which is the default template
+ * but with a file driver set according to the constant or
+ * environment variable HDF5_DRIVER
*
- * Return: Success: A file access property list
- *
- * Failure: -1
+ * Return: Success: A file access property list
+ * Failure: -1
*
* Programmer: Robb Matzke
* Thursday, November 19, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -804,45 +801,56 @@ h5_fileaccess(void)
{
const char *val = NULL;
const char *name;
- char s[1024];
- hid_t fapl = -1;
+ char s[1024];
+ hid_t fapl = -1;
/* First use the environment variable, then the constant */
val = HDgetenv("HDF5_DRIVER");
#ifdef HDF5_DRIVER
- if (!val)
+ if(!val)
val = HDF5_DRIVER;
#endif
- if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0)
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
- if (!val || !*val)
- return fapl; /*use default*/
+ if(!val || !*val)
+ return fapl; /* use default */
HDstrncpy(s, val, sizeof s);
s[sizeof(s)-1] = '\0';
- if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl;
+ if(NULL == (name = HDstrtok(s, " \t\n\r")))
+ return fapl;
- if (!HDstrcmp(name, "sec2")) {
+ if(!HDstrcmp(name, "sec2")) {
/* Unix read() and write() system calls */
- if (H5Pset_fapl_sec2(fapl)<0) return -1;
- } else if (!HDstrcmp(name, "stdio")) {
+ if (H5Pset_fapl_sec2(fapl) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "stdio")) {
/* Standard C fread() and fwrite() system calls */
- if (H5Pset_fapl_stdio(fapl)<0) return -1;
- } else if (!HDstrcmp(name, "core")) {
+ if (H5Pset_fapl_stdio(fapl) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "core")) {
/* In-memory driver settings (backing store on, 1 MB increment) */
- if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1;
- } else if (!HDstrcmp(name, "core_paged")) {
+ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "core_paged")) {
/* In-memory driver with write tracking and paging on */
- if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1;
- if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096)<0) return -1;
- } else if (!HDstrcmp(name, "split")) {
+ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0)
+ return -1;
+ if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "split")) {
/* Split meta data and raw data each using default driver */
- if (H5Pset_fapl_split(fapl,
+ if(H5Pset_fapl_split(fapl,
"-m.h5", H5P_DEFAULT,
- "-r.h5", H5P_DEFAULT)<0)
+ "-r.h5", H5P_DEFAULT) < 0)
return -1;
- } else if (!HDstrcmp(name, "multi")) {
+ }
+ else if(!HDstrcmp(name, "multi")) {
/* Multi-file driver, general case of the split driver */
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl[H5FD_MEM_NTYPES];
@@ -858,45 +866,47 @@ h5_fileaccess(void)
HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
- memb_fapl[mt] = H5P_DEFAULT;
- sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
+ memb_fapl[mt] = H5P_DEFAULT;
+ HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
} /* end for */
- if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name,
- memb_addr, FALSE)<0) {
+ if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
return -1;
- }
- } else if (!HDstrcmp(name, "family")) {
+ }
+ else if(!HDstrcmp(name, "family")) {
hsize_t fam_size = 100*1024*1024; /*100 MB*/
/* Family of files, each 1MB and using the default driver */
- if ((val=HDstrtok(NULL, " \t\n\r")))
+ if((val = HDstrtok(NULL, " \t\n\r")))
fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024);
- if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
+ if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
return -1;
- } else if (!HDstrcmp(name, "log")) {
+ }
+ else if(!HDstrcmp(name, "log")) {
unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC;
/* Log file access */
- if ((val = HDstrtok(NULL, " \t\n\r")))
+ if((val = HDstrtok(NULL, " \t\n\r")))
log_flags = (unsigned)HDstrtol(val, NULL, 0);
-
- if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
+ if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
return -1;
- } else if (!HDstrcmp(name, "direct")) {
+ }
+ else if(!HDstrcmp(name, "direct")) {
#ifdef H5_HAVE_DIRECT
/* Linux direct read() and write() system calls. Set memory boundary, file block size,
* and copy buffer size to the default values. */
- if (H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0)
+ if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0)
return -1;
#endif
- } else if(!HDstrcmp(name, "latest")) {
+ }
+ else if(!HDstrcmp(name, "latest")) {
/* use the latest format */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
- } else {
+ }
+ else {
/* Unknown driver */
return -1;
}