mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r7318] Purpose:
Code cleanup Description: Switched 'hobj_ref_t' from funny structure with array inside to just be 'haddr_t', since that was equivalent and less confusing. Platforms tested: h5committested
This commit is contained in:
parent
2e1ef03cef
commit
f3c2fbaff5
@ -298,7 +298,7 @@ nh5dwrite_ref_obj_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_
|
||||
buf_c = (hobj_ref_t*)HDmalloc(sizeof(hobj_ref_t)*(n));
|
||||
if ( buf_c != NULL ) {
|
||||
for (i = 0; i < n; i++) {
|
||||
HDmemcpy(buf_c[i].oid, buf, H5R_OBJ_REF_BUF_SIZE);
|
||||
HDmemcpy(&buf_c[i], buf, H5R_OBJ_REF_BUF_SIZE);
|
||||
buf = buf + REF_OBJ_BUF_LEN_F;
|
||||
}
|
||||
}
|
||||
@ -358,7 +358,7 @@ nh5dwrite_ref_obj_c_b (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_spac
|
||||
buf_c = (hobj_ref_t*)HDmalloc(sizeof(hobj_ref_t)*(n));
|
||||
if ( buf_c != NULL ) {
|
||||
for (i = 0; i < n; i++) {
|
||||
HDmemcpy(buf_c[i].oid, buf, H5R_OBJ_REF_BUF_SIZE);
|
||||
HDmemcpy(&buf_c[i], buf, H5R_OBJ_REF_BUF_SIZE);
|
||||
buf = buf + REF_OBJ_BUF_LEN_F;
|
||||
}
|
||||
}
|
||||
@ -694,7 +694,7 @@ nh5dread_ref_obj_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_i
|
||||
ret = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c);
|
||||
if (ret >=0) {
|
||||
for (i = 0; i < n; i++) {
|
||||
HDmemcpy(buf, buf_c[i].oid, H5R_OBJ_REF_BUF_SIZE);
|
||||
HDmemcpy(buf, &buf_c[i], H5R_OBJ_REF_BUF_SIZE);
|
||||
buf = buf + REF_OBJ_BUF_LEN_F;
|
||||
}
|
||||
}
|
||||
@ -753,7 +753,7 @@ nh5dread_ref_obj_c_b (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space
|
||||
ret = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c);
|
||||
if (ret >=0) {
|
||||
for (i = 0; i < n; i++) {
|
||||
HDmemcpy(buf, buf_c[i].oid, H5R_OBJ_REF_BUF_SIZE);
|
||||
HDmemcpy(buf, &buf_c[i], H5R_OBJ_REF_BUF_SIZE);
|
||||
buf = buf + REF_OBJ_BUF_LEN_F;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ nh5rcreate_object_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen)
|
||||
|
||||
HDfree(c_name);
|
||||
if (ret_value_c >= 0) {
|
||||
HDmemcpy(ref, ref_c.oid, H5R_OBJ_REF_BUF_SIZE);
|
||||
*ref=ref_c;
|
||||
ret_value = 0;
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ nh5rdereference_object_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id)
|
||||
hid_t c_obj_id;
|
||||
hobj_ref_t ref_c;
|
||||
|
||||
HDmemcpy (ref_c.oid, ref, H5R_OBJ_REF_BUF_SIZE);
|
||||
ref_c=*ref;
|
||||
|
||||
/*
|
||||
* Call H5Rdereference function.
|
||||
@ -225,7 +225,7 @@ nh5rget_object_type_obj_c (hid_t_f *dset_id, int_f *ref, int_f *obj_type)
|
||||
int c_obj_type;
|
||||
hobj_ref_t ref_c;
|
||||
|
||||
HDmemcpy (ref_c.oid, ref, H5R_OBJ_REF_BUF_SIZE);
|
||||
ref_c=*ref;
|
||||
|
||||
/*
|
||||
* Call H5Rget_object_type function.
|
||||
|
14
src/H5R.c
14
src/H5R.c
@ -156,20 +156,17 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
|
||||
switch(ref_type) {
|
||||
case H5R_OBJECT:
|
||||
{
|
||||
haddr_t addr;
|
||||
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */
|
||||
uint8_t *p; /* Pointer to OID to store */
|
||||
|
||||
/* Set information for reference */
|
||||
p=(uint8_t *)ref->oid;
|
||||
H5F_addr_pack(loc->file,&addr,&sb.objno[0]);
|
||||
H5F_addr_encode(loc->file,&p,addr);
|
||||
p=(uint8_t *)ref;
|
||||
H5F_addr_encode(loc->file,&p,sb.objno);
|
||||
break;
|
||||
}
|
||||
|
||||
case H5R_DATASET_REGION:
|
||||
{
|
||||
haddr_t addr;
|
||||
H5HG_t hobjid; /* Heap object ID */
|
||||
hdset_reg_ref_t *ref=(hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
|
||||
hssize_t buf_size; /* Size of buffer needed to serialize selection */
|
||||
@ -211,8 +208,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
|
||||
|
||||
/* Serialize information for dataset OID */
|
||||
p=(uint8_t *)buf;
|
||||
H5F_addr_pack(loc->file,&addr,&sb.objno[0]);
|
||||
H5F_addr_encode(loc->file,&p,addr);
|
||||
H5F_addr_encode(loc->file,&p,sb.objno);
|
||||
|
||||
/* Serialize the selection */
|
||||
if ((*space->select.serialize)(space,p) < 0)
|
||||
@ -360,7 +356,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
|
||||
* open a dataset for now
|
||||
*/
|
||||
/* Get the object oid */
|
||||
p=(uint8_t *)ref->oid;
|
||||
p=(uint8_t *)ref;
|
||||
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header));
|
||||
} /* end case */
|
||||
break;
|
||||
@ -670,7 +666,7 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
|
||||
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Only object references currently supported */
|
||||
|
||||
/* Get the object oid */
|
||||
p=(uint8_t *)ref->oid;
|
||||
p=(uint8_t *)ref;
|
||||
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header));
|
||||
} /* end case */
|
||||
break;
|
||||
|
@ -50,10 +50,7 @@ typedef struct {
|
||||
*/
|
||||
#define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t)
|
||||
/* Object reference structure for user's code */
|
||||
typedef struct {
|
||||
unsigned char oid[H5R_OBJ_REF_BUF_SIZE]; /* Buffer to store OID of object referenced */
|
||||
/* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) */
|
||||
} hobj_ref_t;
|
||||
typedef haddr_t hobj_ref_t; /* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) */
|
||||
|
||||
#define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t)+sizeof(int))
|
||||
/* Dataset Region reference structure for user's code */
|
||||
|
Loading…
Reference in New Issue
Block a user