summaryrefslogtreecommitdiffstats
path: root/hl/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-03-25 03:51:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-03-25 03:51:41 (GMT)
commit42efc1c2b591e4cd45ec6cb3bdf32044343118d2 (patch)
tree0ab542871c32246199479e8933ff26286aaf629a /hl/test
parent3360c3af0c100ac4d3a2fe2865f34661da862ec5 (diff)
downloadhdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.zip
hdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.tar.gz
hdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.tar.bz2
[svn-r18451] Description:
Bring r18172:18446 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'hl/test')
-rw-r--r--hl/test/H5srcdir_str.h.in22
-rw-r--r--hl/test/Makefile.in8
-rw-r--r--hl/test/gen_test_ds.c126
-rw-r--r--hl/test/test_ds.c509
-rw-r--r--hl/test/test_image.c45
-rw-r--r--hl/test/test_lite.c13
-rw-r--r--hl/test/test_table.c18
7 files changed, 348 insertions, 393 deletions
diff --git a/hl/test/H5srcdir_str.h.in b/hl/test/H5srcdir_str.h.in
new file mode 100644
index 0000000..d472124
--- /dev/null
+++ b/hl/test/H5srcdir_str.h.in
@@ -0,0 +1,22 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* If you are reading this file and it has a '.h' suffix, it was automatically
+ * generated from the '.in' version. Make changes there.
+ */
+
+/* Set the 'srcdir' path from configure time */
+static const char *config_srcdir = "@srcdir@";
+
diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in
index a364c75..4f86240 100644
--- a/hl/test/Makefile.in
+++ b/hl/test/Makefile.in
@@ -53,8 +53,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/config/commence.am \
+DIST_COMMON = $(srcdir)/H5srcdir_str.h.in $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
check_PROGRAMS = $(am__EXEEXT_1)
@BUILD_ALL_CONDITIONAL_TRUE@noinst_PROGRAMS = $(am__EXEEXT_2)
@@ -66,7 +66,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = H5srcdir_str.h
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = test_lite$(EXEEXT) test_image$(EXEEXT) \
test_table$(EXEEXT) test_ds$(EXEEXT) test_packet$(EXEEXT)
@@ -448,6 +448,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+H5srcdir_str.h: $(top_builddir)/config.status $(srcdir)/H5srcdir_str.h.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c
index 573fe20..93bda2b 100644
--- a/hl/test/gen_test_ds.c
+++ b/hl/test/gen_test_ds.c
@@ -17,11 +17,11 @@
* Purpose: This program is run to generate an HDF5 data file with datasets
* that use dimension scales.
*
- * Compile and run this program to generate the "test_ds_xx.h5"
+ * Compile and run this program to generate the "test_ds_xx.h5"
* file, where xx is "le" on a little-endian machine and "be"
* on a big-endian machine.
* Move it to the test directory in the current branch.
- * The test: test_foreign_scaleattached(const char *fileforeign)
+ * The test: test_foreign_scaleattached(const char *fileforeign)
* in test_ds.c will read them.
*/
@@ -33,7 +33,7 @@
/* prototypes */
static hid_t open_test_file(const char *fileext);
-herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx);
+herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx);
herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx);
@@ -79,7 +79,7 @@ int main(int argc , char **argv)
int nerrors=0;
char filename[65];
-
+
if (argc < 2) {
printf("Usage: gen_test [le | be]\n");
return 1;
@@ -102,7 +102,7 @@ int main(int argc , char **argv)
nerrors += test_duplicatelong_attachscales(filename) < 0 ? 1 : 0;
nerrors += test_samelong_scalenames(filename) < 0 ? 1 : 0;
nerrors += test_foreign_scaleattached(filename) < 0 ? 1 : 0;
-
+
if(nerrors) goto error;
printf("Dimension scales file generation passed.\n");
@@ -120,7 +120,7 @@ static hid_t open_test_file(const char *fileext)
strcpy(filename, FILENAME);
strcat(filename, fileext);
strcat(filename, FILEEXT);
-
+
return H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
}
@@ -129,7 +129,7 @@ static hid_t open_test_file(const char *fileext)
*-------------------------------------------------------------------------
*/
-herr_t create_long_dataset(hid_t fid, const char *name, const char *dsidx)
+herr_t create_long_dataset(hid_t fid, const char *name, const char *dsidx)
{
int rank = 4;
int rankds = 1;
@@ -181,11 +181,11 @@ herr_t create_long_dataset(hid_t fid, const char *name, const char *dsidx)
return SUCCEED;
}
-herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
{
herr_t ret_value = FAIL;
hid_t dsid = -1;
-
+
if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
if(H5DSis_attached(did, dsid, idx) == 0) {
if(H5DSattach_scale(did, dsid, idx) >= 0) {
@@ -205,7 +205,7 @@ herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int id
return ret_value;
}
-herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
{
herr_t ret_value = FAIL;
hid_t dsid = -1;
@@ -225,11 +225,11 @@ herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int id
return ret_value;
}
-herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
{
herr_t ret_value = FAIL;
hid_t dsid = -1;
-
+
if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
if(H5DSis_attached(did, dsid, idx) == 1) {
if(H5DSset_scale(dsid, scalename) >= 0) {
@@ -245,7 +245,7 @@ herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *sc
return ret_value;
}
-herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
{
herr_t ret_value = FAIL;
hid_t dsid = -1;
@@ -282,12 +282,12 @@ static int test_long_attachscales(const char *filename)
char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al");
-
+
TESTING2("test_long_attachscales");
-
+
if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
-
+
/* make a dataset */
if(create_long_dataset(fid, dsname, "al") < 0)
goto out;
@@ -297,22 +297,22 @@ static int test_long_attachscales(const char *filename)
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM3) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -320,18 +320,18 @@ static int test_long_attachscales(const char *filename)
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -343,12 +343,12 @@ static int test_duplicatelong_attachscales(const char *filename)
char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al2");
-
+
TESTING2("test_duplicatelong_attachscales");
-
+
if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
-
+
/* make a dataset 2 */
if(create_long_dataset(fid, dsname, "al2") < 0)
goto out;
@@ -358,22 +358,22 @@ static int test_duplicatelong_attachscales(const char *filename)
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM3) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -381,18 +381,18 @@ static int test_duplicatelong_attachscales(const char *filename)
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -404,10 +404,10 @@ static int test_long_scalenames(const char *filename) {
char name[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al");
-
+
if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
-
+
TESTING2("set long scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
@@ -419,7 +419,7 @@ static int test_long_scalenames(const char *filename) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
strcpy(name, SCALE_2_NAME);
@@ -429,7 +429,7 @@ static int test_long_scalenames(const char *filename) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
strcpy(name, SCALE_3_NAME);
@@ -439,7 +439,7 @@ static int test_long_scalenames(const char *filename) {
if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
strcpy(name, SCALE_4_NAME);
@@ -449,7 +449,7 @@ static int test_long_scalenames(const char *filename) {
if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -457,18 +457,18 @@ static int test_long_scalenames(const char *filename) {
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -481,10 +481,10 @@ static int test_samelong_scalenames(const char *filename) {
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al2");
-
+
if((fid = open_test_file(filename)) < 0)
goto out;
-
+
TESTING2("set same long scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
@@ -496,7 +496,7 @@ static int test_samelong_scalenames(const char *filename) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
strcpy(name, DS_2_NAME);
@@ -506,7 +506,7 @@ static int test_samelong_scalenames(const char *filename) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
strcpy(name, DS_3_NAME);
@@ -516,7 +516,7 @@ static int test_samelong_scalenames(const char *filename) {
if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
strcpy(name, DS_4_NAME);
@@ -526,7 +526,7 @@ static int test_samelong_scalenames(const char *filename) {
if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -534,18 +534,18 @@ static int test_samelong_scalenames(const char *filename) {
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -555,7 +555,7 @@ static int test_foreign_scaleattached(const char *filename)
hid_t fid = -1;
hid_t did = -1;
hid_t dsid = -1;
-
+
TESTING2("test_foreign_scaleattached");
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
@@ -565,7 +565,7 @@ static int test_foreign_scaleattached(const char *filename)
if((dsid = H5Dopen2(fid, "/ds_4_al", H5P_DEFAULT)) >= 0) {
if(H5DSis_attached(did, dsid, 3) == 1) {
ret_value = SUCCEED;
- }
+ }
if(H5Dclose(dsid) < 0)
goto out;
}
@@ -574,22 +574,22 @@ static int test_foreign_scaleattached(const char *filename)
}
else
goto out;
-
+
if(ret_value == FAIL)
goto out;
-
+
PASSED();
-
+
H5Fclose(fid);
return 0;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 32622ed..d1705ec 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include "h5hltest.h"
+#include "H5srcdir.h"
#include "H5DSpublic.h"
#include "H5LTpublic.h"
#include "H5IMpublic.h"
@@ -32,9 +33,9 @@ static int create_test_file(const char *fileext);
static int open_test_file(const char *fileext);
herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims);
herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims);
-herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims);
-herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims);
-herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims);
+herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims);
+herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims);
+herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims);
herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf);
herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf);
herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf, char *s3_wbuf);
@@ -168,8 +169,8 @@ int main(void)
nerrors += test_samelong_scalenames("2") < 0 ? 1 : 0;
nerrors += test_foreign_scaleattached(FOREIGN_FILE1) < 0 ? 1 : 0;
nerrors += test_foreign_scaleattached(FOREIGN_FILE2) < 0 ? 1 : 0;
-
-/* the following tests have not been rewritten to match those above */
+
+/* the following tests have not been rewritten to match those above */
nerrors += test_simple() < 0 ?1:0;
nerrors += test_errors() < 0 ?1:0;
nerrors += test_errors2() < 0 ?1:0;
@@ -177,7 +178,7 @@ int main(void)
nerrors += test_iterators() < 0 ?1:0;
nerrors += test_types() < 0 ?1:0;
nerrors += test_data() < 0 ?1:0;
-
+
if(nerrors) goto error;
printf("All dimension scales tests passed.\n");
@@ -224,7 +225,7 @@ static hid_t open_test_file(const char *fileext)
strcpy(filename, FILENAME);
strcat(filename, fileext);
strcat(filename, FILEEXT);
-
+
return H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
}
@@ -232,7 +233,7 @@ static hid_t open_test_file(const char *fileext)
* create "data" dataset
*-------------------------------------------------------------------------
*/
-herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims)
+herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims)
{
int rank = 3;
int rankds = 1;
@@ -261,11 +262,11 @@ herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims)
/* make a DS dataset for the first dimension */
if(create_DS1_char_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
return FAIL;
-
+
/* make a DS dataset for the second dimension */
if(create_DS2_char_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
return FAIL;
-
+
/* make a DS dataset for the third dimension */
if(create_DS3_char_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
return FAIL;
@@ -273,10 +274,10 @@ herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims)
else {
if(create_DS1_char_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
return FAIL;
-
+
if(create_DS2_char_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
return FAIL;
-
+
if(create_DS3_char_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) < 0)
return FAIL;
}
@@ -286,7 +287,7 @@ herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims)
return SUCCEED;
}
-herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims)
+herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims)
{
int rank = 3;
int rankds = 1;
@@ -316,11 +317,11 @@ herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims)
/* make a DS dataset for the first dimension */
if(create_DS1_short_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
return FAIL;
-
+
/* make a DS dataset for the second dimension */
if(create_DS2_short_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
return FAIL;
-
+
/* make a DS dataset for the third dimension */
if(create_DS3_short_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
return FAIL;
@@ -328,10 +329,10 @@ herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims)
else {
if(create_DS1_short_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
return FAIL;
-
+
if(create_DS2_short_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
return FAIL;
-
+
if(create_DS3_short_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) < 0)
return FAIL;
}
@@ -341,7 +342,7 @@ herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims)
return SUCCEED;
}
-herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
+herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
{
int rank = RANK;
int rankds = 1;
@@ -365,7 +366,7 @@ herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
/* make a DS dataset for the first dimension */
if(create_DS1_int_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
return FAIL;
-
+
/* make a DS dataset for the second dimension */
if(create_DS2_int_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
return FAIL;
@@ -373,7 +374,7 @@ herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
else {
if(create_DS1_int_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
return FAIL;
-
+
if(create_DS2_int_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
return FAIL;
}
@@ -383,7 +384,7 @@ herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
return SUCCEED;
}
-herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims)
+herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims)
{
int rank = 4;
int rankds = 1;
@@ -420,15 +421,15 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int
/* make a DS dataset for the first dimension */
if(create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
return FAIL;
-
+
/* make a DS dataset for the second dimension */
if(create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
return FAIL;
-
+
/* make a DS dataset for the third dimension */
if(create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
return FAIL;
-
+
/* make a DS dataset for the fourth dimension */
if(create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, NULL, NULL, NULL, NULL) < 0)
return FAIL;
@@ -436,13 +437,13 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int
else {
if(create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
return FAIL;
-
+
if(create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
return FAIL;
-
+
if(create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) < 0)
return FAIL;
-
+
if(create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, s41_wbuf, s42_wbuf, s43_wbuf, s44_wbuf) < 0)
return FAIL;
}
@@ -452,7 +453,7 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int
return SUCCEED;
}
-herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims)
+herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims)
{
int rank = RANK;
int rankds = 1;
@@ -476,7 +477,7 @@ herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims)
/* make a DS dataset for the first dimension */
if(create_DS1_float_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
return FAIL;
-
+
/* make a DS dataset for the second dimension */
if(create_DS2_float_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
return FAIL;
@@ -484,7 +485,7 @@ herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims)
else {
if(create_DS1_float_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
return FAIL;
-
+
if(create_DS2_float_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
return FAIL;
}
@@ -498,7 +499,7 @@ herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims)
* create 2 dimension scales datasets for first dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf)
+herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf)
{
char name[32];
@@ -523,10 +524,10 @@ herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 3 dimension scales datasets for second dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf)
+herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf)
{
char name[32];
-
+
strcpy(name, DS_2_NAME);
strcat(name, dsidx);
/* make a DS dataset for the second dimension */
@@ -556,7 +557,7 @@ herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 1 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf, char *s3_wbuf)
+herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf, char *s3_wbuf)
{
char name[32];
@@ -597,7 +598,7 @@ herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 2 dimension scales datasets for first dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf)
+herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf)
{
char name[32];
@@ -622,10 +623,10 @@ herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize
* create 3 dimension scales datasets for second dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf)
+herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf)
{
char name[32];
-
+
strcpy(name, DS_2_NAME);
strcat(name, dsidx);
@@ -656,7 +657,7 @@ herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize
* create 1 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf, short *s3_wbuf)
+herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf, short *s3_wbuf)
{
char name[32];
@@ -698,7 +699,7 @@ herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize
* create 2 dimension scales datasets for first dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf)
+herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf)
{
char name[32];
@@ -724,10 +725,10 @@ herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t
* create 3 dimension scales datasets for second dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf)
+herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf)
{
char name[32];
-
+
strcpy(name, DS_2_NAME);
strcat(name, dsidx);
@@ -758,7 +759,7 @@ herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t
* create 1 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf, int *s3_wbuf)
+herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf, int *s3_wbuf)
{
char name[32];
@@ -800,7 +801,7 @@ herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t
* create 2 dimension scales datasets for first dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf)
+herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf)
{
char name[32];
@@ -826,10 +827,10 @@ herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 3 dimension scales datasets for second dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf)
+herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf)
{
char name[32];
-
+
strcpy(name, DS_2_NAME);
strcat(name, dsidx);
@@ -860,7 +861,7 @@ herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 3 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf)
+herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf)
{
char name[32];
@@ -902,7 +903,7 @@ herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 4 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf, long *s4_wbuf)
+herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf, long *s4_wbuf)
{
char name[32];
@@ -952,7 +953,7 @@ herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 2 dimension scales datasets for first dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf)
+herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf)
{
char name[32];
@@ -978,10 +979,10 @@ herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize
* create 3 dimension scales datasets for second dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf)
+herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf)
{
char name[32];
-
+
strcpy(name, DS_2_NAME);
strcat(name, dsidx);
@@ -1012,7 +1013,7 @@ herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize
* create 3 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf, float *s3_wbuf)
+herr_t create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf, float *s3_wbuf)
{
char name[32];
@@ -1050,11 +1051,11 @@ herr_t create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize
return SUCCEED;
}
-herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
{
herr_t ret_value = FAIL;
hid_t dsid = -1;
-
+
if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
if(H5DSis_attached(did, dsid, idx) == 0) {
if(H5DSattach_scale(did, dsid, idx) >= 0) {
@@ -1074,7 +1075,7 @@ herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int id
return ret_value;
}
-herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
{
herr_t ret_value = FAIL;
hid_t dsid = -1;
@@ -1094,11 +1095,11 @@ herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int id
return ret_value;
}
-herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
{
herr_t ret_value = FAIL;
hid_t dsid = -1;
-
+
if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
if(H5DSis_attached(did, dsid, idx) == 1) {
if(H5DSset_scale(dsid, scalename) >= 0) {
@@ -1114,7 +1115,7 @@ herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *sc
return ret_value;
}
-herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
{
herr_t ret_value = FAIL;
hid_t dsid = -1;
@@ -1151,12 +1152,12 @@ static int test_char_attachscales(const char *fileext)
char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "ac");
-
+
TESTING2("test_char_attachscales");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
/* make a dataset */
if(create_char_dataset(fid, "ac", 0) < 0)
goto out;
@@ -1166,17 +1167,17 @@ static int test_char_attachscales(const char *fileext)
strcat(scalename, "ac");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "ac");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "ac");
if(test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1184,18 +1185,18 @@ static int test_char_attachscales(const char *fileext)
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1207,12 +1208,12 @@ static int test_short_attachscales(const char *fileext)
char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "as");
-
+
TESTING2("test_short_attachscales");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
/* make a dataset */
if(create_short_dataset(fid, "as", 1) < 0)
goto out;
@@ -1222,47 +1223,47 @@ static int test_short_attachscales(const char *fileext)
strcat(scalename, "as");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_11_NAME);
strcat(scalename, "as");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "as");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_21_NAME);
strcat(scalename, "as");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_22_NAME);
strcat(scalename, "as");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "as");
if(test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_31_NAME);
strcat(scalename, "as");
if(test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_32_NAME);
strcat(scalename, "as");
if(test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_33_NAME);
strcat(scalename, "as");
if(test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1270,18 +1271,18 @@ static int test_short_attachscales(const char *fileext)
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1293,12 +1294,12 @@ static int test_int_attachscales(const char *fileext)
char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "a");
-
+
TESTING2("test_int_attachscales");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
/* make a dataset */
if(create_int_dataset(fid, "a", 1) < 0)
goto out;
@@ -1308,27 +1309,27 @@ static int test_int_attachscales(const char *fileext)
strcat(scalename, "a");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_11_NAME);
strcat(scalename, "a");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "a");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_21_NAME);
strcat(scalename, "a");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_22_NAME);
strcat(scalename, "a");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1336,18 +1337,18 @@ static int test_int_attachscales(const char *fileext)
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1359,12 +1360,12 @@ static int test_long_attachscales(const char *fileext)
char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al");
-
+
TESTING2("test_long_attachscales");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
/* make a dataset */
if(create_long_dataset(fid, dsname, "al", 0) < 0)
goto out;
@@ -1374,22 +1375,22 @@ static int test_long_attachscales(const char *fileext)
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM3) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1397,18 +1398,18 @@ static int test_long_attachscales(const char *fileext)
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1420,12 +1421,12 @@ static int test_duplicatelong_attachscales(const char *fileext)
char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al2");
-
+
TESTING2("test_duplicatelong_attachscales");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
/* make a dataset 2 */
if(create_long_dataset(fid, dsname, "al2", 0) < 0)
goto out;
@@ -1435,22 +1436,22 @@ static int test_duplicatelong_attachscales(const char *fileext)
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
if(test_attach_scale(fid, did, scalename, DIM3) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1458,18 +1459,18 @@ static int test_duplicatelong_attachscales(const char *fileext)
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1481,12 +1482,12 @@ static int test_float_attachscales(const char *fileext)
char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "af");
-
+
TESTING2("test_float_attachscales");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
/* make a dataset */
if(create_float_dataset(fid, "af", 1) < 0)
goto out;
@@ -1496,27 +1497,27 @@ static int test_float_attachscales(const char *fileext)
strcat(scalename, "af");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_11_NAME);
strcat(scalename, "af");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "af");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_21_NAME);
strcat(scalename, "af");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_22_NAME);
strcat(scalename, "af");
if(test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1524,18 +1525,18 @@ static int test_float_attachscales(const char *fileext)
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1548,25 +1549,25 @@ static int test_numberofscales(const char *fileext)
char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "a");
-
+
TESTING2("test_numberofscales");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
if((nscales = H5DSget_num_scales(did, 0)) < 0)
goto out;
-
+
if(nscales != 2)
goto out;
-
+
if((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
-
+
if(nscales != 3)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1586,19 +1587,19 @@ static int test_numberofscales(const char *fileext)
strcat(scalename, "b");
if(test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
-
+
if((nscales = H5DSget_num_scales(did, 0)) < 0)
goto out;
-
+
if(nscales != 1)
goto out;
-
+
if((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
-
+
if(nscales != 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1606,18 +1607,18 @@ static int test_numberofscales(const char *fileext)
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1629,10 +1630,10 @@ static int test_char_scalenames(const char *fileext) {
char name[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "ac");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
TESTING2("set char scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
@@ -1644,7 +1645,7 @@ static int test_char_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "ac");
strcpy(name, SCALE_2_NAME);
@@ -1654,7 +1655,7 @@ static int test_char_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "ac");
strcpy(name, SCALE_3_NAME);
@@ -1664,7 +1665,7 @@ static int test_char_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1672,18 +1673,18 @@ static int test_char_scalenames(const char *fileext) {
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1695,10 +1696,10 @@ static int test_short_scalenames(const char *fileext) {
char name[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "as");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
TESTING2("set short scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
@@ -1710,7 +1711,7 @@ static int test_short_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_11_NAME);
strcat(scalename, "as");
strcpy(name, SCALE_11_NAME);
@@ -1720,7 +1721,7 @@ static int test_short_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "as");
strcpy(name, SCALE_2_NAME);
@@ -1730,7 +1731,7 @@ static int test_short_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_21_NAME);
strcat(scalename, "as");
strcpy(name, SCALE_21_NAME);
@@ -1740,7 +1741,7 @@ static int test_short_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_22_NAME);
strcat(scalename, "as");
strcpy(name, SCALE_22_NAME);
@@ -1750,7 +1751,7 @@ static int test_short_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "as");
strcpy(name, SCALE_3_NAME);
@@ -1760,7 +1761,7 @@ static int test_short_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_31_NAME);
strcat(scalename, "as");
strcpy(name, SCALE_31_NAME);
@@ -1770,7 +1771,7 @@ static int test_short_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_32_NAME);
strcat(scalename, "as");
strcpy(name, SCALE_32_NAME);
@@ -1780,7 +1781,7 @@ static int test_short_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_33_NAME);
strcat(scalename, "as");
strcpy(name, SCALE_33_NAME);
@@ -1790,7 +1791,7 @@ static int test_short_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1798,18 +1799,18 @@ static int test_short_scalenames(const char *fileext) {
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1821,10 +1822,10 @@ static int test_int_scalenames(const char *fileext) {
char name[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "a");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
TESTING2("set int scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
@@ -1836,7 +1837,7 @@ static int test_int_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_11_NAME);
strcat(scalename, "a");
strcpy(name, SCALE_11_NAME);
@@ -1846,7 +1847,7 @@ static int test_int_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "a");
strcpy(name, SCALE_2_NAME);
@@ -1856,7 +1857,7 @@ static int test_int_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_21_NAME);
strcat(scalename, "a");
strcpy(name, SCALE_21_NAME);
@@ -1866,7 +1867,7 @@ static int test_int_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_22_NAME);
strcat(scalename, "a");
strcpy(name, SCALE_22_NAME);
@@ -1884,18 +1885,18 @@ static int test_int_scalenames(const char *fileext) {
goto out;
PASSED();
-
+
H5Fclose(fid);
return 0;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1907,10 +1908,10 @@ static int test_long_scalenames(const char *fileext) {
char name[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
TESTING2("set long scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
@@ -1922,7 +1923,7 @@ static int test_long_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
strcpy(name, SCALE_2_NAME);
@@ -1932,7 +1933,7 @@ static int test_long_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
strcpy(name, SCALE_3_NAME);
@@ -1942,7 +1943,7 @@ static int test_long_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
strcpy(name, SCALE_4_NAME);
@@ -1952,7 +1953,7 @@ static int test_long_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -1960,18 +1961,18 @@ static int test_long_scalenames(const char *fileext) {
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -1983,10 +1984,10 @@ static int test_samelong_scalenames(const char *fileext) {
char name[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al2");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
TESTING2("set same long scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
@@ -1998,7 +1999,7 @@ static int test_samelong_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
strcpy(name, DS_2_NAME);
@@ -2008,7 +2009,7 @@ static int test_samelong_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
strcpy(name, DS_3_NAME);
@@ -2018,7 +2019,7 @@ static int test_samelong_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
-
+
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
strcpy(name, DS_4_NAME);
@@ -2028,7 +2029,7 @@ static int test_samelong_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
-
+
if(H5Dclose(did) < 0)
goto out;
}
@@ -2036,18 +2037,18 @@ static int test_samelong_scalenames(const char *fileext) {
goto out;
PASSED();
-
+
H5Fclose(fid);
return SUCCEED;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -2059,10 +2060,10 @@ static int test_float_scalenames(const char *fileext) {
char name[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "af");
-
+
if((fid = open_test_file(fileext)) < 0)
goto out;
-
+
TESTING2("set float scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
@@ -2074,7 +2075,7 @@ static int test_float_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_11_NAME);
strcat(scalename, "af");
strcpy(name, SCALE_11_NAME);
@@ -2084,7 +2085,7 @@ static int test_float_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
-
+
strcpy(scalename, DS_2_NAME);
strcat(scalename, "af");
strcpy(name, SCALE_2_NAME);
@@ -2094,7 +2095,7 @@ static int test_float_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_21_NAME);
strcat(scalename, "af");
strcpy(name, SCALE_21_NAME);
@@ -2104,7 +2105,7 @@ static int test_float_scalenames(const char *fileext) {
if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
-
+
strcpy(scalename, DS_22_NAME);
strcat(scalename, "af");
strcpy(name, SCALE_22_NAME);
@@ -2122,18 +2123,18 @@ static int test_float_scalenames(const char *fileext) {
goto out;
PASSED();
-
+
H5Fclose(fid);
return 0;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -2143,16 +2144,8 @@ static int test_foreign_scaleattached(const char *fileforeign)
hid_t fid = -1;
hid_t did = -1;
hid_t dsid = -1;
- char *srcdir = getenv("srcdir"); /* the source directory */
- char filename[512]=""; /* buffer to hold name of existing file */
+ const char *filename = H5_get_srcdir_filename(fileforeign);
- /* compose the name of the file to open, using the srcdir, if appropriate */
- if (srcdir) {
- strcpy(filename,srcdir);
- strcat(filename,"/");
- }
- strcat(filename, fileforeign);
-
TESTING2("test_foreign_scaleattached");
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
@@ -2162,7 +2155,7 @@ static int test_foreign_scaleattached(const char *fileforeign)
if((dsid = H5Dopen2(fid, "/ds_4_al", H5P_DEFAULT)) >= 0) {
if(H5DSis_attached(did, dsid, 3) == 1) {
ret_value = SUCCEED;
- }
+ }
if(H5Dclose(dsid) < 0)
goto out;
}
@@ -2171,23 +2164,23 @@ static int test_foreign_scaleattached(const char *fileforeign)
}
else
goto out;
-
+
if(ret_value == FAIL)
goto out;
-
+
PASSED();
-
+
H5Fclose(fid);
return 0;
-
+
out:
H5E_BEGIN_TRY {
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
-
+
H5_FAILED();
-
+
return FAIL;
}
@@ -2226,7 +2219,7 @@ static int test_simple(void)
char *name_out=NULL;
char snames[3];
int i, j;
-
+
printf("Testing API functions\n");
/*-------------------------------------------------------------------------
@@ -2391,7 +2384,7 @@ static int test_simple(void)
if(H5Dclose(did) < 0)
goto out;
-
+
/*-------------------------------------------------------------------------
* H5DSdetach_scale
@@ -2984,7 +2977,7 @@ static int test_simple(void)
PASSED();
-
+
/*-------------------------------------------------------------------------
* H5DSset_label, H5DSget_label
*-------------------------------------------------------------------------
@@ -3406,7 +3399,7 @@ static int test_simple(void)
/* error zone */
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Dclose(did);
H5Dclose(dsid);
@@ -3544,7 +3537,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor
/* error zone */
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Sclose(sid);
H5Tclose(tid);
@@ -3634,7 +3627,7 @@ static herr_t match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor
return ret;
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Sclose(sid);
} H5E_END_TRY;
@@ -3645,7 +3638,7 @@ out:
/*-------------------------------------------------------------------------
* Function: op_continue
*
- * Purpose: example operator function used by H5DSiterate_scales that continues
+ * Purpose: example operator function used by H5DSiterate_scales that continues
* iteration and increments visitor_data (Note: int*)
*
* Return:
@@ -3678,7 +3671,7 @@ static herr_t op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visito
/*-------------------------------------------------------------------------
* Function: op_stop
*
- * Purpose: example operator function used by H5DSiterate_scales that stops
+ * Purpose: example operator function used by H5DSiterate_scales that stops
* iteration and increments visitor_data (Note: int*)
*
* Return:
@@ -3698,7 +3691,7 @@ static herr_t op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_da
dset = dset;
dim = dim;
scale_id = scale_id;
-
+
if ( visitor_data != NULL )
{
(*(int *)visitor_data)++;
@@ -4073,7 +4066,7 @@ static int test_errors(void)
/* error zone */
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Sclose(sid);
H5Sclose(sidds);
@@ -4265,7 +4258,7 @@ static int test_iterators(void)
/* error zone */
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Gclose(gid);
H5Dclose(did);
@@ -4474,7 +4467,7 @@ static int test_rank(void)
/* error zone */
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Dclose(did);
H5Dclose(dsid);
@@ -4654,7 +4647,7 @@ static int test_types(void)
/* error zone */
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Dclose(did);
H5Dclose(dsid);
@@ -4734,7 +4727,7 @@ static int test_data(void)
goto out;
if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fill) < 0)
goto out;
-
+
/* read ASCII bathymetry data and dimensions to create dataset */
if(read_data("dsdata.txt",2,dims,&vals) < 0)
goto out;
@@ -4813,7 +4806,7 @@ static int test_data(void)
/* error zone */
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Dclose(did);
H5Dclose(dsid);
@@ -4845,9 +4838,9 @@ out:
*-------------------------------------------------------------------------
*/
-static int read_data( const char* fname,
- int ndims,
- hsize_t *dims,
+static int read_data( const char* fname,
+ int ndims,
+ hsize_t *dims,
float **buf )
{
int i, n;
@@ -4856,19 +4849,9 @@ static int read_data( const char* fname,
size_t nelms;
FILE *f;
float val;
- char *srcdir = getenv("srcdir"); /* the source directory */
- char data_file[512]; /* buffer to hold name of existing data file */
+ const char *data_file = H5_get_srcdir_filename(fname);
- strcpy(data_file, "");
- /* compose the name of the file to open, using the srcdir, if appropriate */
- if(srcdir)
- {
- strcpy(data_file, srcdir);
- strcat(data_file, "/");
- }
/* read first data file */
- strcat(data_file,fname);
-
f = fopen(data_file, "r");
if( f == NULL )
{
@@ -4922,7 +4905,7 @@ static int test_errors2(void)
int scale_idx; /* scale index */
int nscales; /* number of scales in DIM */
int count; /* visitor data */
-
+
printf("Testing parameter errors\n");
/*-------------------------------------------------------------------------
@@ -4987,7 +4970,7 @@ static int test_errors2(void)
if (H5Dclose(dsid) < 0)
goto out;
if (H5Dclose(did) < 0)
- goto out;
+ goto out;
PASSED();
@@ -5004,15 +4987,15 @@ static int test_errors2(void)
if (H5DSset_label(did,0,"label") < 0)
goto out;
if (H5DSget_label(did,2,lbuf,sizeof(lbuf)) == SUCCEED)
- goto out;
+ goto out;
if ((label_len=H5DSget_label(did,0,NULL,0)) < 0)
- goto out;
+ goto out;
if ( label_len != strlen("label") )
goto out;
if (H5DSget_label(did,0,lbuf,sizeof(lbuf)) < 0)
goto out;
if (H5Dclose(did) < 0)
- goto out;
+ goto out;
PASSED();
@@ -5049,10 +5032,10 @@ static int test_errors2(void)
if (H5DSiterate_scales(did,2,NULL,op_continue,NULL)== SUCCEED)
goto out;
/* invalid DS_IDX */
- scale_idx = 2;
+ scale_idx = 2;
if (H5DSiterate_scales(did,0,&scale_idx,op_continue,NULL)== SUCCEED)
goto out;
-
+
/* continue iteration */
scale_idx = 0;
count = 0;
@@ -5075,9 +5058,9 @@ static int test_errors2(void)
goto out;
}
-
+
if (H5Dclose(did) < 0)
- goto out;
+ goto out;
/*-------------------------------------------------------------------------
* close
@@ -5092,7 +5075,7 @@ static int test_errors2(void)
/* error zone */
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Dclose(did);
H5Dclose(dsid);
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 426ae1d..1332841 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include "h5hltest.h"
+#include "H5srcdir.h"
#include "H5LTpublic.h"
#include "H5IMpublic.h"
#include "pal_rgb.h"
@@ -510,8 +511,7 @@ static int test_generate(void)
int imax, jmax, kmax;
float valex, xmin, xmax, value;
FILE *f;
- char *srcdir = getenv("srcdir"); /* the source directory */
- char data_file[512]=""; /* buffer to hold name of existing data file */
+ const char *data_file = H5_get_srcdir_filename(DATA_FILE4);
int i;
/* create a file using default properties */
@@ -521,17 +521,6 @@ static int test_generate(void)
printf("Testing read and process data and make indexed images\n");
/*-------------------------------------------------------------------------
- * compose the name of the file to open, using the srcdir, if appropriate
- *-------------------------------------------------------------------------
- */
- if ( srcdir )
- {
- strcpy(data_file, srcdir);
- strcat(data_file, "/");
- }
- strcat(data_file,DATA_FILE4);
-
- /*-------------------------------------------------------------------------
* read data; the file data format is described below
*-------------------------------------------------------------------------
*/
@@ -723,20 +712,7 @@ static int read_data( const char* fname, /*IN*/
char str[20];
FILE *f;
int w, h;
- char *srcdir = getenv("srcdir"); /* the source directory */
- char data_file[512]=""; /* buffer to hold name of existing data file */
-
- /*-------------------------------------------------------------------------
- * compose the name of the file to open, using "srcdir", if appropriate
- *-------------------------------------------------------------------------
- */
- strcpy(data_file, "");
- if (srcdir)
- {
- strcpy(data_file, srcdir);
- strcat(data_file, "/");
- }
- strcat(data_file,fname);
+ const char *data_file = H5_get_srcdir_filename(fname);
/*-------------------------------------------------------------------------
* read
@@ -811,20 +787,7 @@ static int read_palette(const char* fname,
unsigned int green;
unsigned int blue;
unsigned nentries;
- char *srcdir = getenv("srcdir"); /* the source directory */
- char data_file[512]; /* buffer to hold name of existing data file */
-
- /*-------------------------------------------------------------------------
- * compose the name of the file to open, using "srcdir", if appropriate
- *-------------------------------------------------------------------------
- */
- strcpy(data_file, "");
- if (srcdir)
- {
- strcpy(data_file, srcdir);
- strcat(data_file, "/");
- }
- strcat(data_file,fname);
+ const char *data_file = H5_get_srcdir_filename(fname);
/* ensure the given palette is valid */
if (!palette)
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index 95869af..2b36eb6 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include "h5hltest.h"
+#include "H5srcdir.h"
#include "H5LTpublic.h"
#define FILE_NAME "test_lite1.h5"
@@ -1537,18 +1538,10 @@ static int test_complicated_compound(void)
char *line = NULL;
FILE *fp = NULL;
size_t size = 1024;
- char *srcdir = getenv("srcdir"); /* the source directory */
- char filename[1024]="";
+ const char *filename = H5_get_srcdir_filename(INPUT_FILE);
TESTING3(" text for complicated compound types");
- /* compose the name of the file to open, using the srcdir, if appropriate */
- if(srcdir) {
- strcpy(filename, srcdir);
- strcat(filename, "/");
- }
- strcat(filename, INPUT_FILE);
-
/* Open input file */
fp = fopen(filename, "r");
if(fp == NULL) {
@@ -1605,7 +1598,7 @@ out:
free(line);
if(fp)
fclose(fp);
-
+
H5_FAILED();
return -1;
}
diff --git a/hl/test/test_table.c b/hl/test/test_table.c
index 433d49f..0fc4c84 100644
--- a/hl/test/test_table.c
+++ b/hl/test/test_table.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include "h5hltest.h"
+#include "H5srcdir.h"
#include "H5TBpublic.h"
#define TEST_FILE_BE "test_table_be.hdf5"
@@ -123,19 +124,10 @@ static hid_t h5file_open(const char *fname, unsigned flags)
{
hid_t fid; /* identifier for the file */
- char *srcdir = getenv("srcdir"); /* the source directory */
- char data_file[512]=""; /* buffer to hold name of existing file */
-
- /* compose the name of the file to open, using the srcdir, if appropriate */
- if (srcdir)
- {
- strcpy(data_file,srcdir);
- strcat(data_file,"/");
- }
- strcat(data_file,fname);
+ const char *data_file = H5_get_srcdir_filename(fname);
/* open */
- if ((fid = H5Fopen(data_file,flags,H5P_DEFAULT))<0)
+ if ((fid = H5Fopen(data_file,flags,H5P_DEFAULT))<0)
{
fprintf(stderr,"Error: Cannot open file <%s>\n",data_file );
exit(1);
@@ -154,7 +146,7 @@ static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf )
rbuf[i].lati != wbuf[j].lati ||
rbuf[i].longi != wbuf[j].longi ||
rbuf[i].pressure != wbuf[j].pressure ||
- rbuf[i].temperature != wbuf[j].temperature )
+ rbuf[i].temperature != wbuf[j].temperature )
{
fprintf(stderr,"read and write buffers have differences\n");
fprintf(stderr,"%s %ld %f %f %d\n",
@@ -459,7 +451,7 @@ static int test_table(hid_t fid, int do_write)
* data= 0 1 2 3 4 5 6 7
*-------------------------------------------------------------------------
*/
- wstart=0;
+ wstart=0;
wrecords=8;
if (H5TBwrite_records(fid,"table2",wstart,wrecords,type_size_mem,field_offset,
field_size,wbuf)<0)