diff options
-rw-r--r-- | src/H5B.c | 18 | ||||
-rw-r--r-- | src/H5D.c | 12 | ||||
-rw-r--r-- | src/H5Distore.c | 6 | ||||
-rw-r--r-- | src/H5F.c | 40 | ||||
-rw-r--r-- | src/H5Farray.c | 14 | ||||
-rw-r--r-- | src/H5Fcore.c | 2 | ||||
-rw-r--r-- | src/H5Ffamily.c | 18 | ||||
-rw-r--r-- | src/H5Fistore.c | 6 | ||||
-rw-r--r-- | src/H5Flow.c | 148 | ||||
-rw-r--r-- | src/H5Fmpio.c | 11 | ||||
-rw-r--r-- | src/H5Fprivate.h | 14 | ||||
-rw-r--r-- | src/H5Fsplit.c | 3 | ||||
-rw-r--r-- | src/H5Fstdio.c | 4 | ||||
-rw-r--r-- | src/H5G.c | 6 | ||||
-rw-r--r-- | src/H5HG.c | 3 | ||||
-rw-r--r-- | src/H5HL.c | 8 | ||||
-rw-r--r-- | src/H5MF.c | 13 | ||||
-rw-r--r-- | src/H5O.c | 15 | ||||
-rw-r--r-- | src/H5Odtype.c | 8 | ||||
-rw-r--r-- | src/H5Oefl.c | 2 | ||||
-rw-r--r-- | src/H5P.c | 3 | ||||
-rw-r--r-- | src/H5Smpio.c | 5 | ||||
-rw-r--r-- | src/H5T.c | 37 | ||||
-rw-r--r-- | src/H5detect.c | 2 | ||||
-rw-r--r-- | tools/h5debug.c | 5 |
25 files changed, 120 insertions, 283 deletions
@@ -188,7 +188,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, sizeof_rkey = (type->get_sizeof_rkey) (f, udata); size = H5B_nodesize(f, type, &total_native_keysize, sizeof_rkey); if (H5MF_alloc(f, H5MF_META, (hsize_t)size, addr_p/*out*/) < 0) { - H5F_addr_undef(addr_p); + *addr_p = H5F_ADDR_UNDEF; HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree root node"); } @@ -202,8 +202,8 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, bt->ndirty = 0; bt->type = type; bt->level = 0; - H5F_addr_undef(&(bt->left)); - H5F_addr_undef(&(bt->right)); + bt->left = H5F_ADDR_UNDEF; + bt->right = H5F_ADDR_UNDEF; bt->nchildren = 0; if (NULL==(bt->page=H5MM_calloc(size)) || NULL==(bt->native=H5MM_malloc(total_native_keysize)) || @@ -225,7 +225,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, bt->key[i].dirty = FALSE; bt->key[i].rkey = bt->page + offset; bt->key[i].nkey = NULL; - H5F_addr_undef(bt->child + i); + bt->child[i] = H5F_ADDR_UNDEF; } /* @@ -353,7 +353,7 @@ H5B_load(H5F_t *f, haddr_t addr, const void *_type, void *udata) if (i < bt->nchildren) { H5F_addr_decode(f, (const uint8_t **) &p, bt->child + i); } else { - H5F_addr_undef(bt->child + i); + bt->child[i] = H5F_ADDR_UNDEF; p += H5F_SIZEOF_ADDR(f); } } @@ -960,8 +960,8 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, } bt->dirty = TRUE; bt->ndirty = 0; - H5F_addr_undef(&(bt->left)); - H5F_addr_undef(&(bt->right)); + bt->left = H5F_ADDR_UNDEF; + bt->right = H5F_ADDR_UNDEF; bt->nchildren = 0; /* the new root */ @@ -1774,8 +1774,8 @@ H5B_remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, sibling->left = bt->left; sibling->dirty = TRUE; } - H5F_addr_undef(&(bt->left)); - H5F_addr_undef(&(bt->right)); + bt->left = H5F_ADDR_UNDEF; + bt->right = H5F_ADDR_UNDEF; sizeof_rkey = (type->get_sizeof_rkey)(f, udata); sizeof_node = H5B_nodesize(f, type, NULL, sizeof_rkey); if (H5AC_unprotect(f, H5AC_BT, addr, bt)<0 || @@ -819,7 +819,7 @@ H5D_new(const H5D_create_t *create_parms) ret_value->create_parms = H5P_copy (H5P_DATASET_CREATE, &H5D_create_dflt); } - H5F_addr_undef(&(ret_value->ent.header)); + ret_value->ent.header = H5F_ADDR_UNDEF; /* Success */ @@ -1039,7 +1039,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, "unable to initialize storage"); } } else { - H5F_addr_undef (&(new_dset->layout.addr)); + new_dset->layout.addr = H5F_ADDR_UNDEF; } /* Update layout message */ @@ -1870,7 +1870,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* support parallel access of that yet */ if (H5F_LOW_MPIO==dataset->ent.file->shared->access_parms->driver && H5T_get_class(mem_type)==H5T_VLEN) { - HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, + HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet"); } #endif @@ -1881,7 +1881,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, if (H5F_LOW_MPIO==dataset->ent.file->shared->access_parms->driver && H5T_get_class(mem_type)==H5T_REFERENCE && H5T_get_ref_type(mem_type)==H5R_DATASET_REGION) { - HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, + HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet"); } #endif @@ -2443,7 +2443,7 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space) H5V_array_fill(buf, dset->create_parms->fill.buf, dset->create_parms->fill.size, ptsperbuf); if (dset->create_parms->efl.nused) { - H5F_addr_reset(&addr); + addr = 0; } else { addr = dset->layout.addr; } @@ -2465,7 +2465,7 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space) } } npoints -= MIN(ptsperbuf, npoints); - H5F_addr_inc(&addr, size); + addr += size; } } else if (dset->create_parms->fill.buf) { /* diff --git a/src/H5Distore.c b/src/H5Distore.c index e8bc974..6052b31 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -848,7 +848,7 @@ H5F_istore_flush_entry (H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) if (ent->dirty) { udata.mesg = *(ent->layout); udata.key.filter_mask = 0; - H5F_addr_undef(&(udata.addr)); + udata.addr = H5F_ADDR_UNDEF; udata.key.nbytes = ent->chunk_size; for (i=0; i<ent->layout->ndims; i++) { udata.key.offset[i] = ent->offset[i]; @@ -1299,7 +1299,7 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout, } chunk_alloc = chunk_size; udata.mesg = *layout; - H5F_addr_undef (&(udata.addr)); + udata.addr = H5F_ADDR_UNDEF; status = H5B_find (f, H5B_ISTORE, layout->addr, &udata); H5E_clear (); if (NULL==(chunk = H5MM_malloc (chunk_alloc))) { @@ -2151,7 +2151,7 @@ H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, udata->key.offset[i] = offset[i]; } udata->mesg = *layout; - H5F_addr_undef (&(udata->addr)); + udata->addr = H5F_ADDR_UNDEF; status = H5B_find (f, H5B_ISTORE, layout->addr, udata); H5E_clear (); if (status>=0 && H5F_addr_defined(udata->addr)) @@ -216,7 +216,7 @@ H5F_init_interface(void) H5F_access_dflt.u.mpio.info = MPI_INFO_NULL; H5F_access_dflt.u.mpio.btype = MPI_DATATYPE_NULL; H5F_access_dflt.u.mpio.ftype = MPI_DATATYPE_NULL; - H5F_addr_reset(&(H5F_access_dflt.u.mpio.disp)); + H5F_access_dflt.u.mpio.disp = 0; H5F_access_dflt.u.mpio.use_types = 0; H5F_access_dflt.u.mpio.old_use_types = 0; #elif (H5F_LOW_DFLT == H5F_LOW_SPLIT) @@ -554,7 +554,7 @@ H5F_locate_signature(H5F_low_t *f_handle, const H5F_access_t *access_parms, FUNC_ENTER(H5F_locate_signature, FAIL); H5F_low_size(f_handle, &max_addr); - H5F_addr_reset(addr_p); + *addr_p = 0; while (H5F_addr_lt(*addr_p, max_addr)) { if (H5F_low_read(f_handle, access_parms, &H5F_xfer_dflt, *addr_p, H5F_SIGNATURE_LEN, buf) < 0) { @@ -564,7 +564,7 @@ H5F_locate_signature(H5F_low_t *f_handle, const H5F_access_t *access_parms, ret_value=SUCCEED; break; } - H5F_addr_pow2(n++, addr_p); + *addr_p = H5F_addr_pow2(n++); } FUNC_LEAVE(ret_value); @@ -672,10 +672,10 @@ H5F_new(H5F_file_t *shared, const H5F_create_t *fcpl, const H5F_access_t *fapl) f->shared = shared; } else { f->shared = H5MM_calloc(sizeof(H5F_file_t)); - H5F_addr_undef(&(f->shared->boot_addr)); - H5F_addr_undef(&(f->shared->base_addr)); - H5F_addr_undef(&(f->shared->freespace_addr)); - H5F_addr_undef(&(f->shared->hdf5_eof)); + f->shared->boot_addr = H5F_ADDR_UNDEF; + f->shared->base_addr = H5F_ADDR_UNDEF; + f->shared->freespace_addr = H5F_ADDR_UNDEF; + f->shared->hdf5_eof = H5F_ADDR_UNDEF; /* * Deep-copy the file creation and file access property lists into the @@ -1091,9 +1091,7 @@ H5F_open(const char *name, uintn flags, * insured is a proper size. The base address is set to the same thing * as the boot block. */ - H5F_addr_reset(&(f->shared->boot_addr)); - H5F_addr_inc(&(f->shared->boot_addr), - f->shared->create_parms->userblock_size); + f->shared->boot_addr = f->shared->create_parms->userblock_size; f->shared->base_addr = f->shared->boot_addr; f->shared->consist_flags = 0x03; @@ -1189,8 +1187,7 @@ H5F_open(const char *name, uintn flags, H5F_SIZEOF_ADDR(f) + /*reserved address*/ H5G_SIZEOF_ENTRY(f); assert(variable_size <= sizeof buf); - addr1 = f->shared->boot_addr; - H5F_addr_inc(&addr1/*in,out*/, (hsize_t)fixed_size); + addr1 = f->shared->boot_addr + (hsize_t)fixed_size; if (H5F_low_read(f->shared->lf, access_parms, &H5F_xfer_dflt, addr1, variable_size, buf) < 0) { HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, NULL, @@ -1222,8 +1219,7 @@ H5F_open(const char *name, uintn flags, * address while H5F_low_size() returns an absolute address. */ H5F_low_size(f->shared->lf, &addr1/*out*/); - addr2 = f->shared->hdf5_eof; - H5F_addr_add(&addr2/*in,out*/, f->shared->base_addr); + addr2 = f->shared->hdf5_eof + f->shared->base_addr; if (H5F_addr_lt(addr1, addr2)) { /* * Truncated file? This might happen if one tries to open the first @@ -1612,7 +1608,6 @@ static herr_t H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate) { uint8_t buf[2048], *p = buf; - haddr_t reserved_addr; uintn firsttime_bootblock=0; uintn nerrors=0, i; @@ -1673,8 +1668,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate) H5F_addr_encode(f, &p, f->shared->base_addr); H5F_addr_encode(f, &p, f->shared->freespace_addr); H5F_addr_encode(f, &p, f->shared->hdf5_eof); - H5F_addr_undef(&reserved_addr); - H5F_addr_encode(f, &p, reserved_addr); + H5F_addr_encode(f, &p, H5F_ADDR_UNDEF); H5G_ent_encode(f, &p, H5G_entof(f->shared->root_grp)); /* update file length if necessary */ @@ -1682,12 +1676,10 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate) haddr_t t_addr; /*temporary address */ /* Set the HDF5 file size */ - H5F_addr_reset(&(f->shared->hdf5_eof)); - H5F_addr_inc(&(f->shared->hdf5_eof), (hsize_t)(p-buf)); + f->shared->hdf5_eof = (hsize_t)(p-buf); /* Set the logical file size, including the userblock data */ - t_addr = f->shared->hdf5_eof; - H5F_addr_add(&t_addr/*in,out*/, f->shared->base_addr); + t_addr = f->shared->hdf5_eof + f->shared->base_addr; H5F_low_seteof(f->shared->lf, t_addr); /* Indicate that the boot block needs to be flushed out */ @@ -2382,8 +2374,7 @@ H5F_block_read(H5F_t *f, haddr_t addr, hsize_t size, assert (size < SIZET_MAX); /* convert the relative address to an absolute address */ - abs_addr = f->shared->base_addr; - H5F_addr_add(&abs_addr/*in,out*/, addr); + abs_addr = f->shared->base_addr + addr; /* Read the data */ if (H5F_low_read(f->shared->lf, f->shared->access_parms, xfer_parms, @@ -2433,8 +2424,7 @@ H5F_block_write(H5F_t *f, haddr_t addr, hsize_t size, } /* Convert the relative address to an absolute address */ - abs_addr = f->shared->base_addr; - H5F_addr_add(&abs_addr/*in,out*/, addr); + abs_addr = f->shared->base_addr + addr; /* Write the data */ if (H5F_low_write(f->shared->lf, f->shared->access_parms, xfer_parms, diff --git a/src/H5Farray.c b/src/H5Farray.c index b2c9551..67c0446 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -51,7 +51,7 @@ H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/) /* check args */ assert (f); assert (layout); - H5F_addr_undef(&(layout->addr)); /*just in case we fail*/ + layout->addr = H5F_ADDR_UNDEF; /*just in case we fail*/ switch (layout->type) { case H5D_CONTIGUOUS: @@ -211,11 +211,11 @@ H5F_arr_read (H5F_t *f, const H5F_xfer_t *xfer, H5V_vector_cpy (ndims, idx, hslab_size); nelmts = H5V_vector_reduce_product (ndims, hslab_size); if (efl && efl->nused>0) { - H5F_addr_reset (&addr); + addr = 0; } else { addr = layout->addr; } - H5F_addr_inc (&addr, file_start); + addr += file_start; buf += mem_start; /* @@ -262,7 +262,7 @@ H5F_arr_read (H5F_t *f, const H5F_xfer_t *xfer, /* Decrement indices and advance pointers */ for (j=ndims-1, carray=TRUE; j>=0 && carray; --j) { - H5F_addr_adj(&addr, file_stride[j]); + addr += file_stride[j]; buf += mem_stride[j]; if (--idx[j]) carray = FALSE; @@ -437,11 +437,11 @@ H5F_arr_write (H5F_t *f, const H5F_xfer_t *xfer, H5V_vector_cpy (ndims, idx, hslab_size); nelmts = H5V_vector_reduce_product (ndims, hslab_size); if (efl && efl->nused>0) { - H5F_addr_reset (&addr); + addr = 0; } else { addr = layout->addr; } - H5F_addr_inc (&addr, file_start); + addr += file_start; buf += mem_start; /* @@ -489,7 +489,7 @@ H5F_arr_write (H5F_t *f, const H5F_xfer_t *xfer, /* Decrement indices and advance pointers */ for (j=ndims-1, carray=TRUE; j>=0 && carray; --j) { - H5F_addr_adj (&addr, file_stride[j]); + addr += file_stride[j]; buf += mem_stride[j]; if (--idx[j]) carray = FALSE; diff --git a/src/H5Fcore.c b/src/H5Fcore.c index 021490c..882648c 100644 --- a/src/H5Fcore.c +++ b/src/H5Fcore.c @@ -121,7 +121,7 @@ H5F_core_open(const char UNUSED *name, lf->u.core.mem = NULL; lf->u.core.alloc = 0; lf->u.core.size = 0; - H5F_addr_reset(&(lf->eof)); + lf->eof = 0; if (key) { key->dev = H5F_CORE_DEV; diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c index d871e69..ac50541 100644 --- a/src/H5Ffamily.c +++ b/src/H5Ffamily.c @@ -327,7 +327,6 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms, member_size = lf->u.fam.memb_size; membno = H5F_FAM_MEMBNO(lf, addr); - H5F_addr_reset (&offset); offset = H5F_FAM_OFFSET(lf, addr); cur_addr = addr; @@ -347,7 +346,7 @@ H5F_fam_read(H5F_low_t *lf, const H5F_access_t *access_parms, buf += nbytes; size -= nbytes; membno++; - H5F_addr_reset (&offset); + offset = 0; } } @@ -404,7 +403,6 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms, memb_type = H5F_low_class (access_parms->u.fam.memb_access->driver); member_size = lf->u.fam.memb_size; membno = H5F_FAM_MEMBNO(lf, addr); - H5F_addr_reset (&offset); offset = H5F_FAM_OFFSET(lf, addr); cur_addr = addr; @@ -444,8 +442,7 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms, * maximum possible value. */ if (i < membno) { - H5F_addr_reset(&max_addr); - H5F_addr_inc(&max_addr, member_size); + max_addr = member_size; H5F_low_seteof(member, max_addr); } lf->u.fam.memb[lf->u.fam.nmemb++] = member; @@ -456,8 +453,7 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms, * Make sure the logical eof is large enough to handle the request. * Do not decrease the EOF */ - max_addr = cur_addr; - H5F_addr_inc(&max_addr, (hsize_t)nbytes); + max_addr = cur_addr + (hsize_t)nbytes; if (H5F_addr_gt(max_addr, lf->u.fam.memb[membno]->eof)) { H5F_low_seteof(lf->u.fam.memb[membno], max_addr); } @@ -472,7 +468,7 @@ H5F_fam_write(H5F_low_t *lf, const H5F_access_t *access_parms, buf += nbytes; size -= nbytes; membno++; - H5F_addr_reset (&offset); + offset = 0; } FUNC_LEAVE(SUCCEED); @@ -514,11 +510,9 @@ H5F_fam_flush(H5F_low_t *lf, const H5F_access_t *access_parms) * end of the member) and then writing it back. */ max_offset = lf->u.fam.memb_size - 1; - H5F_addr_reset(&addr1); - H5F_addr_inc(&addr1, max_offset); + addr1 = max_offset; H5F_low_size(lf->u.fam.memb[0], &addr2/*out*/);/*remember logical eof */ - addr3 = addr1; - H5F_addr_inc(&addr3, (hsize_t)1); + addr3 = addr1 + 1; H5F_low_seteof(lf->u.fam.memb[0], addr3); /*prevent a warning */ if (H5F_low_read(lf->u.fam.memb[0], access_parms->u.fam.memb_access, &H5F_xfer_dflt, addr1, 1, buf) < 0) { diff --git a/src/H5Fistore.c b/src/H5Fistore.c index e8bc974..6052b31 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -848,7 +848,7 @@ H5F_istore_flush_entry (H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) if (ent->dirty) { udata.mesg = *(ent->layout); udata.key.filter_mask = 0; - H5F_addr_undef(&(udata.addr)); + udata.addr = H5F_ADDR_UNDEF; udata.key.nbytes = ent->chunk_size; for (i=0; i<ent->layout->ndims; i++) { udata.key.offset[i] = ent->offset[i]; @@ -1299,7 +1299,7 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout, } chunk_alloc = chunk_size; udata.mesg = *layout; - H5F_addr_undef (&(udata.addr)); + udata.addr = H5F_ADDR_UNDEF; status = H5B_find (f, H5B_ISTORE, layout->addr, &udata); H5E_clear (); if (NULL==(chunk = H5MM_malloc (chunk_alloc))) { @@ -2151,7 +2151,7 @@ H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, udata->key.offset[i] = offset[i]; } udata->mesg = *layout; - H5F_addr_undef (&(udata->addr)); + udata->addr = H5F_ADDR_UNDEF; status = H5B_find (f, H5B_ISTORE, layout->addr, udata); H5E_clear (); if (status>=0 && H5F_addr_defined(udata->addr)) diff --git a/src/H5Flow.c b/src/H5Flow.c index c54f845..4764388 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -287,8 +287,7 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms, assert(buf); /* check for writing past the end of file marker */ - tmp_addr = addr; - H5F_addr_inc(&tmp_addr, (hsize_t)size); + tmp_addr = addr + (hsize_t)size; if (H5F_addr_gt(tmp_addr, lf->eof)) HRETURN_ERROR(H5E_IO, H5E_OVERFLOW, ret_value, "write past end of logical file"); @@ -344,7 +343,7 @@ H5F_low_flush(H5F_low_t *lf, const H5F_access_t *access_parms) assert(lf && lf->type); /* Make sure the last block of the file has been allocated on disk */ - H5F_addr_reset(&last_byte); + last_byte = 0; if (!lf->eof_written && H5F_addr_defined(lf->eof) && H5F_addr_gt(lf->eof, last_byte)) { last_byte = lf->eof; @@ -553,7 +552,7 @@ H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op, } } else { *addr_p = lf->eof; - H5F_addr_inc(&(lf->eof), size); + lf->eof += size; } FUNC_LEAVE(SUCCEED); @@ -615,8 +614,7 @@ H5F_low_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold, ret_value = 1; } else if (blk->size>wasted && blk->size-wasted>=size) { /* over-satisfied */ - *addr_p = blk->addr; - H5F_addr_inc (addr_p, wasted); + *addr_p = blk->addr + wasted; ret_value = 0; } } @@ -652,39 +650,6 @@ H5F_low_seteof(H5F_low_t *lf, haddr_t addr) FUNC_LEAVE(SUCCEED); } - -/*------------------------------------------------------------------------- - * Function: H5F_addr_cmp - * - * Purpose: Compares two addresses. - * - * Return: Success: <0 if A1<A2 - * =0 if A1=A2 - * >0 if A1>A2 - * - * Failure: never fails - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 - * - * Modifications: - * Robb Matzke, 1999-07-28 - * The A1 and A2 arguments are passed by value. - *------------------------------------------------------------------------- - */ -intn -H5F_addr_cmp(haddr_t a1, haddr_t a2) -{ - FUNC_ENTER(H5F_addr_cmp, FAIL); - - assert(H5F_addr_defined(a1)); - assert(H5F_addr_defined(a2)); - - if (a1 < a2) HRETURN(-1); - if (a1 > a2) HRETURN(1); - - FUNC_LEAVE(0); -} /*------------------------------------------------------------------------- @@ -774,110 +739,7 @@ H5F_addr_decode(H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/) assert(0 == **pp); /*overflow */ } } - if (all_zero) H5F_addr_undef(addr_p); -} - - -/*------------------------------------------------------------------------- - * Function: H5F_addr_pow2 - * - * Purpose: Returns an address which is a power of two. - * - * Return: void - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -void -H5F_addr_pow2(uintn n, haddr_t *addr_p/*out*/) -{ - assert(addr_p); - assert(n < 8*sizeof(haddr_t)); - - *addr_p = 1; - *addr_p <<= n; -} - - -/*------------------------------------------------------------------------- - * Function: H5F_addr_inc - * - * Purpose: Increments an address by some number of bytes. - * - * Return: void - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -void -H5F_addr_inc(haddr_t *addr_p/*in,out*/, hsize_t inc) -{ - assert(addr_p && H5F_addr_defined(*addr_p)); - assert(*addr_p <= *addr_p + inc); - - *addr_p += inc; -} - - -/*------------------------------------------------------------------------- - * Function: H5F_addr_adj - * - * Purpose: Adjusts an address by adding or subtracting some amount. - * - * Return: void - * - * Programmer: Robb Matzke - * Monday, April 6, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -void -H5F_addr_adj(haddr_t *addr_p/*in,out */, hssize_t adj) -{ -#ifndef NDEBUG - assert(addr_p && H5F_addr_defined(*addr_p)); - if (adj>=0) { - assert(*addr_p <= *addr_p + adj); - } else { - assert (*addr_p > *addr_p + adj); - } -#endif - - *addr_p += adj; -} - - -/*------------------------------------------------------------------------- - * Function: H5F_addr_add - * - * Purpose: Adds two addresses and puts the result in the first argument. - * - * Return: void - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 - * - * Modifications: - * Robb Matzke, 1999-07-28 - * The A2 argument is passed by value. - *------------------------------------------------------------------------- - */ -void -H5F_addr_add(haddr_t *a1/*in,out*/, haddr_t a2) -{ - assert(a1 && H5F_addr_defined(*a1)); - assert(H5F_addr_defined(a2)); - *a1 += a2; + if (all_zero) *addr_p = H5F_ADDR_UNDEF; } diff --git a/src/H5Fmpio.c b/src/H5Fmpio.c index 11f8da5..88f9877 100644 --- a/src/H5Fmpio.c +++ b/src/H5Fmpio.c @@ -384,7 +384,7 @@ H5F_mpio_open(const char *name, const H5F_access_t *access_parms, uintn flags, } lf->u.mpio.f = fh; H5F_mpio_tas_allsame( lf, FALSE ); /* initialize */ - H5F_addr_reset(&(lf->eof)); + lf->eof = 0; mpierr = MPI_File_get_size( fh, &size ); if (MPI_SUCCESS != mpierr) { MPI_File_close( &(lf->u.mpio.f) ); @@ -397,7 +397,7 @@ H5F_mpio_open(const char *name, const H5F_access_t *access_parms, uintn flags, HRETURN_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "couldn't convert size to haddr_t" ); } - H5F_low_seteof( lf, &new_eof ); + H5F_low_seteof(lf, new_eof); } /* The unique key */ @@ -561,7 +561,7 @@ H5F_mpio_read(H5F_low_t *lf, H5F_access_t *access_parms, buf_type = access_parms->u.mpio.btype; file_type = access_parms->u.mpio.ftype; if (SUCCEED != - H5F_haddr_to_MPIOff(&(access_parms->u.mpio.disp), &mpi_disp)) { + H5F_haddr_to_MPIOff(access_parms->u.mpio.disp, &mpi_disp)) { HRETURN_ERROR(H5E_IO, H5E_BADTYPE, FAIL, "couldn't convert addr to MPIOffset" ); } @@ -793,8 +793,7 @@ H5F_mpio_write(H5F_low_t *lf, H5F_access_t *access_parms, HRETURN_ERROR(H5E_IO, H5E_BADTYPE, FAIL, "couldn't convert addr to MPIOffset" ); } - if (SUCCEED!=H5F_haddr_to_MPIOff(&(access_parms->u.mpio.disp), - &mpi_disp)) { + if (SUCCEED!=H5F_haddr_to_MPIOff(access_parms->u.mpio.disp, &mpi_disp)) { HRETURN_ERROR(H5E_IO, H5E_BADTYPE, FAIL, "couldn't convert addr to MPIOffset" ); } @@ -837,7 +836,7 @@ H5F_mpio_write(H5F_low_t *lf, H5F_access_t *access_parms, buf_type = access_parms->u.mpio.btype; file_type = access_parms->u.mpio.ftype; if (SUCCEED != - H5F_haddr_to_MPIOff(&(access_parms->u.mpio.disp), &mpi_disp)) { + H5F_haddr_to_MPIOff(access_parms->u.mpio.disp, &mpi_disp)) { HRETURN_ERROR(H5E_IO, H5E_BADTYPE, FAIL, "couldn't convert addr to MPIOffset" ); } diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index ab5b748..85aa03b 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -701,8 +701,8 @@ __DLL__ herr_t H5F_low_flush(H5F_low_t *lf, const H5F_access_t *access_parms); /* Address-related macros and functions */ #define H5F_ADDR_UNDEF ((uint64_t)(-1L)) -#define H5F_addr_defined(X) (X!=H5F_ADDR_UNDEF) #define H5F_addr_hash(X,M) ((unsigned)((X)%(M))) +#define H5F_addr_defined(X) (X!=H5F_ADDR_UNDEF) #define H5F_addr_eq(X,Y) ((X)!=H5F_ADDR_UNDEF && \ (Y)!=H5F_ADDR_UNDEF && \ (X)==(Y)) @@ -719,17 +719,13 @@ __DLL__ herr_t H5F_low_flush(H5F_low_t *lf, const H5F_access_t *access_parms); #define H5F_addr_ge(X,Y) ((X)!=H5F_ADDR_UNDEF && \ (Y)!=H5F_ADDR_UNDEF && \ (X)>=(Y)) -#define H5F_addr_undef(XP) (*(XP)=H5F_ADDR_UNDEF) -#define H5F_addr_reset(XP) (*(XP)=0) -#define H5F_addr_zerop(X) ((X)==0) -__DLL__ void H5F_addr_inc(haddr_t *addr/*in,out*/, hsize_t inc); +#define H5F_addr_cmp(X,Y) (H5F_addr_eq(X,Y)?0: \ + (H5F_addr_lt(X, Y)?-1:1)) +#define H5F_addr_pow2(N) ((haddr_t)1<<(N)) + __DLL__ void H5F_addr_encode(H5F_t *, uint8_t**/*in,out*/, haddr_t); __DLL__ void H5F_addr_decode(H5F_t *, const uint8_t**/*in,out*/, haddr_t*/*out*/); -__DLL__ void H5F_addr_pow2(uintn n, haddr_t *addr/*out*/); -__DLL__ void H5F_addr_add(haddr_t *a1/*in,out*/, haddr_t a2); -__DLL__ intn H5F_addr_cmp(haddr_t a1, haddr_t a2); -__DLL__ void H5F_addr_adj(haddr_t *addr/*in,out */, hssize_t adj); __DLL__ herr_t H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/, const unsigned long objno[2]); diff --git a/src/H5Fsplit.c b/src/H5Fsplit.c index 8d3a8f9..d18b113 100644 --- a/src/H5Fsplit.c +++ b/src/H5Fsplit.c @@ -515,8 +515,7 @@ H5F_split_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold, ret_value = 1; } else if (blk->size>wasted && blk->size-wasted>=size) { /* over-satisfied */ - *addr_p = blk->addr; - H5F_addr_inc (addr_p, wasted); + *addr_p = blk->addr + wasted; ret_value = 0; } diff --git a/src/H5Fstdio.c b/src/H5Fstdio.c index 5804a92..94ab0d1 100644 --- a/src/H5Fstdio.c +++ b/src/H5Fstdio.c @@ -109,13 +109,13 @@ H5F_stdio_open(const char *name, const H5F_access_t UNUSED *access_parms, lf->u.stdio.f = f; lf->u.stdio.op = H5F_OP_SEEK; lf->u.stdio.cur = 0; - H5F_addr_reset(&(lf->eof)); + lf->eof = 0; if (HDfseek(lf->u.stdio.f, 0, SEEK_END) < 0) { lf->u.stdio.op = H5F_OP_UNKNOWN; } else { hssize_t x = HDftell (lf->u.stdio.f); assert (x>=0); - H5F_addr_inc(&(lf->eof), (hsize_t)x); + lf->eof += (hsize_t)x; } /* The unique key */ @@ -1010,7 +1010,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, *obj_ent = *loc_ent; } HDmemset(grp_ent, 0, sizeof(H5G_entry_t)); - H5F_addr_undef(&(grp_ent->header)); + grp_ent->header = H5F_ADDR_UNDEF; /* traverse the name */ while ((name = H5G_component(name, &nchars)) && *name) { @@ -1040,7 +1040,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, */ *grp_ent = *obj_ent; HDmemset(obj_ent, 0, sizeof(H5G_entry_t)); - H5F_addr_undef(&(obj_ent->header)); + obj_ent->header = H5F_ADDR_UNDEF; if (H5G_stab_find(grp_ent, comp, obj_ent/*out*/)<0) { /* @@ -1926,7 +1926,7 @@ H5G_link (H5G_entry_t *loc, H5G_link_t type, const char *cur_name, * undefined and the cache contains the link-value offset. */ HDmemset (&cur_obj, 0, sizeof cur_obj); - H5F_addr_undef (&(cur_obj.header)); + cur_obj.header = H5F_ADDR_UNDEF; cur_obj.file = grp_ent.file; cur_obj.type = H5G_CACHED_SLINK; cur_obj.cache.slink.lval_offset = offset; @@ -265,8 +265,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1, * collection now. */ if (heap->size > H5HG_MINSIZE) { - haddr_t next_addr = addr; - H5F_addr_inc (&next_addr, (hsize_t)H5HG_MINSIZE); + haddr_t next_addr = addr + (hsize_t)H5HG_MINSIZE; if (NULL==(heap->chunk = H5MM_realloc (heap->chunk, heap->size))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); @@ -112,7 +112,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/) /* allocate file version */ total_size = H5HL_SIZEOF_HDR(f) + size_hint; if (H5MF_alloc(f, H5MF_META, (hsize_t)total_size, addr_p/*out*/) < 0) { - H5F_addr_undef(addr_p); + *addr_p = H5F_ADDR_UNDEF; HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file memory"); } @@ -122,8 +122,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } - heap->addr = *addr_p; - H5F_addr_inc(&(heap->addr), (hsize_t)H5HL_SIZEOF_HDR(f)); + heap->addr = *addr_p + (hsize_t)H5HL_SIZEOF_HDR(f); heap->disk_alloc = size_hint; heap->mem_alloc = size_hint; if (NULL==(heap->chunk = H5MM_calloc(H5HL_SIZEOF_HDR(f) + size_hint))) { @@ -375,8 +374,7 @@ H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap) /* * Copy buffer to disk. */ - hdr_end_addr = addr; - H5F_addr_inc(&hdr_end_addr, (hsize_t)H5HL_SIZEOF_HDR(f)); + hdr_end_addr = addr + (hsize_t)H5HL_SIZEOF_HDR(f); if (H5F_addr_eq(heap->addr, hdr_end_addr)) { /* The header and data are contiguous */ #ifdef HAVE_PARALLEL @@ -124,7 +124,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr_p/*out*/) if (blk.size > size) { /* Free the second part of the free block */ - H5F_addr_inc (&(blk.addr), size); + blk.addr += size; blk.size -= size; H5MF_xfree (f, blk.addr, blk.size); } @@ -150,8 +150,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr_p/*out*/) blk.addr -= f->shared->base_addr; /* Did we extend the size of the hdf5 data? */ - tmp_addr = blk.addr; - H5F_addr_inc(&tmp_addr, blk.size); + tmp_addr = blk.addr + blk.size; if (H5F_addr_gt(tmp_addr, f->shared->hdf5_eof)) { f->shared->hdf5_eof = tmp_addr; } @@ -168,7 +167,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr_p/*out*/) blk.size -= n; } if (blk.size > size) { - H5F_addr_inc (&(blk.addr), size); + blk.addr += size; blk.size -= size; H5MF_xfree (f, blk.addr, blk.size); } @@ -209,7 +208,7 @@ H5MF_xfree(H5F_t *f, haddr_t addr, hsize_t size) if (!H5F_addr_defined(addr) || 0 == size) { HRETURN(SUCCEED); } - assert(!H5F_addr_zerop(addr)); + assert(addr!=0); /* * Insert this free block into the free list without attempting to @@ -285,7 +284,7 @@ H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, haddr_t orig_addr, "unable to allocate new file memory"); } } else { - H5F_addr_undef (new_addr_p); + *new_addr_p = H5F_ADDR_UNDEF; } } else if (0==new_size) { @@ -295,7 +294,7 @@ H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, haddr_t orig_addr, HRETURN_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "unable to free old file memory"); } - H5F_addr_undef (new_addr_p); + *new_addr_p = H5F_ADDR_UNDEF; } else if (new_size > orig_size) { /* Size is getting larger */ @@ -169,8 +169,7 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/) HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } - tmp_addr = ent->header; - H5F_addr_inc(&tmp_addr, (hsize_t)H5O_SIZEOF_HDR(f)); + tmp_addr = ent->header + (hsize_t)H5O_SIZEOF_HDR(f); oh->chunk[0].dirty = TRUE; oh->chunk[0].addr = tmp_addr; oh->chunk[0].size = size_hint; @@ -376,8 +375,7 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1, UINT32DECODE(p, oh->nlink); /* decode first chunk info */ - chunk_addr = addr; - H5F_addr_inc(&chunk_addr, (hsize_t)H5O_SIZEOF_HDR(f)); + chunk_addr = addr + (hsize_t)H5O_SIZEOF_HDR(f); UINT32DECODE(p, chunk_size); /* build the message array */ @@ -460,7 +458,7 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1, assert(p == oh->chunk[chunkno].image + chunk_size); /* decode next object header continuation message */ - for (H5F_addr_undef(&chunk_addr); + for (chunk_addr=H5F_ADDR_UNDEF; !H5F_addr_defined(chunk_addr) && curmesg < oh->nmesgs; curmesg++) { if (H5O_CONT_ID == oh->mesg[curmesg].type->id) { @@ -1790,7 +1788,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) } chunkno = oh->nchunks++; oh->chunk[chunkno].dirty = TRUE; - H5F_addr_undef(&(oh->chunk[chunkno].addr)); + oh->chunk[chunkno].addr = H5F_ADDR_UNDEF; oh->chunk[chunkno].size = size; if (NULL==(oh->chunk[chunkno].image = p = H5MM_calloc(size))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, @@ -1873,7 +1871,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } - H5F_addr_undef(&(cont->addr)); + cont->addr = H5F_ADDR_UNDEF; cont->size = 0; cont->chunkno = chunkno; oh->mesg[found_null].native = cont; @@ -2125,8 +2123,7 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, intn indent, intn fwidth) HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "Address:", oh->chunk[i].addr); - tmp_addr = addr; - H5F_addr_inc(&tmp_addr, (hsize_t)H5O_SIZEOF_HDR(f)); + tmp_addr = addr + (hsize_t)H5O_SIZEOF_HDR(f); if (0 == i && H5F_addr_ne(oh->chunk[i].addr, tmp_addr)) { HDfprintf(stream, "*** WRONG ADDRESS!\n"); } diff --git a/src/H5Odtype.c b/src/H5Odtype.c index a3d99b5..b98e24d 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -228,7 +228,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } - H5F_addr_undef (&(dt->u.compnd.memb[i].type->ent.header)); + dt->u.compnd.memb[i].type->ent.header = H5F_ADDR_UNDEF; if (H5O_dtype_decode_helper(f, pp, dt->u.compnd.memb[i].type)<0) { for (j=0; j<=i; j++) H5MM_xfree(dt->u.compnd.memb[j].name); H5MM_xfree(dt->u.compnd.memb); @@ -261,7 +261,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } - H5F_addr_undef(&(dt->parent->ent.header)); + dt->parent->ent.header = H5F_ADDR_UNDEF; if (H5O_dtype_decode_helper(f, pp, dt->parent)<0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode parent data type"); @@ -297,7 +297,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) case H5T_VLEN: /* Variable length datatypes... */ /* Decode base type of VL information */ - H5F_addr_undef(&(dt->parent->ent.header)); + dt->parent->ent.header = H5F_ADDR_UNDEF; if (H5O_dtype_decode_helper(f, pp, dt->parent)<0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode VL parent type"); } @@ -685,7 +685,7 @@ H5O_dtype_decode(H5F_t *f, const uint8_t *p, HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } - H5F_addr_undef (&(dt->ent.header)); + dt->ent.header = H5F_ADDR_UNDEF; if (H5O_dtype_decode_helper(f, &p, dt) < 0) { H5MM_xfree(dt); diff --git a/src/H5Oefl.c b/src/H5Oefl.c index baf0857..063e655 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -337,7 +337,7 @@ H5O_efl_reset(void *_mesg) for (i=0; i<mesg->nused; i++) { mesg->slot[i].name = H5MM_xfree (mesg->slot[i].name); } - H5F_addr_undef (&(mesg->heap_addr)); + mesg->heap_addr = H5F_ADDR_UNDEF; mesg->nused = mesg->nalloc = 0; mesg->slot = H5MM_xfree(mesg->slot); @@ -1783,8 +1783,7 @@ H5Pset_family(hid_t plist_id, hsize_t memb_size, hid_t memb_plist_id) /* Set driver */ plist->driver = H5F_LOW_FAMILY; - H5F_addr_reset (&(plist->u.fam.memb_size)); - H5F_addr_inc (&(plist->u.fam.memb_size), memb_size); + plist->u.fam.memb_size = memb_size; plist->u.fam.memb_access = H5P_copy (H5P_FILE_ACCESS, memb_plist); FUNC_LEAVE (SUCCEED); diff --git a/src/H5Smpio.c b/src/H5Smpio.c index e186959..91a42ba 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -571,15 +571,14 @@ H5S_mpio_spaces_xfer (H5F_t *f, const struct H5O_layout_t *layout, f->shared->access_parms->u.mpio.ftype = mpi_file_type; /* calculate the absolute base addr (i.e., the file view disp) */ - disp = f->shared->base_addr; - H5F_addr_add(&disp, layout->addr); + disp = f->shared->base_addr + layout->addr; f->shared->access_parms->u.mpio.disp = disp; #ifdef H5Smpi_DEBUG fprintf(stdout, "spaces_xfer: disp=%Hu\n", disp.offset ); #endif /* Effective address determined by base addr and the MPI file type */ - H5F_addr_reset( &addr ); /* set to 0 */ + addr = 0; /* request a dataspace xfer (instead of an elementary byteblock xfer) */ f->shared->access_parms->u.mpio.use_types = 1; @@ -462,7 +462,7 @@ H5T_init_interface(void) "memory allocation failed"); } dt->state = H5T_STATE_IMMUTABLE; - H5F_addr_undef (&(dt->ent.header)); + dt->ent.header = H5F_ADDR_UNDEF; dt->type = H5T_OPAQUE; dt->size = 1; dt->u.opaque.tag = H5MM_strdup(""); @@ -837,7 +837,7 @@ H5T_init_interface(void) "memory allocation failed"); } dt->state = H5T_STATE_IMMUTABLE; - H5F_addr_undef (&(dt->ent.header)); + dt->ent.header = H5F_ADDR_UNDEF; dt->type = H5T_STRING; dt->size = 1; dt->u.atomic.order = H5T_ORDER_NONE; @@ -863,7 +863,7 @@ H5T_init_interface(void) "memory allocation failed"); } dt->state = H5T_STATE_IMMUTABLE; - H5F_addr_undef (&(dt->ent.header)); + dt->ent.header = H5F_ADDR_UNDEF; dt->type = H5T_STRING; dt->size = 1; dt->u.atomic.order = H5T_ORDER_NONE; @@ -889,7 +889,7 @@ H5T_init_interface(void) "memory allocation failed"); } dt->state = H5T_STATE_IMMUTABLE; - H5F_addr_undef (&(dt->ent.header)); + dt->ent.header = H5F_ADDR_UNDEF; dt->type = H5T_REFERENCE; dt->size = H5R_OBJ_REF_BUF_SIZE; dt->u.atomic.order = H5T_ORDER_NONE; @@ -909,7 +909,7 @@ H5T_init_interface(void) "memory allocation failed"); } dt->state = H5T_STATE_IMMUTABLE; - H5F_addr_undef (&(dt->ent.header)); + dt->ent.header = H5F_ADDR_UNDEF; dt->type = H5T_REFERENCE; dt->size = H5R_DSET_REG_REF_BUF_SIZE; dt->u.atomic.order = H5T_ORDER_NONE; @@ -3903,17 +3903,25 @@ H5Tvlen_create(hid_t base_id) H5TRACE1("i","i",base_id); /* Check args */ - if (H5I_DATATYPE!=H5I_get_type(base_id) || NULL==(base=H5I_object(base_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype"); + if (H5I_DATATYPE!=H5I_get_type(base_id) || + NULL==(base=H5I_object(base_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "not an valid base datatype"); } /* Build new type */ if (NULL==(dt=H5MM_calloc(sizeof(H5T_t)))) { - HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed"); } - H5F_addr_undef (&(dt->ent.header)); + dt->ent.header = H5F_ADDR_UNDEF; dt->type = H5T_VLEN; - dt->force_conv = TRUE; /* Force conversions (i.e. memory to memory conversions should duplicate data, not point to the same VL sequences */ + + /* + * Force conversions (i.e. memory to memory conversions should duplicate + * data, not point to the same VL sequences + */ + dt->force_conv = TRUE; dt->parent = H5T_copy(base, H5T_COPY_ALL); /* Set up VL information */ @@ -3923,7 +3931,8 @@ H5Tvlen_create(hid_t base_id) /* Atomize the type */ if ((ret_value=H5I_register(H5I_DATATYPE, dt))<0) { - HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype"); + HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, + "unable to register datatype"); } FUNC_LEAVE(ret_value); @@ -4571,7 +4580,7 @@ H5T_create(H5T_class_t type, size_t size) "unknown data type class"); } - H5F_addr_undef (&(dt->ent.header)); + dt->ent.header = H5F_ADDR_UNDEF; dt->size = size; FUNC_LEAVE(dt); } @@ -4761,7 +4770,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) */ new_dt->state = H5T_STATE_TRANSIENT; HDmemset (&(new_dt->ent), 0, sizeof(new_dt->ent)); - H5F_addr_undef (&(new_dt->ent.header)); + new_dt->ent.header = H5F_ADDR_UNDEF; break; case H5T_COPY_ALL: @@ -4941,7 +4950,7 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type) if (ret_value<0) { if (H5F_addr_defined(type->ent.header)) { H5O_close(&(type->ent)); - H5F_addr_undef (&(type->ent.header)); + type->ent.header = H5F_ADDR_UNDEF; } } FUNC_LEAVE (ret_value); diff --git a/src/H5detect.c b/src/H5detect.c index 5930c54..f5ebc30 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -434,7 +434,7 @@ H5TN_init_interface(void)\n\ \"memory allocation failed\");\n\ }\n\ dt->state = H5T_STATE_IMMUTABLE;\n\ - H5F_addr_undef (&(dt->ent.header));\n\ + dt->ent.header = H5F_ADDR_UNDEF;\n\ dt->type = H5T_%s;\n\ dt->size = %d;\n\ dt->u.atomic.order = H5T_ORDER_%s;\n\ diff --git a/tools/h5debug.c b/tools/h5debug.c index 63afb98..97b5e63 100644 --- a/tools/h5debug.c +++ b/tools/h5debug.c @@ -50,11 +50,10 @@ main(int argc, char *argv[]) { hid_t fid, plist=H5P_DEFAULT; H5F_t *f; - haddr_t addr; + haddr_t addr=0, extra=0; uint8_t sig[16]; intn i, ndims; herr_t status = SUCCEED; - haddr_t extra; /* * Open the file and get the file descriptor. @@ -75,8 +74,6 @@ main(int argc, char *argv[]) /* * Parse command arguments. */ - H5F_addr_reset(&addr); - H5F_addr_reset(&extra); if (argc > 2) { printf("New address: %s\n", argv[2]); addr = HDstrtoll(argv[2], NULL, 0); |