summaryrefslogtreecommitdiffstats
path: root/src/H5FDfamily.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-08-21 20:30:19 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-08-21 20:30:19 (GMT)
commitf8a796ebfc24c8f5f2c2c4f592234deb2b225c09 (patch)
treeb68f1de29b43ba1d654d9b8c7c05e23db9a1b15d /src/H5FDfamily.c
parent5f7de916882208cd9f3b3490c59e0f3ab92cdc40 (diff)
downloadhdf5-f8a796ebfc24c8f5f2c2c4f592234deb2b225c09.zip
hdf5-f8a796ebfc24c8f5f2c2c4f592234deb2b225c09.tar.gz
hdf5-f8a796ebfc24c8f5f2c2c4f592234deb2b225c09.tar.bz2
[svn-r15510] Description:
Clean up warnings & formatting Tested on: Mac OS X/32 10.5.4 (amazon) More tests forthcoming
Diffstat (limited to 'src/H5FDfamily.c')
-rw-r--r--src/H5FDfamily.c107
1 files changed, 55 insertions, 52 deletions
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 5d9058c..c70bfdb 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -277,7 +277,7 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id)
fa.memb_size = msize;
fa.memb_fapl_id = memb_fapl_id;
- if(NULL == (plist = H5I_object(fapl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
ret_value= H5P_set_driver(plist, H5FD_FAMILY, &fa);
@@ -321,14 +321,14 @@ H5Pget_fapl_family(hid_t fapl_id, hsize_t *msize/*out*/,
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
- if (H5FD_FAMILY!=H5P_get_driver(plist))
+ if(H5FD_FAMILY != H5P_get_driver(plist))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
- if (NULL==(fa=H5P_get_driver_info(plist)))
+ if(NULL == (fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist)))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info")
- if (msize)
+ if(msize)
*msize = fa->memb_size;
- if (memb_fapl_id) {
- if(NULL == (plist = H5I_object(fa->memb_fapl_id)))
+ if(memb_fapl_id) {
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fa->memb_fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list")
*memb_fapl_id = H5P_copy_plist(plist, TRUE);
} /* end if */
@@ -365,11 +365,11 @@ H5FD_family_fapl_get(H5FD_t *_file)
FUNC_ENTER_NOAPI(H5FD_family_fapl_get, NULL)
- if (NULL==(fa=H5MM_calloc(sizeof(H5FD_family_fapl_t))))
+ if(NULL == (fa = (H5FD_family_fapl_t *)H5MM_calloc(sizeof(H5FD_family_fapl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
fa->memb_size = file->memb_size;
- if(NULL == (plist = H5I_object(file->memb_fapl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(file->memb_fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
fa->memb_fapl_id = H5P_copy_plist(plist, FALSE);
@@ -411,7 +411,7 @@ H5FD_family_fapl_copy(const void *_old_fa)
FUNC_ENTER_NOAPI(H5FD_family_fapl_copy, NULL)
- if (NULL==(new_fa=H5MM_malloc(sizeof(H5FD_family_fapl_t))))
+ if(NULL == (new_fa = (H5FD_family_fapl_t *)H5MM_malloc(sizeof(H5FD_family_fapl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the fields of the structure */
@@ -423,7 +423,7 @@ H5FD_family_fapl_copy(const void *_old_fa)
HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
} /* end if */
else {
- if(NULL == (plist = H5I_object(old_fa->memb_fapl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(old_fa->memb_fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
new_fa->memb_fapl_id = H5P_copy_plist(plist, FALSE);
} /* end else */
@@ -499,17 +499,17 @@ H5FD_family_dxpl_copy(const void *_old_dx)
FUNC_ENTER_NOAPI(H5FD_family_dxpl_copy, NULL)
- if (NULL==(new_dx=H5MM_malloc(sizeof(H5FD_family_dxpl_t))))
+ if(NULL == (new_dx = (H5FD_family_dxpl_t *)H5MM_malloc(sizeof(H5FD_family_dxpl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- memcpy(new_dx, old_dx, sizeof(H5FD_family_dxpl_t));
+ HDmemcpy(new_dx, old_dx, sizeof(H5FD_family_dxpl_t));
- if(old_dx->memb_dxpl_id==H5P_DATASET_XFER_DEFAULT) {
+ if(old_dx->memb_dxpl_id == H5P_DATASET_XFER_DEFAULT) {
if(H5I_inc_ref(new_dx->memb_dxpl_id, FALSE)<0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
} /* end if */
else {
- if(NULL == (plist = H5I_object(old_dx->memb_dxpl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(old_dx->memb_dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
new_dx->memb_dxpl_id = H5P_copy_plist(plist, FALSE);
} /* end else */
@@ -740,27 +740,29 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
FUNC_ENTER_NOAPI(H5FD_family_open, NULL)
/* Check arguments */
- if (!name || !*name)
+ if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name")
- if (0==maxaddr || HADDR_UNDEF==maxaddr)
+ if(0 == maxaddr || HADDR_UNDEF == maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr")
/* Initialize file from file access properties */
- if (NULL==(file=H5MM_calloc(sizeof(H5FD_family_t))))
+ if(NULL == (file = (H5FD_family_t *)H5MM_calloc(sizeof(H5FD_family_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct")
- if (H5P_FILE_ACCESS_DEFAULT==fapl_id) {
+ if(H5P_FILE_ACCESS_DEFAULT==fapl_id) {
file->memb_fapl_id = H5P_FILE_ACCESS_DEFAULT;
- if(H5I_inc_ref(file->memb_fapl_id, FALSE)<0)
+ if(H5I_inc_ref(file->memb_fapl_id, FALSE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
- file->memb_size = 1024*1024*1024; /*1GB. Actual member size to be updated later */
- file->pmem_size = 1024*1024*1024; /*1GB. Member size passed in through property */
+ file->memb_size = 1024 * 1024 * 1024; /*1GB. Actual member size to be updated later */
+ file->pmem_size = 1024 * 1024 * 1024; /*1GB. Member size passed in through property */
file->mem_newsize = 0; /*New member size used by h5repart only */
- } else {
+ } /* end if */
+ else {
H5FD_family_fapl_t *fa;
- if(NULL == (plist = H5I_object(fapl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- fa = H5P_get_driver_info(plist);
+ fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist);
+ HDassert(fa);
/* New family file size. It's used by h5repart only. */
if(H5P_exist_plist(plist, H5F_ACS_FAMILY_NEWSIZE_NAME) > 0)
@@ -773,14 +775,14 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
file->memb_fapl_id = fa->memb_fapl_id;
} /* end if */
else {
- if(NULL == (plist = H5I_object(fa->memb_fapl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fa->memb_fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
file->memb_fapl_id = H5P_copy_plist(plist, FALSE);
} /* end else */
file->memb_size = fa->memb_size; /* Actual member size to be updated later */
file->pmem_size = fa->memb_size; /* Member size passed in through property */
file->mem_newsize = fam_newsize; /* New member size passed in through property */
- }
+ } /* end else */
file->name = H5MM_strdup(name);
file->flags = flags;
@@ -792,19 +794,19 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique")
/* Open all the family members */
- while (1) {
+ while(1) {
sprintf(memb_name, name, file->nmembs);
/* Enlarge member array */
- if (file->nmembs>=file->amembs) {
- unsigned n = MAX(64, 2*file->amembs);
- H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*));
+ if(file->nmembs >= file->amembs) {
+ unsigned n = MAX(64, 2 * file->amembs);
+ H5FD_t **x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *));
- if (!x)
+ if(!x)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to reallocate members")
file->amembs = n;
file->memb = x;
- }
+ } /* end if */
/*
* Attempt to open file. If the first file cannot be opened then fail;
@@ -1059,18 +1061,19 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa)
FUNC_ENTER_NOAPI(H5FD_family_set_eoa, FAIL)
- for (u=0; addr || u<file->nmembs; u++) {
+ for(u = 0; addr || u < file->nmembs; u++) {
/* Enlarge member array */
- if (u>=file->amembs) {
- unsigned n = MAX(64, 2*file->amembs);
- H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*));
- if (!x)
+ if(u >= file->amembs) {
+ unsigned n = MAX(64, 2 * file->amembs);
+ H5FD_t **x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *));
+
+ if(!x)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block")
file->amembs = n;
file->memb = x;
file->nmembs = u;
- }
+ } /* end if */
/* Create another file if necessary */
if (u>=file->nmembs || !file->memb[u]) {
@@ -1192,7 +1195,7 @@ H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle)
if(H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get offset for family driver")
- if(offset>(file->memb_size*file->nmembs))
+ if(offset > (file->memb_size * file->nmembs))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "offset is bigger than file size")
memb = (int)(offset/file->memb_size);
@@ -1242,18 +1245,18 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
* Get the member data transfer property list. If the transfer property
* list does not belong to this driver then assume defaults
*/
- if(NULL == (plist = H5I_object(dxpl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- if (H5P_DATASET_XFER_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(plist)) {
- H5FD_family_dxpl_t *dx = H5P_get_driver_info(plist);
+ if(H5P_DATASET_XFER_DEFAULT != dxpl_id && H5FD_FAMILY == H5P_get_driver(plist)) {
+ H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t *)H5P_get_driver_info(plist);
- assert(TRUE==H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
+ HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
assert(dx);
memb_dxpl_id = dx->memb_dxpl_id;
- }
+ } /* end if */
/* Read from each member */
- while (size>0) {
+ while(size > 0) {
H5_ASSIGN_OVERFLOW(u,addr /file->memb_size,hsize_t,unsigned);
sub = addr % file->memb_size;
@@ -1311,7 +1314,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
hsize_t tempreq;
unsigned u; /* Local index variable */
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_family_write, FAIL)
@@ -1319,15 +1322,15 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
* Get the member data transfer property list. If the transfer property
* list does not belong to this driver then assume defaults.
*/
- if(NULL == (plist = H5I_object(dxpl_id)))
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- if (H5P_DATASET_XFER_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(plist)) {
- H5FD_family_dxpl_t *dx = H5P_get_driver_info(plist);
+ if(H5P_DATASET_XFER_DEFAULT != dxpl_id && H5FD_FAMILY == H5P_get_driver(plist)) {
+ H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t *)H5P_get_driver_info(plist);
- assert(TRUE==H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
- assert(dx);
+ HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
+ HDassert(dx);
memb_dxpl_id = dx->memb_dxpl_id;
- }
+ } /* end if */
/* Write to each member */
while (size>0) {