From 8baa67525092387f0e5b8ce7e139a9a6849c2c63 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Fri, 18 Jun 1999 10:12:18 -0500 Subject: [svn-r1362] Changes since 19990616 ---------------------- ./src/H5T.c ./src/H5Tconv.c All conversion functions take an extra argument called `stride' which is the number of bytes to advance the source and destination pointers after each element is converted. If the value is zero then the old behavior is preserved (source and destination values are packed). This feature was necessary to implement the compound datatype conversion optimizations and it causes a minor change to the API (application-defined type conversion functions take an extra size_t stride argument). ./src/H5Tconv.c An additional compound data type conversion function was added which is applied unless the destination type is larger than the source type. I'm measuring significant performance increases for certain operations: Test Name Struct-Conv Noop-Conv New(Old) MB/s New(Old) MB/s ---------- ------------- ------------- Reordering 2.062(0.3936) 54087(0.9047) Subsetting 2.901(0.6581) 40192(1.1100) Shrinking 1.976(0.3925) 33628(1.1500) ---------- ------------- ------------- ./test/dtypes.c Added various compound datatype conversion tests. Fixed return values from functions. ./src/H5T.c Conversion timers are updated only if H5T debugging is turned on a runtime (in addition to compile time). This allows the data type layer to be compiled with debugging support without having to pay a big runtime penalty if the debugging isn't actually used. ./src/H5A.c ./src/H5D.c ./src/H5Ofill.c ./src/H5P.c ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5Tpublic.h Added the stride argument to the H5T_convert() calls. The stride is always zero, which means that the source and destination data values are packed. ./configure.in ./configure [REGENERATED] If API tracing is turned off then libhdf5.settings will say `no' instead of nothing. ./test/flush1.c ./test/flush2.c Added better error messages in a couple places. --- configure | 15 +- configure.in | 1 + src/.distdep | 190 +++++++++++ src/H5A.c | 4 +- src/H5D.c | 4 +- src/H5Ofill.c | 2 +- src/H5P.c | 2 +- src/H5T.c | 46 ++- src/H5Tconv.c | 946 +++++++++++++++++++++++++++++++++++++++---------------- src/H5Tpkg.h | 216 +++++++------ src/H5Tprivate.h | 2 +- src/H5Tpublic.h | 3 +- test/.distdep | 96 ++++++ test/dtypes.c | 443 +++++++++++++++++++++++--- test/flush1.c | 2 +- test/flush2.c | 9 +- 16 files changed, 1535 insertions(+), 446 deletions(-) diff --git a/configure b/configure index 06eeadd..5e84ec4 100755 --- a/configure +++ b/configure @@ -5137,6 +5137,7 @@ if test X = "X$TRACE" -o Xyes = "X$TRACE"; then CPPFLAGS="$CPPFLAGS -DH5_DEBUG_API" else echo "$ac_t""no" 1>&6 + TRACE_API=no CPPFLAGS="$CPPFLAGS -UH5_DEBUG_API" fi @@ -5151,7 +5152,7 @@ case "$CC_BASENAME" in # exists. PARALLEL=mpicc echo $ac_n "checking for mpirun""... $ac_c" 1>&6 -echo "configure:5155: checking for mpirun" >&5 +echo "configure:5156: checking for mpirun" >&5 # Find the path where mpicc is located. cmd=`echo $CC |cut -f1 -d' '` @@ -5196,7 +5197,7 @@ fi echo $ac_n "checking for parallel support files""... $ac_c" 1>&6 -echo "configure:5200: checking for parallel support files" >&5 +echo "configure:5201: checking for parallel support files" >&5 case "X-$enable_parallel" in X-|X-no|X-none) # Either we are not compiling for parallel or the header and library @@ -5227,7 +5228,7 @@ case "X-$enable_parallel" in # is missing. PARALLEL=mpich echo $ac_n "checking for MPI_Init in -lmpich""... $ac_c" 1>&6 -echo "configure:5231: checking for MPI_Init in -lmpich" >&5 +echo "configure:5232: checking for MPI_Init in -lmpich" >&5 ac_lib_var=`echo mpich'_'MPI_Init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5235,7 +5236,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmpich $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5295,10 +5296,10 @@ EOF # Display what we found about running programs echo $ac_n "checking prefix for running on one processor""... $ac_c" 1>&6 -echo "configure:5299: checking prefix for running on one processor" >&5 +echo "configure:5300: checking prefix for running on one processor" >&5 echo "$ac_t""$RUNSERIAL" 1>&6 echo $ac_n "checking prefix for running in parallel""... $ac_c" 1>&6 -echo "configure:5302: checking prefix for running in parallel" >&5 +echo "configure:5303: checking prefix for running in parallel" >&5 echo "$ac_t""$RUNPARALLEL" 1>&6 # Check that we can link a simple MPI and MPI-IO application diff --git a/configure.in b/configure.in index 0ad60c9..e2789df 100644 --- a/configure.in +++ b/configure.in @@ -541,6 +541,7 @@ if test X = "X$TRACE" -o Xyes = "X$TRACE"; then CPPFLAGS="$CPPFLAGS -DH5_DEBUG_API" else AC_MSG_RESULT(no) + TRACE_API=no CPPFLAGS="$CPPFLAGS -UH5_DEBUG_API" fi diff --git a/src/.distdep b/src/.distdep index 8bcc7a7..cee970e 100644 --- a/src/.distdep +++ b/src/.distdep @@ -1376,3 +1376,193 @@ H5TB.lo: \ H5Iprivate.h \ H5Ipublic.h \ H5Eprivate.h +H5A.lo: \ + H5A.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5Apkg.h \ + H5Aprivate.h +H5D.lo: \ + H5D.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5HLprivate.h \ + H5HLpublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5TBprivate.h +H5Ofill.lo: \ + H5Ofill.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5Iprivate.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h +H5P.lo: \ + H5P.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h +H5T.lo: \ + H5T.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5Dprivate.h \ + H5Dpublic.h \ + H5Ipublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Iprivate.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h +H5Tconv.lo: \ + H5Tconv.c \ + H5Iprivate.h \ + H5Ipublic.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5private.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Tpkg.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Rprivate.h \ + H5Rpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h +H5TB.lo: \ + H5TB.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5api_adpt.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5Eprivate.h diff --git a/src/H5A.c b/src/H5A.c index 2397b2a..fc0efef 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -667,7 +667,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf) } /* Perform data type conversion */ - if (H5T_convert(tpath, src_id, dst_id, nelmts, tconv_buf, bkg_buf)<0) { + if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, tconv_buf, bkg_buf)<0) { HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed"); } @@ -835,7 +835,7 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf) } /* Perform data type conversion. */ - if (H5T_convert(tpath, src_id, dst_id, nelmts, tconv_buf, bkg_buf)<0) { + if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, tconv_buf, bkg_buf)<0) { HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed"); } diff --git a/src/H5D.c b/src/H5D.c index 56db7e0..2b432d3 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1751,7 +1751,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d, min_e /* * Perform data type conversion. */ - if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, tconv_buf, + if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, tconv_buf, bkg_buf)<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed"); @@ -2151,7 +2151,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* * Perform data type conversion. */ - if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, tconv_buf, + if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, tconv_buf, bkg_buf)<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data type conversion failed"); diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 70a9780..5095919 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -359,7 +359,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type) } /* Do the conversion */ - if (H5T_convert(tpath, src_id, dst_id, 1, buf, bkg)<0) { + if (H5T_convert(tpath, src_id, dst_id, 1, 0, buf, bkg)<0) { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); } diff --git a/src/H5P.c b/src/H5P.c index 0f33e95..1b46535 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -2722,7 +2722,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/) HDmemcpy(buf, plist->fill.buf, H5T_get_size(plist->fill.type)); /* Do the conversion */ - if (H5T_convert(tpath, src_id, type_id, 1, buf, bkg)<0) { + if (H5T_convert(tpath, src_id, type_id, 1, 0, buf, bkg)<0) { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); } diff --git a/src/H5T.c b/src/H5T.c index 2d77793..5b3262a 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -956,6 +956,9 @@ H5T_init_interface(void) status |= H5Tregister(H5T_PERS_SOFT, "struct", compound, compound, H5T_conv_struct); + status |= H5Tregister(H5T_PERS_SOFT, "struct(opt)", + compound, compound, + H5T_conv_struct_opt); status |= H5Tregister(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T_conv_enum); @@ -1355,7 +1358,7 @@ 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, NULL, NULL)<0) { + 0, 0, NULL, NULL)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf (H5DEBUG(T), "H5T: conversion function " @@ -4136,7 +4139,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, } HDmemset(&cdata, 0, sizeof cdata); cdata.command = H5T_CONV_INIT; - if ((func)(tmp_sid, tmp_did, &cdata, 0, NULL, NULL)<0) { + if ((func)(tmp_sid, tmp_did, &cdata, 0, 0, NULL, NULL)<0) { H5I_dec_ref(tmp_sid); H5I_dec_ref(tmp_did); tmp_sid = tmp_did = -1; @@ -4168,7 +4171,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, 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, NULL, NULL)<0) { + 0, 0, NULL, NULL)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " @@ -4284,7 +4287,7 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, /* Shut down path */ H5T_print_stats(path, &nprint); path->cdata.command = H5T_CONV_FREE; - if ((path->func)(FAIL, FAIL, &(path->cdata), 0, NULL, NULL)<0) { + if ((path->func)(FAIL, FAIL, &(path->cdata), 0, 0, NULL, NULL)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " @@ -4402,7 +4405,7 @@ H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, "unable to convert between src and dst data types"); } - if (H5T_convert(tpath, src_id, dst_id, nelmts, buf, background)<0) { + if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, buf, background)<0) { HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); } @@ -6399,7 +6402,7 @@ 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, + if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), 0, 0, NULL, NULL)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { @@ -6487,7 +6490,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, "query"); } path->cdata.command = H5T_CONV_INIT; - if ((func)(src_id, dst_id, &(path->cdata), 0, NULL, NULL)<0) { + if ((func)(src_id, dst_id, &(path->cdata), 0, 0, NULL, NULL)<0) { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function"); } @@ -6519,7 +6522,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, } path->cdata.command = H5T_CONV_INIT; if ((H5T_g.soft[i].func) (src_id, dst_id, &(path->cdata), - 0, NULL, NULL)<0) { + 0, 0, NULL, NULL)<0) { HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t)); H5E_clear(); /*ignore the error*/ } else { @@ -6541,7 +6544,7 @@ 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, NULL, NULL)<0) { + if ((table->func)(FAIL, FAIL, &(table->cdata), 0, 0, NULL, NULL)<0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free " @@ -6605,12 +6608,20 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, * Tuesday, December 15, 1998 * * Modifications: - * + * Robb Matzke, 1999-06-16 + * The timers are updated only if H5T debugging is enabled at + * runtime in addition to compile time. + * + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. *------------------------------------------------------------------------- */ herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, - void *buf, void *bkg) + size_t stride, void *buf, void *bkg) { #ifdef H5T_DEBUG H5_timer_t timer; @@ -6619,17 +6630,20 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, FUNC_ENTER(H5T_convert, FAIL); #ifdef H5T_DEBUG - H5_timer_begin(&timer); + if (H5DEBUG(T)) H5_timer_begin(&timer); #endif tpath->cdata.command = H5T_CONV_CONV; - if ((tpath->func)(src_id, dst_id, &(tpath->cdata), nelmts, buf, bkg)<0) { + if ((tpath->func)(src_id, dst_id, &(tpath->cdata), nelmts, stride, buf, + bkg)<0) { HRETURN_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed"); } #ifdef H5T_DEBUG - H5_timer_end(&(tpath->stats.timer), &timer); - tpath->stats.ncalls++; - tpath->stats.nelmts += nelmts; + if (H5DEBUG(T)) { + H5_timer_end(&(tpath->stats.timer), &timer); + tpath->stats.ncalls++; + tpath->stats.nelmts += nelmts; + } #endif FUNC_LEAVE(SUCCEED); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 3d6bcca..7e2a86b 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -126,155 +126,157 @@ static intn interface_initialize_g = 0; */ #define H5T_CONV_sS(S_ALIGN,D_ALIGN,ST,DT) { \ assert(sizeof(ST)<=sizeof(DT)); \ - CI_BEGIN(S_ALIGN, D_ALIGN, ST, DT, nelmts-1, --) { \ - *d = (DT)(*s); \ + CI_BEGIN(S_ALIGN, D_ALIGN, ST, DT, nelmts-1) { \ + *((DT*)d) = (DT)(*((ST*)s)); \ } CI_END; \ } #define H5T_CONV_sU(STYPE,DTYPE,ST,DT) { \ assert(sizeof(ST)<=sizeof(DT)); \ - CI_BEGIN(STYPE, DTYPE, ST, DT, nelmts-1, --) { \ - if (*s<0) { \ + CI_BEGIN(STYPE, DTYPE, ST, DT, nelmts-1) { \ + if (*((ST*)s)<0) { \ if (!H5T_overflow_g || \ (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \ - *d = 0; \ + *((DT*)d) = 0; \ } \ } else { \ - *d = (DT)(*s); \ + *((DT*)d) = (DT)(*((ST*)s)); \ } \ } CI_END; \ } #define H5T_CONV_uS(STYPE,DTYPE,ST,DT,D_MAX) { \ assert(sizeof(ST)<=sizeof(DT)); \ - CI_BEGIN(STYPE, DTYPE, ST, DT, nelmts-1, --) { \ - if (*s > (D_MAX)) { \ + CI_BEGIN(STYPE, DTYPE, ST, DT, nelmts-1) { \ + if (*((ST*)s) > (D_MAX)) { \ if (!H5T_overflow_g || \ (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \ - *d = (D_MAX); \ + *((DT*)d) = (D_MAX); \ } \ } else { \ - *d = (DT)(*s); \ + *((DT*)d) = (DT)(*((ST*)s)); \ } \ } CI_END; \ } #define H5T_CONV_uU(STYPE,DTYPE,ST,DT) { \ assert(sizeof(ST)<=sizeof(DT)); \ - CI_BEGIN(STYPE, DTYPE, ST, DT, nelmts-1, --) { \ - *d = (DT)(*s); \ + CI_BEGIN(STYPE, DTYPE, ST, DT, nelmts-1) { \ + *((DT*)d) = (DT)(*((ST*)s)); \ } CI_END; \ } #define H5T_CONV_Ss(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ assert(sizeof(ST)>=sizeof(DT)); \ - CI_BEGIN(STYPE, DTYPE, ST, DT, 0, ++) { \ - if (*s > (DT)(D_MAX)) { \ + CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \ + if (*((ST*)s) > (DT)(D_MAX)) { \ if (!H5T_overflow_g || \ (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \ - *d = (D_MAX); \ + *((DT*)d) = (D_MAX); \ } \ - } else if (*s < (D_MIN)) { \ + } else if (*((ST*)s) < (D_MIN)) { \ if (!H5T_overflow_g || \ (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \ - *d = (D_MIN); \ + *((DT*)d) = (D_MIN); \ } \ } else { \ - *d = (DT)(*s); \ + *((DT*)d) = (DT)(*((ST*)s)); \ } \ } CI_END; \ } #define H5T_CONV_Su(STYPE,DTYPE,ST,DT,D_MAX) { \ assert(sizeof(ST)>=sizeof(DT)); \ - CI_BEGIN(STYPE, DTYPE, ST, DT, 0, ++) { \ - if (*s < 0) { \ + CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \ + if (*((ST*)s) < 0) { \ if (!H5T_overflow_g || \ (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \ - *d = 0; \ + *((DT*)d) = 0; \ } \ - } else if (sizeof(ST)>sizeof(DT) && *s>(D_MAX)) { \ + } else if (sizeof(ST)>sizeof(DT) && *((ST*)s)>(D_MAX)) { \ /*sign vs. unsign ok in previous line*/ \ if (!H5T_overflow_g || \ (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \ - *d = (D_MAX); \ + *((DT*)d) = (D_MAX); \ } \ } else { \ - *d = (DT)(*s); \ + *((DT*)d) = (DT)(*((ST*)s)); \ } \ } CI_END; \ } #define H5T_CONV_Us(STYPE,DTYPE,ST,DT,D_MAX) { \ assert(sizeof(ST)>=sizeof(DT)); \ - CI_BEGIN(STYPE, DTYPE, ST, DT, 0, ++) { \ - if (*s > (D_MAX)) { \ + CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \ + if (*((ST*)s) > (D_MAX)) { \ if (!H5T_overflow_g || \ (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \ - *d = (D_MAX); \ + *((DT*)d) = (D_MAX); \ } \ } else { \ - *d = (DT)(*s); \ + *((DT*)d) = (DT)(*s); \ } \ } CI_END; \ } #define H5T_CONV_Uu(STYPE,DTYPE,ST,DT,D_MAX) { \ assert(sizeof(ST)>=sizeof(DT)); \ - CI_BEGIN(STYPE, DTYPE, ST, DT, 0, ++) { \ - if (*s > (D_MAX)) { \ + CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \ + if (*((ST*)s) > (D_MAX)) { \ if (!H5T_overflow_g || \ (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \ - *d = (D_MAX); \ + *((DT*)d) = (D_MAX); \ } \ } else { \ - *d = (DT)(*s); \ + *((DT*)d) = (DT)(*((ST*)s)); \ } \ } CI_END; \ } #define H5T_CONV_su(STYPE,DTYPE,ST,DT) { \ assert(sizeof(ST)==sizeof(DT)); \ - CI_BEGIN(STYPE, DTYPE, ST, DT, 0, ++) { \ - if (*s < 0) { \ + CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \ + if (*((ST*)s) < 0) { \ if (!H5T_overflow_g || \ (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \ - *d = 0; \ + *((DT*)d) = 0; \ } \ } else { \ - *d = (DT)(*s); \ + *((DT*)d) = (DT)(*((ST*)s)); \ } \ } CI_END; \ } #define H5T_CONV_us(STYPE,DTYPE,ST,DT,D_MAX) { \ assert(sizeof(ST)==sizeof(DT)); \ - CI_BEGIN(STYPE, DTYPE, ST, DT, 0, ++) { \ - if (*s > (D_MAX)) { \ + CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \ + if (*((ST*)s) > (D_MAX)) { \ if (!H5T_overflow_g || \ (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \ - *d = (D_MAX); \ + *((DT*)d) = (D_MAX); \ } \ } else { \ - *d = (DT)(*s); \ + *((DT*)d) = (DT)(*((ST*)s)); \ } \ } CI_END; \ } /* The first part of every integer hardware conversion macro */ -#define CI_BEGIN(STYPE,DTYPE,ST,DT,STRT,DIR) { \ +#define CI_BEGIN(STYPE,DTYPE,ST,DT,STRT) { \ size_t elmtno; /*element number */ \ - ST *src, *s; /*source buffer */ \ - DT *dst, *d; /*destination buffer */ \ + uint8_t *src, *s; /*source buffer */ \ + uint8_t *dst, *d; /*destination buffer */ \ H5T_t *st, *dt; /*data type descriptors */ \ long_long aligned; /*largest integer type, aligned */ \ hbool_t s_mv, d_mv; /*move data to align it? */ \ size_t dt_size=sizeof(DT); /*needed by CI_END macro */ \ H5T_conv_hw_t *priv = cdata->priv; /*private data */ \ - char *nonaligned; /*temporary char pointer */ \ + size_t s_stride, d_stride; /*src and dst strides */ \ + int direction; /*1=left-to-right, -1=rt-to-lt */ \ \ switch (cdata->command) { \ case H5T_CONV_INIT: \ + /* Sanity check and initialize statistics */ \ cdata->need_bkg = H5T_BKG_NO; \ if (NULL==(st=H5I_object(src_id)) || \ NULL==(dt=H5I_object(dst_id))) { \ @@ -290,40 +292,66 @@ static intn interface_initialize_g = 0; "memory allocation failed"); \ } \ break; \ + \ case H5T_CONV_FREE: \ + /* Print and free statistics */ \ CI_PRINT_STATS(STYPE,DTYPE); \ cdata->priv = H5MM_xfree(cdata->priv); \ break; \ + \ case H5T_CONV_CONV: \ - src = (ST*)buf+(STRT); \ - dst = (DT*)buf+(STRT); \ + /* Initialize pointers */ \ + if (stride) { \ + s_stride = d_stride = stride; \ + src = dst = buf; \ + direction = 1; \ + } else if (STRT) { \ + s_stride = sizeof(ST); \ + d_stride = sizeof(DT); \ + src = (uint8_t*)buf+(STRT)*s_stride; \ + dst = (uint8_t*)buf+(STRT)*d_stride; \ + direction = -1; \ + } else { \ + s_stride = sizeof(ST); \ + d_stride = sizeof(DT); \ + src = dst = buf; \ + direction = 1; \ + } \ + \ + /* Is alignment required for source or dest? */ \ s_mv = H5T_NATIVE_##STYPE##_ALIGN_g>1 && \ ((size_t)buf%H5T_NATIVE_##STYPE##_ALIGN_g || \ - sizeof(ST)%H5T_NATIVE_##STYPE##_ALIGN_g); \ + s_stride%H5T_NATIVE_##STYPE##_ALIGN_g); \ d_mv = H5T_NATIVE_##DTYPE##_ALIGN_g>1 && \ ((size_t)buf%H5T_NATIVE_##DTYPE##_ALIGN_g || \ - sizeof(DT)%H5T_NATIVE_##DTYPE##_ALIGN_g); \ + d_stride%H5T_NATIVE_##DTYPE##_ALIGN_g); \ if (s_mv) priv->s_aligned += nelmts; \ if (d_mv) priv->d_aligned += nelmts; \ - for (elmtno=0; elmtnotype) { case H5T_INTEGER: + case H5T_BITFIELD: /* nothing to check */ break; @@ -475,7 +510,7 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } md = src->size / 2; - for (i=0; isize) { + for (i=0; isize) { for (j=0; jsize-(j+1)]; @@ -507,12 +542,16 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * Thursday, May 20, 1999 * * Modifications: - * + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. *------------------------------------------------------------------------- */ herr_t H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, - void *_buf, void UNUSED *background) + size_t stride, void *_buf, void UNUSED *background) { uint8_t *buf = (uint8_t*)_buf; H5T_t *src=NULL, *dst=NULL; /*source and dest data types */ @@ -566,7 +605,7 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * how many of the elements have the source and destination areas * overlapping? */ - if (src->size==dst->size) { + if (src->size==dst->size || stride) { sp = dp = (uint8_t*)buf; direction = 1; olap = nelmts; @@ -691,8 +730,13 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * should copy the value to the true destination buffer. */ if (d==dbuf) HDmemcpy (dp, d, dst->size); - sp += direction * src->size; - dp += direction * dst->size; + if (stride) { + sp += direction * stride; + dp += direction * stride; + } else { + sp += direction * src->size; + dp += direction * dst->size; + } } break; @@ -871,23 +915,24 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) FUNC_LEAVE (SUCCEED); } -/*------------------------------------------------------------------------- +/*------------------------------------------------------------------------- * Function: H5T_conv_struct * * Purpose: Converts between compound data types. This is a soft * conversion function. The algorithm is basically: * - * For I=1..NUM_MEMBERS do - * If sizeof detination type <= sizeof source type then - * Convert member to destination type; - * Move member as far left as possible; + * For each element do + * For I=1..NELMTS do + * If sizeof detination type <= sizeof source type then + * Convert member to destination type; + * Move member as far left as possible; * - * For I=NUM_MEMBERS..1 do - * If not destination type then - * Convert member to destination type; - * Move member to correct position in BACKGROUND + * For I=NELMTS..1 do + * If not destination type then + * Convert member to destination type; + * Move member to correct position in BKG * - * Copy BACKGROUND to BUF + * Copy BKG to BUF * * Return: Non-negative on success/Negative on failure * @@ -895,12 +940,16 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) * Thursday, January 22, 1998 * * Modifications: - * + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. *------------------------------------------------------------------------- */ herr_t H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, - void *_buf, void *_bkg) + size_t stride, void *_buf, void *_bkg) { uint8_t *buf = (uint8_t *)_buf; /*cast for pointer arithmetic */ uint8_t *bkg = (uint8_t *)_bkg; /*background pointer arithmetic */ @@ -981,7 +1030,9 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Direction of conversion. */ - if (dst->size <= src->size) { + if (stride) { + src_delta = dst_delta = stride; + } else if (dst->size <= src->size) { src_delta = src->size; dst_delta = dst->size; } else { @@ -1010,6 +1061,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, priv->src_memb_id[i], priv->dst_memb_id[src2dst[i]], priv->memb_nelmts[i], + 0, /*no striding*/ buf + src_memb->offset, bkg + dst_memb->offset)<0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, @@ -1044,6 +1096,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, priv->src_memb_id[i], priv->dst_memb_id[src2dst[i]], priv->memb_nelmts[i], + 0, /*no striding*/ buf+offset, bkg+dst_memb->offset)<0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type " @@ -1079,6 +1132,252 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, FUNC_LEAVE (SUCCEED); } + +/*------------------------------------------------------------------------- + * Function: H5T_conv_struct_opt + * + * Purpose: Converts between compound data types in a manner more + * efficient than the general-purpose H5T_conv_struct() + * function. This function isn't applicable if the destination + * is larger than the source type. This is a soft conversion + * function. The algorithm is basically: + * + * For each member of the struct + * If sizeof detination type <= sizeof source type then + * Convert member to destination type for all elements + * Move member as far left as possible for all elements + * + * For each member of the struct (in reverse order) + * If not destination type then + * Convert member to destination type for all elements + * Move member to correct position in BKG for all elements + * + * Copy BKG to BUF for all elements + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Thursday, January 22, 1998 + * + * Modifications: + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. + * + * Robb Matzke, 1999-06-16 + * If the source and destination data structs are the same size + * then we can convert on a field-by-field basis instead of an + * element by element basis. In other words, for all struct + * elements being converted by this function call, first convert + * all of the field1's, then all field2's, etc. This can + * drastically reduce the number of calls to H5T_convert() and + * thereby eliminate most of the conversion constant overhead. + *------------------------------------------------------------------------- + */ +herr_t +H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t stride, void *_buf, void *_bkg) +{ + uint8_t *buf = (uint8_t *)_buf; /*cast for pointer arithmetic */ + uint8_t *bkg = (uint8_t *)_bkg; /*background pointer arithmetic */ + uint8_t *xbuf = NULL; /*temporary pointer into `buf' */ + uint8_t *xbkg = NULL; /*temporary pointer into `bkg' */ + H5T_t *src = NULL; /*source data type */ + H5T_t *dst = NULL; /*destination data type */ + intn *src2dst = NULL; /*maps src member to dst member */ + H5T_cmemb_t *src_memb = NULL; /*source struct member descript.*/ + H5T_cmemb_t *dst_memb = NULL; /*destination struct memb desc. */ + size_t src_memb_size; /*sizeof single source member */ + size_t dst_memb_size; /*sizeof single destination memb*/ + size_t offset; /*byte offset wrt struct */ + uintn elmtno; /*element counter */ + intn i, j; /*counters */ + H5T_conv_struct_t *priv = (H5T_conv_struct_t *)(cdata->priv); + + FUNC_ENTER (H5T_conv_struct_opt, FAIL); + + switch (cdata->command) { + case H5T_CONV_INIT: + /* + * First, determine if this conversion function applies to the + * conversion path SRC_ID-->DST_ID. If not, return failure; + * otherwise initialize the `priv' field of `cdata' with information + * that remains (almost) constant for this conversion path. + */ + if (H5I_DATATYPE != H5I_get_type(src_id) || + NULL == (src = H5I_object(src_id)) || + H5I_DATATYPE != H5I_get_type(dst_id) || + NULL == (dst = H5I_object(dst_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + } + assert (H5T_COMPOUND==src->type); + assert (H5T_COMPOUND==dst->type); + + /* + * This optimized version only works when the source and destination + * datatypes are the same size. + */ + if (src->size < dst->size) { + HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "conversion is unsupported by this function"); + } + + /* Initialize data which is relatively constant */ + if (H5T_conv_struct_init (src, dst, cdata)<0) { + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, + "unable to initialize conversion data"); + } + break; + + case H5T_CONV_FREE: + /* + * Free the private conversion data. + */ + H5MM_xfree(priv->src2dst); + H5MM_xfree(priv->src_memb_id); + H5MM_xfree(priv->dst_memb_id); + H5MM_xfree(priv->memb_path); + H5MM_xfree(priv->memb_nelmts); + cdata->priv = priv = H5MM_xfree (priv); + break; + + case H5T_CONV_CONV: + /* + * Conversion. + */ + if (H5I_DATATYPE != H5I_get_type(src_id) || + NULL == (src = H5I_object(src_id)) || + H5I_DATATYPE != H5I_get_type(dst_id) || + NULL == (dst = H5I_object(dst_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + } + assert(src->size>=dst->size); + assert(priv); + assert(bkg && cdata->need_bkg>=H5T_BKG_TEMP); + + if (cdata->recalc && + H5T_conv_struct_init (src, dst, cdata)<0) { + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, + "unable to initialize conversion data"); + } + + /* + * Insure that members are sorted. + */ + H5T_sort_value(src, NULL); + H5T_sort_value(dst, NULL); + src2dst = priv->src2dst; + + /* + * For each member where the destination is not larger than the + * source, stride through all the elements converting only that + * member in each element. + * + * Shift struct member (converted or not) as far left as possible + * within each element. + */ + for (i=0, offset=0; iu.compnd.nmembs; i++) { + if (src2dst[i]<0) continue; + src_memb = src->u.compnd.memb + i; + dst_memb = dst->u.compnd.memb + src2dst[i]; + src_memb_size = src_memb->size / priv->memb_nelmts[i]; + dst_memb_size = dst_memb->size / priv->memb_nelmts[i]; + + for (j=0; j<(intn)(priv->memb_nelmts[i]); j++) { + if (dst_memb_size <= src_memb_size) { + xbuf = buf + src_memb->offset + j*src_memb_size; + xbkg = bkg + dst_memb->offset + j*dst_memb_size; + if (H5T_convert(priv->memb_path[i], + priv->src_memb_id[i], + priv->dst_memb_id[src2dst[i]], + nelmts, + stride?stride:src->size, + xbuf, xbkg)<0) { + HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, + "unable to convert compound data " + "type member"); + } + for (xbuf=buf, elmtno=0; elmtnooffset+j*src_memb_size, + dst_memb_size); + xbuf += stride ? stride : src->size; + } + offset += dst_memb_size; + } else { + for (xbuf=buf, elmtno=0; elmtnooffset+j*src_memb_size, + src_memb_size); + xbuf += stride ? stride : src->size; + } + offset += src_memb_size; + } + } + } + + /* + * Work from right to left, converting those members that weren't + * converted in the previous loop -- those members where the + * destination is larger than the source. + * + * Move the member (converted in this loop or not) to the final + * position in the bkg buffer. + */ + for (i=src->u.compnd.nmembs-1; i>=0; --i) { + if (src2dst[i]<0) continue; + src_memb = src->u.compnd.memb + i; + dst_memb = dst->u.compnd.memb + src2dst[i]; + src_memb_size = src_memb->size / priv->memb_nelmts[i]; + dst_memb_size = dst_memb->size / priv->memb_nelmts[i]; + + for (j=priv->memb_nelmts[i]-1; j>=0; --j) { + if (dst_memb_size > src_memb_size) { + offset -= src_memb_size; + xbuf = buf + offset; + xbkg = bkg + dst_memb->offset + j*dst_memb_size; + if (H5T_convert(priv->memb_path[i], + priv->src_memb_id[i], + priv->dst_memb_id[src2dst[i]], + nelmts, stride?stride:src->size, + xbuf, xbkg)<0) { + HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, + "unable to convert compound data " + "type member"); + } + } else { + offset -= dst_memb_size; + xbuf = buf + offset; + xbkg = bkg + dst_memb->offset + j*dst_memb_size; + } + + for (elmtno=0; elmtnosize; + xbkg += stride ? stride : dst->size; + } + } + } + + /* Move background into buffer */ + for (xbuf=buf, xbkg=bkg, elmtno=0; elmtnosize); + xbuf += stride ? stride : dst->size; + xbkg += stride ? stride : dst->size; + } + break; + + default: + /* Some other command we don't know about yet.*/ + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "unknown conversion command"); + } + + FUNC_LEAVE (SUCCEED); +} + /*------------------------------------------------------------------------- * Function: H5T_conv_enum_init @@ -1237,12 +1536,16 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) * Monday, January 4, 1999 * * Modifications: - * + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. *------------------------------------------------------------------------- */ herr_t -H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *_buf, void UNUSED *bkg) +H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t stride, void *_buf, void UNUSED *bkg) { uint8_t *buf = (uint8_t*)_buf; /*cast for pointer arithmetic */ H5T_t *src=NULL, *dst=NULL; /*src and dst data types */ @@ -1313,7 +1616,10 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /* * Direction of conversion. */ - if (dst->size <= src->size) { + if (stride) { + src_delta = dst_delta = stride; + s = d = buf; + } else if (dst->size <= src->size) { src_delta = (int)src->size; /*overflow shouldn't be possible*/ dst_delta = (int)dst->size; /*overflow shouldn't be possible*/ s = d = buf; @@ -1389,15 +1695,17 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * Function: H5T_conv_vlen * * Purpose: Converts between VL data types in memory and on disk. - * This is a soft conversion function. The algorithm is basically: - * - * For every VL struct in the main buffer: - * Allocate space for temporary dst VL data (reuse buffer if possible) - * Copy VL data from src buffer into dst buffer - * Convert VL data into dst representation - * Allocate buffer in dst heap - * Write dst VL data into dst heap - * Store (heap ID or pointer) and length in main dst buffer + * This is a soft conversion function. The algorithm is + * basically: + * + * For every VL struct in the main buffer: + * 1. Allocate space for temporary dst VL data (reuse buffer + * if possible) + * 2. Copy VL data from src buffer into dst buffer + * 3. Convert VL data into dst representation + * 4. Allocate buffer in dst heap + * 5. Write dst VL data into dst heap + * 6. Store (heap ID or pointer) and length in main dst buffer * * Return: Non-negative on success/Negative on failure * @@ -1410,27 +1718,41 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, - void *_buf, void UNUSED *_bkg) + size_t stride, void *_buf, void UNUSED *_bkg) { - H5T_path_t *tpath; /* Type conversion path */ - hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */ - H5T_t *src = NULL; /*source data type */ - H5T_t *dst = NULL; /*destination data type */ - size_t olap; /*num overlapping elements */ - uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t **dptr; /* Pointer to correct destination pointer */ - size_t src_delta, dst_delta; /*source & destination stride */ - hsize_t seq_len; /* The number of elements in the current sequence */ - size_t src_base_size, dst_base_size; /*source & destination base size */ - size_t src_size, dst_size; /*source & destination total size in bytes */ - hid_t conv_buf_id; /* ID for comversion buffer */ - void *conv_buf_ptr; /* Temporary conversion buffer */ - hsize_t conv_buf_size; /* Size of conversion buffer in bytes */ - uint8_t dbuf[64],*dbuf_ptr=dbuf; /*temp destination buffer */ - intn direction; /*direction of traversal */ - uintn elmtno; + H5T_path_t *tpath; /* Type conversion path */ + hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */ + H5T_t *src = NULL; /*source data type */ + H5T_t *dst = NULL; /*destination data type */ + size_t olap; /*num overlapping elements */ + uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs */ + uint8_t **dptr; /*pointer to correct destination pointer*/ + size_t src_delta, dst_delta; /*source & destination stride */ + hsize_t seq_len; /*the number of elements in the current sequence*/ + size_t src_base_size, dst_base_size;/*source & destination base size*/ + size_t src_size, dst_size;/*source & destination total size in bytes*/ + hid_t conv_buf_id; /*ID for comversion buffer */ + void *conv_buf_ptr; /*temporary conversion buffer */ + hsize_t conv_buf_size; /*size of conversion buffer in bytes */ + uint8_t dbuf[64],*dbuf_ptr=dbuf;/*temp destination buffer */ + intn direction; /*direction of traversal */ + uintn elmtno; /*element number counter */ + + FUNC_ENTER (H5T_conv_vlen, FAIL); - FUNC_ENTER (H5T_conv_struct, FAIL); +#ifndef LATER + /* + * If `stride' is non-zero then stride through memory converting one + * element in place at each memory location; otherwise assume that the + * source and destination buffers are packed. + * + * Quincey, I'll let you implement this since this routine is probably + * changing, otherwise let me know when you're done working on it and + * I'll implement it like H5T_conv_struct(). I also added a `0' to the + * argument list for the H5T_convert() call below. --rpm 1999-06-16 + */ + assert(0==stride); +#endif switch (cdata->command) { case H5T_CONV_INIT: @@ -1546,7 +1868,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HRETURN_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data"); /* Convert VL sequence */ - if (H5T_convert(tpath, tsrc_id, tdst_id, seq_len, conv_buf_ptr, NULL)<0) + if (H5T_convert(tpath, tsrc_id, tdst_id, seq_len, 0, conv_buf_ptr, NULL)<0) HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); /* Allocate new VL buffer */ @@ -1605,15 +1927,19 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * Wednesday, June 10, 1998 * * Modifications: - * - * Robb Matzke, 7 Jul 1998 - * Added overflow handling. - * + * Robb Matzke, 7 Jul 1998 + * Added overflow handling. + * + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. *------------------------------------------------------------------------- */ herr_t -H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) +H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t stride, void *buf, void UNUSED *bkg) { H5T_t *src = NULL; /*source data type */ H5T_t *dst = NULL; /*destination data type */ @@ -1671,7 +1997,7 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * how many of the elements have the source and destination areas * overlapping? */ - if (src->size==dst->size) { + if (src->size==dst->size || stride) { sp = dp = (uint8_t*)buf; direction = 1; olap = nelmts; @@ -1936,8 +2262,13 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * should copy the value to the true destination buffer. */ if (d==dbuf) HDmemcpy (dp, d, dst->size); - sp += direction * src->size; - dp += direction * dst->size; + if (stride) { + sp += direction * stride; + dp += direction * stride; + } else { + sp += direction * src->size; + dp += direction * dst->size; + } } break; @@ -1964,15 +2295,19 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * Tuesday, June 23, 1998 * * Modifications: - * - * Robb Matzke, 7 Jul 1998 - * Added overflow handling. - * + * Robb Matzke, 7 Jul 1998 + * Added overflow handling. + * + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. *------------------------------------------------------------------------- */ herr_t -H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) +H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t stride, void *buf, void UNUSED *bkg) { /* Traversal-related variables */ H5T_t *src_p; /*source data type */ @@ -2051,7 +2386,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * how many of the elements have the source and destination areas * overlapping? */ - if (src_p->size==dst_p->size) { + if (src_p->size==dst_p->size || stride) { sp = dp = (uint8_t*)buf; direction = 1; olap = nelmts; @@ -2341,8 +2676,13 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ next: if (d==dbuf) HDmemcpy (dp, d, dst_p->size); - sp += direction * src_p->size; - dp += direction * dst_p->size; + if (stride) { + sp += direction * stride; + dp += direction * stride; + } else { + sp += direction * src_p->size; + dp += direction * dst_p->size; + } } break; @@ -2367,12 +2707,16 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * Friday, August 7, 1998 * * Modifications: - * + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. *------------------------------------------------------------------------- */ herr_t H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, - void *buf, void UNUSED *bkg) + size_t stride, void *buf, void UNUSED *bkg) { H5T_t *src=NULL; /*source data type */ H5T_t *dst=NULL; /*destination data type */ @@ -2430,7 +2774,7 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * how many of the elements have the source and destination areas * overlapping? */ - if (src->size==dst->size) { + if (src->size==dst->size || stride) { /* * When the source and destination are the same size we can do * all the conversions in place. @@ -2475,7 +2819,7 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ - if (src->size==dst->size) { + if (src->size==dst->size || stride) { assert(s==d); } else if (d==dbuf) { assert((dp>=sp && dpsize) || @@ -2567,8 +2911,13 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * should copy the value to the true destination buffer. */ if (d==dbuf) HDmemcpy(dp, d, dst->size); - sp += direction * src->size; - dp += direction * dst->size; + if (stride) { + sp += direction * stride; + dp += direction * stride; + } else { + sp += direction * src->size; + dp += direction * dst->size; + } } break; @@ -2602,7 +2951,7 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ herr_t H5T_conv_schar_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_schar_uchar, FAIL); H5T_CONV_su(SCHAR, UCHAR, @@ -2629,7 +2978,7 @@ H5T_conv_schar_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uchar_schar, FAIL); H5T_CONV_us(UCHAR, SCHAR, @@ -2657,7 +3006,7 @@ H5T_conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_schar_short, FAIL); H5T_CONV_sS(SCHAR, SHORT, @@ -2684,7 +3033,8 @@ H5T_conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_schar_ushort, FAIL); H5T_CONV_sU(SCHAR, USHORT, @@ -2711,7 +3061,7 @@ H5T_conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uchar_short, FAIL); H5T_CONV_uS(UCHAR, SHORT, @@ -2739,7 +3089,8 @@ H5T_conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uchar_ushort, FAIL); H5T_CONV_uU(UCHAR, USHORT, @@ -2766,7 +3117,7 @@ H5T_conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_schar_int, FAIL); H5T_CONV_sS(SCHAR, INT, @@ -2793,7 +3144,7 @@ H5T_conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_schar_uint, FAIL); H5T_CONV_sU(SCHAR, UINT, @@ -2820,7 +3171,7 @@ H5T_conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uchar_int, FAIL); H5T_CONV_uS(UCHAR, INT, @@ -2848,7 +3199,7 @@ H5T_conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uchar_uint, FAIL); H5T_CONV_uU(UCHAR, UINT, @@ -2875,7 +3226,7 @@ H5T_conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_schar_long, FAIL); H5T_CONV_sS(SCHAR, LONG, @@ -2902,7 +3253,7 @@ H5T_conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_schar_ulong, FAIL); H5T_CONV_sU(SCHAR, ULONG, @@ -2929,7 +3280,7 @@ H5T_conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uchar_long, FAIL); H5T_CONV_uS(UCHAR, LONG, @@ -2957,7 +3308,7 @@ H5T_conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uchar_ulong, FAIL); H5T_CONV_uU(UCHAR, ULONG, @@ -2984,7 +3335,7 @@ H5T_conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_schar_llong, FAIL); H5T_CONV_sS(SCHAR, LLONG, @@ -3011,7 +3362,8 @@ H5T_conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_schar_ullong, FAIL); H5T_CONV_sU(SCHAR, ULLONG, @@ -3038,7 +3390,7 @@ H5T_conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uchar_llong, FAIL); H5T_CONV_uS(UCHAR, LLONG, @@ -3066,7 +3418,8 @@ H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uchar_ullong, FAIL); H5T_CONV_uU(UCHAR, ULLONG, @@ -3093,7 +3446,7 @@ H5T_conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_short_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_short_schar, FAIL); H5T_CONV_Ss(SHORT, SCHAR, @@ -3121,7 +3474,7 @@ H5T_conv_short_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_short_uchar, FAIL); H5T_CONV_Su(SHORT, UCHAR, @@ -3149,7 +3502,8 @@ H5T_conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ushort_schar, FAIL); H5T_CONV_Us(USHORT, SCHAR, @@ -3177,7 +3531,8 @@ H5T_conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ushort_uchar, FAIL); H5T_CONV_Uu(USHORT, UCHAR, @@ -3205,7 +3560,8 @@ H5T_conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_short_ushort, FAIL); H5T_CONV_su(SHORT, USHORT, @@ -3232,7 +3588,8 @@ H5T_conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ushort_short, FAIL); H5T_CONV_us(USHORT, SHORT, @@ -3260,7 +3617,7 @@ H5T_conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_short_int, FAIL); H5T_CONV_sS(SHORT, INT, @@ -3287,7 +3644,7 @@ H5T_conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_short_uint, FAIL); H5T_CONV_sU(SHORT, UINT, @@ -3314,7 +3671,7 @@ H5T_conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ushort_int, FAIL); H5T_CONV_uS(USHORT, INT, @@ -3342,7 +3699,7 @@ H5T_conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ushort_uint, FAIL); H5T_CONV_uU(USHORT, UINT, @@ -3369,7 +3726,7 @@ H5T_conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_short_long, FAIL); H5T_CONV_sS(SHORT, LONG, @@ -3396,7 +3753,7 @@ H5T_conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_short_ulong, FAIL); H5T_CONV_sU(SHORT, ULONG, @@ -3423,7 +3780,7 @@ H5T_conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ushort_long, FAIL); H5T_CONV_uS(USHORT, LONG, @@ -3451,7 +3808,8 @@ H5T_conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ushort_ulong, FAIL); H5T_CONV_uU(USHORT, ULONG, @@ -3478,7 +3836,7 @@ H5T_conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_short_llong, FAIL); H5T_CONV_sS(SHORT, LLONG, @@ -3505,7 +3863,8 @@ H5T_conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_short_ullong, FAIL); H5T_CONV_sU(SHORT, ULLONG, @@ -3532,7 +3891,8 @@ H5T_conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ushort_llong, FAIL); H5T_CONV_uS(USHORT, LLONG, @@ -3560,7 +3920,8 @@ H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ushort_ullong, FAIL); H5T_CONV_uU(USHORT, ULLONG, @@ -3587,7 +3948,7 @@ H5T_conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_int_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_int_schar, FAIL); H5T_CONV_Ss(INT, SCHAR, @@ -3615,7 +3976,7 @@ H5T_conv_int_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_int_uchar, FAIL); H5T_CONV_Su(INT, UCHAR, @@ -3643,7 +4004,7 @@ H5T_conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uint_schar, FAIL); H5T_CONV_Us(UINT, SCHAR, @@ -3671,7 +4032,7 @@ H5T_conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uint_uchar, FAIL); H5T_CONV_Uu(UINT, UCHAR, @@ -3699,7 +4060,7 @@ H5T_conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_int_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_int_short, FAIL); H5T_CONV_Ss(INT, SHORT, @@ -3727,7 +4088,7 @@ H5T_conv_int_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_int_ushort, FAIL); H5T_CONV_Su(INT, USHORT, @@ -3755,7 +4116,7 @@ H5T_conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uint_short, FAIL); H5T_CONV_Us(UINT, SHORT, @@ -3783,7 +4144,7 @@ H5T_conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uint_ushort, FAIL); H5T_CONV_Uu(UINT, USHORT, @@ -3811,7 +4172,7 @@ H5T_conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_int_uint, FAIL); H5T_CONV_su(INT, UINT, @@ -3838,7 +4199,7 @@ H5T_conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uint_int, FAIL); H5T_CONV_us(UINT, INT, @@ -3866,7 +4227,7 @@ H5T_conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_int_long, FAIL); H5T_CONV_sS(INT, LONG, @@ -3893,7 +4254,7 @@ H5T_conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_int_ulong, FAIL); H5T_CONV_sU(INT, LONG, @@ -3920,7 +4281,7 @@ H5T_conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uint_long, FAIL); H5T_CONV_uS(UINT, LONG, @@ -3948,7 +4309,7 @@ H5T_conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uint_ulong, FAIL); H5T_CONV_uU(UINT, ULONG, @@ -3975,7 +4336,7 @@ H5T_conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_int_llong, FAIL); H5T_CONV_sS(INT, LLONG, @@ -4002,7 +4363,7 @@ H5T_conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_int_ullong, FAIL); H5T_CONV_sU(INT, ULLONG, @@ -4029,7 +4390,7 @@ H5T_conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uint_llong, FAIL); H5T_CONV_uS(UINT, LLONG, @@ -4057,7 +4418,7 @@ H5T_conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_uint_ullong, FAIL); H5T_CONV_uU(UINT, ULLONG, @@ -4084,7 +4445,7 @@ H5T_conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_long_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_long_schar, FAIL); H5T_CONV_Ss(LONG, SCHAR, @@ -4112,7 +4473,7 @@ H5T_conv_long_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_long_uchar, FAIL); H5T_CONV_Su(LONG, UCHAR, @@ -4140,7 +4501,7 @@ H5T_conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ulong_schar, FAIL); H5T_CONV_Us(ULONG, SCHAR, @@ -4168,7 +4529,7 @@ H5T_conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ulong_uchar, FAIL); H5T_CONV_Uu(ULONG, UCHAR, @@ -4196,7 +4557,7 @@ H5T_conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_long_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_long_short, FAIL); H5T_CONV_Ss(LONG, SHORT, @@ -4224,7 +4585,7 @@ H5T_conv_long_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_long_ushort, FAIL); H5T_CONV_Su(LONG, USHORT, @@ -4252,7 +4613,7 @@ H5T_conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ulong_short, FAIL); H5T_CONV_Us(ULONG, SHORT, @@ -4280,7 +4641,8 @@ H5T_conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ulong_ushort, FAIL); H5T_CONV_Uu(ULONG, USHORT, @@ -4308,7 +4670,7 @@ H5T_conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_long_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_long_int, FAIL); H5T_CONV_Ss(LONG, INT, @@ -4336,7 +4698,7 @@ H5T_conv_long_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_long_uint, FAIL); H5T_CONV_Su(LONG, UINT, @@ -4364,7 +4726,7 @@ H5T_conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ulong_int, FAIL); H5T_CONV_Us(ULONG, INT, @@ -4392,7 +4754,7 @@ H5T_conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ulong_uint, FAIL); H5T_CONV_Uu(ULONG, UINT, @@ -4420,7 +4782,7 @@ H5T_conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_long_ulong, FAIL); H5T_CONV_su(LONG, ULONG, @@ -4447,7 +4809,7 @@ H5T_conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ulong_long, FAIL); H5T_CONV_us(ULONG, LONG, @@ -4475,7 +4837,7 @@ H5T_conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_long_llong, FAIL); H5T_CONV_sS(LONG, LLONG, @@ -4502,7 +4864,7 @@ H5T_conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_long_ullong, FAIL); H5T_CONV_sU(LONG, ULLONG, @@ -4529,7 +4891,7 @@ H5T_conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_long_llong, FAIL); H5T_CONV_uS(ULONG, LLONG, @@ -4557,7 +4919,8 @@ H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ulong_ullong, FAIL); H5T_CONV_uU(ULONG, ULLONG, @@ -4584,7 +4947,7 @@ H5T_conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_llong_schar, FAIL); H5T_CONV_Ss(LLONG, SCHAR, @@ -4612,7 +4975,7 @@ H5T_conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_llong_uchar, FAIL); H5T_CONV_Su(LLONG, UCHAR, @@ -4640,7 +5003,8 @@ H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ullong_schar, FAIL); H5T_CONV_Us(ULLONG, SCHAR, @@ -4668,7 +5032,7 @@ H5T_conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ullong_uchar, FAIL); H5T_CONV_Uu(ULLONG, UCHAR, @@ -4696,7 +5060,7 @@ H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_llong_short, FAIL); H5T_CONV_Ss(LLONG, SHORT, @@ -4724,7 +5088,8 @@ H5T_conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_llong_ushort, FAIL); H5T_CONV_Su(LLONG, USHORT, @@ -4752,7 +5117,8 @@ H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ullong_short, FAIL); H5T_CONV_Us(ULLONG, SHORT, @@ -4780,7 +5146,8 @@ H5T_conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ullong_ushort, FAIL); H5T_CONV_Uu(ULLONG, USHORT, @@ -4808,7 +5175,7 @@ H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_llong_int, FAIL); H5T_CONV_Ss(LLONG, INT, @@ -4836,7 +5203,7 @@ H5T_conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_llong_uint, FAIL); H5T_CONV_Su(LLONG, UINT, @@ -4864,7 +5231,7 @@ H5T_conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ullong_int, FAIL); H5T_CONV_Us(ULLONG, INT, @@ -4892,7 +5259,7 @@ H5T_conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ullong_uint, FAIL); H5T_CONV_Uu(ULLONG, UINT, @@ -4920,7 +5287,7 @@ H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_llong_long, FAIL); H5T_CONV_Ss(LLONG, LONG, @@ -4948,7 +5315,7 @@ H5T_conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_llong_ulong, FAIL); H5T_CONV_Su(LLONG, ULONG, @@ -4976,7 +5343,7 @@ H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ullong_long, FAIL); H5T_CONV_Us(ULLONG, LONG, @@ -5004,7 +5371,8 @@ H5T_conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ullong_ulong, FAIL); H5T_CONV_Uu(ULLONG, ULONG, @@ -5032,7 +5400,8 @@ H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_llong_ullong, FAIL); H5T_CONV_su(LLONG, ULLONG, @@ -5059,7 +5428,8 @@ H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, */ herr_t H5T_conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { FUNC_ENTER(H5T_conv_ullong_llong, FAIL); H5T_CONV_us(ULLONG, LLONG, @@ -5081,16 +5451,21 @@ H5T_conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * Tuesday, June 23, 1998 * * Modifications: - * + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. *------------------------------------------------------------------------- */ herr_t H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { size_t elmtno; /*element number */ - float *src, *s; /*source buffer */ - double *dst, *d; /*destination buffer */ + uint8_t *src, *s; /*source buffer */ + uint8_t *dst, *d; /*destination buffer */ H5T_t *st, *dt; /*type descriptors */ hbool_t src_mv, dst_mv; /*align data? */ double aligned; /*aligned data */ @@ -5122,41 +5497,56 @@ H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, break; case H5T_CONV_CONV: - src = (float*)buf + nelmts-1; - dst = (double*)buf + nelmts-1; - + if (stride) { + src = dst = (uint8_t*)buf + stride*(nelmts-1); + } else { + src = (uint8_t*)buf + sizeof(float)*(nelmts-1); + dst = (uint8_t*)buf + sizeof(double)*(nelmts-1); + } + /* Need alignment? */ if (H5T_NATIVE_FLOAT_ALIGN_g>1) { src_mv = ((size_t)buf % H5T_NATIVE_FLOAT_ALIGN_g) || - (sizeof(float) % H5T_NATIVE_FLOAT_ALIGN_g); + ((stride?stride:sizeof(float)) % + H5T_NATIVE_FLOAT_ALIGN_g); } else { src_mv = FALSE; } if (H5T_NATIVE_DOUBLE_ALIGN_g>1) { dst_mv = ((size_t)buf % H5T_NATIVE_DOUBLE_ALIGN_g) || - (sizeof(double) % H5T_NATIVE_DOUBLE_ALIGN_g); + ((stride?stride:sizeof(double)) % + H5T_NATIVE_DOUBLE_ALIGN_g); } else { dst_mv = FALSE; } if (src_mv) priv->s_aligned += nelmts; if (dst_mv) priv->d_aligned += nelmts; - for (elmtno=0; elmtno1) { src_mv = ((size_t)buf % H5T_NATIVE_DOUBLE_ALIGN_g) || - (sizeof(double) % H5T_NATIVE_DOUBLE_ALIGN_g); + ((stride?stride:sizeof(double)) % + H5T_NATIVE_DOUBLE_ALIGN_g); } else { src_mv = FALSE; } if (H5T_NATIVE_FLOAT_ALIGN_g>1) { dst_mv = ((size_t)buf % H5T_NATIVE_FLOAT_ALIGN_g) || - (sizeof(float) % H5T_NATIVE_FLOAT_ALIGN_g); + ((stride?stride:sizeof(float)) % + H5T_NATIVE_FLOAT_ALIGN_g); } else { dst_mv = FALSE; } if (src_mv) priv->s_aligned += nelmts; if (dst_mv) priv->d_aligned += nelmts; - for (elmtno=0; elmtno FLT_MAX) { + if (*((double*)s) > FLT_MAX) { if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) { - *d = HUGE_VAL; + *((float*)d) = HUGE_VAL; } - } else if (*s < -FLT_MAX) { + } else if (*((double*)s) < -FLT_MAX) { if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) { - *d = -HUGE_VAL; + *((float*)d) = -HUGE_VAL; } } else { - *d = *s; + *((float*)d) = *((double*)s); } /* Unalign destination */ if (dst_mv) HDmemcpy(dst, &aligned, sizeof(float)); + + /* Advance pointers */ + if (stride) { + src += stride; + dst += stride; + } else { + src += sizeof(double); + dst += sizeof(float); + } } break; @@ -5297,12 +5703,17 @@ H5T_conv_double_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * Wednesday, June 10, 1998 * * Modifications: - * + * Robb Matzke, 1999-06-16 + * Added support for non-zero strides. If STRIDE is non-zero + * then convert one value at each memory location advancing + * STRIDE bytes each time; otherwise assume both source and + * destination values are packed. *------------------------------------------------------------------------- */ herr_t H5T_conv_i32le_f64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, - size_t nelmts, void *buf, void UNUSED *bkg) + size_t nelmts, size_t stride, void *buf, + void UNUSED *bkg) { uint8_t *s=NULL, *d=NULL; /*src and dst buf pointers */ uint8_t tmp[8]; /*temporary destination buffer */ @@ -5335,9 +5746,9 @@ H5T_conv_i32le_f64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } - s = (uint8_t*)buf + 4*(nelmts-1); - d = (uint8_t*)buf + 8*(nelmts-1); - for (elmtno=0; elmtnoa = i*8+0; + s_ptr->b = i*8+1; + s_ptr->c[0] = i*8+2; + s_ptr->c[1] = i*8+3; + s_ptr->c[2] = i*8+4; + s_ptr->c[3] = i*8+5; + s_ptr->d = i*8+6; + s_ptr->e = i*8+7; + } + memcpy(buf, orig, nelmts*sizeof(struct st)); + + /* Build hdf5 datatypes */ + if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 || + H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 || + H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 || + H5Tinsert_array(st, "c", HOFFSET(struct st, c), 1, &four, NULL, + H5T_NATIVE_INT)<0 || + H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 || + H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0) + goto error; + + if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 || + H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 || + H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_INT)<0 || + H5Tinsert_array(dt, "c", HOFFSET(struct dt, c), 1, &four, NULL, + H5T_NATIVE_INT)<0 || + H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_INT)<0 || + H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0) + goto error; + + /* Perform the conversion */ + if (H5Tconvert(st, dt, nelmts, buf, bkg)<0) goto error; + + /* Compare results */ + for (i=0; ia != d_ptr->a || + s_ptr->b != d_ptr->b || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->d != d_ptr->d || + s_ptr->e != d_ptr->e) { + FAILED(); + printf(" i=%d\n", i); + printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], + s_ptr->c[3], s_ptr->d, s_ptr->e); + printf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], + d_ptr->c[3], d_ptr->d, d_ptr->e); + goto error; + } + } + + /* Release resources */ + free(buf); + free(bkg); + free(orig); + if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error; + + PASSED(); + reset_hdf5(); + return 0; + + error: + return 1; } /*------------------------------------------------------------------------- + * Function: test_compound_3 + * + * Purpose: Tests compound conversions where the source and destination + * are the same except the destination is missing a couple + * members which appear in the source. + * + * Return: Success: 0 + * + * Failure: number of errors + * + * Programmer: Robb Matzke + * Thursday, June 17, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +test_compound_3(void) +{ + struct st { + int a, b, c[4], d, e; + } *s_ptr; + struct dt { + int a, c[4], e; + } *d_ptr; + + const int nelmts = 200000; + const size_t four = 4; + unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + hid_t st=-1, dt=-1; + int i; + + TESTING("compound subset conversions"); + + /* Initialize */ + buf = malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); + bkg = malloc(nelmts * sizeof(struct dt)); + orig = malloc(nelmts * sizeof(struct st)); + for (i=0; ia = i*8+0; + s_ptr->b = i*8+1; + s_ptr->c[0] = i*8+2; + s_ptr->c[1] = i*8+3; + s_ptr->c[2] = i*8+4; + s_ptr->c[3] = i*8+5; + s_ptr->d = i*8+6; + s_ptr->e = i*8+7; + } + memcpy(buf, orig, nelmts*sizeof(struct st)); + + /* Build hdf5 datatypes */ + if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 || + H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 || + H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 || + H5Tinsert_array(st, "c", HOFFSET(struct st, c), 1, &four, NULL, + H5T_NATIVE_INT)<0 || + H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 || + H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0) + goto error; + + if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 || + H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 || + H5Tinsert_array(dt, "c", HOFFSET(struct dt, c), 1, &four, NULL, + H5T_NATIVE_INT)<0 || + H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0) + goto error; + + /* Perform the conversion */ + if (H5Tconvert(st, dt, nelmts, buf, bkg)<0) goto error; + + /* Compare results */ + for (i=0; ia != d_ptr->a || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->e != d_ptr->e) { + FAILED(); + printf(" i=%d\n", i); + printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], + s_ptr->c[3], s_ptr->d, s_ptr->e); + printf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", + d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], + d_ptr->c[3], d_ptr->e); + goto error; + } + } + + /* Release resources */ + free(buf); + free(bkg); + free(orig); + if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error; + + PASSED(); + reset_hdf5(); + return 0; + + error: + return 1; +} + + +/*------------------------------------------------------------------------- + * Function: test_compound_4 + * + * Purpose: Tests compound conversions when the destination has the same + * fields as the source but one or more of the fields are + * smaller. + * + * Return: Success: 0 + * + * Failure: number of errors + * + * Programmer: Robb Matzke + * Thursday, June 17, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +test_compound_4(void) +{ + + struct st { + int a, b, c[4], d, e; + } *s_ptr; + struct dt { + short b; + int a, c[4]; + short d; + int e; + } *d_ptr; + + const int nelmts = 200000; + const size_t four = 4; + unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + hid_t st=-1, dt=-1; + int i; + + TESTING("compound element shrinking & reordering"); + + /* Sizes should be the same, but be careful just in case */ + buf = malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); + bkg = malloc(nelmts * sizeof(struct dt)); + orig = malloc(nelmts * sizeof(struct st)); + for (i=0; ia = i*8+0; + s_ptr->b = (i*8+1) & 0x7fff; + s_ptr->c[0] = i*8+2; + s_ptr->c[1] = i*8+3; + s_ptr->c[2] = i*8+4; + s_ptr->c[3] = i*8+5; + s_ptr->d = (i*8+6) & 0x7fff; + s_ptr->e = i*8+7; + } + memcpy(buf, orig, nelmts*sizeof(struct st)); + + /* Build hdf5 datatypes */ + if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 || + H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 || + H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 || + H5Tinsert_array(st, "c", HOFFSET(struct st, c), 1, &four, NULL, + H5T_NATIVE_INT)<0 || + H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 || + H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0) + goto error; + + if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 || + H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 || + H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_SHORT)<0 || + H5Tinsert_array(dt, "c", HOFFSET(struct dt, c), 1, &four, NULL, + H5T_NATIVE_INT)<0 || + H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_SHORT)<0 || + H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0) + goto error; + + /* Perform the conversion */ + if (H5Tconvert(st, dt, nelmts, buf, bkg)<0) goto error; + + /* Compare results */ + for (i=0; ia != d_ptr->a || + s_ptr->b != d_ptr->b || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->d != d_ptr->d || + s_ptr->e != d_ptr->e) { + FAILED(); + printf(" i=%d\n", i); + printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], + s_ptr->c[3], s_ptr->d, s_ptr->e); + printf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], + d_ptr->c[3], d_ptr->d, d_ptr->e); + goto error; + } + } + + /* Release resources */ + free(buf); + free(bkg); + free(orig); + if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error; + + PASSED(); + reset_hdf5(); + return 0; + + error: + return 1; +} + + + +/*------------------------------------------------------------------------- * Function: test_transient * * Purpose: Tests transient data types. * * Return: Success: 0 * - * Failure: -1 + * Failure: number of errors * * Programmer: Robb Matzke * Thursday, June 4, 1998 @@ -424,7 +767,7 @@ test_compound(void) * *------------------------------------------------------------------------- */ -static herr_t +static int test_transient (hid_t fapl) { static hsize_t ds_size[2] = {10, 20}; @@ -530,7 +873,7 @@ test_transient (hid_t fapl) H5Dclose (dset); H5Fclose (file); } H5E_END_TRY; - return -1; + return 1; } @@ -541,7 +884,7 @@ test_transient (hid_t fapl) * * Return: Success: 0 * - * Failure: -1 + * Failure: number of errors * * Programmer: Robb Matzke * Monday, June 1, 1998 @@ -550,7 +893,7 @@ test_transient (hid_t fapl) * *------------------------------------------------------------------------- */ -static herr_t +static int test_named (hid_t fapl) { hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, attr1=-1; @@ -715,7 +1058,7 @@ test_named (hid_t fapl) H5Dclose (dset); H5Fclose (file); } H5E_END_TRY; - return -1; + return 1; } @@ -754,7 +1097,7 @@ mkstr(size_t len, H5T_str_t strpad) * * Return: Success: 0 * - * Failure: -1 + * Failure: number of errors * * Programmer: Robb Matzke * Monday, August 10, 1998 @@ -763,7 +1106,7 @@ mkstr(size_t len, H5T_str_t strpad) * *------------------------------------------------------------------------- */ -static herr_t +static int test_conv_str_1(void) { char *buf=NULL; @@ -993,7 +1336,7 @@ test_conv_str_1(void) error: reset_hdf5(); - return -1; + return 1; } @@ -1004,7 +1347,7 @@ test_conv_str_1(void) * * Return: Success: 0 * - * Failure: -1 + * Failure: number of errors * * Programmer: Robb Matzke * Monday, August 10, 1998 @@ -1013,14 +1356,14 @@ test_conv_str_1(void) * *------------------------------------------------------------------------- */ -static herr_t +static int test_conv_str_2(void) { char *buf=NULL, s[80]; hid_t c_type, f_type; const size_t nelmts = 200000, ntests=NTESTS; size_t i, j, nchars; - herr_t ret_value = -1; + int ret_value = 1; /* * Initialize types and buffer. @@ -1066,7 +1409,7 @@ test_conv_str_2(void) * * Return: Success: 0 * - * Failure: -1 + * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, January 5, 1999 @@ -1075,14 +1418,14 @@ test_conv_str_2(void) * *------------------------------------------------------------------------- */ -static herr_t +static int test_conv_enum_1(void) { const int nelmts=200000, ntests=NTESTS; int i, val, *buf=NULL; hid_t t1, t2; char s[80]; - herr_t ret_value=FAIL; + int ret_value = 1; /* Build the data types */ t1 = H5Tcreate(H5T_ENUM, sizeof(int)); @@ -1142,7 +1485,7 @@ test_conv_enum_1(void) * * Return: Success: 0 * - * Failure: -1 + * Failure: number of errors * * Programmer: Robb Matzke * Thursday, May 20, 1999 @@ -1219,7 +1562,7 @@ test_conv_bitfield(void) H5Tclose(st); H5Tclose(dt); reset_hdf5(); - return -1; + return 1; } @@ -1241,7 +1584,8 @@ test_conv_bitfield(void) */ static herr_t convert_opaque(hid_t UNUSED st, hid_t UNUSED dt, H5T_cdata_t *cdata, - size_t UNUSED nelmts, void UNUSED *_buf, void UNUSED *bkg) + size_t UNUSED nelmts, size_t UNUSED stride, void UNUSED *_buf, + void UNUSED *bkg) { if (H5T_CONV_CONV==cdata->command) num_opaque_conversions_g++; return 0; @@ -1255,7 +1599,7 @@ convert_opaque(hid_t UNUSED st, hid_t UNUSED dt, H5T_cdata_t *cdata, * * Return: Success: 0 * - * Failure: -1 + * Failure: number of errors * * Programmer: Robb Matzke * Thursday, May 20, 1999 @@ -1312,7 +1656,7 @@ test_opaque(void) if (st>0) H5Tclose(st); if (dt>0) H5Tclose(dt); FAILED(); - return -1; + return 1; } @@ -1321,9 +1665,9 @@ test_opaque(void) * * Purpose: Test atomic number conversions. * - * Return: Success: + * Return: Success: 0 * - * Failure: + * Failure: number of errors * * Programmer: Robb Matzke * Wednesday, June 10, 1998 @@ -1332,7 +1676,7 @@ test_opaque(void) * *------------------------------------------------------------------------- */ -static herr_t +static int test_conv_int (void) { unsigned char byte[4]; @@ -1431,7 +1775,7 @@ test_conv_int (void) error: reset_hdf5(); - return -1; + return 1; } @@ -1449,7 +1793,7 @@ test_conv_int (void) * * Return: Success: 0 * - * Failure: -1 + * Failure: number of errors * * Programmer: Robb Matzke * Monday, November 16, 1998 @@ -2581,7 +2925,7 @@ my_isnan(flt_t type, void *val) * * Return: Success: 0 * - * Failure: -1 + * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, June 23, 1998 @@ -3188,20 +3532,23 @@ main(void) } /* Do the tests */ - nerrors += test_classes()<0 ? 1 : 0; - nerrors += test_copy()<0 ? 1 : 0; - nerrors += test_compound()<0 ? 1 : 0; - nerrors += test_transient (fapl)<0 ? 1 : 0; - nerrors += test_named (fapl)<0 ? 1 : 0; + nerrors += test_classes(); + nerrors += test_copy(); + nerrors += test_compound_1(); + nerrors += test_transient (fapl); + nerrors += test_named (fapl); h5_cleanup (fapl); /*must happen before first reset*/ reset_hdf5(); - nerrors += test_conv_str_1()<0 ? 1 : 0; - nerrors += test_conv_str_2()<0 ? 1 : 0; - nerrors += test_conv_int ()<0 ? 1 : 0; - nerrors += test_conv_enum_1()<0 ? 1 : 0; - nerrors += test_conv_bitfield()<0 ? 1 : 0; - nerrors += test_opaque()<0 ? 1 : 0; + nerrors += test_conv_str_1(); + nerrors += test_conv_str_2(); + nerrors += test_compound_2(); + nerrors += test_compound_3(); + nerrors += test_compound_4(); + nerrors += test_conv_int (); + nerrors += test_conv_enum_1(); + nerrors += test_conv_bitfield(); + nerrors += test_opaque(); /* Does floating point overflow generate a SIGFPE? */ generates_sigfpe(); diff --git a/test/flush1.c b/test/flush1.c index 7ffcec3..9382b63 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -69,7 +69,7 @@ main(void) * 1998-11-06 ptl */ for (j=0; j0.0001) { + FAILED(); + printf(" dset[%lu][%lu] = %g\n", + (unsigned long)i, (unsigned long)j, the_data[i][j]); + printf(" should be %g\n", + (double)(hssize_t)i/(hssize_t)(j+1)); + goto error; + } } } -- cgit v0.12