summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-09-14 05:04:25 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-09-14 05:04:25 (GMT)
commitb73f3230590f7716ac9bc603bd6692345a376c8e (patch)
treef3ed8a6ffc5a30b1c5fe6d726ebcdf3ced429d51
parent147951e4bb7a7967bbec2324b6f5cc66e40260f3 (diff)
downloadhdf5-b73f3230590f7716ac9bc603bd6692345a376c8e.zip
hdf5-b73f3230590f7716ac9bc603bd6692345a376c8e.tar.gz
hdf5-b73f3230590f7716ac9bc603bd6692345a376c8e.tar.bz2
[svn-r9250] Purpose:
Bug fix Description: Correct typedef for dataset region references to avoid struct alignment issues on Crays. Solution: Change the typedef for hdset_reg_ref_t from a struct to an array of unsigned char's of the correct size and propagate the appropriate adjustments around the code. Platforms tested: FreeBSD 4.10 (sleipnir) Linux 2.4 (verbena) w/fortran Cray T90 (subzero) w/fortran Cray SV1 (wind) w/fortran & parallel Cray T3E (cyclone) w/fortran & parallel
-rw-r--r--fortran/src/H5Df.c4
-rw-r--r--fortran/src/H5Rf.c6
-rw-r--r--release_docs/RELEASE.txt8
-rw-r--r--src/H5.c2
-rw-r--r--src/H5R.c14
-rw-r--r--src/H5Rpublic.h6
6 files changed, 20 insertions, 20 deletions
diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c
index 83b69e7..b7c5263 100644
--- a/fortran/src/H5Df.c
+++ b/fortran/src/H5Df.c
@@ -290,7 +290,7 @@ nh5dwrite_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_
buf_c = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t)*(n));
if ( buf_c != NULL ) {
for (i = 0; i < n; i++) {
- HDmemcpy(buf_c[i].heapid, buf, H5R_DSET_REG_REF_BUF_SIZE);
+ HDmemcpy(&buf_c[i], buf, H5R_DSET_REG_REF_BUF_SIZE);
buf = buf + REF_REG_BUF_LEN_F;
}
}
@@ -496,7 +496,7 @@ nh5dread_ref_reg_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].heapid, H5R_DSET_REG_REF_BUF_SIZE);
+ HDmemcpy(buf, &buf_c[i], H5R_DSET_REG_REF_BUF_SIZE);
buf = buf + REF_REG_BUF_LEN_F;
}
}
diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c
index 06cb6e3..070efdd 100644
--- a/fortran/src/H5Rf.c
+++ b/fortran/src/H5Rf.c
@@ -102,7 +102,7 @@ nh5rcreate_region_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid
HDfree(c_name);
if (ret_value_c >= 0) {
- HDmemcpy (ref, ref_c.heapid, H5R_DSET_REG_REF_BUF_SIZE);
+ HDmemcpy (ref, &ref_c, H5R_DSET_REG_REF_BUF_SIZE);
ret_value = 0;
}
return ret_value;
@@ -127,7 +127,7 @@ nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id)
hdset_reg_ref_t ref_c;
hid_t c_obj_id;
- HDmemcpy (ref_c.heapid, ref, H5R_DSET_REG_REF_BUF_SIZE);
+ HDmemcpy (&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE);
/*
* Call H5Rdereference function.
@@ -192,7 +192,7 @@ nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id)
hid_t c_space_id;
hdset_reg_ref_t ref_c;
- HDmemcpy (ref_c.heapid, ref, H5R_DSET_REG_REF_BUF_SIZE);
+ HDmemcpy (&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE);
/*
* Call H5Rget_region function.
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 5bce3e5..6dc7761 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -180,10 +180,12 @@ Bug Fixes since HDF5-1.6.0 release
Library
-------
+ - Corrected error where dataset region references were written in an
+ incorrect way on Cray machines. PVN & QAK - 2004/09/13
- The H5Tget_native_type now determines the native type for integers
- based on the precision. This is to avoid cases of wrongly converting
- an int to a short in machines that have a short of 8 bytes but with
- 32bit precision (e.g Cray SV1). PVN - 2004/09/07
+ based on the precision. This is to avoid cases of wrongly converting
+ an int to a short in machines that have a short of 8 bytes but with
+ 32bit precision (e.g Cray SV1). PVN - 2004/09/07
- Changed H5Dread() to not overwrite data in an application's buffer
with garbage when accessing a chunked dataset with an undefined
fill value and an unwritten chunk is uncountered. QAK - 2004/08/25
diff --git a/src/H5.c b/src/H5.c
index 2e01b58..44f46e1 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -2464,7 +2464,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
}
} else {
hobj_ref_t ref = va_arg (ap, hobj_ref_t);
- fprintf (out, "Reference Object=%p", (void *)&ref);
+ HDfprintf(out, "Reference Object=%a", ref);
}
break;
diff --git a/src/H5R.c b/src/H5R.c
index cd28345..3bbb5e5 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -175,8 +175,8 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
/* Return any previous heap block to the free list if we are garbage collecting */
if(loc->file->shared->gc_ref) {
/* Check for an existing heap ID in the reference */
- for(u=0, heapid_found=0; u<H5R_DSET_REG_REF_BUF_SIZE; u++)
- if(ref->heapid[u]!=0) {
+ for(u=0, heapid_found=0, p=(uint8_t *)ref; u<H5R_DSET_REG_REF_BUF_SIZE; u++)
+ if(p[u]!=0) {
heapid_found=1;
break;
} /* end if */
@@ -187,7 +187,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
} /* end if */
/* Zero the heap ID out, may leak heap space if user is re-using reference and doesn't have garbage collection on */
- HDmemset(ref->heapid,H5R_DSET_REG_REF_BUF_SIZE,0);
+ HDmemset(ref,H5R_DSET_REG_REF_BUF_SIZE,0);
/* Get the amount of space required to serialize the selection */
if ((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0)
@@ -215,7 +215,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to serialize selection");
/* Serialize the heap ID and index for storage in the file */
- p=(uint8_t *)ref->heapid;
+ p=(uint8_t *)ref;
H5F_addr_encode(loc->file,&p,hobjid.addr);
INT32ENCODE(p,hobjid.idx);
@@ -358,7 +358,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
uint8_t *buf; /* Buffer to store serialized selection in */
/* Get the heap ID for the dataset region */
- p=(uint8_t *)ref->heapid;
+ p=(uint8_t *)ref;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(hobjid.addr));
INT32DECODE(p,hobjid.idx);
@@ -525,7 +525,7 @@ H5R_get_region(H5F_t *file, hid_t dxpl_id, H5R_type_t UNUSED ref_type, void *_re
ent.file=file;
/* Get the heap ID for the dataset region */
- p=(uint8_t *)ref->heapid;
+ p=(uint8_t *)ref;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(hobjid.addr));
INT32DECODE(p,hobjid.idx);
@@ -667,7 +667,7 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
uint8_t *buf; /* Buffer to store serialized selection in */
/* Get the heap ID for the dataset region */
- p=(uint8_t *)ref->heapid;
+ p=(uint8_t *)ref;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(hobjid.addr));
INT32DECODE(p,hobjid.idx);
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index 574ce80..efffb8c 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -57,10 +57,8 @@ typedef haddr_t hobj_ref_t; /* Needs to be large enough to store largest haddr_t
the Crays and other machines (the heap ID is always encoded as an int32 anyway)
*/
/* Dataset Region reference structure for user's code */
-typedef struct {
- unsigned char heapid[H5R_DSET_REG_REF_BUF_SIZE]; /* Buffer to store heap ID and index */
- /* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) plus an int */
-} hdset_reg_ref_t;
+typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];/* Buffer to store heap ID and index */
+/* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) plus an int */
/* Publicly visible datastructures */