diff options
-rw-r--r-- | release_docs/RELEASE.txt | 4 | ||||
-rw-r--r-- | src/H5D.c | 2 | ||||
-rw-r--r-- | src/H5Ofill.c | 2 | ||||
-rw-r--r-- | src/H5T.c | 245 | ||||
-rw-r--r-- | src/H5Tnative.c | 2 | ||||
-rw-r--r-- | src/H5Tpkg.h | 2 | ||||
-rw-r--r-- | src/H5Tprivate.h | 2 |
7 files changed, 157 insertions, 102 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 06638a3..e74beeb 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -67,12 +67,16 @@ Bug Fixes since HDF5-1.6.4 release Library ------- + - Fixed error in opening object in group that was opened in mounted + file which has been unmounted. QAK - 2005/03/17 Configuration ------------- Performance ------------- + - Optimized I/O for enumerated datatypes that are a superset of source + enumerated datatype. QAK - 2005/03/19 Tools ----- @@ -621,7 +621,7 @@ H5D_crt_fill_value_cmp(const void *value1, const void *value2, size_t UNUSED siz if(fill1->type==NULL && fill2->type!=NULL) HGOTO_DONE(-1); if(fill1->type!=NULL && fill2->type==NULL) HGOTO_DONE(1); if(fill1->type!=NULL) - if((cmp_value=H5T_cmp(fill1->type,fill2->type))!=0) + if((cmp_value=H5T_cmp(fill1->type,fill2->type, FALSE))!=0) HGOTO_DONE(cmp_value); /* Check the fill values in the buffers */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 73f60a7..a437105 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -823,7 +823,7 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id) assert(dset_type); /* No-op cases */ - if (!fill->buf || !fill->type || 0==H5T_cmp(fill->type, dset_type)) { + if (!fill->buf || !fill->type || 0==H5T_cmp(fill->type, dset_type, FALSE)) { if (fill->type) H5T_close(fill->type); fill->type = NULL; @@ -522,7 +522,7 @@ H5T_init_inf(void) /* +Inf */ d=(uint8_t *)&H5T_NATIVE_FLOAT_POS_INF_g; - H5T_bit_set (d, dst->u.f.sign, 1, FALSE); + H5T_bit_set (d, dst->u.f.sign, (size_t)1, FALSE); H5T_bit_set (d, dst->u.f.epos, dst->u.f.esize, TRUE); H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE); @@ -538,7 +538,7 @@ H5T_init_inf(void) /* -Inf */ d=(uint8_t *)&H5T_NATIVE_FLOAT_NEG_INF_g; - H5T_bit_set (d, dst->u.f.sign, 1, TRUE); + H5T_bit_set (d, dst->u.f.sign, (size_t)1, TRUE); H5T_bit_set (d, dst->u.f.epos, dst->u.f.esize, TRUE); H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE); @@ -563,7 +563,7 @@ H5T_init_inf(void) /* +Inf */ d=(uint8_t *)&H5T_NATIVE_DOUBLE_POS_INF_g; - H5T_bit_set (d, dst->u.f.sign, 1, FALSE); + H5T_bit_set (d, dst->u.f.sign, (size_t)1, FALSE); H5T_bit_set (d, dst->u.f.epos, dst->u.f.esize, TRUE); H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE); @@ -579,7 +579,7 @@ H5T_init_inf(void) /* -Inf */ d=(uint8_t *)&H5T_NATIVE_DOUBLE_NEG_INF_g; - H5T_bit_set (d, dst->u.f.sign, 1, TRUE); + H5T_bit_set (d, dst->u.f.sign, (size_t)1, TRUE); H5T_bit_set (d, dst->u.f.epos, dst->u.f.esize, TRUE); H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE); @@ -695,7 +695,7 @@ H5T_init_interface(void) FUNC_ENTER_NOAPI_NOINIT(H5T_init_interface); /* Initialize the atom group for the file IDs */ - if (H5I_init_group(H5I_DATATYPE, H5I_DATATYPEID_HASHSIZE, H5T_RESERVED_ATOMS, (H5I_free_t)H5T_close)<0) + if (H5I_init_group(H5I_DATATYPE, (size_t)H5I_DATATYPEID_HASHSIZE, H5T_RESERVED_ATOMS, (H5I_free_t)H5T_close)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface"); /* Make certain there aren't too many classes of datatypes defined */ @@ -941,9 +941,9 @@ H5T_init_interface(void) */ fixedpt = native_int; floatpt = native_float; - if (NULL == (compound = H5T_create(H5T_COMPOUND, 1))) + if (NULL == (compound = H5T_create(H5T_COMPOUND, (size_t)1))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); - if (NULL == (enum_type = H5T_create(H5T_ENUM, 1))) + if (NULL == (enum_type = H5T_create(H5T_ENUM, (size_t)1))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (NULL == (vlen = H5T_vlen_create(native_int))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); @@ -1191,7 +1191,8 @@ H5T_term_interface(void) H5T_print_stats(path, &nprint/*in,out*/); path->cdata.command = H5T_CONV_FREE; if ((path->func)(FAIL, FAIL, &(path->cdata), - 0, 0, 0, NULL, NULL,H5AC_dxpl_id)<0) { + (size_t)0, (size_t)0, (size_t)0, + NULL, NULL,H5AC_dxpl_id)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf (H5DEBUG(T), "H5T: conversion function " @@ -1573,7 +1574,7 @@ H5Tequal(hid_t type1_id, hid_t type2_id) NULL == (dt2 = H5I_object_verify(type2_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - ret_value = (0 == H5T_cmp(dt1, dt2)) ? TRUE : FALSE; + ret_value = (0 == H5T_cmp(dt1, dt2, FALSE)) ? TRUE : FALSE; done: FUNC_LEAVE_API(ret_value); @@ -1737,10 +1738,11 @@ H5Tdetect_class(hid_t type, H5T_class_t cls) if (!(cls>H5T_NO_CLASS && cls<H5T_NCLASSES)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a data type class"); - /* Set return value. Consider VL string as a string for API, as a VL for internal use. */ + /* Set return value. Consider VL string as a string for API, as a VL for + * internal use. */ if(H5T_IS_VL_STRING(dt->shared)) ret_value = (H5T_STRING==cls); - else + else ret_value=H5T_detect_class(dt,cls); done: @@ -2069,7 +2071,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if (H5T_PERS_HARD==pers) { /* Only bother to register the path if it's not a no-op path (for this machine) */ - if(H5T_cmp(src, dst)) { + if(H5T_cmp(src, dst, FALSE)) { /* Locate or create a new conversion path */ if (NULL==(new_path=H5T_path_find(src, dst, name, func, dxpl_id))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path"); @@ -2097,7 +2099,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_g.asoft = (int)na; H5T_g.soft = x; } /* end if */ - HDstrncpy (H5T_g.soft[H5T_g.nsoft].name, name, H5T_NAMELEN); + HDstrncpy (H5T_g.soft[H5T_g.nsoft].name, name, (size_t)H5T_NAMELEN); H5T_g.soft[H5T_g.nsoft].name[H5T_NAMELEN-1] = '\0'; H5T_g.soft[H5T_g.nsoft].src = src->shared->type; H5T_g.soft[H5T_g.nsoft].dst = dst->shared->type; @@ -2124,7 +2126,8 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data types for conv query"); HDmemset(&cdata, 0, sizeof cdata); cdata.command = H5T_CONV_INIT; - if ((func)(tmp_sid, tmp_did, &cdata, 0, 0, 0, NULL, NULL, dxpl_id)<0) { + if ((func)(tmp_sid, tmp_did, &cdata, (size_t)0, (size_t)0, (size_t)0, + NULL, NULL, dxpl_id)<0) { H5I_dec_ref(tmp_sid); H5I_dec_ref(tmp_did); tmp_sid = tmp_did = -1; @@ -2135,7 +2138,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, /* Create a new conversion path */ if (NULL==(new_path=H5FL_CALLOC(H5T_path_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - HDstrncpy(new_path->name, name, H5T_NAMELEN); + HDstrncpy(new_path->name, name, (size_t)H5T_NAMELEN); new_path->name[H5T_NAMELEN-1] = '\0'; if (NULL==(new_path->src=H5T_copy(old_path->src, H5T_COPY_ALL)) || NULL==(new_path->dst=H5T_copy(old_path->dst, H5T_COPY_ALL))) @@ -2151,7 +2154,8 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, /* Free old path */ H5T_print_stats(old_path, &nprint); old_path->cdata.command = H5T_CONV_FREE; - if ((old_path->func)(tmp_sid, tmp_did, &(old_path->cdata), 0, 0, 0, NULL, NULL, dxpl_id)<0) { + if ((old_path->func)(tmp_sid, tmp_did, &(old_path->cdata), + (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " @@ -2302,8 +2306,8 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if (((H5T_PERS_SOFT==pers && path->is_hard) || (H5T_PERS_HARD==pers && !path->is_hard)) || (name && *name && HDstrcmp(name, path->name)) || - (src && H5T_cmp(src, path->src)) || - (dst && H5T_cmp(dst, path->dst)) || + (src && H5T_cmp(src, path->src, FALSE)) || + (dst && H5T_cmp(dst, path->dst, FALSE)) || (func && func!=path->func)) { /* * Notify all other functions to recalculate private data since some @@ -2323,8 +2327,8 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, /* Shut down path */ H5T_print_stats(path, &nprint); path->cdata.command = H5T_CONV_FREE; - if ((path->func)(FAIL, FAIL, &(path->cdata), 0, 0, 0, NULL, NULL, - dxpl_id)<0) { + if ((path->func)(FAIL, FAIL, &(path->cdata), + (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " @@ -2492,7 +2496,7 @@ H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, if (NULL==(tpath=H5T_path_find(src, dst, NULL, NULL, dxpl_id))) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types"); - if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, buf, background, dxpl_id)<0) + if (H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, buf, background, dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); done: @@ -3502,10 +3506,14 @@ H5T_get_size(const H5T_t *dt) * * Robb Matzke, 20 May 1999 * Compares bitfields and opaque types. + * + * Quincey Koziol, 19 Mar 2005 + * Allow an enumerated datatypes to compare equal, if the "superset" + * flag is set and dt2 has a superset of the enumerated values in dt1 *------------------------------------------------------------------------- */ int -H5T_cmp(const H5T_t *dt1, const H5T_t *dt2) +H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) { unsigned *idx1 = NULL, *idx2 = NULL; int ret_value = 0; @@ -3532,7 +3540,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2) if (dt1->shared->parent && !dt2->shared->parent) HGOTO_DONE(-1); if (!dt1->shared->parent && dt2->shared->parent) HGOTO_DONE(1); if (dt1->shared->parent) { - tmp = H5T_cmp(dt1->shared->parent, dt2->shared->parent); + tmp = H5T_cmp(dt1->shared->parent, dt2->shared->parent, superset); if (tmp<0) HGOTO_DONE(-1); if (tmp>0) HGOTO_DONE(1); } @@ -3549,32 +3557,30 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2) /* Build an index for each type so the names are sorted */ if (NULL==(idx1 = H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))) || - NULL==(idx2 = H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned)))) + NULL==(idx2 = H5MM_malloc(dt2->shared->u.compnd.nmembs * sizeof(unsigned)))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed"); for (u=0; u<dt1->shared->u.compnd.nmembs; u++) idx1[u] = idx2[u] = u; - for (i=dt1->shared->u.compnd.nmembs-1, swapped=TRUE; swapped && i>=0; --i) { - for (j=0, swapped=FALSE; j<i; j++) { - if (HDstrcmp(dt1->shared->u.compnd.memb[idx1[j]].name, - dt1->shared->u.compnd.memb[idx1[j+1]].name) > 0) { - tmp = idx1[j]; - idx1[j] = idx1[j+1]; - idx1[j+1] = tmp; - swapped = TRUE; - } - } - } - for (i=dt2->shared->u.compnd.nmembs-1, swapped=TRUE; swapped && i>=0; --i) { - for (j=0, swapped=FALSE; j<i; j++) { - if (HDstrcmp(dt2->shared->u.compnd.memb[idx2[j]].name, - dt2->shared->u.compnd.memb[idx2[j+1]].name) > 0) { - tmp = idx2[j]; - idx2[j] = idx2[j+1]; - idx2[j+1] = tmp; - swapped = TRUE; - } - } - } + if(dt1->shared->u.enumer.nmembs > 1) { + for (i=dt1->shared->u.compnd.nmembs-1, swapped=TRUE; swapped && i>=0; --i) + for (j=0, swapped=FALSE; j<i; j++) + if (HDstrcmp(dt1->shared->u.compnd.memb[idx1[j]].name, + dt1->shared->u.compnd.memb[idx1[j+1]].name) > 0) { + tmp = idx1[j]; + idx1[j] = idx1[j+1]; + idx1[j+1] = tmp; + swapped = TRUE; + } + for (i=dt2->shared->u.compnd.nmembs-1, swapped=TRUE; swapped && i>=0; --i) + for (j=0, swapped=FALSE; j<i; j++) + if (HDstrcmp(dt2->shared->u.compnd.memb[idx2[j]].name, + dt2->shared->u.compnd.memb[idx2[j+1]].name) > 0) { + tmp = idx2[j]; + idx2[j] = idx2[j+1]; + idx2[j+1] = tmp; + swapped = TRUE; + } + } /* end if */ #ifdef H5T_DEBUG /* I don't quite trust the code above yet :-) --RPM */ @@ -3602,7 +3608,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2) if (dt1->shared->u.compnd.memb[idx1[u]].size > dt2->shared->u.compnd.memb[idx2[u]].size) HGOTO_DONE(1); tmp = H5T_cmp(dt1->shared->u.compnd.memb[idx1[u]].type, - dt2->shared->u.compnd.memb[idx2[u]].type); + dt2->shared->u.compnd.memb[idx2[u]].type, superset); if (tmp < 0) HGOTO_DONE(-1); if (tmp > 0) HGOTO_DONE(1); } @@ -3612,39 +3618,49 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2) /* * Enumeration data types... */ - if (dt1->shared->u.enumer.nmembs < dt2->shared->u.enumer.nmembs) - HGOTO_DONE(-1); - if (dt1->shared->u.enumer.nmembs > dt2->shared->u.enumer.nmembs) - HGOTO_DONE(1); + + /* If we are doing a "superset" comparison, dt2 is allowed to have + * more members than dt1 + */ + if(superset) { + if (dt1->shared->u.enumer.nmembs > dt2->shared->u.enumer.nmembs) + HGOTO_DONE(1); + } /* end if */ + else { + if (dt1->shared->u.enumer.nmembs < dt2->shared->u.enumer.nmembs) + HGOTO_DONE(-1); + if (dt1->shared->u.enumer.nmembs > dt2->shared->u.enumer.nmembs) + HGOTO_DONE(1); + } /* end else */ /* Build an index for each type so the names are sorted */ if (NULL==(idx1 = H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))) || - NULL==(idx2 = H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned)))) + NULL==(idx2 = H5MM_malloc(dt2->shared->u.enumer.nmembs * sizeof(unsigned)))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed"); for (u=0; u<dt1->shared->u.enumer.nmembs; u++) - idx1[u] = idx2[u] = u; - for (i=dt1->shared->u.enumer.nmembs-1, swapped=TRUE; swapped && i>=0; --i) { - for (j=0, swapped=FALSE; j<i; j++) { - if (HDstrcmp(dt1->shared->u.enumer.name[idx1[j]], - dt1->shared->u.enumer.name[idx1[j+1]]) > 0) { - tmp = idx1[j]; - idx1[j] = idx1[j+1]; - idx1[j+1] = tmp; - swapped = TRUE; - } - } - } - for (i=dt2->shared->u.enumer.nmembs-1, swapped=TRUE; swapped && i>=0; --i) { - for (j=0, swapped=FALSE; j<i; j++) { - if (HDstrcmp(dt2->shared->u.enumer.name[idx2[j]], - dt2->shared->u.enumer.name[idx2[j+1]]) > 0) { - tmp = idx2[j]; - idx2[j] = idx2[j+1]; - idx2[j+1] = tmp; - swapped = TRUE; - } - } - } + idx1[u] = u; + if(dt1->shared->u.enumer.nmembs > 1) + for (i=dt1->shared->u.enumer.nmembs-1, swapped=TRUE; swapped && i>=0; --i) + for (j=0, swapped=FALSE; j<i; j++) + if (HDstrcmp(dt1->shared->u.enumer.name[idx1[j]], + dt1->shared->u.enumer.name[idx1[j+1]]) > 0) { + tmp = idx1[j]; + idx1[j] = idx1[j+1]; + idx1[j+1] = tmp; + swapped = TRUE; + } + for (u=0; u<dt2->shared->u.enumer.nmembs; u++) + idx2[u] = u; + if(dt2->shared->u.enumer.nmembs > 1) + for (i=dt2->shared->u.enumer.nmembs-1, swapped=TRUE; swapped && i>=0; --i) + for (j=0, swapped=FALSE; j<i; j++) + if (HDstrcmp(dt2->shared->u.enumer.name[idx2[j]], + dt2->shared->u.enumer.name[idx2[j+1]]) > 0) { + tmp = idx2[j]; + idx2[j] = idx2[j+1]; + idx2[j+1] = tmp; + swapped = TRUE; + } #ifdef H5T_DEBUG /* I don't quite trust the code above yet :-) --RPM */ @@ -3659,13 +3675,47 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2) /* Compare the members */ base_size = dt1->shared->parent->shared->size; for (u=0; u<dt1->shared->u.enumer.nmembs; u++) { - tmp = HDstrcmp(dt1->shared->u.enumer.name[idx1[u]], - dt2->shared->u.enumer.name[idx2[u]]); - if (tmp<0) HGOTO_DONE(-1); - if (tmp>0) HGOTO_DONE(1); + unsigned idx; + + if(superset) { + unsigned lt = 0, rt; /* Final, left & right key indices */ + int cmp = 1; /* Key comparison value */ + + /* If a superset is allowed, dt2 may have more members + * than dt1, so binary search for matching member name in + * dt2 + */ + rt = dt2->shared->u.enumer.nmembs; + + while (lt < rt && cmp) { + idx = (lt + rt) / 2; + + /* compare */ + if ((cmp = HDstrcmp(dt1->shared->u.enumer.name[idx1[u]], + dt2->shared->u.enumer.name[idx2[idx]] ) ) < 0) + rt = idx; + else + lt = idx+1; + } + /* Leave, if we couldn't find match */ + if (cmp) + HGOTO_DONE(-1); + } /* end if */ + else { + /* Check for exact member name match when not doing + * "superset" comparison + */ + tmp = HDstrcmp(dt1->shared->u.enumer.name[idx1[u]], + dt2->shared->u.enumer.name[idx2[u]]); + if (tmp<0) HGOTO_DONE(-1); + if (tmp>0) HGOTO_DONE(1); + + /* Set index value appropriately */ + idx = u; + } /* end else */ tmp = HDmemcmp(dt1->shared->u.enumer.value+idx1[u]*base_size, - dt2->shared->u.enumer.value+idx2[u]*base_size, + dt2->shared->u.enumer.value+idx2[idx]*base_size, base_size); if (tmp<0) HGOTO_DONE(-1); if (tmp>0) HGOTO_DONE(1); @@ -3702,9 +3752,10 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2) break; case H5T_OPAQUE: - if(dt1->shared->u.opaque.tag && dt2->shared->u.opaque.tag) { + if(dt1->shared->u.opaque.tag && dt2->shared->u.opaque.tag) HGOTO_DONE(HDstrcmp(dt1->shared->u.opaque.tag,dt2->shared->u.opaque.tag)); - } + break; + case H5T_ARRAY: if (dt1->shared->u.array.ndims < dt2->shared->u.array.ndims) HGOTO_DONE(-1); @@ -3725,7 +3776,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2) HGOTO_DONE(1); } - tmp = H5T_cmp(dt1->shared->parent, dt2->shared->parent); + tmp = H5T_cmp(dt1->shared->parent, dt2->shared->parent, superset); if (tmp < 0) HGOTO_DONE(-1); if (tmp > 0) @@ -3911,8 +3962,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, HDstrcpy(H5T_g.path[0]->name, "no-op"); H5T_g.path[0]->func = H5T_conv_noop; H5T_g.path[0]->cdata.command = H5T_CONV_INIT; - if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), 0, 0, 0, - NULL, NULL, dxpl_id)<0) { + if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), + (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: unable to initialize no-op " @@ -3934,7 +3985,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, * Only allow the no-op conversion to occur if no "force conversion" flags * are set */ - if (src->shared->force_conv==FALSE && dst->shared->force_conv==FALSE && 0==H5T_cmp(src, dst)) { + if (src->shared->force_conv==FALSE && dst->shared->force_conv==FALSE && 0==H5T_cmp(src, dst, TRUE)) { table = H5T_g.path[0]; cmp = 0; md = 0; @@ -3946,8 +3997,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, while (cmp && lt<rt) { md = (lt+rt) / 2; assert(H5T_g.path[md]); - cmp = H5T_cmp(src, H5T_g.path[md]->src); - if (0==cmp) cmp = H5T_cmp(dst, H5T_g.path[md]->dst); + cmp = H5T_cmp(src, H5T_g.path[md]->src, FALSE); + if (0==cmp) cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE); if (cmp<0) { rt = md; } else if (cmp>0) { @@ -3973,7 +4024,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, if (NULL==(path=H5FL_CALLOC(H5T_path_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path"); if (name && *name) { - HDstrncpy(path->name, name, H5T_NAMELEN); + HDstrncpy(path->name, name, (size_t)H5T_NAMELEN); path->name[H5T_NAMELEN-1] = '\0'; } else { HDstrcpy(path->name, "NONAME"); @@ -3999,8 +4050,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_copy(path->dst, H5T_COPY_ALL)))<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register destination conversion type for query"); path->cdata.command = H5T_CONV_INIT; - if ((func)(src_id, dst_id, &(path->cdata), 0, 0, 0, NULL, NULL, - dxpl_id)<0) + if ((func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, + NULL, NULL, dxpl_id)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function"); if (src_id>=0) H5I_dec_ref(src_id); if (dst_id>=0) H5I_dec_ref(dst_id); @@ -4028,7 +4079,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register conversion types for query"); path->cdata.command = H5T_CONV_INIT; if ((H5T_g.soft[i].func) (src_id, dst_id, &(path->cdata), - 0, 0, 0, NULL, NULL, dxpl_id)<0) { + (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id)<0) { HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t)); H5E_clear(); /*ignore the error*/ } else { @@ -4054,8 +4105,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, while (cmp && lt<rt) { md = (lt+rt) / 2; assert(H5T_g.path[md]); - cmp = H5T_cmp(src, H5T_g.path[md]->src); - if (0==cmp) cmp = H5T_cmp(dst, H5T_g.path[md]->dst); + cmp = H5T_cmp(src, H5T_g.path[md]->src, FALSE); + if (0==cmp) cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE); if (cmp<0) { rt = md; } else if (cmp>0) { @@ -4071,8 +4122,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, assert(table==H5T_g.path[md]); H5T_print_stats(table, &nprint/*in,out*/); table->cdata.command = H5T_CONV_FREE; - if ((table->func)(FAIL, FAIL, &(table->cdata), 0, 0, 0, NULL, NULL, - dxpl_id)<0) { + if ((table->func)(FAIL, FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, + NULL, NULL, dxpl_id)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free " @@ -4146,7 +4197,7 @@ H5T_path_noop(const H5T_path_t *p) assert(p); - FUNC_LEAVE_NOAPI(p->is_noop || (p->is_hard && 0==H5T_cmp(p->src, p->dst))); + FUNC_LEAVE_NOAPI(p->is_noop || (p->is_hard && 0==H5T_cmp(p->src, p->dst, FALSE))); } /* end H5T_path_noop() */ diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 686e1e3..ecae777 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -238,7 +238,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig /* Decide if the data type is object or dataset region reference. */ if(NULL==(dt=H5I_object(H5T_STD_REF_OBJ_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") - not_equal = H5T_cmp(ret_value, dt); + not_equal = H5T_cmp(ret_value, dt, FALSE); /* Update size, offset and compound alignment for parent. */ if(!not_equal) { diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 6daef4f..3c19277 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -198,8 +198,8 @@ typedef enum H5T_state_t { typedef struct H5T_shared_t { hsize_t fo_count; /* number of references to this file object */ H5T_state_t state; /*current state of the type */ - H5F_t *sh_file;/*file pointer if this is a shared type */ H5T_class_t type; /*which class of type is this? */ + H5F_t *sh_file;/*file pointer if this is a shared type */ size_t size; /*total size of an instance of this type */ hbool_t force_conv;/* Set if this type always needs to be converted and H5T_conv_noop cannot be called */ struct H5T_t *parent;/*parent type for derived datatypes */ diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 4e8b2ea..f39c396 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -68,7 +68,7 @@ H5_DLL herr_t H5T_close(H5T_t *dt); H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); H5_DLL htri_t H5T_detect_class (const H5T_t *dt, H5T_class_t cls); H5_DLL size_t H5T_get_size(const H5T_t *dt); -H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2); +H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset); H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream); H5_DLL H5G_entry_t *H5T_entof(H5T_t *dt); H5_DLL htri_t H5T_is_immutable(const H5T_t *dt); |