summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-06-17 20:01:52 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-06-17 20:01:52 (GMT)
commit922a109192727c1d091e81069acd743da082872f (patch)
tree46bb7597ea424da84ca85cb5628d84df1371c52a /src
parentb7ef9f5e566163f0972907e63a5e985ef7c38fac (diff)
downloadhdf5-922a109192727c1d091e81069acd743da082872f.zip
hdf5-922a109192727c1d091e81069acd743da082872f.tar.gz
hdf5-922a109192727c1d091e81069acd743da082872f.tar.bz2
[svn-r15227] Description:
Small clean up of datatype copying. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.5.3 (amazon) in debug mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c2
-rw-r--r--src/H5D.c2
-rw-r--r--src/H5Tcompound.c6
-rw-r--r--src/H5Tnative.c2
-rw-r--r--src/H5Tpkg.h6
-rw-r--r--src/H5Tprivate.h2
-rw-r--r--src/H5Znbit.c4
7 files changed, 13 insertions, 11 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 0746720..dc00135 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1277,6 +1277,8 @@ H5Aget_type(hid_t attr_id)
/* Mark any datatypes as being in memory now */
if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
+
+ /* Lock copied type */
if(H5T_lock(dt, FALSE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype")
diff --git a/src/H5D.c b/src/H5D.c
index 7fd03b3..81140eb 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -515,7 +515,7 @@ H5Dget_type(hid_t dset_id)
if(H5T_set_loc(copied_type, NULL, H5T_LOC_MEMORY) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
- /* Unlock copied type */
+ /* Lock copied type */
if(H5T_lock (copied_type, FALSE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype")
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index 660a76d..9942ea1 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -215,7 +215,7 @@ H5Tget_member_type(hid_t type_id, unsigned membno)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype")
if (membno >= dt->shared->u.compnd.nmembs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number")
- if ((memb_dt=H5T_get_member_type(dt, membno))==NULL)
+ if ((memb_dt=H5T_get_member_type(dt, membno, H5T_COPY_REOPEN))==NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to retrieve member type")
if ((ret_value = H5I_register(H5I_DATATYPE, memb_dt)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable register datatype atom")
@@ -251,7 +251,7 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_get_member_type(const H5T_t *dt, unsigned membno)
+H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method)
{
H5T_t *ret_value = NULL;
@@ -261,7 +261,7 @@ H5T_get_member_type(const H5T_t *dt, unsigned membno)
assert(membno < dt->shared->u.compnd.nmembs);
/* Copy datatype into an atom */
- if (NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, H5T_COPY_REOPEN)))
+ if (NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, method)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy member datatype")
done:
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index da478c4..0deba66 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -277,7 +277,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
/* Construct child compound type and retrieve a list of their IDs, offsets, total size, and alignment for compound type. */
for(i=0; i<nmemb; i++) {
- if((memb_type = H5T_get_member_type(dtype, i))==NULL)
+ if((memb_type = H5T_get_member_type(dtype, i, H5T_COPY_TRANSIENT))==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed")
if((comp_mname[i] = H5T_get_member_name(dtype, i))==NULL)
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 5cb668d..b0abb9a 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -340,9 +340,9 @@ typedef struct H5T_array_t {
} H5T_array_t;
typedef enum H5T_state_t {
- H5T_STATE_TRANSIENT, /*type is a modifiable transient */
- H5T_STATE_RDONLY, /*transient, not modifiable, closable*/
- H5T_STATE_IMMUTABLE, /*constant, not closable */
+ H5T_STATE_TRANSIENT, /*type is a modifiable, closable transient */
+ H5T_STATE_RDONLY, /*transient, not modifiable, closable */
+ H5T_STATE_IMMUTABLE, /*transient, not modifiable, not closable */
H5T_STATE_NAMED, /*named constant, not open */
H5T_STATE_OPEN /*named constant, open object header */
} H5T_state_t;
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 2fe4c3a..36f8006 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -129,7 +129,7 @@ H5_DLL herr_t H5T_update_shared(H5T_t *type);
/* Field functions (for both compound & enumerated types) */
H5_DLL int H5T_get_nmembers(const H5T_t *dt);
-H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno);
+H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method);
H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno);
/* Atomic functions */
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index 2423654..fabc7f0 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -326,7 +326,7 @@ H5Z_calc_parms_compound(const H5T_t *type)
/* For each member, calculate parameters */
for(u = 0; u < (unsigned)nmembers; u++) {
/* Get member datatype */
- if(NULL == (dtype_member = H5T_get_member_type(type, u)))
+ if(NULL == (dtype_member = H5T_get_member_type(type, u, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype")
/* Get member datatype's class */
@@ -637,7 +637,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[])
/* For each member, set parameters */
for(u = 0; u < (unsigned)nmembers; u++) {
/* Get member datatype */
- if(NULL == (dtype_member = H5T_get_member_type(type, u)))
+ if(NULL == (dtype_member = H5T_get_member_type(type, u, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype")
/* Get member datatype's class */