From d1ed626845ff1a17bc1667f32789ea0670408904 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Tue, 14 May 2019 13:53:28 -0500 Subject: Fit help message to 80 character width and clarify some details. --- tools/src/h5repack/h5repack_main.c | 71 +++++++++++++++---------- tools/test/h5repack/testfiles/h5repack-help.txt | 71 +++++++++++++++---------- 2 files changed, 88 insertions(+), 54 deletions(-) diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index dec25f9..1852e30 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -83,13 +83,17 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " -v, --verbose Verbose mode, print object information\n"); PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n"); - PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); + PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); + PRINTVALSTREAM(rawoutstream, " occur\n"); PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n"); - PRINTVALSTREAM(rawoutstream, " This option will take precedence over the -j and -k options\n"); - PRINTVALSTREAM(rawoutstream, " --low=BOUND The low bound for library release versions to use when creating\n"); - PRINTVALSTREAM(rawoutstream, " objects in the file (default is H5F_LIBVER_EARLIEST)\n"); - PRINTVALSTREAM(rawoutstream, " --high=BOUND The high bound for library release versions to use when creating\n"); - PRINTVALSTREAM(rawoutstream, " objects in the file (default is H5F_LIBVER_LATEST)\n"); + PRINTVALSTREAM(rawoutstream, " This option will take precedence over the options\n"); + PRINTVALSTREAM(rawoutstream, " --low and --high\n"); + PRINTVALSTREAM(rawoutstream, " --low=BOUND The low bound for library release versions to use\n"); + PRINTVALSTREAM(rawoutstream, " when creating objects in the file (default is 0\n"); + PRINTVALSTREAM(rawoutstream, " [H5F_LIBVER_EARLIEST])\n"); + PRINTVALSTREAM(rawoutstream, " --high=BOUND The high bound for library release versions to use\n"); + PRINTVALSTREAM(rawoutstream, " when creating objects in the file (default is 2\n"); + PRINTVALSTREAM(rawoutstream, " [H5F_LIBVER_V110 this release; H5F_LIBVER_LATEST])\n"); PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n"); PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); @@ -104,10 +108,14 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n"); PRINTVALSTREAM(rawoutstream, " -f FILT, --filter=FILT Filter type\n"); PRINTVALSTREAM(rawoutstream, " -l LAYT, --layout=LAYT Layout type\n"); - PRINTVALSTREAM(rawoutstream, " -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for H5Pset_file_space_strategy\n"); - PRINTVALSTREAM(rawoutstream, " -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free-space for H5Pset_file_space_strategy\n"); - PRINTVALSTREAM(rawoutstream, " -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold for H5Pset_file_space_strategy\n"); - PRINTVALSTREAM(rawoutstream, " -G FS_PAGESIZE, --fs_pagesize=FS_PAGESIZE File space page size for H5Pset_file_space_page_size\n"); + PRINTVALSTREAM(rawoutstream, " -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for\n"); + PRINTVALSTREAM(rawoutstream, " H5Pset_file_space_strategy\n"); + PRINTVALSTREAM(rawoutstream, " -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free-\n"); + PRINTVALSTREAM(rawoutstream, " space for H5Pset_file_space_strategy\n"); + PRINTVALSTREAM(rawoutstream, " -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold\n"); + PRINTVALSTREAM(rawoutstream, " for H5Pset_file_space_strategy\n"); + PRINTVALSTREAM(rawoutstream, " -G FS_PAGESIZE, --fs_pagesize=FS_PAGESIZE File space page size for\n"); + PRINTVALSTREAM(rawoutstream, " H5Pset_file_space_page_size\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " M - is an integer greater than 1, size of dataset in bytes (default is 0)\n"); PRINTVALSTREAM(rawoutstream, " E - is a filename.\n"); @@ -115,15 +123,17 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " U - is a filename.\n"); PRINTVALSTREAM(rawoutstream, " T - is an integer\n"); PRINTVALSTREAM(rawoutstream, " A - is an integer greater than zero\n"); - PRINTVALSTREAM(rawoutstream, " Q - is the sort index type for the input file. It can be \"name\" or \"creation_order\" (default)\n"); - PRINTVALSTREAM(rawoutstream, " Z - is the sort order type for the input file. It can be \"descending\" or \"ascending\" (default)\n"); + PRINTVALSTREAM(rawoutstream, " Q - is the sort index type for the input file. It can be \"name\" or\n"); + PRINTVALSTREAM(rawoutstream, " \"creation_order\" (default)\n"); + PRINTVALSTREAM(rawoutstream, " Z - is the sort order type for the input file. It can be \"descending\" or\n"); + PRINTVALSTREAM(rawoutstream, " \"ascending\" (default)\n"); PRINTVALSTREAM(rawoutstream, " B - is the user block size, any value that is 512 or greater and is\n"); PRINTVALSTREAM(rawoutstream, " a power of 2 (1024 default)\n"); PRINTVALSTREAM(rawoutstream, " F - is the shared object header message type, any of . If F is not specified, S applies to all messages\n"); PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " BOUND is an integer indicating the library release versions to use when creating\n"); - PRINTVALSTREAM(rawoutstream, " objects in the file (see H5Pset_libver_bounds()):\n"); + PRINTVALSTREAM(rawoutstream, " BOUND is an integer indicating the library release versions to use when\n"); + PRINTVALSTREAM(rawoutstream, " creating objects in the file (see H5Pset_libver_bounds()):\n"); PRINTVALSTREAM(rawoutstream, " 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct\n"); PRINTVALSTREAM(rawoutstream, " 1: This is H5F_LIBVER_V18 in H5F_libver_t struct\n"); PRINTVALSTREAM(rawoutstream, " 2: This is H5F_LIBVER_V110 in H5F_libver_t struct\n"); @@ -131,24 +141,31 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " FS_STRATEGY is a string indicating the file space strategy used:\n"); PRINTVALSTREAM(rawoutstream, " FSM_AGGR:\n"); - PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are free-space managers, aggregators and virtual file driver.\n"); + PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are free-space\n"); + PRINTVALSTREAM(rawoutstream, " managers, aggregators and virtual file driver.\n"); PRINTVALSTREAM(rawoutstream, " PAGE:\n"); - PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are free-space managers with embedded paged aggregation and virtual file driver.\n"); + PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are free-space\n"); + PRINTVALSTREAM(rawoutstream, " managers with embedded paged aggregation and virtual file driver.\n"); PRINTVALSTREAM(rawoutstream, " AGGR:\n"); - PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are aggregators and virtual file driver.\n"); + PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are aggregators and\n"); + PRINTVALSTREAM(rawoutstream, " virtual file driver.\n"); PRINTVALSTREAM(rawoutstream, " NONE:\n"); - PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are virtual file driver.\n"); - PRINTVALSTREAM(rawoutstream, " The default strategy when not set is FSM_AGGR without persisting free-space.\n"); + PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are virtual file\n"); + PRINTVALSTREAM(rawoutstream, " driver.\n"); + PRINTVALSTREAM(rawoutstream, " The default strategy when not set is FSM_AGGR without persisting free-\n"); + PRINTVALSTREAM(rawoutstream, " space.\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " FS_PERSIST is 1 to persisting free-space or 0 to not persisting free-space.\n"); PRINTVALSTREAM(rawoutstream, " The default when not set is not persisting free-space.\n"); PRINTVALSTREAM(rawoutstream, " The value is ignored for AGGR and NONE strategies.\n"); PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be tracked by the library.\n"); + PRINTVALSTREAM(rawoutstream, " FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be\n"); + PRINTVALSTREAM(rawoutstream, " tracked by the library.\n"); PRINTVALSTREAM(rawoutstream, " The default when not set is 1.\n"); PRINTVALSTREAM(rawoutstream, " The value is ignored for AGGR and NONE strategies.\n"); PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when the file space strategy PAGE is used.\n"); + PRINTVALSTREAM(rawoutstream, " FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when\n"); + PRINTVALSTREAM(rawoutstream, " the file space strategy PAGE is used.\n"); PRINTVALSTREAM(rawoutstream, " The default when not set is 4096.\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " FILT - is a string with the format:\n"); @@ -176,9 +193,9 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " NBIT (no parameter)\n"); PRINTVALSTREAM(rawoutstream, " SOFF= scale_factor is an integer and scale_type\n"); PRINTVALSTREAM(rawoutstream, " is either IN or DS\n"); - PRINTVALSTREAM(rawoutstream, " UD=\n"); - PRINTVALSTREAM(rawoutstream, " required values for filter_number,filter_flag,cd_value_count,value_1\n"); - PRINTVALSTREAM(rawoutstream, " optional values for value_2 to value_N\n"); + PRINTVALSTREAM(rawoutstream, " UD=\n"); + PRINTVALSTREAM(rawoutstream, " Required values: filter_number, filter_flag, cd_value_count, value1\n"); + PRINTVALSTREAM(rawoutstream, " Optional values: value2 to valueN\n"); PRINTVALSTREAM(rawoutstream, " NONE (no parameter)\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " LAYT - is a string with the format:\n"); @@ -215,12 +232,12 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, "4) h5repack -L -c 10 -s 20:dtype file1 file2\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " Using latest file format with maximum compact group size of 10 and\n"); - PRINTVALSTREAM(rawoutstream, " and minimum shared datatype size of 20\n"); + PRINTVALSTREAM(rawoutstream, " minimum shared datatype size of 20\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, "5) h5repack --low=0 --high=1 file1 file2\n"); PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via H5Pset_libver_bounds() when\n"); - PRINTVALSTREAM(rawoutstream, " creating the repacked file: file2\n"); + PRINTVALSTREAM(rawoutstream, " Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via\n"); + PRINTVALSTREAM(rawoutstream, " H5Pset_libver_bounds() when creating the repacked file, file2\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, "5) h5repack -f SHUF -f GZIP=1 file1 file2\n"); PRINTVALSTREAM(rawoutstream, "\n"); diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt index 0eef0f5..ad07784 100644 --- a/tools/test/h5repack/testfiles/h5repack-help.txt +++ b/tools/test/h5repack/testfiles/h5repack-help.txt @@ -6,13 +6,17 @@ usage: h5repack [OPTIONS] file1 file2 -v, --verbose Verbose mode, print object information -V, --version Print version number and exit -n, --native Use a native HDF5 type when repacking - --enable-error-stack Prints messages from the HDF5 error stack as they occur + --enable-error-stack Prints messages from the HDF5 error stack as they + occur -L, --latest Use latest version of file format - This option will take precedence over the -j and -k options - --low=BOUND The low bound for library release versions to use when creating - objects in the file (default is H5F_LIBVER_EARLIEST) - --high=BOUND The high bound for library release versions to use when creating - objects in the file (default is H5F_LIBVER_LATEST) + This option will take precedence over the options + --low and --high + --low=BOUND The low bound for library release versions to use + when creating objects in the file (default is 0 + [H5F_LIBVER_EARLIEST]) + --high=BOUND The high bound for library release versions to use + when creating objects in the file (default is 2 + [H5F_LIBVER_V110 this release; H5F_LIBVER_LATEST]) -c L1, --compact=L1 Maximum number of links in header messages -d L2, --indexed=L2 Minimum number of links in the indexed format -s S[:F], --ssize=S[:F] Shared object header message minimum size @@ -27,10 +31,14 @@ usage: h5repack [OPTIONS] file1 file2 -z Z, --sort_order=Z Sort groups and attributes by order Z -f FILT, --filter=FILT Filter type -l LAYT, --layout=LAYT Layout type - -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for H5Pset_file_space_strategy - -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free-space for H5Pset_file_space_strategy - -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold for H5Pset_file_space_strategy - -G FS_PAGESIZE, --fs_pagesize=FS_PAGESIZE File space page size for H5Pset_file_space_page_size + -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for + H5Pset_file_space_strategy + -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free- + space for H5Pset_file_space_strategy + -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold + for H5Pset_file_space_strategy + -G FS_PAGESIZE, --fs_pagesize=FS_PAGESIZE File space page size for + H5Pset_file_space_page_size M - is an integer greater than 1, size of dataset in bytes (default is 0) E - is a filename. @@ -38,15 +46,17 @@ usage: h5repack [OPTIONS] file1 file2 U - is a filename. T - is an integer A - is an integer greater than zero - Q - is the sort index type for the input file. It can be "name" or "creation_order" (default) - Z - is the sort order type for the input file. It can be "descending" or "ascending" (default) + Q - is the sort index type for the input file. It can be "name" or + "creation_order" (default) + Z - is the sort order type for the input file. It can be "descending" or + "ascending" (default) B - is the user block size, any value that is 512 or greater and is a power of 2 (1024 default) F - is the shared object header message type, any of . If F is not specified, S applies to all messages - BOUND is an integer indicating the library release versions to use when creating - objects in the file (see H5Pset_libver_bounds()): + BOUND is an integer indicating the library release versions to use when + creating objects in the file (see H5Pset_libver_bounds()): 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct 1: This is H5F_LIBVER_V18 in H5F_libver_t struct 2: This is H5F_LIBVER_V110 in H5F_libver_t struct @@ -54,24 +64,31 @@ usage: h5repack [OPTIONS] file1 file2 FS_STRATEGY is a string indicating the file space strategy used: FSM_AGGR: - The mechanisms used in managing file space are free-space managers, aggregators and virtual file driver. + The mechanisms used in managing file space are free-space + managers, aggregators and virtual file driver. PAGE: - The mechanisms used in managing file space are free-space managers with embedded paged aggregation and virtual file driver. + The mechanisms used in managing file space are free-space + managers with embedded paged aggregation and virtual file driver. AGGR: - The mechanisms used in managing file space are aggregators and virtual file driver. + The mechanisms used in managing file space are aggregators and + virtual file driver. NONE: - The mechanisms used in managing file space are virtual file driver. - The default strategy when not set is FSM_AGGR without persisting free-space. + The mechanisms used in managing file space are virtual file + driver. + The default strategy when not set is FSM_AGGR without persisting free- + space. FS_PERSIST is 1 to persisting free-space or 0 to not persisting free-space. The default when not set is not persisting free-space. The value is ignored for AGGR and NONE strategies. - FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be tracked by the library. + FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be + tracked by the library. The default when not set is 1. The value is ignored for AGGR and NONE strategies. - FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when the file space strategy PAGE is used. + FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when + the file space strategy PAGE is used. The default when not set is 4096. FILT - is a string with the format: @@ -99,9 +116,9 @@ usage: h5repack [OPTIONS] file1 file2 NBIT (no parameter) SOFF= scale_factor is an integer and scale_type is either IN or DS - UD= - required values for filter_number,filter_flag,cd_value_count,value_1 - optional values for value_2 to value_N + UD= + Required values: filter_number, filter_flag, cd_value_count, value1 + Optional values: value2 to valueN NONE (no parameter) LAYT - is a string with the format: @@ -138,12 +155,12 @@ Examples of use: 4) h5repack -L -c 10 -s 20:dtype file1 file2 Using latest file format with maximum compact group size of 10 and - and minimum shared datatype size of 20 + minimum shared datatype size of 20 5) h5repack --low=0 --high=1 file1 file2 - Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via H5Pset_libver_bounds() when - creating the repacked file: file2 + Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via + H5Pset_libver_bounds() when creating the repacked file, file2 5) h5repack -f SHUF -f GZIP=1 file1 file2 -- cgit v0.12 From ea8c99cc56ac1ce8a385fab2e142e6cc417536ef Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Fri, 24 May 2019 16:57:47 -0500 Subject: refactor h5repack_main.c -- remove some redundancy, formatting --- tools/src/h5repack/h5repack_main.c | 307 ++++++++++++++++--------------------- 1 file changed, 134 insertions(+), 173 deletions(-) diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 1852e30..efab3f0 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -23,7 +23,8 @@ static void leave(int ret) H5_ATTR_NORETURN; /* module-scoped variables */ -static int has_i_o = 0; +static int has_i = 0; +static int has_o = 0; const char *infile = NULL; const char *outfile = NULL; @@ -33,34 +34,34 @@ const char *outfile = NULL; */ static const char *s_opts = "hVvf:l:m:e:nLj:k:c:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E"; static struct long_options l_opts[] = { - { "help", no_arg, 'h' }, - { "version", no_arg, 'V' }, - { "verbose", no_arg, 'v' }, - { "filter", require_arg, 'f' }, - { "layout", require_arg, 'l' }, - { "minimum", require_arg, 'm' }, - { "file", require_arg, 'e' }, - { "native", no_arg, 'n' }, - { "latest", no_arg, 'L' }, - { "low", require_arg, 'j' }, - { "high", require_arg, 'k' }, - { "compact", require_arg, 'c' }, - { "indexed", require_arg, 'd' }, - { "ssize", require_arg, 's' }, - { "ublock", require_arg, 'u' }, - { "block", require_arg, 'b' }, + { "help", no_arg, 'h' }, + { "version", no_arg, 'V' }, + { "verbose", no_arg, 'v' }, + { "filter", require_arg, 'f' }, + { "layout", require_arg, 'l' }, + { "minimum", require_arg, 'm' }, + { "file", require_arg, 'e' }, + { "native", no_arg, 'n' }, + { "latest", no_arg, 'L' }, + { "low", require_arg, 'j' }, + { "high", require_arg, 'k' }, + { "compact", require_arg, 'c' }, + { "indexed", require_arg, 'd' }, + { "ssize", require_arg, 's' }, + { "ublock", require_arg, 'u' }, + { "block", require_arg, 'b' }, { "metadata_block_size", require_arg, 'M' }, - { "threshold", require_arg, 't' }, - { "alignment", require_arg, 'a' }, - { "infile", require_arg, 'i' }, /* -i for backward compability */ - { "outfile", require_arg, 'o' }, /* -o for backward compability */ - { "fs_strategy", require_arg, 'S' }, - { "fs_persist", require_arg, 'P' }, - { "fs_threshold", require_arg, 'T' }, - { "fs_pagesize", require_arg, 'G' }, - { "sort_by", require_arg, 'q' }, - { "sort_order", require_arg, 'z' }, - { "enable-error-stack", no_arg, 'E' }, + { "threshold", require_arg, 't' }, + { "alignment", require_arg, 'a' }, + { "infile", require_arg, 'i' }, /* for backward compability */ + { "outfile", require_arg, 'o' }, /* for backward compability */ + { "fs_strategy", require_arg, 'S' }, + { "fs_persist", require_arg, 'P' }, + { "fs_threshold", require_arg, 'T' }, + { "fs_pagesize", require_arg, 'G' }, + { "sort_by", require_arg, 'q' }, + { "sort_order", require_arg, 'z' }, + { "enable-error-stack", no_arg, 'E' }, { NULL, 0, '\0' } }; @@ -281,7 +282,8 @@ int read_info(const char *filename, pack_opt_t *options) int i, rc = 1; int ret_value = EXIT_SUCCESS; - if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) { + fp = HDfopen(filename, "r"); + if ((FILE *)NULL == fp) { error_msg("cannot open options file %s\n", filename); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; @@ -290,90 +292,46 @@ int read_info(const char *filename, pack_opt_t *options) /* cycle until end of file reached */ while (1) { - rc = fscanf(fp, "%s", stype); - if (rc == -1) - break; - - /*------------------------------------------------------------------------- - * filter - *------------------------------------------------------------------------- - */ - if (HDstrcmp(stype,"-f") == 0) { - /* find begining of info */ - i = 0; - c = '0'; - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { - error_msg("fscanf error\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } /* end if */ - if (HDfeof(fp)) - break; - } - c = '0'; - /* go until end */ - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { - error_msg("fscanf error\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } /* end if */ - comp_info[i] = c; - i++; - if (HDfeof(fp)) - break; - if (c == 10 /*eol*/) - break; - } - comp_info[i - 1] = '\0'; /*cut the last " */ - if (h5repack_addfilter(comp_info, options) == -1) { - error_msg("could not add compression option\n"); + /* Info indicator must be for layout or filter */ + if (HDstrcmp(stype,"-l") && HDstrcmp(stype, "-f")) { + error_msg("bad file format for %s", filename); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + + /* find begining of info */ + i = 0; + c = '0'; + while (c != ' ') { + if (fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; goto done; } + if (HDfeof(fp)) + break; } - /*------------------------------------------------------------------------- - * layout - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(stype,"-l") == 0) { - - /* find begining of info */ - i = 0; - c = '0'; - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { - error_msg("fscanf error\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } /* end if */ - if (HDfeof(fp)) - break; - } - c = '0'; - /* go until end */ - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { - error_msg("fscanf error\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } /* end if */ - comp_info[i] = c; - i++; - if (HDfeof(fp)) - break; - if (c == 10 /*eol*/) - break; + c = '0'; + /* go until end */ + while (c != ' ') { + if (fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + error_msg("fscanf error\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; } - comp_info[i - 1] = '\0'; /*cut the last " */ + comp_info[i++] = c; + if (HDfeof(fp)) + break; + if (c == 10 /*eol*/) + break; + } + comp_info[i - 1] = '\0'; /*cut the last " */ + if (!HDstrcmp(stype, "-l")) { if (h5repack_addlayout(comp_info, options) == -1) { error_msg("could not add chunck option\n"); h5tools_setstatus(EXIT_FAILURE); @@ -381,17 +339,15 @@ int read_info(const char *filename, pack_opt_t *options) goto done; } } - /*------------------------------------------------------------------------- - * not valid - *------------------------------------------------------------------------- - */ else { - error_msg("bad file format for %s", filename); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; + if (h5repack_addfilter(comp_info, options) == -1) { + error_msg("could not add compression option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } } - } + } /* end while info-read cycling */ done: if (fp) @@ -415,9 +371,10 @@ set_sort_by(const char *form) { H5_index_t idx_type = H5_INDEX_UNKNOWN; - if (HDstrcmp(form,"name")==0) /* H5_INDEX_NAME */ + if (!HDstrcmp(form, "name")) idx_type = H5_INDEX_NAME; - else if (HDstrcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */ + else + if (!HDstrcmp(form, "creation_order")) idx_type = H5_INDEX_CRT_ORDER; return idx_type; @@ -438,9 +395,10 @@ set_sort_order(const char *form) { H5_iter_order_t iter_order = H5_ITER_UNKNOWN; - if (HDstrcmp(form,"ascending")==0) /* H5_ITER_INC */ + if (!HDstrcmp(form, "ascending")) iter_order = H5_ITER_INC; - else if (HDstrcmp(form,"descending")==0) /* H5_ITER_DEC */ + else + if (!HDstrcmp(form, "descending")) iter_order = H5_ITER_DEC; return iter_order; @@ -459,19 +417,19 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) int ret_value = 0; /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while (EOF != (opt = get_option(argc, argv, s_opts, l_opts))) { switch ((char) opt) { /* -i for backward compatibility */ case 'i': infile = opt_arg; - has_i_o = 1; + has_i++; break; /* -o for backward compatibility */ case 'o': outfile = opt_arg; - has_i_o = 1; + has_o++; break; case 'h': @@ -536,7 +494,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) case 'j': options->low_bound = (H5F_libver_t)HDatoi(opt_arg); - if(options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) { + if (options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) { error_msg("in parsing low bound\n"); goto done; } @@ -544,7 +502,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) case 'k': options->high_bound = (H5F_libver_t)HDatoi(opt_arg); - if(options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) { + if (options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) { error_msg("in parsing high bound\n"); goto done; } @@ -566,10 +524,10 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) { int idx = 0; int ssize = 0; - char *msgPtr = HDstrchr( opt_arg, ':'); + char *msgPtr = HDstrchr(opt_arg, ':'); options->latest = TRUE; /* must use latest format */ if (msgPtr == NULL) { - ssize = HDatoi( opt_arg ); + ssize = HDatoi(opt_arg); for (idx = 0; idx < 5; idx++) options->msg_size[idx] = ssize; } @@ -579,15 +537,19 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) HDstrcpy(msgType, msgPtr + 1); msgPtr[0] = '\0'; ssize = HDatoi( opt_arg ); - if (HDstrncmp(msgType, "dspace",6) == 0) + if (!HDstrncmp(msgType, "dspace", 6)) options->msg_size[0] = ssize; - else if (HDstrncmp(msgType, "dtype", 5) == 0) + else + if (!HDstrncmp(msgType, "dtype", 5)) options->msg_size[1] = ssize; - else if (HDstrncmp(msgType, "fill", 4) == 0) + else + if (!HDstrncmp(msgType, "fill", 4)) options->msg_size[2] = ssize; - else if (HDstrncmp(msgType, "pline", 5) == 0) + else + if (!HDstrncmp(msgType, "pline", 5)) options->msg_size[3] = ssize; - else if (HDstrncmp(msgType, "attr", 4) == 0) + else + if (!HDstrncmp(msgType, "attr", 4)) options->msg_size[4] = ssize; } } @@ -624,13 +586,16 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) char strategy[MAX_NC_NAME]; HDstrcpy(strategy, opt_arg); - if(!HDstrcmp(strategy, "FSM_AGGR")) + if (!HDstrcmp(strategy, "FSM_AGGR")) options->fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; - else if(!HDstrcmp(strategy, "PAGE")) + else + if (!HDstrcmp(strategy, "PAGE")) options->fs_strategy = H5F_FSPACE_STRATEGY_PAGE; - else if(!HDstrcmp(strategy, "AGGR")) + else + if (!HDstrcmp(strategy, "AGGR")) options->fs_strategy = H5F_FSPACE_STRATEGY_AGGR; - else if(!HDstrcmp(strategy, "NONE")) + else + if (!HDstrcmp(strategy, "NONE")) options->fs_strategy = H5F_FSPACE_STRATEGY_NONE; else { error_msg("invalid file space management strategy\n", opt_arg); @@ -638,7 +603,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) ret_value = -1; goto done; } - if(options->fs_strategy == (H5F_fspace_strategy_t)0) + if (options->fs_strategy == (H5F_fspace_strategy_t)0) /* To distinguish the "specified" zero value */ options->fs_strategy = (H5F_fspace_strategy_t)-1; } @@ -646,27 +611,27 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) case 'P': options->fs_persist = HDatoi(opt_arg); - if(options->fs_persist == 0) + if (options->fs_persist == 0) /* To distinguish the "specified" zero value */ options->fs_persist = -1; break; case 'T': options->fs_threshold = HDatol(opt_arg); - if(options->fs_threshold == 0) + if (options->fs_threshold == 0) /* To distinguish the "specified" zero value */ options->fs_threshold = -1; break; case 'G': options->fs_pagesize = HDstrtoll(opt_arg, NULL, 0); - if(options->fs_pagesize == 0) + if (options->fs_pagesize == 0) /* To distinguish the "specified" zero value */ options->fs_pagesize = -1; break; case 'q': - if((sort_by = set_sort_by(opt_arg)) < 0) { + if (H5_INDEX_UNKNOWN == set_sort_by(opt_arg)) { error_msg(" failed to set sort by form <%s>\n", opt_arg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; @@ -675,7 +640,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'z': - if((sort_order = set_sort_order(opt_arg)) < 0) { + if (H5_ITER_UNKNOWN == set_sort_order(opt_arg)) { error_msg(" failed to set sort order form <%s>\n", opt_arg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; @@ -690,17 +655,35 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) default: break; } /* switch */ - } /* while */ - - if (has_i_o == 0) { - /* check for file names to be processed */ - if (argc <= opt_ind || argv[opt_ind + 1] == NULL) { - error_msg("missing file names\n"); - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - } - } + } /* end while there are more options to parse */ + + /* If neither -i nor -o given, get in and out files positionally */ + if (0 == (has_i + has_o)) { + if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) { + infile = argv[opt_ind]; + outfile = argv[opt_ind + 1]; + + if (!HDstrcmp(infile, outfile)) { + error_msg("file names cannot be the same\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + } + } + else { + error_msg("file names missing\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + } + } + else + if (has_i != 1 || has_o != 1) { + error_msg("filenames must be either both -i -o or both positional\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + } done: return ret_value; @@ -757,28 +740,6 @@ int main(int argc, const char **argv) if (parse_command_line(argc, argv, &options) < 0) goto done; - /* get file names if they were not yet got */ - if (has_i_o == 0) { - - if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) { - infile = argv[opt_ind]; - outfile = argv[opt_ind + 1]; - - if ( HDstrcmp( infile, outfile ) == 0) { - error_msg("file names cannot be the same\n"); - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - else { - error_msg("file names missing\n"); - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - if (enable_error_stack > 0) { H5Eset_auto2(H5E_DEFAULT, func, edata); H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); -- cgit v0.12 From eb93107f9f413528f4ef4adf277491013193a390 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Fri, 24 May 2019 16:58:31 -0500 Subject: Add test that uses the family member FAPL setting. --- test/vfd.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/test/vfd.c b/test/vfd.c index 2305593..7c1d9d5 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -1113,6 +1113,117 @@ error: /*------------------------------------------------------------------------- + * Function: test_family_member_fapl + * + * Purpose: Actually use the member fapl input to the member vfd. + * + * Return: 0 - success + * -1 - failure + * + * Programmer: Jacob Smith + * 21 May 2019 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_family_member_fapl(void) +{ + hid_t file; + hid_t fapl_id; + hid_t memb_fapl_id; + hid_t space; + hid_t dset; + char filename[1024]; + char dname[] = "dataset"; + unsigned i; + unsigned j; + int buf[FAMILY_NUMBER][FAMILY_SIZE]; + hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE}; + + TESTING("Family member FAPL"); + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if (H5I_INVALID_HID == fapl_id) + TEST_ERROR; + memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if (H5I_INVALID_HID == memb_fapl_id) + TEST_ERROR; + if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) + TEST_ERROR; + if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) + TEST_ERROR; + h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename)); + + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + if (H5I_INVALID_HID == file) + TEST_ERROR; + + space = H5Screate_simple(2, dims, NULL); + if (H5I_INVALID_HID == space) + TEST_ERROR; + + /* Create and write to dataset, then close file. + */ + dset = H5Dcreate2( + file, + dname, + H5T_NATIVE_INT, + space, + H5P_DEFAULT, + H5P_DEFAULT, + H5P_DEFAULT); + if (H5I_INVALID_HID == dset) + TEST_ERROR; + for (i = 0; i < FAMILY_NUMBER; i++) + for (j = 0; j < FAMILY_SIZE; j++) + buf[i][j] = (int)((i * 10000) + j); + if (H5Dwrite(dset, + H5T_NATIVE_INT, + H5S_ALL, + H5S_ALL, + H5P_DEFAULT, + buf) + == FAIL) + TEST_ERROR; + if (H5Dclose(dset) == FAIL) TEST_ERROR; + if (H5Sclose(space) == FAIL) TEST_ERROR; + if (H5Fclose(file) == FAIL) TEST_ERROR; + + /* "Close" member FAPL at top level and re-open file. + * Should succeed, with library managing reference count properly + */ + if (H5Pclose(memb_fapl_id) == FAIL) + TEST_ERROR; + + file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + if (H5I_INVALID_HID == file) + TEST_ERROR; + + if (H5Fclose(file) == FAIL) + TEST_ERROR; + + h5_delete_test_file(FILENAME[2], fapl_id); + + if (H5Pclose(fapl_id) == FAIL) + TEST_ERROR; + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY{ + H5Sclose(space); + H5Dclose(dset); + H5Pclose(memb_fapl_id); + H5Pclose(fapl_id); + H5Fclose(file); + } H5E_END_TRY; + + return -1; +} /* end test_family_member_fapl() */ + + +/*------------------------------------------------------------------------- * Function: test_multi_opens * * Purpose: Private function for test_multi() to tests wrong ways of @@ -1917,6 +2028,7 @@ main(void) nerrors += test_direct() < 0 ? 1 : 0; nerrors += test_family() < 0 ? 1 : 0; nerrors += test_family_compat() < 0 ? 1 : 0; + nerrors += test_family_member_fapl() < 0 ? 1 : 0; nerrors += test_multi() < 0 ? 1 : 0; nerrors += test_multi_compat() < 0 ? 1 : 0; nerrors += test_log() < 0 ? 1 : 0; -- cgit v0.12 From 132efb2b6943ecabd6f3950a4b52817201bd3513 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Fri, 24 May 2019 16:59:14 -0500 Subject: Some minor reformatting. Replace tabs with spaces. --- test/external.c | 434 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 241 insertions(+), 193 deletions(-) diff --git a/test/external.c b/test/external.c index 6aa9d1b..619ca62 100644 --- a/test/external.c +++ b/test/external.c @@ -15,7 +15,7 @@ * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Purpose: Tests datasets stored in external raw files. + * Purpose: Tests datasets stored in external raw files. */ #include "external_common.h" @@ -26,7 +26,7 @@ * Purpose: Determines whether two files contain the same data. * * Return: Success: nonzero if same, zero if different. - * Failure: zero + * Failure: zero * * Programmer: Robb Matzke * Wednesday, March 4, 1998 @@ -36,14 +36,19 @@ static hbool_t files_have_same_contents(const char *name1, const char *name2) { - int fd1 = 0, fd2 = 0; - ssize_t n1, n2; - char buf1[1024], buf2[1024]; + int fd1 = 0; + int fd2 = 0; + ssize_t n1; + ssize_t n2; + char buf1[1024]; + char buf2[1024]; hbool_t ret = FALSE; /* not equal until proven otherwise */ - if((fd1 = HDopen(name1, O_RDONLY)) < 0) + fd1 = HDopen(name1, O_RDONLY); + if(fd1 < 0) goto out; - if((fd2 = HDopen(name2, O_RDONLY)) < 0) + fd2 = HDopen(name2, O_RDONLY); + if(fd2 < 0) goto out; /* Loop until files are empty or we encounter a problem */ @@ -96,28 +101,29 @@ out: static int test_non_extendible(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - int n; /* number of external files */ - char name[256]; /* external file name */ - off_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ - haddr_t dset_addr; /* address of dataset */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* data space current size */ + hsize_t max_size[1] = {100}; /* data space maximum size */ + int n; /* number of external files */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ + haddr_t dset_addr; /* address of dataset */ TESTING("fixed-size data space, exact storage"); - /* Create the dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + /* Create the dataset and close */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl < 0) FAIL_STACK_ERROR - cur_size[0] = max_size[0] = 100; if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + space = H5Screate_simple(1, cur_size, max_size); + if(space < 0) FAIL_STACK_ERROR - if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(dset < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR @@ -127,7 +133,8 @@ test_non_extendible(hid_t file) FAIL_STACK_ERROR /* Read dataset creation information */ - if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) + dset = H5Dopen2(file, "dset1", H5P_DEFAULT); + if(dset < 0) FAIL_STACK_ERROR /* Test dataset address. Should be undefined. */ @@ -138,36 +145,34 @@ test_non_extendible(hid_t file) FAIL_STACK_ERROR /* Check external count */ - if((dcpl = H5Dget_create_plist(dset)) < 0) + dcpl = H5Dget_create_plist(dset); + if(dcpl < 0) FAIL_STACK_ERROR - if((n = H5Pget_external_count(dcpl)) < 0) + n = H5Pget_external_count(dcpl); + if(n < 0) FAIL_STACK_ERROR if(1 != n) { H5_FAILED(); HDputs(" Returned external count is wrong."); printf(" got: %d\n ans: 1\n", n); goto error; - } /* end if */ + } - HDstrcpy(name + sizeof(name) - 4, "..."); - if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) + /* Verify external file settings */ + if(H5Pget_external(dcpl, 0, 0, NULL, &file_offset, &file_size) < 0) FAIL_STACK_ERROR - - /* Check file offset */ if(file_offset != 0) { H5_FAILED(); HDputs(" Wrong file offset."); printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; - } /* end if */ - - /* Check file size */ + } if(file_size != (max_size[0] * sizeof(int))) { H5_FAILED(); HDputs(" Wrong file size."); printf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, (unsigned long)max_size[0]*sizeof(int)); goto error; - } /* end if */ + } /* Done (dataspace was previously closed) */ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR @@ -194,7 +199,7 @@ test_non_extendible(hid_t file) * Return: Success: 0 * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * *------------------------------------------------------------------------- @@ -202,20 +207,21 @@ test_non_extendible(hid_t file) static int test_too_small(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* current data space size */ + hsize_t max_size[1] = {100}; /* maximum data space size */ TESTING("external storage is too small"); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl < 0) FAIL_STACK_ERROR - cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) /* note -1 */ FAIL_STACK_ERROR - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + space = H5Screate_simple(1, cur_size, max_size); + if(space < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { @@ -248,10 +254,10 @@ test_too_small(hid_t file) * represent the current data and large enough to represent the * eventual size of the data. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * *------------------------------------------------------------------------- @@ -259,23 +265,24 @@ test_too_small(hid_t file) static int test_large_enough_current_eventual(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* current data space size */ + hsize_t max_size[1] = {200}; /* maximum data space size */ TESTING("extendible dataspace, exact external size"); - if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + dcpl = H5Pcreate (H5P_DATASET_CREATE); + if(dcpl < 0) FAIL_STACK_ERROR - cur_size[0] = 100; - max_size[0] = 200; if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + space = H5Screate_simple(1, cur_size, max_size); + if(space < 0) FAIL_STACK_ERROR - if((dset = H5Dcreate2(file, "dset3", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + dset = H5Dcreate2(file, "dset3", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(dset < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR @@ -312,21 +319,21 @@ error: static int test_large_enough_current_not_eventual(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* current data space size */ + hsize_t max_size[1] = {200}; /* maximum data space size */ TESTING("extendible dataspace, external storage is too small"); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl < 0) FAIL_STACK_ERROR - cur_size[0] = 100; - max_size[0] = 200; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) /* note -1 */ FAIL_STACK_ERROR - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + space = H5Screate_simple(1, cur_size, max_size); + if(space < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { @@ -368,28 +375,28 @@ test_large_enough_current_not_eventual(hid_t file) static int test_unlimited(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - int n; /* number of external files */ - char name[256]; /* external file name */ - off_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* data space current size */ + hsize_t max_size[1] = {H5S_UNLIMITED}; /* data space maximum size */ + int n; /* number of external files */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ TESTING("unlimited dataspace, unlimited external storage"); /* Create dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR - cur_size[0] = 100; - max_size[0] = H5S_UNLIMITED; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + space = H5Screate_simple(1, cur_size, max_size); + if(space < 0) FAIL_STACK_ERROR - if((dset = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + dset = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(dset < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR @@ -397,11 +404,14 @@ test_unlimited(hid_t file) if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR /* Read dataset creation information */ - if((dset = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) + dset = H5Dopen2(file, "dset5", H5P_DEFAULT); + if(dset < 0) FAIL_STACK_ERROR - if((dcpl = H5Dget_create_plist(dset)) < 0) + dcpl = H5Dget_create_plist(dset); + if(dcpl < 0) FAIL_STACK_ERROR - if((n = H5Pget_external_count(dcpl)) < 0) + n = H5Pget_external_count(dcpl); + if(n < 0) FAIL_STACK_ERROR if(1 != n) { H5_FAILED(); @@ -410,22 +420,20 @@ test_unlimited(hid_t file) goto error; } /* end if */ - HDstrcpy(name + sizeof(name) - 4, "..."); - if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) + if(H5Pget_external(dcpl, 0, 0, NULL, &file_offset, &file_size) < 0) FAIL_STACK_ERROR if(file_offset != 0) { H5_FAILED(); HDputs(" Wrong file offset."); printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; - } /* end if */ - + } if(H5F_UNLIMITED != file_size) { H5_FAILED(); HDputs(" Wrong file size."); printf(" got: %lu\n ans: INF\n", (unsigned long)file_size); goto error; - } /* end if */ + } if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR @@ -459,35 +467,71 @@ test_unlimited(hid_t file) static int test_multiple_files(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* dataspace */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* dataspace */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* data space current size */ + hsize_t max_size[1] = {100}; /* data space maximum size */ + hsize_t max_ext_size; /* maximum size of external files */ + unsigned n_external_files = 4; TESTING("multiple external files"); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl < 0) FAIL_STACK_ERROR - cur_size[0] = max_size[0] = 100; + max_ext_size = (hsize_t)(sizeof(int) * max_size[0] / n_external_files); - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) - FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) - FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext3.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) - FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext4.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) - FAIL_STACK_ERROR - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + for (unsigned i = 0; i < n_external_files; i++) { + char exname[9] = ""; + HDsnprintf(exname, 9, "ext%d.data", i+1); + if (H5Pset_external(dcpl, exname, (off_t)0, max_ext_size) < 0) { + HDfprintf(stderr, "Problem adding external file %s\n", exname); + fflush(stderr); + FAIL_STACK_ERROR + } + } + + space = H5Screate_simple(1, cur_size, max_size); + if(space < 0) FAIL_STACK_ERROR - if((dset = H5Dcreate2(file, "dset6", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + + dset = H5Dcreate2(file, "dset6", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(dset < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR - if(H5Sclose(space) < 0) FAIL_STACK_ERROR if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + /* Re-use space below */ + + /* ---------------------------------------------- + * Verify that too-small external files will fail + */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + if(dcpl < 0) + FAIL_STACK_ERROR + + max_ext_size -= 1; + + for (unsigned i = 0; i < n_external_files; i++) { + char exname[9] = ""; + HDsnprintf(exname, 9, "ext%d.data", i+1); + if (H5Pset_external(dcpl, exname, (off_t)0, max_ext_size) < 0) { + HDfprintf(stderr, "Problem adding external file %s\n", exname); + fflush(stderr); + FAIL_STACK_ERROR + } + } + + H5E_BEGIN_TRY { + dset = H5Dcreate2(file, "dset7", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + } H5E_END_TRY; + if(dset >= 0) + FAIL_PUTS_ERROR(" Small external files succeeded instead of failing."); + + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -519,13 +563,14 @@ error: static int test_add_to_unlimited(void) { - hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* function return status */ - int n; /* number of external files */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* function return status */ + int n; /* number of external files */ TESTING("external file following unlimited file"); - if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + dcpl = H5Pcreate (H5P_DATASET_CREATE); + if(dcpl < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR @@ -536,7 +581,8 @@ test_add_to_unlimited(void) if(status >= 0) FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); - if((n = H5Pget_external_count(dcpl)) < 0) + n = H5Pget_external_count(dcpl); + if(n < 0) FAIL_STACK_ERROR if(1 != n) FAIL_PUTS_ERROR(" Wrong external file count returned."); @@ -570,12 +616,13 @@ test_add_to_unlimited(void) static int test_overflow(void) { - hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* return status */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* return status */ TESTING("address overflow in external files"); - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) + dcpl = H5Pcreate (H5P_DATASET_CREATE); + if(dcpl < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) FAIL_STACK_ERROR @@ -615,19 +662,19 @@ test_overflow(void) static int test_read_file_set(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hid_t grp = -1; /* group to emit diagnostics */ - size_t i; /* miscellaneous counter */ - char filename[1024]; /* file names */ - int part[PART_SIZE]; /* raw data buffer (partial) */ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hid_t grp = -1; /* group to emit diagnostics */ + size_t i; /* miscellaneous counter */ + char filename[1024]; /* file names */ + int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ - hid_t hs_space = -1; /* hyperslab data space */ - hsize_t hs_start = 30; /* hyperslab starting offset */ - hsize_t hs_count = 25; /* hyperslab size */ + hsize_t cur_size; /* current data space size */ + hid_t hs_space = -1; /* hyperslab data space */ + hsize_t hs_start = 30; /* hyperslab starting offset */ + hsize_t hs_count = 25; /* hyperslab size */ TESTING("read external dataset"); @@ -656,7 +703,7 @@ test_read_file_set(hid_t fapl) HDsnprintf(filename, sizeof(filename), "extern_%dr.raw", (int) i + 1); if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) FAIL_STACK_ERROR - } /* end for */ + } /* Create the dataspace */ cur_size = TOTAL_SIZE; @@ -733,19 +780,19 @@ test_read_file_set(hid_t fapl) static int test_write_file_set(hid_t fapl) { - hid_t file = -1; /* file to which to write */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t mem_space = -1; /* memory data space */ - hid_t file_space = -1; /* file data space */ - hid_t dset = -1; /* dataset */ - unsigned i; /* miscellaneous counter */ - int part[PART_SIZE]; /* raw data buffer (partial) */ - int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size = 100; /* current data space size */ - hsize_t max_size = 200; /* maximum data space size */ - hsize_t hs_start = 100; /* hyperslab starting offset */ - hsize_t hs_count = 100; /* hyperslab size */ - char filename[1024]; /* file name */ + hid_t file = -1; /* file to which to write */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t mem_space = -1; /* memory data space */ + hid_t file_space = -1; /* file data space */ + hid_t dset = -1; /* dataset */ + unsigned i; /* miscellaneous counter */ + int part[PART_SIZE]; /* raw data buffer (partial) */ + int whole[TOTAL_SIZE]; /* raw data buffer (total) */ + hsize_t cur_size = 100; /* current data space size */ + hsize_t max_size = 200; /* maximum data space size */ + hsize_t hs_start = 100; /* hyperslab starting offset */ + hsize_t hs_count = 100; /* hyperslab size */ + char filename[1024]; /* file name */ TESTING("write external dataset"); @@ -858,16 +905,16 @@ test_write_file_set(hid_t fapl) static int test_path_absolute(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - size_t i; /* miscellaneous counter */ - char cwdpath[1024]; /* working directory */ - char filename[1024]; /* file name */ - int part[PART_SIZE]; /* raw data buffer (partial) */ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + size_t i; /* miscellaneous counter */ + char cwdpath[1024]; /* working directory */ + char filename[1024]; /* file name */ + int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ + hsize_t cur_size; /* current data space size */ TESTING("absolute filenames for external file"); @@ -948,16 +995,16 @@ error: static int test_path_relative(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - size_t i; /* miscellaneous counters */ - char cwdpath[1024]; /* working directory */ - char filename[1024]; /* file name */ - int part[PART_SIZE]; /* raw data buffer (partial) */ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + size_t i; /* miscellaneous counters */ + char cwdpath[1024]; /* working directory */ + char filename[1024]; /* file name */ + int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ + hsize_t cur_size; /* current data space size */ TESTING("filenames relative to current directory for external file"); @@ -1038,21 +1085,21 @@ error: static int test_path_relative_cwd(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dapl = -1; /* dataset access property list */ - hid_t dapl2 = -1; /* copy of dapl */ - hid_t dset = -1; /* dataset */ - hid_t dset2 = -1; /* dataset, opened a second time */ - hid_t dset3 = -1; /* dataset, opened with different prefix */ - size_t i; /* miscellaneous counters */ - char cwdpath[1024]; /* working directory */ - char filename[1024]; /* file name */ - int part[PART_SIZE]; /* raw data buffer (partial) */ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dapl = -1; /* dataset access property list */ + hid_t dapl2 = -1; /* copy of dapl */ + hid_t dset = -1; /* dataset */ + hid_t dset2 = -1; /* dataset, opened a second time */ + hid_t dset3 = -1; /* dataset, opened with different prefix */ + size_t i; /* miscellaneous counters */ + char cwdpath[1024]; /* working directory */ + char filename[1024]; /* file name */ + int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ - char buffer[1024]; /* buffer to read efile_prefix */ + hsize_t cur_size; /* current data space size */ + char buffer[1024]; /* buffer to read efile_prefix */ TESTING("filenames relative to HDF5 file for external file"); @@ -1194,14 +1241,14 @@ error: static int test_h5d_get_access_plist(hid_t fapl_id) { - hid_t fid = -1; /* file to write to */ - hid_t dcpl_id = -1; /* dataset creation properties */ - hid_t dapl_id = -1; /* dataset access properties */ - hid_t sid = -1; /* data space */ - hid_t did = -1; /* dataset */ - hsize_t dims = 0; /* dataset size */ - char *buffer = NULL; /* saved prefix name from dapl */ - char filename[1024]; /* file names */ + hid_t fid = -1; /* file to write to */ + hid_t dcpl_id = -1; /* dataset creation properties */ + hid_t dapl_id = -1; /* dataset access properties */ + hid_t sid = -1; /* data space */ + hid_t did = -1; /* dataset */ + hsize_t dims = 0; /* dataset size */ + char *buffer = NULL; /* saved prefix name from dapl */ + char filename[1024]; /* file names */ TESTING("H5Dget_access_plist() returns correct prefix"); @@ -1284,7 +1331,7 @@ test_h5d_get_access_plist(hid_t fapl_id) * * Return: EXIT_SUCCESS/EXIT_FAILURE * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 3, 1998 * *------------------------------------------------------------------------- @@ -1292,13 +1339,13 @@ test_h5d_get_access_plist(hid_t fapl_id) int main(void) { - hid_t fapl_id_old = -1; /* file access properties (old format) */ - hid_t fapl_id_new = -1; /* file access properties (new format) */ - hid_t fid = -1; /* file for test_1* functions */ - hid_t gid = -1; /* group to emit diagnostics */ - char filename[1024]; /* file name for test_1* funcs */ - unsigned latest_format; /* default or latest file format */ - int nerrors = 0; /* number of errors */ + hid_t fapl_id_old = -1; /* file access properties (old format) */ + hid_t fapl_id_new = -1; /* file access properties (new format) */ + hid_t fid = -1; /* file for test_1* functions */ + hid_t gid = -1; /* group to emit diagnostics */ + char filename[1024]; /* file name for test_1* funcs */ + unsigned latest_format; /* default or latest file format */ + int nerrors = 0; /* number of errors */ h5_reset(); @@ -1324,11 +1371,11 @@ main(void) if(latest_format) { HDputs("\nTesting with the latest file format:"); current_fapl_id = fapl_id_new; - } /* end if */ + } else { HDputs("Testing with the default file format:"); current_fapl_id = fapl_id_old; - } /* end else */ + } /* Create the common file used by some of the tests */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, current_fapl_id)) < 0) @@ -1364,7 +1411,7 @@ main(void) /* Close the common file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - } /* end for */ + } /* end for old and new format */ if(nerrors > 0) goto error; @@ -1386,7 +1433,7 @@ main(void) HDremove("extern_4w.raw"); HDrmdir("extern_dir"); - } /* end if */ + } return EXIT_SUCCESS; @@ -1401,3 +1448,4 @@ error: printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); return EXIT_FAILURE; } /* end main() */ + -- cgit v0.12 From 449d6807d5f81eff9db7356eed918d459154ee6c Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Tue, 28 May 2019 14:12:30 -0500 Subject: Modify code comments for clarity. Some minor reformatting. --- tools/src/h5repack/h5repack.c | 363 +++++++++++++++++++++++++----------------- 1 file changed, 218 insertions(+), 145 deletions(-) diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index a63e56f..a8b1458 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -41,7 +41,9 @@ static int have_request(pack_opt_t *options); * Return: 0, ok, -1, fail *------------------------------------------------------------------------- */ -int h5repack(const char* infile, const char* outfile, pack_opt_t *options) { +int +h5repack(const char* infile, const char* outfile, pack_opt_t *options) +{ /* check input */ if (check_options(options) < 0) return -1; @@ -55,7 +57,7 @@ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) { return -1; return 0; -} +} /* end h5repack() */ /*------------------------------------------------------------------------- * Function: h5repack_init @@ -86,7 +88,7 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest) } return (options_table_init(&(options->op_tbl))); -} +} /* end h5repack_init() */ /*------------------------------------------------------------------------- * Function: h5repack_end @@ -95,9 +97,11 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest) *------------------------------------------------------------------------- */ -int h5repack_end(pack_opt_t *options) { +int +h5repack_end(pack_opt_t *options) +{ return options_table_free(options->op_tbl); -} +} /* end h5repack_end() */ /*------------------------------------------------------------------------- * Function: h5repack_addfilter @@ -138,7 +142,7 @@ h5repack_addfilter(const char *str, pack_opt_t *options) HDfree(obj_list); return 0; -} +} /* end h5repack_addfilter() */ /*------------------------------------------------------------------------- * Function: h5repack_addlayout @@ -175,7 +179,7 @@ h5repack_addlayout(const char *str, pack_opt_t *options) if (pack.layout == H5D_CHUNKED) { /* -2 means the NONE option, remove chunking and set the global layout to contiguous */ - if (pack.chunk.rank == -2) + if (pack.chunk.rank == -2) /* TODO: fix 'magic number' */ options->layout_g = H5D_CONTIGUOUS; /* otherwise set the global chunking type */ else { @@ -192,10 +196,10 @@ h5repack_addlayout(const char *str, pack_opt_t *options) HDfree(obj_list); ret_value = 0; - } + } /* end if obj_list exists */ return ret_value; -} +} /* end h5repack_addlayout() */ /* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr() * were located in h5repack_copy.c as static prior to bugfix1726. @@ -215,8 +219,13 @@ h5repack_addlayout(const char *str, pack_opt_t *options) * to free the stack. *------------------------------------------------------------------------- */ -hid_t copy_named_datatype(hid_t type_in, hid_t fidout, - named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) { +hid_t +copy_named_datatype(hid_t type_in, + hid_t fidout, + named_dt_t **named_dt_head_p, + trav_table_t *travt, + pack_opt_t *options) +{ named_dt_t *dt = *named_dt_head_p; /* Stack pointer */ named_dt_t *dt_ret = NULL; /* Datatype to return */ H5O_info_t oinfo; /* Object info of input dtype */ @@ -238,8 +247,10 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout, for (i = 0; i < travt->nobjs; i++) { if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { /* Push onto the stack */ - if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed"); + dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t)); + if (NULL == dt) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "buffer allocation failed failed"); dt->next = *named_dt_head_p; *named_dt_head_p = dt; @@ -250,13 +261,14 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout, /* Check if this type is the one requested */ if (oinfo.addr == dt->addr_in) { dt_ret = dt; - } /* end if */ - } /* end if */ - } /* end for */ - } /* end else */ + } + } /* end if named datatype */ + } /* end for each object in traversal table */ + } /* end else (create the stack) */ /* Handle the case that the requested datatype was not found. This is - * possible if the datatype was committed anonymously in the input file. */ + * possible if the datatype was committed anonymously in the input file. + */ if (!dt_ret) { /* Push the new datatype onto the stack */ if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) @@ -267,31 +279,35 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout, /* Update the address and id */ dt_ret->addr_in = oinfo.addr; dt_ret->id_out = -1; - } /* end if */ + } /* end if requested datatype not found */ /* If the requested datatype does not yet exist in the output file, copy it - * anonymously */ + * anonymously + */ if (dt_ret->id_out < 0) { if (options->use_native == 1) dt_ret->id_out = H5Tget_native_type(type_in, H5T_DIR_DEFAULT); else dt_ret->id_out = H5Tcopy(type_in); if (dt_ret->id_out < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type-H5Tcopy failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "H5Tget_native_type-H5Tcopy failed"); if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommit_anon failed"); - } /* end if */ + } /* end if named datatype not yet in output file */ /* Set return value */ ret_value = dt_ret->id_out; - /* Increment the ref count on id_out, because the calling function will try to close it */ - if(H5Iinc_ref(ret_value) < 0) + /* Increment the ref count on id_out, because the calling function will try + * to close it. (TODO: fix scope envy) + */ + if (H5Iinc_ref(ret_value) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iinc_ref failed"); done: return ret_value; -} /* end copy_named_datatype */ +} /* end copy_named_datatype() */ /*------------------------------------------------------------------------- * Function: named_datatype_free @@ -299,7 +315,9 @@ done: * Purpose: Frees the stack of named datatypes. *------------------------------------------------------------------------- */ -int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) { +int +named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) +{ named_dt_t *dt = *named_dt_head_p; int ret_value = -1; @@ -310,13 +328,13 @@ int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) { dt = dt->next; HDfree(*named_dt_head_p); *named_dt_head_p = dt; - } /* end while */ + } ret_value = 0; done: return (ret_value); -} /* end named_datatype_free */ +} /* end named_datatype_free() */ /*------------------------------------------------------------------------- * Function: copy_attr @@ -330,8 +348,12 @@ done: *------------------------------------------------------------------------- */ int -copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, - trav_table_t *travt, pack_opt_t *options) +copy_attr( + hid_t loc_in, + hid_t loc_out, + named_dt_t **named_dt_head_p, + trav_table_t *travt, + pack_opt_t *options) { int ret_value = 0; hid_t attr_id = -1; /* attr ID */ @@ -361,42 +383,58 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, */ for (u = 0; u < (unsigned) oinfo.num_attrs; u++) { /* open attribute */ - if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0) + attr_id = H5Aopen_by_idx( + loc_in, + ".", + H5_INDEX_CRT_ORDER, + H5_ITER_INC, + (hsize_t) u, + H5P_DEFAULT, + H5P_DEFAULT); + if (attr_id < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); - /* get name */ if (H5Aget_name(attr_id, (size_t) 255, name) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - /* get the file datatype */ - if ((ftype_id = H5Aget_type(attr_id)) < 0) + ftype_id = H5Aget_type(attr_id); + if (ftype_id < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); /* Check if the datatype is committed */ - if ((is_named = H5Tcommitted(ftype_id)) < 0) + is_named = H5Tcommitted(ftype_id); + if (is_named < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed"); if (is_named && travt) { hid_t fidout = -1; /* Create out file id */ - if ((fidout = H5Iget_file_id(loc_out)) < 0) + fidout = H5Iget_file_id(loc_out); + if (fidout < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iget_file_id failed"); /* Copy named dt */ - if ((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, travt, options)) < 0) { + wtype_id = copy_named_datatype( + ftype_id, + fidout, + named_dt_head_p, + travt, + options); + if (wtype_id < 0) { H5Fclose(fidout); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); - } /* end if */ + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "copy_named_datatype failed"); + } if (H5Fclose(fidout) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); - } /* end if */ + } else { if (options->use_native == 1) wtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT); else wtype_id = H5Tcopy(ftype_id); - } /* end else */ + } /* get the dataspace handle */ if ((space_id = H5Aget_space(attr_id)) < 0) @@ -404,7 +442,8 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, /* get dimensions */ if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "H5Sget_simple_extent_dims failed"); nelmts = 1; for (j = 0; j < rank; j++) @@ -413,12 +452,12 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, if ((msize = H5Tget_size(wtype_id)) == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - /*------------------------------------------------------------------------- - * object references are a special case. We cannot just copy the buffers, - * but instead we recreate the reference. - * This is done on a second sweep of the file that just copies the referenced - * objects at copy_refs_attr() - *------------------------------------------------------------------------- + /*--------------------------------------------------------------------- + * object references are a special case. We cannot just copy the + * buffers, but instead we recreate the reference. + * This is done on a second sweep of the file that just copies the + * referenced objects at copy_refs_attr(). + *--------------------------------------------------------------------- */ type_class = H5Tget_class(wtype_id); is_ref = (type_class == H5T_REFERENCE); @@ -429,7 +468,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE)); if (H5Tclose(base_type) < 0) H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed"); - } + } /* end if type_class is variable length or array */ if (type_class == H5T_COMPOUND) { int nmembers = H5Tget_nmembers(wtype_id); @@ -444,13 +483,13 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, is_ref = 1; break; } - } /* for (j=0; iverbose) printf(FORMAT_OBJ_ATTR, "attr", name); - /*------------------------------------------------------------------------- + /*--------------------------------------------------------------------- * close - *------------------------------------------------------------------------- + *--------------------------------------------------------------------- */ if (H5Sclose(space_id) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); @@ -501,19 +540,18 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, if (H5Aclose(attr_id) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); attr_id = -1; - } /* for u */ + } /* for u (each attribute) */ done: H5E_BEGIN_TRY { if (buf) { - /* Check if we have VL data and string in the attribute's datatype that must - * be reclaimed */ + /* Check if we have VL data and string in the attribute's + * datatype that must be reclaimed + */ if (TRUE == h5tools_detect_vlen(wtype_id)) H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); - - /* Free buf */ HDfree(buf); - } /* end if */ + } H5Aclose(attr_out); H5Sclose(space_id); @@ -525,25 +563,27 @@ done: return ret_value; } /* end copy_attr() */ -/*------------------------------------------------------------------------- +/*----------------------------------------------------------------------------- * Function: check_options * * Purpose: print options, checks for invalid options * * Return: void, return -1 on error - *------------------------------------------------------------------------- + *----------------------------------------------------------------------------- */ -static int check_options(pack_opt_t *options) { +static int +check_options(pack_opt_t *options) +{ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ unsigned int i; int k, j, has_cp = 0, has_ck = 0; char slayout[30]; /*------------------------------------------------------------------------- - * objects to layout - *------------------------------------------------------------------------- - */ - if (options->verbose && have_request(options) /* only print if requested */) { + * Objects to layout + *------------------------------------------------------------------------- + */ + if (options->verbose && have_request(options)) { if (options->all_layout == 1) { printf("All objects to modify layout are...\n"); switch (options->layout_g) { @@ -577,7 +617,7 @@ static int check_options(pack_opt_t *options) { } else printf("No all objects to modify layout\n"); - }/* verbose */ + } /* end if verbose */ for (i = 0; i < options->op_tbl->nelems; i++) { char* name = options->op_tbl->objs[i].path; @@ -586,27 +626,28 @@ static int check_options(pack_opt_t *options) { if (options->verbose) { printf(" <%s> with chunk size ", name); for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) - printf("%d ", (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]); + printf("%d ", (int)options->op_tbl->objs[i].chunk.chunk_lengths[k]); printf("\n"); } has_ck = 1; } - else if (options->op_tbl->objs[i].chunk.rank == -2) { + else if (options->op_tbl->objs[i].chunk.rank == -2) { /* TODO: replace 'magic number' */ if (options->verbose) printf(" <%s> %s\n", name, "NONE (contiguous)"); has_ck = 1; } - } + } /* end for each object in options */ if (options->all_layout == 1 && has_ck) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid chunking input: 'all' option is present with other objects"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "invalid chunking input: 'all' option is present with other objects"); /*------------------------------------------------------------------------- - * objects to filter - *------------------------------------------------------------------------- - */ + * Objects to filter + *------------------------------------------------------------------------- + */ - if (options->verbose && have_request(options) /* only print if requested */) { + if (options->verbose && have_request(options)) { if (options->all_filter == 1) { printf("All objects to apply filter are...\n"); for (k = 0; k < options->n_filter_g; k++) { @@ -625,13 +666,15 @@ static int check_options(pack_opt_t *options) { break; case H5Z_FILTER_SZIP: case H5Z_FILTER_DEFLATE: - printf(" All with %s, parameter %d\n", get_sfilter(filtn), options->filter_g[k].cd_values[0]); + printf(" All with %s, parameter %d\n", + get_sfilter(filtn), + options->filter_g[k].cd_values[0]); break; default: printf(" User Defined %d\n", filtn); break; - } /* k */ - }; + } + } } else printf("No all objects to apply filter\n"); @@ -643,39 +686,50 @@ static int check_options(pack_opt_t *options) { for (j = 0; j < pack.nfilters; j++) { if (options->verbose) { - if(pack.filter[j].filtn >= 0) { - if(pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) - printf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), pack.filter[j].filtn); + if (pack.filter[j].filtn >= 0) { + if (pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) + printf(" <%s> with %s filter %d\n", + name, + get_sfilter(pack.filter[j].filtn), + pack.filter[j].filtn); else - printf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn)); + printf(" <%s> with %s filter\n", + name, + get_sfilter(pack.filter[j].filtn)); } } has_cp = 1; - } /* j */ - } /* i */ + } /* for each filter */ + } /* end for each object in options table */ if (options->all_filter == 1 && has_cp) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid compression input: 'all' option is present with other objects"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "invalid compression input: 'all' option is present with " \ + "other objects"); /*------------------------------------------------------------------------- - * check options for the latest format - *------------------------------------------------------------------------- - */ + * Check options for the latest format + *------------------------------------------------------------------------- + */ if (options->grp_compact < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid maximum number of links to store as header messages"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "invalid maximum number of links to store as header messages"); if (options->grp_indexed < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid minimum number of links to store in the indexed format"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "invalid minimum number of links to store in indexed format"); if (options->grp_indexed > options->grp_compact) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "minimum indexed size is greater than the maximum compact size"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "minimum indexed size is greater than maximum compact size"); for (i = 0; i < 8; i++) if (options->msg_size[i] < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid shared message size"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "invalid shared message size"); - /*-------------------------------------------------------------------------------- - * verify new user userblock options; file name must be present - *--------------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------ + * Verify new user userblock options; file name must be present + *------------------------------------------------------------------------ + */ if (options->ublock_filename != NULL && options->ublock_size == 0) { if (options->verbose) { printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", options->ublock_filename); @@ -684,37 +738,41 @@ static int check_options(pack_opt_t *options) { } if (options->ublock_filename == NULL && options->ublock_size != 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file name missing for user block", options->ublock_filename); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "file name missing for user block", options->ublock_filename); - /*-------------------------------------------------------------------------------- - * verify alignment options; threshold is zero default but alignment not - *--------------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------ + * Verify alignment options; threshold is zero default but alignment not + *------------------------------------------------------------------------ + */ if (options->alignment == 0 && options->threshold != 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "alignment for H5Pset_alignment missing"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "alignment for H5Pset_alignment missing"); done: return ret_value; -} +} /* end check_options() */ /*------------------------------------------------------------------------- * Function: check_objects * - * Purpose: locate all HDF5 objects in the file and compare with user - * supplied list + * Purpose: Locate all HDF5 objects in the file and compare with user-supplied + * list. * * Return: 0, ok, -1 no *------------------------------------------------------------------------- */ -static int check_objects(const char* fname, pack_opt_t *options) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ +static int +check_objects(const char* fname, pack_opt_t *options) +{ hid_t fid = -1; hid_t did = -1; hid_t sid = -1; unsigned int i; unsigned int uf; trav_table_t *travt = NULL; + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ /* nothing to do */ if (options->op_tbl->nelems == 0) @@ -724,8 +782,10 @@ static int check_objects(const char* fname, pack_opt_t *options) { * open the file *------------------------------------------------------------------------- */ - if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); + fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0); + if (fid < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); /*------------------------------------------------------------------------- * get the list of objects in the file @@ -734,7 +794,6 @@ static int check_objects(const char* fname, pack_opt_t *options) { /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); - /* init table */ trav_table_init(&travt); /* get the list of objects in the file */ @@ -747,68 +806,80 @@ static int check_objects(const char* fname, pack_opt_t *options) { */ if (options->verbose) - printf("Opening file. Searching %d objects to modify ...\n", travt->nobjs); + printf("Opening file. Searching %lu objects to modify ...\n", + travt->nobjs); for (i = 0; i < options->op_tbl->nelems; i++) { - char* name = options->op_tbl->objs[i].path; + pack_info_t obj = options->op_tbl->objs[i]; + char* name = obj.path; if (options->verbose) printf(" <%s>", name); /* the input object names are present in the file and are valid */ if (h5trav_getindext(name, travt) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "%s Could not find <%s> in file <%s>. Exiting...\n", + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose ? "\n" : ""), name, fname); if (options->verbose) printf("...Found\n"); - for (uf = 0; uf < options->op_tbl->objs[i].nfilters; uf++) { - if (options->op_tbl->objs[i].filter[uf].filtn < 0) + for (uf = 0; uf < obj.nfilters; uf++) { + if (obj.filter[uf].filtn < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); /* check for extra filter conditions */ - switch (options->op_tbl->objs[i].filter[uf].filtn) { + switch (obj.filter[uf].filtn) { /* chunk size must be smaller than pixels per block */ case H5Z_FILTER_SZIP: { int j; hsize_t csize = 1; - unsigned ppb = options->op_tbl->objs[i].filter[uf].cd_values[0]; + unsigned ppb = obj.filter[uf].cd_values[0]; hsize_t dims[H5S_MAX_RANK]; int rank; - if (options->op_tbl->objs[i].chunk.rank > 0) { - rank = options->op_tbl->objs[i].chunk.rank; + if (obj.chunk.rank > 0) { + rank = obj.chunk.rank; for (j = 0; j < rank; j++) - csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j]; + csize *= obj.chunk.chunk_lengths[j]; } else { - if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - if ((sid = H5Dget_space(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); - if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + did = H5Dopen2(fid, name, H5P_DEFAULT); + if (did < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "H5Dopen2 failed"); + sid = H5Dget_space(did); + if (sid < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "H5Dget_space failed"); + rank = H5Sget_simple_extent_ndims(sid); + if (rank < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "H5Sget_simple_extent_ndims failed"); HDmemset(dims, 0, sizeof dims); if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "H5Sget_simple_extent_dims failed"); for (j = 0; j < rank; j++) csize *= dims[j]; if (H5Sclose(sid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "H5Sclose failed"); if (H5Dclose(did) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - } + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, + "H5Dclose failed"); + } /* end else (chunk rank is 0) */ if (csize < ppb) { printf(" \n"); HGOTO_DONE(0); } - } + } /* end SZIP */ break; default: break; - } - } /* for uf */ - } /* for i */ + } /* end switch */ + } /* for uf (each user-defined filter) */ + } /* for i (each object in options traversal table) */ done: H5E_BEGIN_TRY { @@ -819,7 +890,7 @@ done: if (travt) trav_table_free(travt); return ret_value; -} +} /* end check_objects() */ /*------------------------------------------------------------------------- * Function: have_request @@ -829,14 +900,15 @@ done: * Return: 1 yes, 0 no *------------------------------------------------------------------------- */ -static int have_request(pack_opt_t *options) { +static int +have_request(pack_opt_t *options) +{ if (options->all_filter || options->all_layout || options->op_tbl->nelems) return 1; return 0; - -} +} /* end have_request() */ /*------------------------------------------------------------------------- * Function: get_sfilter @@ -846,8 +918,9 @@ static int have_request(pack_opt_t *options) { * Return: name of filter, exit on error *------------------------------------------------------------------------- */ - -static const char* get_sfilter(H5Z_filter_t filtn) { +static const char * +get_sfilter(H5Z_filter_t filtn) +{ if (filtn < 0) return NULL; else if (filtn == H5Z_FILTER_NONE) @@ -866,5 +939,5 @@ static const char* get_sfilter(H5Z_filter_t filtn) { return "SOFF"; else return "UD"; -} +} /* end get_sfilter() */ -- cgit v0.12 From a648183cc38e71f7393702c3ad11bf5ccb7a74a4 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Thu, 30 May 2019 15:45:53 -0500 Subject: Add initial failing test for h5repack copying external data into new file. --- MANIFEST | 1 + tools/test/h5repack/Makefile.am | 2 + tools/test/h5repack/h5repack.sh.in | 93 ++++++++++++++++++++- tools/test/h5repack/h5repackgentest.c | 83 ++++++++++++++++++ tools/test/h5repack/testfiles/h5repack_int32le.h5 | Bin 0 -> 4096 bytes .../h5repack/testfiles/h5repack_int32le_ex-0.dat | Bin 0 -> 2048 bytes .../test/h5repack/testfiles/h5repack_int32le_ex.h5 | Bin 0 -> 1472 bytes 7 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 tools/test/h5repack/h5repackgentest.c create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_ex-0.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 diff --git a/MANIFEST b/MANIFEST index c3dc0e9..7a4257e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1478,6 +1478,7 @@ ./tools/test/h5repack/dynlib_rpk.c ./tools/test/h5repack/dynlib_vrpk.c ./tools/test/h5repack/h5repack.sh.in +./tools/test/h5repack/h5repackgentest.c ./tools/test/h5repack/h5repack_plugin.sh.in ./tools/test/h5repack/h5repacktst.c ./tools/test/h5repack/testh5repack_detect_szip.c diff --git a/tools/test/h5repack/Makefile.am b/tools/test/h5repack/Makefile.am index 59d7a6a..ff950e4 100644 --- a/tools/test/h5repack/Makefile.am +++ b/tools/test/h5repack/Makefile.am @@ -22,10 +22,12 @@ include $(top_srcdir)/config/commence.am AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib -I$(top_srcdir)/tools/src/h5repack # Test programs and scripts +TEST_PROG=h5repackgentest TEST_SCRIPT=h5repack.sh noinst_PROGRAMS=h5repacktst testh5repack_detect_szip +check_PROGRAMS=$(TEST_PROG) SCRIPT_DEPEND=../../src/h5repack/h5repack$(EXEEXT) h5repacktst$(EXEEXT) if HAVE_SHARED_CONDITIONAL if USE_PLUGINS_CONDITIONAL diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 282ba76..9851e89 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -115,6 +115,8 @@ $SRC_H5REPACK_TESTFILES/h5repack_fsm_aggr_persist.h5 $SRC_H5REPACK_TESTFILES/h5repack_none.h5 $SRC_H5REPACK_TESTFILES/h5repack_paged_nopersist.h5 $SRC_H5REPACK_TESTFILES/h5repack_paged_persist.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_ex.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr1.h5 $SRC_TOOLS_TESTFILES/tfamily00000.h5 $SRC_TOOLS_TESTFILES/tfamily00001.h5 @@ -160,6 +162,7 @@ $SRC_H5REPACK_TESTFILES/ublock.bin $SRC_H5REPACK_TESTFILES/h5repack.info $SRC_H5REPACK_TESTFILES/crtorder.tordergr.h5.ddl $SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl +$SRC_H5REPACK_TESTFILES/h5repack_int32le_ex-0.dat $SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl $SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst $SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst @@ -599,8 +602,91 @@ VERIFY_INVALIDBOUNDS() } # end of VERIFY_INVALIDBOUNDS +# ----------------------------------------------------------------------------- +# Expect h5diff to fail +# ----------------------------------------------------------------------------- +DIFFFAIL() +{ + VERIFY h5diff unequal $@ + ( + cd $TESTDIR + $RUNSERIAL $H5DIFF_BIN -q "$@" + ) + RET=$? + if [ $RET == 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi +} + +# ----------------------------------------------------------------------------- +# Catchall test for repacking with external files +# Loops over all (internally-listed) cases and applies the given arguments +# to h5repack. +# Expects case files to be of format: +# + h5repack_.h5 +# + h5repack__ex.h5 +# + h5repack__ex-.dat +# ...where NAME is part of the internal list, and N is a positive decimal +# number; multiple external files (*.dat) are allowed per file, but they must +# follow the same pattern and be in numerical sequence starting at 0. +# ----------------------------------------------------------------------------- +VERIFY_EXTERNAL_CONSOLIDATION() +{ + for name in int32le + do + basename="h5repack_${name}" + base_ext="${basename}_ex" + base_rpkg="${basename}_rp" + canonical="${basename}.h5" + external="${base_ext}.h5" + ex_dat="${base_ext}-0.dat" + ex_dat_mv="__${ext_dat}" + repacked="${base_rpkg}.h5" + prev_nerrors=$nerrors + + TESTING external consolidation on $name with h5repack $@ + echo " . . ." + + # baseline comparison of known files + DIFFTEST $canonical $external + + # repack the external file, verify integrity + ( cd $TESTDIR + $H5REPACK_BIN $@ $external $repacked + ) + DIFFTEST $repacked $canonical + DIFFTEST $repacked $external + + # invalidate external file by moving its data file; verify + ( cd $TESTDIR + mv $ex_dat $ex_dat_mv + ) + DIFFFAIL $canonical $external + DIFFFAIL $repacked $external + DIFFTEST $canonical $repacked + + # reset test state for re-runs with different h5repack arguments + ( cd $TESTDIR + mv $ex_dat_mv $ex_dat + rm $repacked + ) + + # flag if any of the above checks failed + if [ $prev_nerrors != $nerrors ]; then + echo ". . . *FAILED*" + nerrors="`expr $prev_nerrors + 1`" + else + echo ". . . PASSED" + fi + done +} # end VERIFY_EXTERNAL_CONSOLIDATION + +# ----------------------------------------------------------------------------- # same as TOOLTEST, but it uses the old syntax -i input_file -o output_file -# +# ----------------------------------------------------------------------------- TOOLTEST0() { infile=$2 @@ -1464,6 +1550,11 @@ VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5 # -j 0 -k 1, file cannot be opened VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5 +# +# Testing external storage +# +VERIFY_EXTERNAL_CONSOLIDATION + # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c new file mode 100644 index 0000000..8076b42 --- /dev/null +++ b/tools/test/h5repack/h5repackgentest.c @@ -0,0 +1,83 @@ +#include "hdf5.h" +#include "H5private.h" + +#define MAX_NAME_SIZE 256 +#define FILE_INT32LE "h5repack_int32le" + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + */ +static void +generate_external_int32le(hbool_t external) +{ + char filename[MAX_NAME_SIZE]; + hid_t file; + hid_t dspace; + hid_t dset; + hid_t dcpl = H5P_DEFAULT; + hsize_t dims[] = {8, 8, 8}; + int32_t wdata[512]; /* 8^3 */ + int32_t n; + int i; + int j; + int k; + + /* generate values, alternating positive and negative + */ + for (i=0, n=0; i < 8; i++) + for (j=0; j < 8; j++) + for (k=0; k < 8; k++, n++) + wdata[n] = (k + j*512 + i*4096) * ((n&1) ? (-1) : (1)); + + snprintf(filename, + MAX_NAME_SIZE, + "%s%s.h5", + FILE_INT32LE, + (external) ? "_ex" : ""); + + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(file >= 0); + + dspace = H5Screate_simple(3, dims, NULL); + HDassert(dspace >= 0); + + if (external) { + char name[MAX_NAME_SIZE]; + dcpl = H5Pcreate(H5P_DATASET_CREATE); + HDassert(dcpl >= 0); + snprintf(name, MAX_NAME_SIZE, "%s_ex-0.dat", FILE_INT32LE); + HDassert(H5Pset_external(dcpl, name, 0, H5F_UNLIMITED) >= 0); + } + + dset = H5Dcreate2( + file, + "dset", + H5T_STD_I32LE, + dspace, + H5P_DEFAULT, + dcpl, + H5P_DEFAULT); + HDassert(dset >= 0); + + HDassert(H5Dwrite(dset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) + >= 0); + + if (external) + HDassert(H5Pclose(dcpl) >= 0); + HDassert(H5Dclose(dset) >= 0); + HDassert(H5Sclose(dspace) >= 0); + HDassert(H5Fclose(file) >= 0); +} /* end generate_external_int32le() */ + + +/* ---------------------------------------------------------------------------- + */ +int +main(void) +{ + generate_external_int32le(FALSE); + generate_external_int32le(TRUE); + return 0; +} /* end main() */ + + diff --git a/tools/test/h5repack/testfiles/h5repack_int32le.h5 b/tools/test/h5repack/testfiles/h5repack_int32le.h5 new file mode 100644 index 0000000..fb00579 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_int32le_ex-0.dat new file mode 100644 index 0000000..b505eb4 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_ex-0.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 new file mode 100644 index 0000000..337b297 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 differ -- cgit v0.12 From cb6029196af9a960872c627db53fcbc4cf89d923 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Thu, 30 May 2019 15:46:39 -0500 Subject: Formatting changes, mostly. --- tools/src/h5repack/h5repack_copy.c | 183 +++++++++++++++++++++++++------------ 1 file changed, 125 insertions(+), 58 deletions(-) diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 0567269..544793a 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -80,8 +80,8 @@ static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t * -1 no *------------------------------------------------------------------------- */ - -int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) +int +copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) { int ret_value = 0; hid_t fidin = -1; @@ -387,7 +387,7 @@ done: trav_table_free(travt); return ret_value; -} +} /* end copy_objects() */ /*------------------------------------------------------------------------- * Function: Get_hyperslab @@ -543,7 +543,7 @@ Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], done: return ret_value; -} +} /* end Get_hyperslab() */ /*------------------------------------------------------------------------- * Function: do_copy_objects @@ -599,7 +599,8 @@ done: *------------------------------------------------------------------------- */ -int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, +int +do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */ { int ret_value = 0; @@ -699,7 +700,11 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, } else { if (options->grp_compact > 0 || options->grp_indexed > 0) - if (H5Pset_link_phase_change(gcpl_out, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0) + if (H5Pset_link_phase_change( + gcpl_out, + (unsigned) options->grp_compact, + (unsigned) options->grp_indexed) + < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed"); if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) @@ -780,6 +785,9 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (H5Dclose(dset_in) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); +/* TODO: be smart about external storage */ +/* can we use the dcpl_in/out to adjust any external storage? */ +/* what about the case with just H5Ocopy? */ /*------------------------------------------------------------------------- * check if we should use H5Ocopy or not * if there is a request for filters/layout, we read/write the object @@ -819,7 +827,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, wtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT); else wtype_id = H5Tcopy(ftype_id); - } /* end if */ + } if ((msize = H5Tget_size(wtype_id)) == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); @@ -858,12 +866,20 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* apply the filter */ if (apply_s) - if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out, options, &has_filter) < 0) + if (apply_filters( + travt->objs[i].name, + rank, + dims, + msize, + dcpl_out, + options, + &has_filter) + < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "apply_filters failed"); /* only if layout change requested for entire file or * individual obj */ - if (options->all_layout > 0 || req_obj_layout == 1) + if (options->all_layout > 0 || req_obj_layout == 1) { /*------------------------------------------------- * Unset the unlimited max dims if convert to other * than chunk layouts, because unlimited max dims @@ -883,14 +899,14 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* if convert to COMPACT */ if (options->layout_g == H5D_COMPACT) - /* should be smaller than 64K */ if (size_dset > MAX_COMPACT_DSIZE) limit_maxdims = FALSE; /* unset unlimited max dims */ if (limit_maxdims) H5Sset_extent_simple(f_space_id, rank, dims, NULL); - } + } /* if not chunked */ + } /* if layout change requested for entire file or individual object */ /*------------------------------------------------------------------------- * create the output dataset; @@ -898,16 +914,36 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, * modified dcpl; in that case use the original instead *------------------------------------------------------------------------- */ - dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); - if (dset_out == FAIL) { - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); + dset_out = H5Dcreate2(fidout, + travt->objs[i].name, + wtype_id, + f_space_id, + H5P_DEFAULT, + dcpl_out, + H5P_DEFAULT); + if (dset_out < 0) { + H5Epush2(H5tools_ERR_STACK_g, + __FILE__, + FUNC, + __LINE__, + H5tools_ERR_CLS_g, + H5E_tools_g, + H5E_tools_min_id_g, + "H5Dcreate2 failed"); if (options->verbose) - printf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name); - - if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) + printf(" warning: could not create dataset <%s>. Applying original settings\n", + travt->objs[i].name); + dset_out = H5Dcreate2(fidout, + travt->objs[i].name, + wtype_id, + f_space_id, + H5P_DEFAULT, + dcpl_in, + H5P_DEFAULT); + if (dset_out < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); apply_f = 0; - } + } /* if opening dataset with original DCPL (retry) */ /*------------------------------------------------------------------------- * read/write @@ -931,8 +967,8 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) if (H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dvlen_reclaim failed"); - /* free */ - if (buf != NULL) { + + if (buf != NULL) { /* TODO: is buf potentially released by H5Dvlen_reclaim()? */ HDfree(buf); buf = NULL; } @@ -968,17 +1004,25 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, dset_layout = H5Pget_layout(dcpl_out); if (dset_layout == H5D_CHUNKED) dcpl_tmp = dcpl_out; /* writing dataset */ - else { /* if reading dataset is chunked */ + else { dset_layout = H5Pget_layout(dcpl_in); if (dset_layout == H5D_CHUNKED) dcpl_tmp = dcpl_in; /* reading dataset */ } - /* get hyperslab dims and size in byte */ - if (Get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) + if (Get_hyperslab( + dcpl_tmp, + rank, + dims, + p_type_nbytes, + hslab_dims, + &hslab_nbytes) + < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Get_hyperslab failed"); hslab_buf = HDmalloc((size_t)hslab_nbytes); + if (hslab_buf == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "can't allocate space for hyperslab"); hslab_nelmts = hslab_nbytes / p_type_nbytes; hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL); @@ -996,28 +1040,57 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ for (k = 0, hs_select_nelmts = 1; k < rank; k++) { /* MIN() is used to get the remaining edge portion if exist. - * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/ + * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is + * smaller then the hyperslab. + */ hs_sel_count[k] = MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]); hs_select_nelmts *= hs_sel_count[k]; } - if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0) + if (H5Sselect_hyperslab( + f_space_id, + H5S_SELECT_SET, + hs_sel_offset, + NULL, + hs_sel_count, + NULL) + < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0) + if (H5Sselect_hyperslab( + hslab_space, + H5S_SELECT_SET, + zero, + NULL, + &hs_select_nelmts, + NULL) + < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - } + } /* end if rank > 0 */ else { H5Sselect_all(f_space_id); H5Sselect_all(hslab_space); hs_select_nelmts = 1; - } /* rank */ - - if(H5Dread(dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) + } /* rank == 0 */ + + if (H5Dread( + dset_in, + wtype_id, + hslab_space, + f_space_id, + H5P_DEFAULT, + hslab_buf) + < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - if(H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) + if (H5Dwrite( + dset_out, + wtype_id, + hslab_space, + f_space_id, + H5P_DEFAULT, + hslab_buf) + < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); - /* reclaim any VL memory, if necessary */ if (vl_data) H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT, hslab_buf); @@ -1029,20 +1102,19 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, hs_sel_offset[k - 1] = 0; else carry = 0; - } /* k */ - } /* elmtno */ + } + } /* hyperslab selection loop */ H5Sclose(hslab_space); - /* free */ if (hslab_buf != NULL) { HDfree(hslab_buf); hslab_buf = NULL; } - } /* hyperslab read */ - } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */ + } /* end if reading/writing by hyperslab */ + } /* if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) */ /*------------------------------------------------------------------------- - * amount of compression used + * print amount of compression used *------------------------------------------------------------------------- */ if (options->verbose) { @@ -1062,14 +1134,16 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0); /* print a message that the filter was not applied - (in case there was a filter) + * (in case there was a filter) */ if (has_filter && apply_s == 0) - printf(" \n", travt->objs[i].name, (int) options->min_comp); + printf(" \n", + travt->objs[i].name, + (int) options->min_comp); if (has_filter && apply_f == 0) printf(" \n", travt->objs[i].name); - } /* verbose */ + } /* if verbose (print compression) */ /*------------------------------------------------------------------------- * copy attrs @@ -1078,11 +1152,10 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); - /*close */ if (H5Dclose(dset_out) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - }/*!H5T_REFERENCE*/ - }/*h5tools_canreadf*/ + } /* !H5T_REFERENCE */ + } /* if h5tools_canreadf (filter availability check) */ /*------------------------------------------------------------------------- * close @@ -1116,11 +1189,6 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_copy_object failed"); - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - if (H5Ocopy(fidin, /* Source file or group identifier */ travt->objs[i].name, /* Name of the source object to be copied */ fidout, /* Destination file or group identifier */ @@ -1129,7 +1197,6 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Ocopy failed"); - /* close property */ if (H5Pclose(pid) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); @@ -1151,7 +1218,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (options->verbose) printf(FORMAT_OBJ, "dset", travt->objs[i].name); - } /* end do we have request for filter/chunking */ + } /* end whether we have request for filter/chunking */ break; /*------------------------------------------------------------------------- @@ -1211,8 +1278,8 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, default: HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Object type not found"); } /* switch */ - } /* end for */ - } /* end if */ + } /* end for each object to traverse */ + } /* end if there are objects */ done: @@ -1250,7 +1317,7 @@ done: HDfree(hslab_buf); return ret_value; -} +} /* end do_copy_objects() */ /*------------------------------------------------------------------------- * Function: print_dataset_info @@ -1345,7 +1412,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) HDstrcat(strfilter, "UD "); break; } /* switch */ - }/*i*/ + } /* for each filter */ if (!pr) printf(FORMAT_OBJ, "dset", objname); @@ -1358,7 +1425,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) HDstrcat(str, temp); printf(FORMAT_OBJ, str, objname); } -} +} /* end print_dataset_info() */ /*------------------------------------------------------------------------- * Function: copy_user_block @@ -1428,7 +1495,7 @@ done: HDclose(outfid); return ret_value; -} +} /* end copy_user_block() */ /*------------------------------------------------------------------------- * Function: print_user_block @@ -1501,6 +1568,6 @@ done: HDclose(fh); return; -} +} /* end print_user_block() */ #endif -- cgit v0.12 From ad2a7f47896cf636b42fbc73b96781b2d5200f56 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Fri, 31 May 2019 17:24:26 -0500 Subject: First pass at repack consolidating external storage if layout given. Checks out manually, tests still complain. --- tools/src/h5repack/h5repack_copy.c | 15 ++++++++++++--- tools/test/h5repack/Makefile.am | 3 ++- tools/test/h5repack/h5repack.sh.in | 3 ++- tools/test/h5repack/h5repackgentest.c | 8 ++++---- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 544793a..c638f3d 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -807,8 +807,17 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); - if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); + /* If the input dataset has external storage, it must be contiguous. + * Accordingly, there would be no filter or chunk properties to preserve. + */ + if (H5Pget_external_count(dcpl_in)) { + if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + } + else { + if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); + } if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); HDmemset(dims, 0, sizeof dims); @@ -1175,7 +1184,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); } /*------------------------------------------------------------------------- - * we do not have request for filter/chunking use H5Ocopy instead + * we do not have request for filter/chunking; use H5Ocopy instead *------------------------------------------------------------------------- */ else { diff --git a/tools/test/h5repack/Makefile.am b/tools/test/h5repack/Makefile.am index ff950e4..38f7b2f 100644 --- a/tools/test/h5repack/Makefile.am +++ b/tools/test/h5repack/Makefile.am @@ -59,7 +59,8 @@ endif # Temporary files. *.h5 are generated by h5repack. They should # copied to the testfiles/ directory if update is required. -CHECK_CLEANFILES+=*.h5 *.bin testfiles/h5diff_attr1.h5 testfiles/tfamily*.h5 +# *.dat files may be created by h5repackgentest. +CHECK_CLEANFILES+=*.h5 *.dat *.bin testfiles/h5diff_attr1.h5 testfiles/tfamily*.h5 DISTCLEANFILES=h5repack.sh h5repack_plugin.sh include $(top_srcdir)/config/conclude.am diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 9851e89..56df3c8 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -675,7 +675,8 @@ VERIFY_EXTERNAL_CONSOLIDATION() ) # flag if any of the above checks failed - if [ $prev_nerrors != $nerrors ]; then + if [ $prev_nerrors != $nerrors ] + then echo ". . . *FAILED*" nerrors="`expr $prev_nerrors + 1`" else diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 8076b42..0eec88c 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -8,7 +8,7 @@ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static void -generate_external_int32le(hbool_t external) +generate_int32le(hbool_t external) { char filename[MAX_NAME_SIZE]; hid_t file; @@ -67,7 +67,7 @@ generate_external_int32le(hbool_t external) HDassert(H5Dclose(dset) >= 0); HDassert(H5Sclose(dspace) >= 0); HDassert(H5Fclose(file) >= 0); -} /* end generate_external_int32le() */ +} /* end generate_int32le() */ /* ---------------------------------------------------------------------------- @@ -75,8 +75,8 @@ generate_external_int32le(hbool_t external) int main(void) { - generate_external_int32le(FALSE); - generate_external_int32le(TRUE); + generate_int32le(FALSE); + generate_int32le(TRUE); return 0; } /* end main() */ -- cgit v0.12 From 2ba7b8f5e0c406376d90b344dadee385e69ca987 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Wed, 19 Jun 2019 17:13:54 -0500 Subject: Fix failing automated reporting. Add 8-bit big-endian testfile. --- tools/test/h5repack/CMakeTests.cmake | 13 ++ tools/test/h5repack/h5repack.sh.in | 12 +- tools/test/h5repack/h5repackgentest.c | 160 ++++++++++++++++++--- tools/test/h5repack/testfiles/h5repack_int32le.h5 | Bin 4096 -> 4096 bytes .../test/h5repack/testfiles/h5repack_int32le_ex.h5 | Bin 1472 -> 1472 bytes tools/test/h5repack/testfiles/h5repack_uint8be.h5 | Bin 0 -> 2560 bytes .../h5repack/testfiles/h5repack_uint8be_ex-0.dat | Bin 0 -> 64 bytes .../h5repack/testfiles/h5repack_uint8be_ex-1.dat | 1 + .../h5repack/testfiles/h5repack_uint8be_ex-2.dat | 1 + .../h5repack/testfiles/h5repack_uint8be_ex-3.dat | 1 + .../h5repack/testfiles/h5repack_uint8be_ex-4.dat | Bin 0 -> 64 bytes .../h5repack/testfiles/h5repack_uint8be_ex-5.dat | Bin 0 -> 64 bytes .../h5repack/testfiles/h5repack_uint8be_ex-6.dat | Bin 0 -> 64 bytes .../h5repack/testfiles/h5repack_uint8be_ex-7.dat | Bin 0 -> 64 bytes .../test/h5repack/testfiles/h5repack_uint8be_ex.h5 | Bin 0 -> 1912 bytes 15 files changed, 164 insertions(+), 24 deletions(-) create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 7dbf2a1..f6cf9bf 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -30,6 +30,9 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fletcher.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_hlink.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_ex.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_ex-0.dat ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layouto.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout2.h5 @@ -51,6 +54,16 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_none.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_paged_nopersist.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_paged_persist.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-0.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-1.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-2.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-3.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-4.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-5.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-6.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-7.dat # h5diff/testfile ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5 # tools/testfiles diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 56df3c8..04f04f2 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -625,17 +625,19 @@ DIFFFAIL() # Catchall test for repacking with external files # Loops over all (internally-listed) cases and applies the given arguments # to h5repack. +# Each test file family must be listed in the for loop at the start of the +# 'function'. # Expects case files to be of format: # + h5repack_.h5 # + h5repack__ex.h5 # + h5repack__ex-.dat # ...where NAME is part of the internal list, and N is a positive decimal # number; multiple external files (*.dat) are allowed per file, but they must -# follow the same pattern and be in numerical sequence starting at 0. +# follow the pattern and be in contiguous numerical sequence starting at 0. # ----------------------------------------------------------------------------- VERIFY_EXTERNAL_CONSOLIDATION() { - for name in int32le + for name in int32le uint8be do basename="h5repack_${name}" base_ext="${basename}_ex" @@ -1551,10 +1553,10 @@ VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5 # -j 0 -k 1, file cannot be opened VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5 -# +######################################## # Testing external storage -# -VERIFY_EXTERNAL_CONSOLIDATION +######################################## +VERIFY_EXTERNAL_CONSOLIDATION -l CONTI # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 0eec88c..27f6009 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -1,26 +1,50 @@ #include "hdf5.h" #include "H5private.h" +/* For generating files for verifying h5repack with external storage. . . + * + * Each case file should follow the format of: + * + h5repack_.h5 + * + h5repack__ex.h5 + * + h5repack__ex-.dat + * ...where NAME idenfities the type, and N is a positive decimal number; + * multiple external files (*.dat) are allowed per file, but they must + * follow the pattern and be in contiguous numerical sequence starting at 0. + * + * Each file typename must be added to the listing for + * `VERIFY_EXTERNAL_CONSOLIDATION` in h5repack.sh + * + * There is no restriction on the name, number, or structure of datasets and + * groups in HDF5 file. + * + * The generated files will need to be moved "by hand" into the testfiles + * directory. (TODO) + */ + #define MAX_NAME_SIZE 256 #define FILE_INT32LE "h5repack_int32le" +#define FILE_UINT8BE "h5repack_uint8be" /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * TODO: error handling is a joke, but this seems normal for the tools' + * gentest operations. */ static void generate_int32le(hbool_t external) { char filename[MAX_NAME_SIZE]; hid_t file; - hid_t dspace; hid_t dset; hid_t dcpl = H5P_DEFAULT; + hid_t dspace; hsize_t dims[] = {8, 8, 8}; int32_t wdata[512]; /* 8^3 */ int32_t n; int i; int j; int k; + herr_t ret; /* error-checking */ /* generate values, alternating positive and negative */ @@ -35,20 +59,21 @@ generate_int32le(hbool_t external) FILE_INT32LE, (external) ? "_ex" : ""); - file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - HDassert(file >= 0); - - dspace = H5Screate_simple(3, dims, NULL); - HDassert(dspace >= 0); - if (external) { char name[MAX_NAME_SIZE]; dcpl = H5Pcreate(H5P_DATASET_CREATE); - HDassert(dcpl >= 0); + HDassert(dcpl != H5I_INVALID_HID); snprintf(name, MAX_NAME_SIZE, "%s_ex-0.dat", FILE_INT32LE); - HDassert(H5Pset_external(dcpl, name, 0, H5F_UNLIMITED) >= 0); + ret = H5Pset_external(dcpl, name, 0, H5F_UNLIMITED); + HDassert(ret >= 0); } + dspace = H5Screate_simple(3, dims, NULL); + HDassert(dspace != H5I_INVALID_HID); + + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(file != H5I_INVALID_HID); + dset = H5Dcreate2( file, "dset", @@ -57,26 +82,123 @@ generate_int32le(hbool_t external) H5P_DEFAULT, dcpl, H5P_DEFAULT); - HDassert(dset >= 0); + HDassert(dset != H5I_INVALID_HID); - HDassert(H5Dwrite(dset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) - >= 0); + ret = H5Dwrite( + dset, + H5T_STD_I32LE, + H5S_ALL, + H5S_ALL, + H5P_DEFAULT, + wdata); + HDassert(ret >= 0); + + if (dcpl != H5P_DEFAULT) { + ret = H5Pclose(dcpl); + HDassert(ret >= 0); + } + ret = H5Dclose(dset); + HDassert(ret >= 0); + ret = H5Fclose(file); + HDassert(ret >= 0); + ret = H5Sclose(dspace); + HDassert(ret >= 0); - if (external) - HDassert(H5Pclose(dcpl) >= 0); - HDassert(H5Dclose(dset) >= 0); - HDassert(H5Sclose(dspace) >= 0); - HDassert(H5Fclose(file) >= 0); } /* end generate_int32le() */ +static void +generate_uint8be(hbool_t external) +{ + char filename[MAX_NAME_SIZE]; + hid_t file; + hid_t dset; + hid_t dcpl = H5P_DEFAULT; + hid_t dspace; + hsize_t dims[] = {8, 8, 8}; + uint8_t wdata[512]; /* 8^3 */ + uint8_t n; + int i; + int j; + int k; + herr_t ret; /* error-checking */ + + /* Generate values, alternating positive and negative + * The latter half of the dataset is "overflow garbage" (TODO?) + */ + for (i=0, n=0; i < 8; i++) + for (j=0; j < 8; j++) + for (k=0; k < 8; k++, n++) + wdata[n] = n * ((n&1) ? (-1) : (1)); + + snprintf(filename, + MAX_NAME_SIZE, + "%s%s.h5", + FILE_UINT8BE, + (external) ? "_ex" : ""); + + if (external) { + char name[MAX_NAME_SIZE]; + dcpl = H5Pcreate(H5P_DATASET_CREATE); + HDassert(dcpl != H5I_INVALID_HID); + for (i = 0; i < 8; i++) { + snprintf(name, MAX_NAME_SIZE, "%s_ex-%d.dat", FILE_UINT8BE, i); + ret = H5Pset_external(dcpl, name, 0, 64 * sizeof(char)); + HDassert(ret >= 0); + } + } + + dspace = H5Screate_simple(3, dims, NULL); + HDassert(dspace != H5I_INVALID_HID); + + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(file != H5I_INVALID_HID); + + dset = H5Dcreate2( + file, + "dset", + H5T_STD_U8BE, + dspace, + H5P_DEFAULT, + dcpl, + H5P_DEFAULT); + HDassert(dset != H5I_INVALID_HID); + + ret = H5Dwrite( + dset, + H5T_STD_U8BE, + H5S_ALL, + H5S_ALL, + H5P_DEFAULT, + wdata); + HDassert(ret >= 0); + + if (dcpl != H5P_DEFAULT) { + ret = H5Pclose(dcpl); + HDassert(ret >= 0); + } + ret = H5Dclose(dset); + HDassert(ret >= 0); + ret = H5Fclose(file); + HDassert(ret >= 0); + ret = H5Sclose(dspace); + HDassert(ret >= 0); + +} /* end generate_uint8be() */ + + /* ---------------------------------------------------------------------------- */ int main(void) { - generate_int32le(FALSE); - generate_int32le(TRUE); + int i; + + for (i=0; i < 2; i++) { + hbool_t external = (i&1) ? TRUE : FALSE; + generate_int32le(external); + generate_uint8be(external); + } return 0; } /* end main() */ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le.h5 b/tools/test/h5repack/testfiles/h5repack_int32le.h5 index fb00579..4e9500f 100644 Binary files a/tools/test/h5repack/testfiles/h5repack_int32le.h5 and b/tools/test/h5repack/testfiles/h5repack_int32le.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 index 337b297..8c8b644 100644 Binary files a/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 and b/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be.h5 b/tools/test/h5repack/testfiles/h5repack_uint8be.h5 new file mode 100644 index 0000000..f89bc03 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat new file mode 100644 index 0000000..f95b90a Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat new file mode 100644 index 0000000..011ab48 --- /dev/null +++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat @@ -0,0 +1 @@ +@¿B½D»F¹H·JµL³N±P¯R­T«V©X§Z¥\£^¡`Ÿbd›f™h—j•l“n‘prt‹v‰x‡z…|ƒ~ \ No newline at end of file diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat new file mode 100644 index 0000000..069b96d --- /dev/null +++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat @@ -0,0 +1 @@ +€‚}„{†yˆwŠuŒsŽqo’m”k–i˜gšeœcža _¢]¤[¦Y¨WªU¬S®Q°O²M´K¶I¸GºE¼C¾A \ No newline at end of file diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat new file mode 100644 index 0000000..240d8ca --- /dev/null +++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat @@ -0,0 +1 @@ +À?Â=Ä;Æ9È7Ê5Ì3Î1Ð/Ò-Ô+Ö)Ø'Ú%Ü#Þ!àâäæèêìîðò ô ö øúüþ \ No newline at end of file diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat new file mode 100644 index 0000000..b5c4e7c Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat new file mode 100644 index 0000000..b77f32c Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat new file mode 100644 index 0000000..1e335eb Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat new file mode 100644 index 0000000..3dadb7d Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 b/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 new file mode 100644 index 0000000..6f8c3fe Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 differ -- cgit v0.12 From 63fc460c137e871d21941de8fedc4371be229d42 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Thu, 20 Jun 2019 12:30:20 -0500 Subject: Add forgotten files to include from h5repack testfiles for tests. --- tools/test/h5repack/h5repack.sh.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 04f04f2..1af4fd0 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -117,6 +117,8 @@ $SRC_H5REPACK_TESTFILES/h5repack_paged_nopersist.h5 $SRC_H5REPACK_TESTFILES/h5repack_paged_persist.h5 $SRC_H5REPACK_TESTFILES/h5repack_int32le.h5 $SRC_H5REPACK_TESTFILES/h5repack_int32le_ex.h5 +$SRC_H5REPACK_TESTFILES/h5repack_uint8be.h5 +$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr1.h5 $SRC_TOOLS_TESTFILES/tfamily00000.h5 $SRC_TOOLS_TESTFILES/tfamily00001.h5 @@ -167,6 +169,14 @@ $SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl $SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst $SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst $SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl +$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-0.dat +$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-1.dat +$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-2.dat +$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-3.dat +$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-4.dat +$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-5.dat +$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-6.dat +$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-7.dat $SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst $SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_chunk20x10x5-v.ddl $SRC_H5REPACK_TESTFILES/2_vds.h5-vds_chunk3x6x9-v.ddl -- cgit v0.12 From 9103fd59530cc45cef39cba81e0f1330a94b4807 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Fri, 21 Jun 2019 12:05:54 -0500 Subject: Undo some formatting modifications. Update MANIFEST. --- MANIFEST | 13 +++++++++++++ tools/src/h5repack/h5repack.c | 40 +++++++++++++++----------------------- tools/src/h5repack/h5repack_copy.c | 32 ++++++++++++++---------------- tools/src/h5repack/h5repack_main.c | 12 +++++++++--- 4 files changed, 53 insertions(+), 44 deletions(-) diff --git a/MANIFEST b/MANIFEST index bf1b35a..2704ced 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2557,6 +2557,9 @@ ./tools/test/h5repack/testfiles/h5repack_fsm_aggr_persist.h5 ./tools/test/h5repack/testfiles/h5repack_hlink.h5 ./tools/test/h5repack/testfiles/h5repack.info +./tools/test/h5repack/testfiles/h5repack_int32le.h5 +./tools/test/h5repack/testfiles/h5repack_int32le_ex-0.dat +./tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 ./tools/test/h5repack/testfiles/h5repack_layout.h5 ./tools/test/h5repack/testfiles/h5repack_layouto.h5 ./tools/test/h5repack/testfiles/h5repack_layout2.h5 @@ -2574,6 +2577,16 @@ ./tools/test/h5repack/testfiles/h5repack_shuffle.h5 ./tools/test/h5repack/testfiles/h5repack_soffset.h5 ./tools/test/h5repack/testfiles/h5repack_szip.h5 +./tools/test/h5repack/testfiles/h5repack_uint8be.h5 +./tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat +./tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat +./tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat +./tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat +./tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat +./tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat +./tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat +./tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat +./tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 ./tools/test/h5repack/testfiles/ublock.bin ./tools/test/h5repack/testfiles/crtorder.tordergr.h5.ddl ./tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index a8b1458..7dc38e6 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -247,8 +247,7 @@ copy_named_datatype(hid_t type_in, for (i = 0; i < travt->nobjs; i++) { if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { /* Push onto the stack */ - dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t)); - if (NULL == dt) + if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed"); dt->next = *named_dt_head_p; @@ -397,20 +396,17 @@ copy_attr( if (H5Aget_name(attr_id, (size_t) 255, name) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - ftype_id = H5Aget_type(attr_id); - if (ftype_id < 0) + if ((ftype_id = H5Aget_type(attr_id)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); /* Check if the datatype is committed */ - is_named = H5Tcommitted(ftype_id); - if (is_named < 0) + if ((is_named = H5Tcommitted(ftype_id)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed"); if (is_named && travt) { hid_t fidout = -1; /* Create out file id */ - fidout = H5Iget_file_id(loc_out); - if (fidout < 0) + if ((fidout = H5Iget_file_id(loc_out)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iget_file_id failed"); /* Copy named dt */ @@ -428,13 +424,13 @@ copy_attr( if (H5Fclose(fidout) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); - } + } /* end if datatype is committed and we have a traversal table */ else { if (options->use_native == 1) wtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT); else wtype_id = H5Tcopy(ftype_id); - } + } /* end else: uncommitted datatype and/or no traversal table */ /* get the dataspace handle */ if ((space_id = H5Aget_space(attr_id)) < 0) @@ -673,12 +669,12 @@ check_options(pack_opt_t *options) default: printf(" User Defined %d\n", filtn); break; - } - } - } + } /* end switch */ + } /* end for each filter */ + } /* end if options->all_filter == 1 (TODO: meaning) */ else printf("No all objects to apply filter\n"); - } /* verbose */ + } /* end if verbose */ for (i = 0; i < options->op_tbl->nelems; i++) { pack_info_t pack = options->op_tbl->objs[i]; @@ -699,7 +695,7 @@ check_options(pack_opt_t *options) } } has_cp = 1; - } /* for each filter */ + } /* end for each filter */ } /* end for each object in options table */ if (options->all_filter == 1 && has_cp) @@ -782,8 +778,7 @@ check_objects(const char* fname, pack_opt_t *options) * open the file *------------------------------------------------------------------------- */ - fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0); - if (fid < 0) + if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); @@ -843,16 +838,13 @@ check_objects(const char* fname, pack_opt_t *options) csize *= obj.chunk.chunk_lengths[j]; } else { - did = H5Dopen2(fid, name, H5P_DEFAULT); - if (did < 0) + if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - sid = H5Dget_space(did); - if (sid < 0) + if ((sid = H5Dget_space(did)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); - rank = H5Sget_simple_extent_ndims(sid); - if (rank < 0) + if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); HDmemset(dims, 0, sizeof dims); @@ -873,7 +865,7 @@ check_objects(const char* fname, pack_opt_t *options) printf(" \n"); HGOTO_DONE(0); } - } /* end SZIP */ + } /* end case SZIP */ break; default: break; diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index c638f3d..0d6a6c5 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -785,9 +785,6 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (H5Dclose(dset_in) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); -/* TODO: be smart about external storage */ -/* can we use the dcpl_in/out to adjust any external storage? */ -/* what about the case with just H5Ocopy? */ /*------------------------------------------------------------------------- * check if we should use H5Ocopy or not * if there is a request for filters/layout, we read/write the object @@ -914,8 +911,8 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* unset unlimited max dims */ if (limit_maxdims) H5Sset_extent_simple(f_space_id, rank, dims, NULL); - } /* if not chunked */ - } /* if layout change requested for entire file or individual object */ + } /* end if not chunked */ + } /* end if layout change requested for entire file or individual object */ /*------------------------------------------------------------------------- * create the output dataset; @@ -930,6 +927,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); + /* if unable to create, retry with original DCPL */ if (dset_out < 0) { H5Epush2(H5tools_ERR_STACK_g, __FILE__, @@ -952,7 +950,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (dset_out < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); apply_f = 0; - } /* if opening dataset with original DCPL (retry) */ + } /* end if retry dataset create */ /*------------------------------------------------------------------------- * read/write @@ -1079,7 +1077,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, H5Sselect_all(f_space_id); H5Sselect_all(hslab_space); hs_select_nelmts = 1; - } /* rank == 0 */ + } /* end (else) rank == 0 */ if (H5Dread( dset_in, @@ -1112,7 +1110,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, else carry = 0; } - } /* hyperslab selection loop */ + } /* end for (hyperslab selection loop) */ H5Sclose(hslab_space); if (hslab_buf != NULL) { @@ -1120,7 +1118,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, hslab_buf = NULL; } } /* end if reading/writing by hyperslab */ - } /* if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) */ + } /* end if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) */ /*------------------------------------------------------------------------- * print amount of compression used @@ -1152,7 +1150,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (has_filter && apply_f == 0) printf(" \n", travt->objs[i].name); - } /* if verbose (print compression) */ + } /* end if verbose (print compression) */ /*------------------------------------------------------------------------- * copy attrs @@ -1163,11 +1161,11 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (H5Dclose(dset_out) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - } /* !H5T_REFERENCE */ - } /* if h5tools_canreadf (filter availability check) */ + } /* end if not a reference */ + } /* end if h5tools_canreadf (filter availability check) */ /*------------------------------------------------------------------------- - * close + * Close *------------------------------------------------------------------------- */ if (H5Tclose(ftype_id) < 0) @@ -1184,7 +1182,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); } /*------------------------------------------------------------------------- - * we do not have request for filter/chunking; use H5Ocopy instead + * We do not have request for filter/chunking; use H5Ocopy instead *------------------------------------------------------------------------- */ else { @@ -1210,7 +1208,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); /*------------------------------------------------------------------------- - * copy attrs manually + * Copy attrs manually *------------------------------------------------------------------------- */ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) @@ -1420,8 +1418,8 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) default: HDstrcat(strfilter, "UD "); break; - } /* switch */ - } /* for each filter */ + } /* end switch */ + } /* end for each filter */ if (!pr) printf(FORMAT_OBJ, "dset", objname); diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index efab3f0..19eabd0 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -282,8 +282,7 @@ int read_info(const char *filename, pack_opt_t *options) int i, rc = 1; int ret_value = EXIT_SUCCESS; - fp = HDfopen(filename, "r"); - if ((FILE *)NULL == fp) { + if (NULL == (fp = HDfopen(filename, "r"))) { error_msg("cannot open options file %s\n", filename); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; @@ -417,7 +416,14 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) int ret_value = 0; /* parse command line options */ +#if 0 while (EOF != (opt = get_option(argc, argv, s_opts, l_opts))) { +#else + for (opt = get_option(argc, argv, s_opts, l_opts); + opt != EOF; + opt = get_option(argc, argv, s_opts, l_opts)) + { +#endif switch ((char) opt) { /* -i for backward compatibility */ @@ -654,7 +660,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) default: break; - } /* switch */ + } /* end switch */ } /* end while there are more options to parse */ /* If neither -i nor -o given, get in and out files positionally */ -- cgit v0.12 From 7ff3a63d5f6c74210a7e5ee064086306436c4062 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Mon, 22 Jul 2019 16:55:37 -0500 Subject: Minor formatting adjustments. --- test/external.c | 121 +++++++++--------------- test/vfd.c | 85 ++++++++++------- tools/src/h5repack/h5repack.c | 18 +--- tools/src/h5repack/h5repack_main.c | 8 +- tools/test/h5repack/testfiles/h5repack-help.txt | 8 +- 5 files changed, 110 insertions(+), 130 deletions(-) diff --git a/test/external.c b/test/external.c index 619ca62..09e1e20 100644 --- a/test/external.c +++ b/test/external.c @@ -38,17 +38,15 @@ files_have_same_contents(const char *name1, const char *name2) { int fd1 = 0; int fd2 = 0; - ssize_t n1; - ssize_t n2; + ssize_t n1 = 0; + ssize_t n2 = 0; char buf1[1024]; char buf2[1024]; hbool_t ret = FALSE; /* not equal until proven otherwise */ - fd1 = HDopen(name1, O_RDONLY); - if(fd1 < 0) + if ((fd1 = HDopen(name1, O_RDONLY)) < 0) goto out; - fd2 = HDopen(name2, O_RDONLY); - if(fd2 < 0) + if ((fd2 = HDopen(name2, O_RDONLY)) < 0) goto out; /* Loop until files are empty or we encounter a problem */ @@ -101,29 +99,26 @@ out: static int test_non_extendible(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1] = {100}; /* data space current size */ - hsize_t max_size[1] = {100}; /* data space maximum size */ - int n; /* number of external files */ - off_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ - haddr_t dset_addr; /* address of dataset */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* data space current size */ + hsize_t max_size[1] = {100}; /* data space maximum size */ + int n = 0; /* number of external files */ + off_t file_offset = 0; /* external file offset */ + hsize_t file_size = 0; /* sizeof external file segment */ + haddr_t dset_addr = HADDR_UNDEF; /* address of dataset */ TESTING("fixed-size data space, exact storage"); /* Create the dataset and close */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - if(dcpl < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR - space = H5Screate_simple(1, cur_size, max_size); - if(space < 0) + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR - dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); - if(dset < 0) + if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR @@ -133,8 +128,7 @@ test_non_extendible(hid_t file) FAIL_STACK_ERROR /* Read dataset creation information */ - dset = H5Dopen2(file, "dset1", H5P_DEFAULT); - if(dset < 0) + if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Test dataset address. Should be undefined. */ @@ -145,11 +139,9 @@ test_non_extendible(hid_t file) FAIL_STACK_ERROR /* Check external count */ - dcpl = H5Dget_create_plist(dset); - if(dcpl < 0) + if((dcpl = H5Dget_create_plist(dset)) < 0) FAIL_STACK_ERROR - n = H5Pget_external_count(dcpl); - if(n < 0) + if((n = H5Pget_external_count(dcpl)) < 0) FAIL_STACK_ERROR if(1 != n) { H5_FAILED(); @@ -215,13 +207,11 @@ test_too_small(hid_t file) TESTING("external storage is too small"); - dcpl = H5Pcreate(H5P_DATASET_CREATE); - if(dcpl < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) /* note -1 */ FAIL_STACK_ERROR - space = H5Screate_simple(1, cur_size, max_size); - if(space < 0) + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { @@ -273,16 +263,13 @@ test_large_enough_current_eventual(hid_t file) TESTING("extendible dataspace, exact external size"); - dcpl = H5Pcreate (H5P_DATASET_CREATE); - if(dcpl < 0) + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR - space = H5Screate_simple(1, cur_size, max_size); - if(space < 0) + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR - dset = H5Dcreate2(file, "dset3", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); - if(dset < 0) + if((dset = H5Dcreate2(file, "dset3", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR @@ -327,13 +314,11 @@ test_large_enough_current_not_eventual(hid_t file) TESTING("extendible dataspace, external storage is too small"); - dcpl = H5Pcreate(H5P_DATASET_CREATE); - if(dcpl < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) /* note -1 */ FAIL_STACK_ERROR - space = H5Screate_simple(1, cur_size, max_size); - if(space < 0) + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { @@ -387,16 +372,13 @@ test_unlimited(hid_t file) TESTING("unlimited dataspace, unlimited external storage"); /* Create dataset */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - if(dcpl < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR - space = H5Screate_simple(1, cur_size, max_size); - if(space < 0) + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR - dset = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); - if(dset < 0) + if((dset = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR @@ -404,14 +386,11 @@ test_unlimited(hid_t file) if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR /* Read dataset creation information */ - dset = H5Dopen2(file, "dset5", H5P_DEFAULT); - if(dset < 0) + if((dset = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - dcpl = H5Dget_create_plist(dset); - if(dcpl < 0) + if((dcpl = H5Dget_create_plist(dset)) < 0) FAIL_STACK_ERROR - n = H5Pget_external_count(dcpl); - if(n < 0) + if((n = H5Pget_external_count(dcpl)) < 0) FAIL_STACK_ERROR if(1 != n) { H5_FAILED(); @@ -493,12 +472,10 @@ test_multiple_files(hid_t file) } } - space = H5Screate_simple(1, cur_size, max_size); - if(space < 0) + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR - dset = H5Dcreate2(file, "dset6", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); - if(dset < 0) + if((dset = H5Dcreate2(file, "dset6", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR @@ -508,8 +485,7 @@ test_multiple_files(hid_t file) /* ---------------------------------------------- * Verify that too-small external files will fail */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - if(dcpl < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR max_ext_size -= 1; @@ -522,7 +498,7 @@ test_multiple_files(hid_t file) fflush(stderr); FAIL_STACK_ERROR } - } + } /* end for each external file */ H5E_BEGIN_TRY { dset = H5Dcreate2(file, "dset7", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -564,13 +540,12 @@ static int test_add_to_unlimited(void) { hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* function return status */ - int n; /* number of external files */ + herr_t status = FAIL; /* function return status */ + int n = 0; /* number of external files */ TESTING("external file following unlimited file"); - dcpl = H5Pcreate (H5P_DATASET_CREATE); - if(dcpl < 0) + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR @@ -581,8 +556,7 @@ test_add_to_unlimited(void) if(status >= 0) FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); - n = H5Pget_external_count(dcpl); - if(n < 0) + if((n = H5Pget_external_count(dcpl)) < 0) FAIL_STACK_ERROR if(1 != n) FAIL_PUTS_ERROR(" Wrong external file count returned."); @@ -617,12 +591,11 @@ static int test_overflow(void) { hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* return status */ + herr_t status = FAIL; /* return status */ TESTING("address overflow in external files"); - dcpl = H5Pcreate (H5P_DATASET_CREATE); - if(dcpl < 0) + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) FAIL_STACK_ERROR @@ -667,7 +640,7 @@ test_read_file_set(hid_t fapl) hid_t space = -1; /* data space */ hid_t dset = -1; /* dataset */ hid_t grp = -1; /* group to emit diagnostics */ - size_t i; /* miscellaneous counter */ + size_t i = 0; /* miscellaneous counter */ char filename[1024]; /* file names */ int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ @@ -785,7 +758,7 @@ test_write_file_set(hid_t fapl) hid_t mem_space = -1; /* memory data space */ hid_t file_space = -1; /* file data space */ hid_t dset = -1; /* dataset */ - unsigned i; /* miscellaneous counter */ + unsigned i = 0; /* miscellaneous counter */ int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ hsize_t cur_size = 100; /* current data space size */ @@ -909,7 +882,7 @@ test_path_absolute(hid_t fapl) hid_t dcpl = -1; /* dataset creation properties */ hid_t space = -1; /* data space */ hid_t dset = -1; /* dataset */ - size_t i; /* miscellaneous counter */ + size_t i = 0; /* miscellaneous counter */ char cwdpath[1024]; /* working directory */ char filename[1024]; /* file name */ int part[PART_SIZE]; /* raw data buffer (partial) */ @@ -999,7 +972,7 @@ test_path_relative(hid_t fapl) hid_t dcpl = -1; /* dataset creation properties */ hid_t space = -1; /* data space */ hid_t dset = -1; /* dataset */ - size_t i; /* miscellaneous counters */ + size_t i = 0; /* miscellaneous counters */ char cwdpath[1024]; /* working directory */ char filename[1024]; /* file name */ int part[PART_SIZE]; /* raw data buffer (partial) */ @@ -1093,7 +1066,7 @@ test_path_relative_cwd(hid_t fapl) hid_t dset = -1; /* dataset */ hid_t dset2 = -1; /* dataset, opened a second time */ hid_t dset3 = -1; /* dataset, opened with different prefix */ - size_t i; /* miscellaneous counters */ + size_t i = 0; /* miscellaneous counters */ char cwdpath[1024]; /* working directory */ char filename[1024]; /* file name */ int part[PART_SIZE]; /* raw data buffer (partial) */ diff --git a/test/vfd.c b/test/vfd.c index 7c1d9d5..e7c133b 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -1113,54 +1113,60 @@ error: /*------------------------------------------------------------------------- - * Function: test_family_member_fapl + * Function: test_family_member_fapl * - * Purpose: Actually use the member fapl input to the member vfd. + * Purpose: Actually use the member fapl input to the member vfd. * - * Return: 0 - success - * -1 - failure + * Return: Success: 0 + * Failure: -1 * - * Programmer: Jacob Smith - * 21 May 2019 + * Programmer: Jacob Smith + * 21 May 2019 * *------------------------------------------------------------------------- */ static herr_t test_family_member_fapl(void) { - hid_t file; - hid_t fapl_id; - hid_t memb_fapl_id; - hid_t space; - hid_t dset; + hid_t file = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t memb_fapl_id = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; char filename[1024]; - char dname[] = "dataset"; - unsigned i; - unsigned j; + char dname[] = "dataset"; + unsigned i = 0; + unsigned j = 0; int buf[FAMILY_NUMBER][FAMILY_SIZE]; - hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE}; + hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE}; TESTING("Family member FAPL"); fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if (H5I_INVALID_HID == fapl_id) + if (H5I_INVALID_HID == fapl_id) { TEST_ERROR; + } memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if (H5I_INVALID_HID == memb_fapl_id) + if (H5I_INVALID_HID == memb_fapl_id) { TEST_ERROR; - if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) + } + if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) { TEST_ERROR; - if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) + } + if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) { TEST_ERROR; + } h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename)); file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); - if (H5I_INVALID_HID == file) + if (H5I_INVALID_HID == file) { TEST_ERROR; + } space = H5Screate_simple(2, dims, NULL); - if (H5I_INVALID_HID == space) + if (H5I_INVALID_HID == space) { TEST_ERROR; + } /* Create and write to dataset, then close file. */ @@ -1172,11 +1178,14 @@ test_family_member_fapl(void) H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (H5I_INVALID_HID == dset) + if (H5I_INVALID_HID == dset) { TEST_ERROR; - for (i = 0; i < FAMILY_NUMBER; i++) - for (j = 0; j < FAMILY_SIZE; j++) + } + for (i = 0; i < FAMILY_NUMBER; i++) { + for (j = 0; j < FAMILY_SIZE; j++) { buf[i][j] = (int)((i * 10000) + j); + } + } if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, @@ -1184,34 +1193,46 @@ test_family_member_fapl(void) H5P_DEFAULT, buf) == FAIL) + { TEST_ERROR; - if (H5Dclose(dset) == FAIL) TEST_ERROR; - if (H5Sclose(space) == FAIL) TEST_ERROR; - if (H5Fclose(file) == FAIL) TEST_ERROR; + } + if (H5Dclose(dset) == FAIL) { + TEST_ERROR; + } + if (H5Sclose(space) == FAIL) { + TEST_ERROR; + } + if (H5Fclose(file) == FAIL) { + TEST_ERROR; + } /* "Close" member FAPL at top level and re-open file. * Should succeed, with library managing reference count properly */ - if (H5Pclose(memb_fapl_id) == FAIL) + if (H5Pclose(memb_fapl_id) == FAIL) { TEST_ERROR; + } file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); - if (H5I_INVALID_HID == file) + if (H5I_INVALID_HID == file) { TEST_ERROR; + } - if (H5Fclose(file) == FAIL) + if (H5Fclose(file) == FAIL) { TEST_ERROR; + } h5_delete_test_file(FILENAME[2], fapl_id); - if (H5Pclose(fapl_id) == FAIL) + if (H5Pclose(fapl_id) == FAIL) { TEST_ERROR; + } PASSED(); return 0; error: - H5E_BEGIN_TRY{ + H5E_BEGIN_TRY { H5Sclose(space); H5Dclose(dset); H5Pclose(memb_fapl_id); diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 7dc38e6..c9cc020 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -382,15 +382,7 @@ copy_attr( */ for (u = 0; u < (unsigned) oinfo.num_attrs; u++) { /* open attribute */ - attr_id = H5Aopen_by_idx( - loc_in, - ".", - H5_INDEX_CRT_ORDER, - H5_ITER_INC, - (hsize_t) u, - H5P_DEFAULT, - H5P_DEFAULT); - if (attr_id < 0) + if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); if (H5Aget_name(attr_id, (size_t) 255, name) < 0) @@ -410,13 +402,7 @@ copy_attr( HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iget_file_id failed"); /* Copy named dt */ - wtype_id = copy_named_datatype( - ftype_id, - fidout, - named_dt_head_p, - travt, - options); - if (wtype_id < 0) { + if ((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, travt, options)) < 0) { H5Fclose(fidout); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 19eabd0..b4e5470 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -90,11 +90,11 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " This option will take precedence over the options\n"); PRINTVALSTREAM(rawoutstream, " --low and --high\n"); PRINTVALSTREAM(rawoutstream, " --low=BOUND The low bound for library release versions to use\n"); - PRINTVALSTREAM(rawoutstream, " when creating objects in the file (default is 0\n"); - PRINTVALSTREAM(rawoutstream, " [H5F_LIBVER_EARLIEST])\n"); + PRINTVALSTREAM(rawoutstream, " when creating objects in the file\n"); + PRINTVALSTREAM(rawoutstream, " (default is H5F_LIBVER_EARLIEST)\n"); PRINTVALSTREAM(rawoutstream, " --high=BOUND The high bound for library release versions to use\n"); - PRINTVALSTREAM(rawoutstream, " when creating objects in the file (default is 2\n"); - PRINTVALSTREAM(rawoutstream, " [H5F_LIBVER_V110 this release; H5F_LIBVER_LATEST])\n"); + PRINTVALSTREAM(rawoutstream, " when creating objects in the file\n"); + PRINTVALSTREAM(rawoutstream, " (default is H5F_LIBVER_LATEST)\n"); PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n"); PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt index ad07784..03553dd 100644 --- a/tools/test/h5repack/testfiles/h5repack-help.txt +++ b/tools/test/h5repack/testfiles/h5repack-help.txt @@ -12,11 +12,11 @@ usage: h5repack [OPTIONS] file1 file2 This option will take precedence over the options --low and --high --low=BOUND The low bound for library release versions to use - when creating objects in the file (default is 0 - [H5F_LIBVER_EARLIEST]) + when creating objects in the file + (default is H5F_LIBVER_EARLIEST) --high=BOUND The high bound for library release versions to use - when creating objects in the file (default is 2 - [H5F_LIBVER_V110 this release; H5F_LIBVER_LATEST]) + when creating objects in the file + (default is H5F_LIBVER_LATEST) -c L1, --compact=L1 Maximum number of links in header messages -d L2, --indexed=L2 Minimum number of links in the indexed format -s S[:F], --ssize=S[:F] Shared object header message minimum size -- cgit v0.12 From ded30348ae923a15f287b9a2f49a97ce5ac10da0 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Mon, 22 Jul 2019 17:34:01 -0500 Subject: Add copyright/disclaimer to repack gentest. Minor formatting tweaks. --- tools/src/h5repack/h5repack_main.c | 7 ---- tools/test/h5repack/h5repackgentest.c | 74 +++++++++++++++++++++-------------- 2 files changed, 45 insertions(+), 36 deletions(-) diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index b4e5470..a146499 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -416,14 +416,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) int ret_value = 0; /* parse command line options */ -#if 0 while (EOF != (opt = get_option(argc, argv, s_opts, l_opts))) { -#else - for (opt = get_option(argc, argv, s_opts, l_opts); - opt != EOF; - opt = get_option(argc, argv, s_opts, l_opts)) - { -#endif switch ((char) opt) { /* -i for backward compatibility */ diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 27f6009..c236d71 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -1,5 +1,15 @@ -#include "hdf5.h" -#include "H5private.h" +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* For generating files for verifying h5repack with external storage. . . * @@ -16,11 +26,11 @@ * * There is no restriction on the name, number, or structure of datasets and * groups in HDF5 file. - * - * The generated files will need to be moved "by hand" into the testfiles - * directory. (TODO) */ +#include "hdf5.h" +#include "H5private.h" + #define MAX_NAME_SIZE 256 #define FILE_INT32LE "h5repack_int32le" #define FILE_UINT8BE "h5repack_uint8be" @@ -34,24 +44,27 @@ static void generate_int32le(hbool_t external) { char filename[MAX_NAME_SIZE]; - hid_t file; - hid_t dset; + hid_t file = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; hid_t dcpl = H5P_DEFAULT; - hid_t dspace; + hid_t dspace = H5I_INVALID_HID; hsize_t dims[] = {8, 8, 8}; - int32_t wdata[512]; /* 8^3 */ - int32_t n; - int i; - int j; - int k; - herr_t ret; /* error-checking */ + int32_t wdata[512]; /* 8^3, from dims */ + int32_t n = 0; + int i = 0; + int j = 0; + int k = 0; + herr_t ret = FAIL; /* error-checking */ /* generate values, alternating positive and negative */ - for (i=0, n=0; i < 8; i++) - for (j=0; j < 8; j++) - for (k=0; k < 8; k++, n++) + for (i=0, n=0; i < 8; i++) { + for (j=0; j < 8; j++) { + for (k=0; k < 8; k++, n++) { wdata[n] = (k + j*512 + i*4096) * ((n&1) ? (-1) : (1)); + } + } + } snprintf(filename, MAX_NAME_SIZE, @@ -111,25 +124,28 @@ static void generate_uint8be(hbool_t external) { char filename[MAX_NAME_SIZE]; - hid_t file; - hid_t dset; + hid_t file = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; hid_t dcpl = H5P_DEFAULT; - hid_t dspace; + hid_t dspace = H5I_INVALID_HID; hsize_t dims[] = {8, 8, 8}; - uint8_t wdata[512]; /* 8^3 */ - uint8_t n; - int i; - int j; - int k; + uint8_t wdata[512]; /* 8^3, from dims */ + uint8_t n = 0; + int i = 0; + int j = 0; + int k = 0; herr_t ret; /* error-checking */ /* Generate values, alternating positive and negative * The latter half of the dataset is "overflow garbage" (TODO?) */ - for (i=0, n=0; i < 8; i++) - for (j=0; j < 8; j++) - for (k=0; k < 8; k++, n++) + for (i=0, n=0; i < 8; i++) { + for (j=0; j < 8; j++) { + for (k=0; k < 8; k++, n++) { wdata[n] = n * ((n&1) ? (-1) : (1)); + } + } + } snprintf(filename, MAX_NAME_SIZE, @@ -192,7 +208,7 @@ generate_uint8be(hbool_t external) int main(void) { - int i; + int i = 0; for (i=0; i < 2; i++) { hbool_t external = (i&1) ? TRUE : FALSE; -- cgit v0.12 From 7d3e17076312ddf8083d749e51629f0ef90b38c7 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Mon, 29 Jul 2019 14:58:39 -0500 Subject: Refactoring. --- tools/test/h5repack/h5repackgentest.c | 235 ++++++++++++++++++++++------------ 1 file changed, 156 insertions(+), 79 deletions(-) diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index c236d71..7242ebf 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -35,26 +35,104 @@ #define FILE_INT32LE "h5repack_int32le" #define FILE_UINT8BE "h5repack_uint8be" +#define H5REPACKGENTEST_OOPS ret_value = -1; goto done; + +#define H5REPACKGENTEST_COMMON_CLEANUP(dcpl, file, space) { \ + if ((dcpl) != H5P_DEFAULT && (dcpl) != H5I_INVALID_HID) { \ + (void)H5Pclose((dcpl)); \ + } \ + if ((file) != H5I_INVALID_HID) { (void)H5Fclose((file)); } \ + if ((space) != H5I_INVALID_HID) { (void)H5Sclose((space)); } \ +} + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Helper function to create and write a dataset to file. + * Returns 0 on success, -1 on failure. + */ +static int +make_dataset( + hid_t file, + const char *dset_name, + hid_t mem_type_id, + hid_t space, + hid_t dcpl, + void *wdata) +{ + hid_t dset = H5I_INVALID_HID; + int ret_value = 0; + + dset = H5Dcreate2( + file, + "dset", + mem_type_id, + space, + H5P_DEFAULT, + dcpl, + H5P_DEFAULT); + if (dset == H5I_INVALID_HID) { + H5REPACKGENTEST_OOPS; + } + + if (H5Dwrite( + dset, + mem_type_id, + H5S_ALL, + H5S_ALL, + H5P_DEFAULT, + wdata) + < 0) + { + H5REPACKGENTEST_OOPS; + } + +done: + if (dset != H5I_INVALID_HID) { (void)H5Dclose(dset); } + return ret_value; +} /* end make_dataset() */ + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Helper function to populate the DCPL external storage list. + * Returns 0 on success, -1 on failure. + */ +static int +set_dcpl_external_list( + hid_t dcpl, + const char *filename, + hsize_t n_external_files, + hsize_t n_elts, + hsize_t elt_size) +{ + hsize_t i = 0; + char name[MAX_NAME_SIZE]; + + for (i = 0; i < n_external_files; i++) { + snprintf(name, MAX_NAME_SIZE, "%s_ex-%llu.dat", filename, i); + if (H5Pset_external(dcpl, name, 0, n_elts * elt_size) < 0) { + return -1; + } + } + return 0; +} /* end set_dcpl_external_list() */ + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * TODO: error handling is a joke, but this seems normal for the tools' - * gentest operations. */ -static void +static int generate_int32le(hbool_t external) { char filename[MAX_NAME_SIZE]; hid_t file = H5I_INVALID_HID; - hid_t dset = H5I_INVALID_HID; hid_t dcpl = H5P_DEFAULT; - hid_t dspace = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; hsize_t dims[] = {8, 8, 8}; int32_t wdata[512]; /* 8^3, from dims */ int32_t n = 0; int i = 0; int j = 0; int k = 0; - herr_t ret = FAIL; /* error-checking */ + int ret_value = 0; /* generate values, alternating positive and negative */ @@ -73,68 +151,66 @@ generate_int32le(hbool_t external) (external) ? "_ex" : ""); if (external) { - char name[MAX_NAME_SIZE]; dcpl = H5Pcreate(H5P_DATASET_CREATE); - HDassert(dcpl != H5I_INVALID_HID); - snprintf(name, MAX_NAME_SIZE, "%s_ex-0.dat", FILE_INT32LE); - ret = H5Pset_external(dcpl, name, 0, H5F_UNLIMITED); - HDassert(ret >= 0); + if (dcpl == H5I_INVALID_HID) { + H5REPACKGENTEST_OOPS; + } + if (set_dcpl_external_list( + dcpl, + FILE_INT32LE, + 1, + 512, + sizeof(int32_t)) + < 0) + { + H5REPACKGENTEST_OOPS; + } } - dspace = H5Screate_simple(3, dims, NULL); - HDassert(dspace != H5I_INVALID_HID); + space = H5Screate_simple(3, dims, NULL); + if (space == H5I_INVALID_HID) { + H5REPACKGENTEST_OOPS; + } file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - HDassert(file != H5I_INVALID_HID); + if (file == H5I_INVALID_HID) { + H5REPACKGENTEST_OOPS; + } - dset = H5Dcreate2( + if (make_dataset( file, "dset", H5T_STD_I32LE, - dspace, - H5P_DEFAULT, + space, dcpl, - H5P_DEFAULT); - HDassert(dset != H5I_INVALID_HID); - - ret = H5Dwrite( - dset, - H5T_STD_I32LE, - H5S_ALL, - H5S_ALL, - H5P_DEFAULT, - wdata); - HDassert(ret >= 0); - - if (dcpl != H5P_DEFAULT) { - ret = H5Pclose(dcpl); - HDassert(ret >= 0); + wdata) + < 0) + { + H5REPACKGENTEST_OOPS; } - ret = H5Dclose(dset); - HDassert(ret >= 0); - ret = H5Fclose(file); - HDassert(ret >= 0); - ret = H5Sclose(dspace); - HDassert(ret >= 0); +done: + H5REPACKGENTEST_COMMON_CLEANUP(dcpl, file, space); + return ret_value; } /* end generate_int32le() */ -static void +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + */ +static int generate_uint8be(hbool_t external) { char filename[MAX_NAME_SIZE]; hid_t file = H5I_INVALID_HID; - hid_t dset = H5I_INVALID_HID; hid_t dcpl = H5P_DEFAULT; - hid_t dspace = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; hsize_t dims[] = {8, 8, 8}; uint8_t wdata[512]; /* 8^3, from dims */ uint8_t n = 0; int i = 0; int j = 0; int k = 0; - herr_t ret; /* error-checking */ + int ret_value = 0; /* Generate values, alternating positive and negative * The latter half of the dataset is "overflow garbage" (TODO?) @@ -154,52 +230,47 @@ generate_uint8be(hbool_t external) (external) ? "_ex" : ""); if (external) { - char name[MAX_NAME_SIZE]; dcpl = H5Pcreate(H5P_DATASET_CREATE); - HDassert(dcpl != H5I_INVALID_HID); - for (i = 0; i < 8; i++) { - snprintf(name, MAX_NAME_SIZE, "%s_ex-%d.dat", FILE_UINT8BE, i); - ret = H5Pset_external(dcpl, name, 0, 64 * sizeof(char)); - HDassert(ret >= 0); + if (dcpl == H5I_INVALID_HID) { + H5REPACKGENTEST_OOPS; + } + if (set_dcpl_external_list( + dcpl, + FILE_UINT8BE, + 8, + 64, + sizeof(uint8_t)) + < 0) + { + H5REPACKGENTEST_OOPS; } } - dspace = H5Screate_simple(3, dims, NULL); - HDassert(dspace != H5I_INVALID_HID); + space = H5Screate_simple(3, dims, NULL); + if (space == H5I_INVALID_HID) { + H5REPACKGENTEST_OOPS; + } file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - HDassert(file != H5I_INVALID_HID); + if (file == H5I_INVALID_HID) { + H5REPACKGENTEST_OOPS; + } - dset = H5Dcreate2( + if (make_dataset( file, "dset", H5T_STD_U8BE, - dspace, - H5P_DEFAULT, + space, dcpl, - H5P_DEFAULT); - HDassert(dset != H5I_INVALID_HID); - - ret = H5Dwrite( - dset, - H5T_STD_U8BE, - H5S_ALL, - H5S_ALL, - H5P_DEFAULT, - wdata); - HDassert(ret >= 0); - - if (dcpl != H5P_DEFAULT) { - ret = H5Pclose(dcpl); - HDassert(ret >= 0); + wdata) + < 0) + { + H5REPACKGENTEST_OOPS; } - ret = H5Dclose(dset); - HDassert(ret >= 0); - ret = H5Fclose(file); - HDassert(ret >= 0); - ret = H5Sclose(dspace); - HDassert(ret >= 0); +done: + H5REPACKGENTEST_COMMON_CLEANUP(dcpl, file, space); + return ret_value; } /* end generate_uint8be() */ @@ -208,14 +279,20 @@ generate_uint8be(hbool_t external) int main(void) { - int i = 0; + int i = 0; /* loop variable */ + int ret_value = 0; for (i=0; i < 2; i++) { hbool_t external = (i&1) ? TRUE : FALSE; - generate_int32le(external); - generate_uint8be(external); + if (ret_value == 0) { ret_value -= generate_int32le(external); } + if (ret_value == 0) { ret_value -= generate_uint8be(external); } + } /* end for external data storage or not */ + + if (ret_value != 0) { + /* TODO: print warning message? */ } - return 0; + + return ret_value; } /* end main() */ -- cgit v0.12 From adce9e7f4e9a743c4d48cf5fc7c52a13cc751be3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 17 Sep 2019 10:30:04 -0500 Subject: HDFFV-10903 - fix VFD constants in JNI --- java/src/jni/h5Constants.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index ac55a13..9f52b3c 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -453,7 +453,13 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) { JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1FAMILY(JNIEnv *env, jclass cls) { return H5FD_FAMILY; } JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) { return H5FD_HDFS; } +Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) { +#ifdef H5_HAVE_LIBHDFS + return H5FD_HDFS; +#else + return -1; +#endif +} JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG(JNIEnv *env, jclass cls) { return H5FD_LOG; } JNIEXPORT jlong JNICALL @@ -463,7 +469,13 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1MULTI(JNIEnv *env, jclass cls) { return H5F JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1SEC2(JNIEnv *env, jclass cls) { return H5FD_SEC2; } JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) { return H5FD_ROS3; } +Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) { +#ifdef H5_HAVE_ROS3_VFD + return H5FD_ROS3; +#else + return -1; +#endif +} JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1STDIO(JNIEnv *env, jclass cls) { return H5FD_STDIO; } JNIEXPORT jlong JNICALL -- cgit v0.12 From 3790ba38a1ad9751696f1244e73b83964994e8d5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 17 Sep 2019 14:38:26 -0500 Subject: HDFFV-10905 fix test scripts for no zlib --- tools/test/h5copy/testh5copy.sh.in | 9 ++++----- tools/test/h5repack/h5repack.sh.in | 9 +++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in index 50758b5..2440ca4 100644 --- a/tools/test/h5copy/testh5copy.sh.in +++ b/tools/test/h5copy/testh5copy.sh.in @@ -504,22 +504,21 @@ fi TOOLTEST -i $TESTFILE -o $TESTDIR/dsrename.out.h5 -v -s compound -d rename echo "Test copying empty, 'full' & 'nested' groups" -if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST -i $TESTFILE -o $TESTDIR/grp_empty.out.h5 -v -s grp_empty -d grp_empty -fi +if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST -i $TESTFILE -o $TESTDIR/grp_dsets.out.h5 -v -s grp_dsets -d grp_dsets TOOLTEST -i $TESTFILE -o $TESTDIR/grp_nested.out.h5 -v -s grp_nested -d grp_nested +fi TOOLTEST -i $TESTFILE -o $TESTDIR/grp_attr.out.h5 -v -s grp_attr -d grp_attr -if test $USE_FILTER_DEFLATE = "yes" ; then echo "Test copying dataset within group in source file to group in destination" TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/simple_group.out.h5 grp_dsets grp_dsets /grp_dsets/simple /grp_dsets/simple_group +if test $USE_FILTER_DEFLATE = "yes" ; then echo "Test copying & renaming group" TOOLTEST -i $TESTFILE -o $TESTDIR/grp_rename.out.h5 -v -s grp_dsets -d grp_rename -fi - echo "Test copying 'full' group hierarchy into group in destination file" TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/grp_dsets_rename.out.h5 grp_dsets grp_rename grp_dsets /grp_rename/grp_dsets +fi echo "Test copying objects into group hier. that doesn't exist yet in destination file" TOOLTEST -i $TESTFILE -o $TESTDIR/A_B1_simple.out.h5 -vp -s simple -d /A/B1/simple diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 282ba76..c515786 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -1391,7 +1391,12 @@ TOOLTEST add_alignment $arg TOOLTEST upgrade_layout h5repack_layouto.h5 # test for datum size > H5TOOLS_MALLOCSIZE -TOOLTEST gt_mallocsize h5repack_objs.h5 -f GZIP=1 +arg="h5repack_objs.h5 -f GZIP=1" +if test $USE_FILTER_DEFLATE != "yes" ; then + SKIP $arg +else + TOOLTEST gt_mallocsize $arg +fi # Check repacking file with committed datatypes in odd configurations TOOLTEST committed_dt h5repack_named_dtypes.h5 @@ -1462,7 +1467,7 @@ VERIFY_SUPERBLOCK 1 2 2 h5repack_layout.h5 -j 1 -k 2 h5repack_layout.h5 # -j 2 -k 2, superblock will be 3 VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5 # -j 0 -k 1, file cannot be opened -VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5 +VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5 # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR -- cgit v0.12 From 8e686c8211f837cd57427c46efc06386f156fb92 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 17 Sep 2019 15:43:27 -0500 Subject: Correct HDF5 options to tristate values. --- config/cmake/HDFCompilerFlags.cmake | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 37ddcbb..adace89 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -346,10 +346,12 @@ endif () # By default, CMake adds NDEBUG to CMAKE_${lang}_FLAGS for Release build types # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- -option (HDF5_ENABLE_ASSERTS "Determines whether NDEBUG is defined to control assertions." OFF) -if (HDF5_ENABLE_ASSERTS) +#option (HDF5_ENABLE_ASSERTS "Determines whether NDEBUG is defined to control assertions." OFF) +set (HDF5_ENABLE_ASSERTS "OFF" CACHE STRING "Determines whether NDEBUG is defined to control assertions (OFF NO YES)") +set_property (CACHE HDF5_ENABLE_ASSERTS PROPERTY STRINGS OFF NO YES) +if (HDF5_ENABLE_ASSERTS MATCHES "YES") add_compile_options ("-UNDEBUG") -else () +elseif (HDF5_ENABLE_ASSERTS MATCHES "NO") add_compile_options ("-DNDEBUG") endif () MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS) @@ -358,8 +360,10 @@ MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS) # Option for --enable-symbols # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- -option (HDF5_ENABLE_SYMBOLS "Add debug symbols to the library independent of the build mode and optimization level." OFF) -if (HDF5_ENABLE_SYMBOLS) +#option (HDF5_ENABLE_SYMBOLS "Add debug symbols to the library independent of the build mode and optimization level." OFF) +set (HDF5_ENABLE_SYMBOLS "OFF" CACHE STRING "Add debug symbols to the library independent of the build mode and optimization level (OFF NO YES)") +set_property (CACHE HDF5_ENABLE_SYMBOLS PROPERTY STRINGS OFF NO YES) +if (HDF5_ENABLE_SYMBOLS MATCHES "YES") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") @@ -372,7 +376,7 @@ if (HDF5_ENABLE_SYMBOLS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") endif () endif () -else () +elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-s") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") -- cgit v0.12 From 624d5d9a8e27fdad93208821d1cd7f535d2ca61a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 18 Sep 2019 11:04:09 -0500 Subject: HDFFV-10740 - skip copying dirs in for loops --- test/test_usecases.sh.in | 31 ++++++++++++++++++++----------- test/testflushrefresh.sh.in | 25 ++++++++++++++++--------- test/testswmr.sh.in | 11 +++++++---- test/testvdsswmr.sh.in | 13 +++++++++++-- 4 files changed, 54 insertions(+), 26 deletions(-) diff --git a/test/test_usecases.sh.in b/test/test_usecases.sh.in index 8bc2078..49868ca 100644 --- a/test/test_usecases.sh.in +++ b/test/test_usecases.sh.in @@ -40,7 +40,7 @@ fi # Define symbols EXIT_SUCCESS=0 EXIT_FAILURE=1 -EXIT_VALUE=$EXIT_SUCCESS # Default all tests succeed +EXIT_VALUE=$EXIT_SUCCESS # Default all tests succeed RESULT_PASSED=" PASSED" RESULT_FAILED="*FAILED*" RESULT_SKIP="-SKIP-" @@ -97,17 +97,17 @@ TOOLTEST() { cat $actual_err >> $actual if [ $exit_code -eq 0 ];then - echo "$RESULT_PASSED" - test yes = "$verbose" && sed 's/^/ /' < $actual + echo "$RESULT_PASSED" + test yes = "$verbose" && sed 's/^/ /' < $actual else - echo "$RESULT_FAILED" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && sed 's/^/ /' < $actual + echo "$RESULT_FAILED" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && sed 's/^/ /' < $actual fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext fi } @@ -122,7 +122,9 @@ for FILE in use_*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE usecases_test + if test -f "$FILE" ; then + cp $FILE usecases_test + fi done # With the --disable-shared option, swmr program files are built in the test @@ -131,7 +133,14 @@ done # always be copied, swmr files in .libs should be copied only if they exists. if [ -f .libs/use_append_chunk ]; then mkdir usecases_test/.libs - cp .libs/use_* usecases_test/.libs + for FILE in .libs/use_*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE usecases_test/.libs + fi + done cp .libs/twriteorder usecases_test/.libs fi @@ -176,10 +185,10 @@ for p in $USECASES_PROGRAMS; do TOOLTEST ./$p -l w TOOLTEST ./$p -l r # use case 1.9, testing with multi-planes chunks - TOOLTEST ./$p -z 256 -y 5 # 5 planes chunks + TOOLTEST ./$p -z 256 -y 5 # 5 planes chunks # cleanup temp datafile if test -z "$HDF5_NOCLEANUP"; then - rm -f $p.h5 + rm -f $p.h5 fi done diff --git a/test/testflushrefresh.sh.in b/test/testflushrefresh.sh.in index ca46dcb..3cdf10f 100644 --- a/test/testflushrefresh.sh.in +++ b/test/testflushrefresh.sh.in @@ -20,7 +20,7 @@ # the verification of this feature needs to occur in separate processes # from the one in which the file is being manipulated in. (i.e., we have # a single writer process, and various reader processes spawning off -# and doing the verification that individual objects are being +# and doing the verification that individual objects are being # correctly flushed). # # Programmer: @@ -80,23 +80,30 @@ fi # HDF5 has several tests that create and delete signal files to communicate # between processes, and it seems that even though the names of the files are # different, occasionally the wrong file is deleted, interrupting the flow of -# the test. Running each of these tests in its own directory should eliminate +# the test. Running each of these tests in its own directory should eliminate # the problem. mkdir flushrefresh_test cp flushrefresh flushrefresh_test # With the --disable-shared option, flushrefresh is built in the test directory, -# otherwise it is in test/.libs with a wrapper script named flushrefresh in -# the test directory. test/flushrefresh should always be copied, +# otherwise it is in test/.libs with a wrapper script named flushrefresh in +# the test directory. test/flushrefresh should always be copied, # .libs/flushrefresh should be copied only if it exists. if [ -f .libs/flushrefresh ]; then mkdir flushrefresh_test/.libs - cp .libs/flushrefresh flushrefresh_test/.libs + for FILE in .libs/flushrefresh*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE flushrefresh_test/.libs + fi + done fi cd flushrefresh_test # ================================================= -# Set up/initialize some variables to be used later +# Set up/initialize some variables to be used later # ================================================= testfile=flushrefresh.h5 startsignal=flushrefresh_VERIFICATION_START @@ -119,13 +126,13 @@ pid_main=$! # ======================================= until [ $verification_done -eq 1 ]; do - + # Wait for signal from test program that verification routine can run. before=`TimeStamp` until [ -s $startsignal ]; do after=`TimeStamp` timediff=`expr $after - $before` - if [ $timediff -gt $timeout_length ]; then + if [ $timediff -gt $timeout_length ]; then nerrors=`expr $nerrors + 1` timedout=1 break @@ -165,7 +172,7 @@ if [ $timedout -eq 0 ]; then until [ -s $startsignal ]; do after=`TimeStamp` timediff=`expr $after - $before` - if [ $timediff -gt $timeout_length ]; then + if [ $timediff -gt $timeout_length ]; then nerrors=`expr $nerrors + 1` timedout=1 break diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in index f81a7d7..a41947e 100644 --- a/test/testswmr.sh.in +++ b/test/testswmr.sh.in @@ -131,9 +131,10 @@ for FILE in swmr*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE swmr_test + if test -f "$FILE" ; then + cp $FILE swmr_test + fi done -cp swmr* swmr_test # With the --disable-shared option, swmr program files are built in the test # directory, otherwise they are in test/.libs with a corresponding wrapper @@ -145,7 +146,9 @@ if [ -f .libs/swmr ]; then case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE swmr_test/.libs + if test -f "$FILE" ; then + cp $FILE swmr_test/.libs + fi done fi @@ -153,7 +156,7 @@ cd swmr_test # Loop over index types -for index_type in "-i ea" "-i b2" +for index_type in "-i ea" "-i b2" do # Try with and without compression for compress in "" "-c 5" diff --git a/test/testvdsswmr.sh.in b/test/testvdsswmr.sh.in index 32af072..28abcf5 100644 --- a/test/testvdsswmr.sh.in +++ b/test/testvdsswmr.sh.in @@ -117,7 +117,9 @@ for FILE in vds_swmr*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE vds_swmr_test + if test -f "$FILE" ; then + cp $FILE vds_swmr_test + fi done # With the --disable-shared option, swmr program files are built in the test @@ -126,7 +128,14 @@ done # always be copied, swmr files in .libs should be copied only if they exists. if [ -f .libs/vds_swmr_writer ]; then mkdir vds_swmr_test/.libs - cp .libs/vds_swmr* vds_swmr_test/.libs + for FILE in .libs/vds_swmr*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE vds_swmr_test/.libs + fi + done fi cd vds_swmr_test -- cgit v0.12 From 4775b6a3d9f6cd9be4865897d7ab8301222a076b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 18 Sep 2019 11:15:58 -0500 Subject: Add missing HD prefix --- tools/test/perform/sio_perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index ff9e2b4..90030d8 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -1423,6 +1423,6 @@ usage(const char *prog) HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n"); HDprintf(" HDF5_PREFIX Data file prefix\n"); HDprintf("\n"); - fflush(stdout); + HDfflush(stdout); } /* end usage() */ -- cgit v0.12 From 6f34503a5a93ae1ba97d35475643fac1ef70447e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 18 Sep 2019 12:11:12 -0500 Subject: Whitespace cleanup --- c++/examples/chunks.cpp | 338 ++++++++++++------------- c++/examples/compound.cpp | 16 +- c++/examples/create.cpp | 12 +- c++/examples/extend_ds.cpp | 24 +- c++/examples/h5group.cpp | 288 +++++++++++----------- c++/examples/h5tutr_cmprss.cpp | 196 +++++++-------- c++/examples/h5tutr_crtatt.cpp | 58 ++--- c++/examples/h5tutr_crtdat.cpp | 55 +++-- c++/examples/h5tutr_crtgrp.cpp | 34 +-- c++/examples/h5tutr_crtgrpar.cpp | 54 ++-- c++/examples/h5tutr_crtgrpd.cpp | 136 +++++----- c++/examples/h5tutr_extend.cpp | 218 ++++++++-------- c++/examples/h5tutr_rdwt.cpp | 48 ++-- c++/examples/h5tutr_subset.cpp | 192 +++++++-------- c++/examples/readdata.cpp | 36 +-- c++/examples/writedata.cpp | 518 +++++++++++++++++++-------------------- 16 files changed, 1112 insertions(+), 1111 deletions(-) diff --git a/c++/examples/chunks.cpp b/c++/examples/chunks.cpp index 142e70f..03e2855 100644 --- a/c++/examples/chunks.cpp +++ b/c++/examples/chunks.cpp @@ -37,194 +37,194 @@ const int RANKC = 1; int main (void) { - hsize_t i, j; + hsize_t i, j; // Try block to detect exceptions raised by any of the calls inside it try { - /* - * Turn off the auto-printing when failure occurs so that we can - * handle the errors appropriately - */ - Exception::dontPrint(); - - /* - * Open the file and the dataset. - */ - H5File file( FILE_NAME, H5F_ACC_RDONLY ); - DataSet dataset = file.openDataSet( DATASET_NAME ); - - /* - * Get filespace for rank and dimension - */ - DataSpace filespace = dataset.getSpace(); - - /* - * Get number of dimensions in the file dataspace - */ - int rank = filespace.getSimpleExtentNdims(); - - /* - * Get and print the dimension sizes of the file dataspace - */ - hsize_t dims[2]; // dataset dimensions - rank = filespace.getSimpleExtentDims( dims ); - cout << "dataset rank = " << rank << ", dimensions " - << (unsigned long)(dims[0]) << " x " - << (unsigned long)(dims[1]) << endl; - - /* - * Define the memory space to read dataset. - */ - DataSpace mspace1(RANK, dims); - - /* - * Read dataset back and display. - */ - int data_out[NX][NY]; // buffer for dataset to be read - dataset.read( data_out, PredType::NATIVE_INT, mspace1, filespace ); - - cout << "\n"; - cout << "Dataset: \n"; - for (j = 0; j < dims[0]; j++) - { - for (i = 0; i < dims[1]; i++) - cout << data_out[j][i] << " "; - cout << endl; - } - - /* - * dataset rank 2, dimensions 10 x 5 - * chunk rank 2, dimensions 2 x 5 - - * Dataset: - * 1 1 1 3 3 - * 1 1 1 3 3 - * 1 1 1 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - */ - - /* - * Read the third column from the dataset. - * First define memory dataspace, then define hyperslab - * and read it into column array. - */ - hsize_t col_dims[1]; - col_dims[0] = 10; - DataSpace mspace2( RANKC, col_dims ); - - /* - * Define the column (hyperslab) to read. - */ - hsize_t offset[2] = { 0, 2 }; - hsize_t count[2] = { 10, 1 }; - int column[10]; // buffer for column to be read - - /* - * Define hyperslab and read. - */ - filespace.selectHyperslab( H5S_SELECT_SET, count, offset ); - dataset.read( column, PredType::NATIVE_INT, mspace2, filespace ); - - cout << endl; - cout << "Third column: " << endl; - for (i = 0; i < 10; i++) - cout << column[i] << endl; - - /* - * Third column: - * 1 - * 1 - * 1 - * 0 - * 0 - * 0 - * 0 - * 0 - * 0 - * 0 - */ - - /* - * Get creation properties list. - */ - DSetCreatPropList cparms = dataset.getCreatePlist(); - - /* - * Check if dataset is chunked. - */ - hsize_t chunk_dims[2]; - int rank_chunk; - if( H5D_CHUNKED == cparms.getLayout() ) - { - /* - * Get chunking information: rank and dimensions - */ - rank_chunk = cparms.getChunk( 2, chunk_dims); - cout << "chunk rank " << rank_chunk << "dimensions " - << (unsigned long)(chunk_dims[0]) << " x " - << (unsigned long)(chunk_dims[1]) << endl; - - /* - * Define the memory space to read a chunk. - */ - DataSpace mspace3( rank_chunk, chunk_dims ); - - /* - * Define chunk in the file (hyperslab) to read. - */ - offset[0] = 2; - offset[1] = 0; - count[0] = chunk_dims[0]; - count[1] = chunk_dims[1]; - filespace.selectHyperslab( H5S_SELECT_SET, count, offset ); - - /* - * Read chunk back and display. - */ - int chunk_out[2][5]; // buffer for chunk to be read - dataset.read( chunk_out, PredType::NATIVE_INT, mspace3, filespace ); - cout << endl; - cout << "Chunk:" << endl; - for (j = 0; j < chunk_dims[0]; j++) - { - for (i = 0; i < chunk_dims[1]; i++) - cout << chunk_out[j][i] << " "; - cout << endl; - } - /* - * Chunk: - * 1 1 1 0 0 - * 2 0 0 0 0 - */ - } + /* + * Turn off the auto-printing when failure occurs so that we can + * handle the errors appropriately + */ + Exception::dontPrint(); + + /* + * Open the file and the dataset. + */ + H5File file( FILE_NAME, H5F_ACC_RDONLY ); + DataSet dataset = file.openDataSet( DATASET_NAME ); + + /* + * Get filespace for rank and dimension + */ + DataSpace filespace = dataset.getSpace(); + + /* + * Get number of dimensions in the file dataspace + */ + int rank = filespace.getSimpleExtentNdims(); + + /* + * Get and print the dimension sizes of the file dataspace + */ + hsize_t dims[2]; // dataset dimensions + rank = filespace.getSimpleExtentDims( dims ); + cout << "dataset rank = " << rank << ", dimensions " + << (unsigned long)(dims[0]) << " x " + << (unsigned long)(dims[1]) << endl; + + /* + * Define the memory space to read dataset. + */ + DataSpace mspace1(RANK, dims); + + /* + * Read dataset back and display. + */ + int data_out[NX][NY]; // buffer for dataset to be read + dataset.read( data_out, PredType::NATIVE_INT, mspace1, filespace ); + + cout << "\n"; + cout << "Dataset: \n"; + for (j = 0; j < dims[0]; j++) + { + for (i = 0; i < dims[1]; i++) + cout << data_out[j][i] << " "; + cout << endl; + } + + /* + * dataset rank 2, dimensions 10 x 5 + * chunk rank 2, dimensions 2 x 5 + + * Dataset: + * 1 1 1 3 3 + * 1 1 1 3 3 + * 1 1 1 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + */ + + /* + * Read the third column from the dataset. + * First define memory dataspace, then define hyperslab + * and read it into column array. + */ + hsize_t col_dims[1]; + col_dims[0] = 10; + DataSpace mspace2( RANKC, col_dims ); + + /* + * Define the column (hyperslab) to read. + */ + hsize_t offset[2] = { 0, 2 }; + hsize_t count[2] = { 10, 1 }; + int column[10]; // buffer for column to be read + + /* + * Define hyperslab and read. + */ + filespace.selectHyperslab( H5S_SELECT_SET, count, offset ); + dataset.read( column, PredType::NATIVE_INT, mspace2, filespace ); + + cout << endl; + cout << "Third column: " << endl; + for (i = 0; i < 10; i++) + cout << column[i] << endl; + + /* + * Third column: + * 1 + * 1 + * 1 + * 0 + * 0 + * 0 + * 0 + * 0 + * 0 + * 0 + */ + + /* + * Get creation properties list. + */ + DSetCreatPropList cparms = dataset.getCreatePlist(); + + /* + * Check if dataset is chunked. + */ + hsize_t chunk_dims[2]; + int rank_chunk; + if( H5D_CHUNKED == cparms.getLayout() ) + { + /* + * Get chunking information: rank and dimensions + */ + rank_chunk = cparms.getChunk( 2, chunk_dims); + cout << "chunk rank " << rank_chunk << "dimensions " + << (unsigned long)(chunk_dims[0]) << " x " + << (unsigned long)(chunk_dims[1]) << endl; + + /* + * Define the memory space to read a chunk. + */ + DataSpace mspace3( rank_chunk, chunk_dims ); + + /* + * Define chunk in the file (hyperslab) to read. + */ + offset[0] = 2; + offset[1] = 0; + count[0] = chunk_dims[0]; + count[1] = chunk_dims[1]; + filespace.selectHyperslab( H5S_SELECT_SET, count, offset ); + + /* + * Read chunk back and display. + */ + int chunk_out[2][5]; // buffer for chunk to be read + dataset.read( chunk_out, PredType::NATIVE_INT, mspace3, filespace ); + cout << endl; + cout << "Chunk:" << endl; + for (j = 0; j < chunk_dims[0]; j++) + { + for (i = 0; i < chunk_dims[1]; i++) + cout << chunk_out[j][i] << " "; + cout << endl; + } + /* + * Chunk: + * 1 1 1 0 0 + * 2 0 0 0 0 + */ + } } // end of try block // catch failure caused by the H5File operations catch( FileIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch( DataSetIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch( DataSpaceIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; } diff --git a/c++/examples/compound.cpp b/c++/examples/compound.cpp index 192a1cf..4b116e0 100644 --- a/c++/examples/compound.cpp +++ b/c++/examples/compound.cpp @@ -41,15 +41,15 @@ int main(void) { /* First structure and dataset*/ typedef struct s1_t { - int a; - float b; - double c; + int a; + float b; + double c; } s1_t; /* Second structure (subset of s1_t) and dataset*/ typedef struct s2_t { - double c; - int a; + double c; + int a; } s2_t; // Try block to detect exceptions raised by any of the calls inside it @@ -135,12 +135,12 @@ int main(void) */ cout << endl << "Field c : " << endl; for( i = 0; i < LENGTH; i++) - cout << s2[i].c << " "; + cout << s2[i].c << " "; cout << endl; cout << endl << "Field a : " << endl; for( i = 0; i < LENGTH; i++) - cout << s2[i].a << " "; + cout << s2[i].a << " "; cout << endl; /* @@ -161,7 +161,7 @@ int main(void) */ cout << endl << "Field b : " << endl; for( i = 0; i < LENGTH; i++) - cout << s3[i] << " "; + cout << s3[i] << " "; cout << endl; /* diff --git a/c++/examples/create.cpp b/c++/examples/create.cpp index 890fb03..06b981b 100644 --- a/c++/examples/create.cpp +++ b/c++/examples/create.cpp @@ -25,11 +25,11 @@ #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME( "SDS.h5" ); -const H5std_string DATASET_NAME( "IntArray" ); -const int NX = 5; // dataset dimensions -const int NY = 6; -const int RANK = 2; +const H5std_string FILE_NAME( "SDS.h5" ); +const H5std_string DATASET_NAME( "IntArray" ); +const int NX = 5; // dataset dimensions +const int NY = 6; +const int RANK = 2; int main (void) { @@ -41,7 +41,7 @@ int main (void) for (j = 0; j < NX; j++) { for (i = 0; i < NY; i++) - data[j][i] = i + j; + data[j][i] = i + j; } /* * 0 1 2 3 4 5 diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp index 271100e..9e005c6 100644 --- a/c++/examples/extend_ds.cpp +++ b/c++/examples/extend_ds.cpp @@ -105,8 +105,8 @@ int main (void) * Write the data to the hyperslab. */ int data1[3][3] = { {1, 1, 1}, /* data to write */ - {1, 1, 1}, - {1, 1, 1} }; + {1, 1, 1}, + {1, 1, 1} }; dataset.write( data1, PredType::NATIVE_INT, mspace1, fspace1 ); /* @@ -179,16 +179,16 @@ int main (void) /* * Resulting dataset * - * 1 1 1 3 3 - * 1 1 1 3 3 - * 1 1 1 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 + * 1 1 1 3 3 + * 1 1 1 3 3 + * 1 1 1 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 */ /* * Display the result. diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp index a8c9953..fab54cd 100644 --- a/c++/examples/h5group.cpp +++ b/c++/examples/h5group.cpp @@ -33,7 +33,7 @@ using std::endl; using namespace H5; const H5std_string FILE_NAME( "Group.h5" ); -const int RANK = 2; +const int RANK = 2; // Operator function extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, @@ -48,169 +48,169 @@ int main(void) // Try block to detect exceptions raised by any of the calls inside it try { - /* - * Turn off the auto-printing when failure occurs so that we can - * handle the errors appropriately - */ - Exception::dontPrint(); - - /* - * Create the named file, truncating the existing one if any, - * using default create and access property lists. - */ - H5File *file = new H5File( FILE_NAME, H5F_ACC_TRUNC ); - - /* - * Create a group in the file - */ - Group* group = new Group( file->createGroup( "/Data" )); - - /* - * Create dataset "Compressed Data" in the group using absolute - * name. Dataset creation property list is modified to use - * GZIP compression with the compression effort set to 6. - * Note that compression can be used only when dataset is chunked. - */ - dims[0] = 1000; - dims[1] = 20; - cdims[0] = 20; - cdims[1] = 20; - DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace - DSetCreatPropList ds_creatplist; // create dataset creation prop list - ds_creatplist.setChunk( 2, cdims ); // then modify it for compression - ds_creatplist.setDeflate( 6 ); - - /* - * Create the first dataset. - */ - DataSet* dataset = new DataSet(file->createDataSet( - "/Data/Compressed_Data", PredType::NATIVE_INT, - *dataspace, ds_creatplist )); - - /* - * Close the first dataset. - */ - delete dataset; - delete dataspace; - - /* - * Create the second dataset. - */ - dims[0] = 500; - dims[1] = 20; - dataspace = new DataSpace(RANK, dims); // create second dspace - dataset = new DataSet(file->createDataSet("/Data/Float_Data", - PredType::NATIVE_FLOAT, *dataspace)); - - delete dataset; - delete dataspace; - delete group; - delete file; - - /* - * Now reopen the file and group in the file. - */ - file = new H5File(FILE_NAME, H5F_ACC_RDWR); - group = new Group(file->openGroup("Data")); - - /* - * Access "Compressed_Data" dataset in the group. - */ - try { // to determine if the dataset exists in the group - dataset = new DataSet( group->openDataSet( "Compressed_Data" )); - } - catch( GroupIException not_found_error ) { - cout << " Dataset is not found." << endl; - } - cout << "dataset \"/Data/Compressed_Data\" is open" << endl; - - /* - * Close the dataset. - */ - delete dataset; - - /* - * Create hard link to the Data group. - */ - file->link( H5L_TYPE_HARD, "Data", "Data_new" ); - - /* - * We can access "Compressed_Data" dataset using created - * hard link "Data_new". - */ - try { // to determine if the dataset exists in the file - dataset = new DataSet(file->openDataSet( "/Data_new/Compressed_Data" )); - } - catch( FileIException not_found_error ) - { - cout << " Dataset is not found." << endl; - } - cout << "dataset \"/Data_new/Compressed_Data\" is open" << endl; - - /* - * Close the dataset. - */ - delete dataset; - - /* - * Use iterator to see the names of the objects in the file - * root directory. - */ - cout << endl << "Iterating over elements in the file" << endl; - herr_t idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); - cout << endl; - - /* - * Unlink name "Data" and use iterator to see the names - * of the objects in the file root direvtory. - */ - cout << "Unlinking..." << endl; - try { // attempt to unlink the dataset - file->unlink( "Data" ); - } - catch( FileIException unlink_error ) - { - cout << " unlink failed." << endl; - } - cout << "\"Data\" is unlinked" << endl; - - cout << endl << "Iterating over elements in the file again" << endl; - idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); - cout << endl; - - /* - * Close the group and file. - */ - delete group; - delete file; + /* + * Turn off the auto-printing when failure occurs so that we can + * handle the errors appropriately + */ + Exception::dontPrint(); + + /* + * Create the named file, truncating the existing one if any, + * using default create and access property lists. + */ + H5File *file = new H5File( FILE_NAME, H5F_ACC_TRUNC ); + + /* + * Create a group in the file + */ + Group* group = new Group( file->createGroup( "/Data" )); + + /* + * Create dataset "Compressed Data" in the group using absolute + * name. Dataset creation property list is modified to use + * GZIP compression with the compression effort set to 6. + * Note that compression can be used only when dataset is chunked. + */ + dims[0] = 1000; + dims[1] = 20; + cdims[0] = 20; + cdims[1] = 20; + DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace + DSetCreatPropList ds_creatplist; // create dataset creation prop list + ds_creatplist.setChunk( 2, cdims ); // then modify it for compression + ds_creatplist.setDeflate( 6 ); + + /* + * Create the first dataset. + */ + DataSet* dataset = new DataSet(file->createDataSet( + "/Data/Compressed_Data", PredType::NATIVE_INT, + *dataspace, ds_creatplist )); + + /* + * Close the first dataset. + */ + delete dataset; + delete dataspace; + + /* + * Create the second dataset. + */ + dims[0] = 500; + dims[1] = 20; + dataspace = new DataSpace(RANK, dims); // create second dspace + dataset = new DataSet(file->createDataSet("/Data/Float_Data", + PredType::NATIVE_FLOAT, *dataspace)); + + delete dataset; + delete dataspace; + delete group; + delete file; + + /* + * Now reopen the file and group in the file. + */ + file = new H5File(FILE_NAME, H5F_ACC_RDWR); + group = new Group(file->openGroup("Data")); + + /* + * Access "Compressed_Data" dataset in the group. + */ + try { // to determine if the dataset exists in the group + dataset = new DataSet( group->openDataSet( "Compressed_Data" )); + } + catch( GroupIException not_found_error ) { + cout << " Dataset is not found." << endl; + } + cout << "dataset \"/Data/Compressed_Data\" is open" << endl; + + /* + * Close the dataset. + */ + delete dataset; + + /* + * Create hard link to the Data group. + */ + file->link( H5L_TYPE_HARD, "Data", "Data_new" ); + + /* + * We can access "Compressed_Data" dataset using created + * hard link "Data_new". + */ + try { // to determine if the dataset exists in the file + dataset = new DataSet(file->openDataSet( "/Data_new/Compressed_Data" )); + } + catch( FileIException not_found_error ) + { + cout << " Dataset is not found." << endl; + } + cout << "dataset \"/Data_new/Compressed_Data\" is open" << endl; + + /* + * Close the dataset. + */ + delete dataset; + + /* + * Use iterator to see the names of the objects in the file + * root directory. + */ + cout << endl << "Iterating over elements in the file" << endl; + herr_t idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + cout << endl; + + /* + * Unlink name "Data" and use iterator to see the names + * of the objects in the file root direvtory. + */ + cout << "Unlinking..." << endl; + try { // attempt to unlink the dataset + file->unlink( "Data" ); + } + catch( FileIException unlink_error ) + { + cout << " unlink failed." << endl; + } + cout << "\"Data\" is unlinked" << endl; + + cout << endl << "Iterating over elements in the file again" << endl; + idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + cout << endl; + + /* + * Close the group and file. + */ + delete group; + delete file; } // end of try block // catch failure caused by the H5File operations catch( FileIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch( DataSetIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch( DataSpaceIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the Attribute operations catch( AttributeIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; } diff --git a/c++/examples/h5tutr_cmprss.cpp b/c++/examples/h5tutr_cmprss.cpp index 9b1d2bc..9531bdd 100644 --- a/c++/examples/h5tutr_cmprss.cpp +++ b/c++/examples/h5tutr_cmprss.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * 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 COPYING file, which can be found at the root of the source code * @@ -24,130 +24,130 @@ using std::endl; #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME("h5tutr_cmprss.h5"); -const H5std_string DATASET_NAME("Compressed_Data"); -const int DIM0 = 100; -const int DIM1 = 20; +const H5std_string FILE_NAME("h5tutr_cmprss.h5"); +const H5std_string DATASET_NAME("Compressed_Data"); +const int DIM0 = 100; +const int DIM1 = 20; int main (void) { - hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions - hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions + hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions + hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions int i,j, buf[DIM0][DIM1]; // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Create a new file using the default property lists. - H5File file(FILE_NAME, H5F_ACC_TRUNC); + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); - // Create the data space for the dataset. - DataSpace *dataspace = new DataSpace(2, dims); + // Create the data space for the dataset. + DataSpace *dataspace = new DataSpace(2, dims); - // Modify dataset creation property to enable chunking - DSetCreatPropList *plist = new DSetCreatPropList; - plist->setChunk(2, chunk_dims); + // Modify dataset creation property to enable chunking + DSetCreatPropList *plist = new DSetCreatPropList; + plist->setChunk(2, chunk_dims); - // Set ZLIB (DEFLATE) Compression using level 6. - // To use SZIP compression comment out this line. - plist->setDeflate(6); + // Set ZLIB (DEFLATE) Compression using level 6. + // To use SZIP compression comment out this line. + plist->setDeflate(6); - // Uncomment these lines to set SZIP Compression - // unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK; - // unsigned szip_pixels_per_block = 16; - // plist->setSzip(szip_options_mask, szip_pixels_per_block); + // Uncomment these lines to set SZIP Compression + // unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK; + // unsigned szip_pixels_per_block = 16; + // plist->setSzip(szip_options_mask, szip_pixels_per_block); - // Create the dataset. - DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME, - PredType::STD_I32BE, *dataspace, *plist) ); - - for (i = 0; i< DIM0; i++) - for (j=0; jwrite(buf, PredType::NATIVE_INT); - - // Close objects and file. Either approach will close the HDF5 item. - delete dataspace; - delete dataset; - delete plist; - file.close(); - - // ----------------------------------------------- - // Re-open the file and dataset, retrieve filter - // information for dataset and read the data back. - // ----------------------------------------------- - - int rbuf[DIM0][DIM1]; - int numfilt; - size_t nelmts={1}, namelen={1}; - unsigned flags, filter_info, cd_values[1], idx; - char name[1]; - H5Z_filter_t filter_type; - - // Open the file and the dataset in the file. - file.openFile(FILE_NAME, H5F_ACC_RDONLY); - dataset = new DataSet(file.openDataSet( DATASET_NAME)); - - // Get the create property list of the dataset. - plist = new DSetCreatPropList(dataset->getCreatePlist ()); - - // Get the number of filters associated with the dataset. - numfilt = plist->getNfilters(); - cout << "Number of filters associated with dataset: " << numfilt << endl; - - for (idx=0; idx < numfilt; idx++) { - nelmts = 0; - - filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info); - - cout << "Filter Type: "; - - switch (filter_type) { - case H5Z_FILTER_DEFLATE: - cout << "H5Z_FILTER_DEFLATE" << endl; - break; - case H5Z_FILTER_SZIP: - cout << "H5Z_FILTER_SZIP" << endl; - break; - default: - cout << "Other filter type included." << endl; - } - } - - // Read data. - dataset->read(rbuf, PredType::NATIVE_INT); - - delete plist; - delete dataset; - file.close(); // can be skipped + // Create the dataset. + DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME, + PredType::STD_I32BE, *dataspace, *plist) ); + + for (i = 0; i< DIM0; i++) + for (j=0; jwrite(buf, PredType::NATIVE_INT); + + // Close objects and file. Either approach will close the HDF5 item. + delete dataspace; + delete dataset; + delete plist; + file.close(); + + // ----------------------------------------------- + // Re-open the file and dataset, retrieve filter + // information for dataset and read the data back. + // ----------------------------------------------- + + int rbuf[DIM0][DIM1]; + int numfilt; + size_t nelmts={1}, namelen={1}; + unsigned flags, filter_info, cd_values[1], idx; + char name[1]; + H5Z_filter_t filter_type; + + // Open the file and the dataset in the file. + file.openFile(FILE_NAME, H5F_ACC_RDONLY); + dataset = new DataSet(file.openDataSet( DATASET_NAME)); + + // Get the create property list of the dataset. + plist = new DSetCreatPropList(dataset->getCreatePlist ()); + + // Get the number of filters associated with the dataset. + numfilt = plist->getNfilters(); + cout << "Number of filters associated with dataset: " << numfilt << endl; + + for (idx=0; idx < numfilt; idx++) { + nelmts = 0; + + filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info); + + cout << "Filter Type: "; + + switch (filter_type) { + case H5Z_FILTER_DEFLATE: + cout << "H5Z_FILTER_DEFLATE" << endl; + break; + case H5Z_FILTER_SZIP: + cout << "H5Z_FILTER_SZIP" << endl; + break; + default: + cout << "Other filter type included." << endl; + } + } + + // Read data. + dataset->read(rbuf, PredType::NATIVE_INT); + + delete plist; + delete dataset; + file.close(); // can be skipped } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch(DataSpaceIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp index f865501..fcf6c27 100644 --- a/c++/examples/h5tutr_crtatt.cpp +++ b/c++/examples/h5tutr_crtatt.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * 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 COPYING file, which can be found at the root of the source code * @@ -21,11 +21,11 @@ #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME( "h5tutr_dset.h5" ); -const H5std_string DATASET_NAME( "dset" ); -const H5std_string ATTR_NAME( "Units" ); +const H5std_string FILE_NAME( "h5tutr_dset.h5" ); +const H5std_string DATASET_NAME( "dset" ); +const H5std_string ATTR_NAME( "Units" ); -const int DIM1 = 2; +const int DIM1 = 2; int main (void) { @@ -36,52 +36,52 @@ int main (void) // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Open an existing file and dataset. - H5File file( FILE_NAME, H5F_ACC_RDWR ); - DataSet dataset = file.openDataSet( DATASET_NAME ); + // Open an existing file and dataset. + H5File file( FILE_NAME, H5F_ACC_RDWR ); + DataSet dataset = file.openDataSet( DATASET_NAME ); - // Create the data space for the attribute. - DataSpace attr_dataspace = DataSpace (1, dims ); + // Create the data space for the attribute. + DataSpace attr_dataspace = DataSpace (1, dims ); - // Create a dataset attribute. - Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE, - attr_dataspace); + // Create a dataset attribute. + Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE, + attr_dataspace); - // Write the attribute data. - attribute.write( PredType::NATIVE_INT, attr_data); + // Write the attribute data. + attribute.write( PredType::NATIVE_INT, attr_data); } // end of try block // catch failure caused by the H5File operations catch( DataSpaceIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the H5File operations catch( AttributeIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the H5File operations catch( FileIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch( DataSetIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp index 7cd49f8..985f6ac 100644 --- a/c++/examples/h5tutr_crtdat.cpp +++ b/c++/examples/h5tutr_crtdat.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * 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 COPYING file, which can be found at the root of the source code * @@ -18,57 +18,58 @@ #include #include + #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME("h5tutr_dset.h5"); -const H5std_string DATASET_NAME("dset"); -const int NX = 4; // dataset dimensions -const int NY = 6; -const int RANK = 2; +const H5std_string FILE_NAME("h5tutr_dset.h5"); +const H5std_string DATASET_NAME("dset"); +const int NX = 4; // dataset dimensions +const int NY = 6; +const int RANK = 2; int main (void) { // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Create a new file using the default property lists. - H5File file(FILE_NAME, H5F_ACC_TRUNC); + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); - // Create the data space for the dataset. - hsize_t dims[2]; // dataset dimensions - dims[0] = NX; - dims[1] = NY; - DataSpace dataspace(RANK, dims); + // Create the data space for the dataset. + hsize_t dims[2]; // dataset dimensions + dims[0] = NX; + dims[1] = NY; + DataSpace dataspace(RANK, dims); - // Create the dataset. - DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace); + // Create the dataset. + DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace); } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch(DataSpaceIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/h5tutr_crtgrp.cpp b/c++/examples/h5tutr_crtgrp.cpp index 4bdb02c..e35cb46 100644 --- a/c++/examples/h5tutr_crtgrp.cpp +++ b/c++/examples/h5tutr_crtgrp.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * 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 COPYING file, which can be found at the root of the source code * @@ -31,31 +31,31 @@ int main(void) // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Create a new file using default property lists. - H5File file(FILE_NAME, H5F_ACC_TRUNC); - - // Create a group named "/MygGroup" in the file - Group group(file.createGroup("/MyGroup")); + // Create a new file using default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create a group named "/MygGroup" in the file + Group group(file.createGroup("/MyGroup")); - // File and group will be closed as their instances go out of scope. + // File and group will be closed as their instances go out of scope. } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the Group operations catch(GroupIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; diff --git a/c++/examples/h5tutr_crtgrpar.cpp b/c++/examples/h5tutr_crtgrpar.cpp index 3e175d6..76ec9e5 100644 --- a/c++/examples/h5tutr_crtgrpar.cpp +++ b/c++/examples/h5tutr_crtgrpar.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * 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 COPYING file, which can be found at the root of the source code * @@ -33,50 +33,50 @@ int main(void) try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately. + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately. - Exception::dontPrint(); + Exception::dontPrint(); - // Create a new file using default properties. + // Create a new file using default properties. - H5File file(FILE_NAME, H5F_ACC_TRUNC); + H5File file(FILE_NAME, H5F_ACC_TRUNC); - // Create group "MyGroup" in the root group using an absolute name. - - Group group1(file.createGroup( "/MyGroup")); + // Create group "MyGroup" in the root group using an absolute name. + + Group group1(file.createGroup( "/MyGroup")); - // Create group "Group_A" in group "MyGroup" using an - // absolute name. + // Create group "Group_A" in group "MyGroup" using an + // absolute name. - Group group2(file.createGroup("/MyGroup/Group_A")); + Group group2(file.createGroup("/MyGroup/Group_A")); - // Create group "Group_B" in group "MyGroup" using a - // relative name. + // Create group "Group_B" in group "MyGroup" using a + // relative name. - Group group3(group1.createGroup ("Group_B")); + Group group3(group1.createGroup ("Group_B")); - // Close the groups and file. + // Close the groups and file. - group1.close(); - group2.close(); - group3.close(); - file.close(); + group1.close(); + group2.close(); + group3.close(); + file.close(); } // end of try block // catch failure caused by the File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the Group operations catch(GroupIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; diff --git a/c++/examples/h5tutr_crtgrpd.cpp b/c++/examples/h5tutr_crtgrpd.cpp index 318ab1c..e3bb1b1 100644 --- a/c++/examples/h5tutr_crtgrpd.cpp +++ b/c++/examples/h5tutr_crtgrpd.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * 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 COPYING file, which can be found at the root of the source code * @@ -27,11 +27,11 @@ using namespace H5; const H5std_string FILE_NAME("h5tutr_groups.h5"); const H5std_string DATASET_NAME1("/MyGroup/dset1"); const H5std_string DATASET_NAME2("dset2"); -const int RANK = 2; -const int D1DIM1 = 3; -const int D1DIM2 = 3; -const int D2DIM1 = 2; -const int D2DIM2 = 10; +const int RANK = 2; +const int D1DIM1 = 3; +const int D1DIM2 = 3; +const int D2DIM1 = 2; +const int D2DIM2 = 10; int main(void) { @@ -41,93 +41,93 @@ int main(void) // Try block to catch exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Initialize the first dataset. - for (i = 0; i < D1DIM1; i++) - for (j = 0; j < D1DIM2; j++) - dset1_data[i][j] = j + 1; + // Initialize the first dataset. + for (i = 0; i < D1DIM1; i++) + for (j = 0; j < D1DIM2; j++) + dset1_data[i][j] = j + 1; - // Initialize the second dataset. - for (i = 0; i < D2DIM1; i++) - for (j = 0; j < D2DIM2; j++) - dset2_data[i][j] = j + 1; + // Initialize the second dataset. + for (i = 0; i < D2DIM1; i++) + for (j = 0; j < D2DIM2; j++) + dset2_data[i][j] = j + 1; - // Open an existing file and dataset. - H5File file(FILE_NAME, H5F_ACC_RDWR); + // Open an existing file and dataset. + H5File file(FILE_NAME, H5F_ACC_RDWR); // Create the data space for the first dataset. Note the use of // pointer for the instance 'dataspace'. It can be deleted and // used again later for another data space. An HDF5 identifier is // closed by the destructor or the method 'close()'. - hsize_t dims[RANK]; // dataset dimensions - dims[0] = D1DIM1; - dims[1] = D1DIM2; - DataSpace *dataspace = new DataSpace (RANK, dims); - - // Create the dataset in group "MyGroup". Same note as for the - // dataspace above. - DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1, - PredType::STD_I32BE, *dataspace)); - - // Write the data to the dataset using default memory space, file - // space, and transfer properties. - dataset->write(dset1_data, PredType::NATIVE_INT); - - // Close the current dataset and data space. - delete dataset; - delete dataspace; - - // Create the data space for the second dataset. - dims[0] = D2DIM1; - dims[1] = D2DIM2; - dataspace = new DataSpace (RANK, dims); - - // Create group "Group_A" in group "MyGroup". - Group group(file.openGroup("/MyGroup/Group_A")); - - // Create the second dataset in group "Group_A". - dataset = new DataSet (group.createDataSet(DATASET_NAME2, - PredType::STD_I32BE, *dataspace)); - - // Write the data to the dataset using default memory space, file - // space, and transfer properties. - dataset->write(dset2_data, PredType::NATIVE_INT); - - // Close all objects. - delete dataspace; - delete dataset; - group.close(); + hsize_t dims[RANK]; // dataset dimensions + dims[0] = D1DIM1; + dims[1] = D1DIM2; + DataSpace *dataspace = new DataSpace (RANK, dims); + + // Create the dataset in group "MyGroup". Same note as for the + // dataspace above. + DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1, + PredType::STD_I32BE, *dataspace)); + + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset->write(dset1_data, PredType::NATIVE_INT); + + // Close the current dataset and data space. + delete dataset; + delete dataspace; + + // Create the data space for the second dataset. + dims[0] = D2DIM1; + dims[1] = D2DIM2; + dataspace = new DataSpace (RANK, dims); + + // Create group "Group_A" in group "MyGroup". + Group group(file.openGroup("/MyGroup/Group_A")); + + // Create the second dataset in group "Group_A". + dataset = new DataSet (group.createDataSet(DATASET_NAME2, + PredType::STD_I32BE, *dataspace)); + + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset->write(dset2_data, PredType::NATIVE_INT); + + // Close all objects. + delete dataspace; + delete dataset; + group.close(); } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch(DataSpaceIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the Group operations catch(GroupIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp index 8c1bc03..b6927ea 100644 --- a/c++/examples/h5tutr_extend.cpp +++ b/c++/examples/h5tutr_extend.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * 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 COPYING file, which can be found at the root of the source code * @@ -24,17 +24,17 @@ using std::endl; #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME("h5tutr_extend.h5"); -const H5std_string DATASETNAME("ExtendibleArray"); +const H5std_string FILE_NAME("h5tutr_extend.h5"); +const H5std_string DATASETNAME("ExtendibleArray"); int main (void) { - hsize_t dims[2] = {3,3}; // dataset dimensions at creation + hsize_t dims[2] = {3,3}; // dataset dimensions at creation hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; hsize_t chunk_dims[2] ={2, 5}; - int data[3][3] = { {1, 1, 1}, // data to write - {1, 1, 1}, - {1, 1, 1} }; + int data[3][3] = { {1, 1, 1}, // data to write + {1, 1, 1}, + {1, 1, 1} }; // Variables used in extending and writing to the extended portion of dataset @@ -42,127 +42,127 @@ int main (void) hsize_t offset[2]; hsize_t dimsext[2] = {7, 3}; // extend dimensions int dataext[7][3] = { {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4} }; + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4} }; // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); - - // Create a new file using the default property lists. - H5File file(FILE_NAME, H5F_ACC_TRUNC); - - // Create the data space for the dataset. Note the use of pointer - // for the instance 'dataspace'. It can be deleted and used again - // later for another dataspace. An HDF5 identifier can be closed - // by the destructor or the method 'close()'. - DataSpace *dataspace = new DataSpace (2, dims, maxdims); - - // Modify dataset creation property to enable chunking - DSetCreatPropList prop; - prop.setChunk(2, chunk_dims); - - // Create the chunked dataset. Note the use of pointer. - DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME, - PredType::STD_I32BE, *dataspace, prop) ); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create the data space for the dataset. Note the use of pointer + // for the instance 'dataspace'. It can be deleted and used again + // later for another dataspace. An HDF5 identifier can be closed + // by the destructor or the method 'close()'. + DataSpace *dataspace = new DataSpace (2, dims, maxdims); + + // Modify dataset creation property to enable chunking + DSetCreatPropList prop; + prop.setChunk(2, chunk_dims); + + // Create the chunked dataset. Note the use of pointer. + DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME, + PredType::STD_I32BE, *dataspace, prop) ); - // Write data to dataset. - dataset->write(data, PredType::NATIVE_INT); - - // Extend the dataset. Dataset becomes 10 x 3. - size[0] = dims[0] + dimsext[0]; - size[1] = dims[1]; - dataset->extend(size); - - // Select a hyperslab in extended portion of the dataset. - DataSpace *filespace = new DataSpace(dataset->getSpace ()); - offset[0] = 3; - offset[1] = 0; - filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset); - - // Define memory space. - DataSpace *memspace = new DataSpace(2, dimsext, NULL); - - // Write data to the extended portion of the dataset. - dataset->write(dataext, PredType::NATIVE_INT, *memspace, *filespace); - - // Close all objects and file. - prop.close(); - delete filespace; - delete memspace; - delete dataspace; - delete dataset; - file.close(); - - // --------------------------------------- - // Re-open the file and read the data back - // --------------------------------------- - - int rdata[10][3]; - int i,j, rank, rank_chunk; - hsize_t chunk_dimsr[2], dimsr[2]; - - // Open the file and dataset. - file.openFile(FILE_NAME, H5F_ACC_RDONLY); - dataset = new DataSet(file.openDataSet( DATASETNAME)); - - // Get the dataset's dataspace and creation property list. - filespace = new DataSpace(dataset->getSpace()); - prop = dataset->getCreatePlist(); - - // Get information to obtain memory dataspace. - rank = filespace->getSimpleExtentNdims(); - herr_t status_n = filespace->getSimpleExtentDims(dimsr); - - if (H5D_CHUNKED == prop.getLayout()) - rank_chunk = prop.getChunk(rank, chunk_dimsr); - cout << "rank chunk = " << rank_chunk << endl;; - - memspace = new DataSpace(rank, dimsr, NULL); - dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace); + // Write data to dataset. + dataset->write(data, PredType::NATIVE_INT); + + // Extend the dataset. Dataset becomes 10 x 3. + size[0] = dims[0] + dimsext[0]; + size[1] = dims[1]; + dataset->extend(size); + + // Select a hyperslab in extended portion of the dataset. + DataSpace *filespace = new DataSpace(dataset->getSpace ()); + offset[0] = 3; + offset[1] = 0; + filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset); + + // Define memory space. + DataSpace *memspace = new DataSpace(2, dimsext, NULL); + + // Write data to the extended portion of the dataset. + dataset->write(dataext, PredType::NATIVE_INT, *memspace, *filespace); + + // Close all objects and file. + prop.close(); + delete filespace; + delete memspace; + delete dataspace; + delete dataset; + file.close(); + + // --------------------------------------- + // Re-open the file and read the data back + // --------------------------------------- + + int rdata[10][3]; + int i,j, rank, rank_chunk; + hsize_t chunk_dimsr[2], dimsr[2]; + + // Open the file and dataset. + file.openFile(FILE_NAME, H5F_ACC_RDONLY); + dataset = new DataSet(file.openDataSet( DATASETNAME)); + + // Get the dataset's dataspace and creation property list. + filespace = new DataSpace(dataset->getSpace()); + prop = dataset->getCreatePlist(); + + // Get information to obtain memory dataspace. + rank = filespace->getSimpleExtentNdims(); + herr_t status_n = filespace->getSimpleExtentDims(dimsr); + + if (H5D_CHUNKED == prop.getLayout()) + rank_chunk = prop.getChunk(rank, chunk_dimsr); + cout << "rank chunk = " << rank_chunk << endl;; + + memspace = new DataSpace(rank, dimsr, NULL); + dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace); - cout << endl; - for (j = 0; j < dimsr[0]; j++) { - for (i = 0; i < dimsr[1]; i++) - cout << " " << rdata[j][i]; - cout << endl; - } - - // Close all objects and file. - prop.close(); - delete filespace; - delete memspace; - delete dataset; - file.close(); + cout << endl; + for (j = 0; j < dimsr[0]; j++) { + for (i = 0; i < dimsr[1]; i++) + cout << " " << rdata[j][i]; + cout << endl; + } + + // Close all objects and file. + prop.close(); + delete filespace; + delete memspace; + delete dataset; + file.close(); } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch(DataSpaceIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp index 4c9d49e..f17e6a5 100644 --- a/c++/examples/h5tutr_rdwt.cpp +++ b/c++/examples/h5tutr_rdwt.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * 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 COPYING file, which can be found at the root of the source code * @@ -21,10 +21,10 @@ #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME("h5tutr_dset.h5"); -const H5std_string DATASET_NAME("dset"); -const int DIM0 = 4; // dataset dimensions -const int DIM1 = 6; +const H5std_string FILE_NAME("h5tutr_dset.h5"); +const H5std_string DATASET_NAME("dset"); +const int DIM0 = 4; // dataset dimensions +const int DIM1 = 6; int main (void) { @@ -32,41 +32,41 @@ int main (void) // Data initialization. int i, j; - int data[DIM0][DIM1]; // buffer for data to write + int data[DIM0][DIM1]; // buffer for data to write for (j = 0; j < DIM0; j++) - for (i = 0; i < DIM1; i++) - data[j][i] = i * 6 + j + 1; + for (i = 0; i < DIM1; i++) + data[j][i] = i * 6 + j + 1; // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Open an existing file and dataset. - H5File file(FILE_NAME, H5F_ACC_RDWR); - DataSet dataset = file.openDataSet(DATASET_NAME); + // Open an existing file and dataset. + H5File file(FILE_NAME, H5F_ACC_RDWR); + DataSet dataset = file.openDataSet(DATASET_NAME); - // Write the data to the dataset using default memory space, file - // space, and transfer properties. - dataset.write(data, PredType::NATIVE_INT); + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset.write(data, PredType::NATIVE_INT); } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp index 14a9ced..0747880 100644 --- a/c++/examples/h5tutr_subset.cpp +++ b/c++/examples/h5tutr_subset.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * 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 COPYING file, which can be found at the root of the source code * @@ -24,13 +24,13 @@ using std::endl; #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME("h5tutr_subset.h5"); -const H5std_string DATASET_NAME("IntArray"); +const H5std_string FILE_NAME("h5tutr_subset.h5"); +const H5std_string DATASET_NAME("IntArray"); const int RANK = 2; -const int DIM0_SUB = 3; // subset dimensions +const int DIM0_SUB = 3; // subset dimensions const int DIM1_SUB = 4; -const int DIM0 = 8; // size of dataset +const int DIM0 = 8; // size of dataset const int DIM1 = 10; int main (void) @@ -41,134 +41,134 @@ int main (void) // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); - - // --------------------------------------------------- - // Create a new file using the default property lists. - // Then create a dataset and write data to it. - // Close the file and dataset. - // --------------------------------------------------- + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // --------------------------------------------------- + // Create a new file using the default property lists. + // Then create a dataset and write data to it. + // Close the file and dataset. + // --------------------------------------------------- - H5File file(FILE_NAME, H5F_ACC_TRUNC); + H5File file(FILE_NAME, H5F_ACC_TRUNC); - hsize_t dims[2]; - dims[0] = DIM0; - dims[1] = DIM1; - DataSpace dataspace = DataSpace (RANK, dims); + hsize_t dims[2]; + dims[0] = DIM0; + dims[1] = DIM1; + DataSpace dataspace = DataSpace (RANK, dims); - DataSet dataset(file.createDataSet( DATASET_NAME, - PredType::STD_I32BE, dataspace) ); + DataSet dataset(file.createDataSet( DATASET_NAME, + PredType::STD_I32BE, dataspace) ); - for (j = 0; j < DIM0; j++) { - for (i = 0; i < DIM1; i++) - if (i< (DIM1/2)) - data[j][i] = 1; - else - data[j][i] = 2; - } + for (j = 0; j < DIM0; j++) { + for (i = 0; i < DIM1; i++) + if (i< (DIM1/2)) + data[j][i] = 1; + else + data[j][i] = 2; + } - dataset.write(data, PredType::NATIVE_INT); + dataset.write(data, PredType::NATIVE_INT); - cout << endl << "Data Written to File:" << endl; - for (j = 0; j < DIM0; j++) { - for (i = 0; i < DIM1; i++) - cout << " " << data[j][i]; - cout << endl; - } + cout << endl << "Data Written to File:" << endl; + for (j = 0; j < DIM0; j++) { + for (i = 0; i < DIM1; i++) + cout << " " << data[j][i]; + cout << endl; + } - dataspace.close(); - dataset.close(); - file.close(); + dataspace.close(); + dataset.close(); + file.close(); - // --------------------------------------------------- - // Reopen the file and dataset and write a subset of - // values to the dataset. - // --------------------------------------------------- + // --------------------------------------------------- + // Reopen the file and dataset and write a subset of + // values to the dataset. + // --------------------------------------------------- - hsize_t offset[2], count[2], stride[2], block[2]; - hsize_t dimsm[2]; + hsize_t offset[2], count[2], stride[2], block[2]; + hsize_t dimsm[2]; - file.openFile(FILE_NAME, H5F_ACC_RDWR); - dataset = file.openDataSet(DATASET_NAME); + file.openFile(FILE_NAME, H5F_ACC_RDWR); + dataset = file.openDataSet(DATASET_NAME); - // Specify size and shape of subset to write. + // Specify size and shape of subset to write. - offset[0] = 1; - offset[1] = 2; + offset[0] = 1; + offset[1] = 2; - count[0] = DIM0_SUB; - count[1] = DIM1_SUB; + count[0] = DIM0_SUB; + count[1] = DIM1_SUB; - stride[0] = 1; - stride[1] = 1; + stride[0] = 1; + stride[1] = 1; - block[0] = 1; - block[1] = 1; + block[0] = 1; + block[1] = 1; - // Define Memory Dataspace. Get file dataspace and select - // a subset from the file dataspace. + // Define Memory Dataspace. Get file dataspace and select + // a subset from the file dataspace. - dimsm[0] = DIM0_SUB; - dimsm[1] = DIM1_SUB; + dimsm[0] = DIM0_SUB; + dimsm[1] = DIM1_SUB; - DataSpace memspace(RANK, dimsm, NULL); + DataSpace memspace(RANK, dimsm, NULL); - dataspace = dataset.getSpace(); - dataspace.selectHyperslab(H5S_SELECT_SET, count, offset, stride, block); + dataspace = dataset.getSpace(); + dataspace.selectHyperslab(H5S_SELECT_SET, count, offset, stride, block); - // Write a subset of data to the dataset, then read the - // entire dataset back from the file. + // Write a subset of data to the dataset, then read the + // entire dataset back from the file. - cout << endl << "Write subset to file specifying: " << endl; - cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl; - for (j = 0; j < DIM0_SUB; j++) { - for (i = 0; i < DIM1_SUB; i++) - sdata[j][i] = 5; - } - - dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace); - dataset.read(rdata, PredType::NATIVE_INT); + cout << endl << "Write subset to file specifying: " << endl; + cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl; + for (j = 0; j < DIM0_SUB; j++) { + for (i = 0; i < DIM1_SUB; i++) + sdata[j][i] = 5; + } + + dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace); + dataset.read(rdata, PredType::NATIVE_INT); - cout << endl << "Data in File after Subset is Written:" << endl; - for (i = 0; i < DIM0; i++) { - for (j = 0; j < DIM1; j++) - cout << " " << rdata[i][j]; - cout << endl; - } - cout << endl; - - // It is not necessary to close these objects because close() will - // be called when the object instances are going out of scope. - dataspace.close(); - memspace.close(); - dataset.close(); - file.close(); + cout << endl << "Data in File after Subset is Written:" << endl; + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) + cout << " " << rdata[i][j]; + cout << endl; + } + cout << endl; + + // It is not necessary to close these objects because close() will + // be called when the object instances are going out of scope. + dataspace.close(); + memspace.close(); + dataset.close(); + file.close(); } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch(DataSpaceIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp index 5a2f3bc..3df8191 100644 --- a/c++/examples/readdata.cpp +++ b/c++/examples/readdata.cpp @@ -31,9 +31,9 @@ using namespace H5; const H5std_string FILE_NAME( "SDS.h5" ); const H5std_string DATASET_NAME( "IntArray" ); -const int NX_SUB = 3; // hyperslab dimensions +const int NX_SUB = 3; // hyperslab dimensions const int NY_SUB = 4; -const int NX = 7; // output buffer dimensions +const int NX = 7; // output buffer dimensions const int NY = 7; const int NZ = 3; const int RANK_OUT = 3; @@ -49,8 +49,8 @@ int main (void) { for (i = 0; i < NY; i++) { - for (k = 0; k < NZ ; k++) - data_out[j][i][k] = 0; + for (k = 0; k < NZ ; k++) + data_out[j][i][k] = 0; } } @@ -81,19 +81,19 @@ int main (void) */ if( type_class == H5T_INTEGER ) { - cout << "Data set has INTEGER type" << endl; + cout << "Data set has INTEGER type" << endl; /* - * Get the integer datatype + * Get the integer datatype */ - IntType intype = dataset.getIntType(); + IntType intype = dataset.getIntType(); /* * Get order of datatype and print message if it's a little endian. */ - H5std_string order_string; + H5std_string order_string; H5T_order_t order = intype.getOrder( order_string ); - cout << order_string << endl; + cout << order_string << endl; /* * Get size of the data element stored in file and print it. @@ -119,15 +119,15 @@ int main (void) hsize_t dims_out[2]; int ndims = dataspace.getSimpleExtentDims( dims_out, NULL); cout << "rank " << rank << ", dimensions " << - (unsigned long)(dims_out[0]) << " x " << - (unsigned long)(dims_out[1]) << endl; + (unsigned long)(dims_out[0]) << " x " << + (unsigned long)(dims_out[1]) << endl; /* * Define hyperslab in the dataset; implicitly giving strike and * block NULL. */ - hsize_t offset[2]; // hyperslab offset in the file - hsize_t count[2]; // size of the hyperslab in the file + hsize_t offset[2]; // hyperslab offset in the file + hsize_t count[2]; // size of the hyperslab in the file offset[0] = 1; offset[1] = 2; count[0] = NX_SUB; @@ -146,8 +146,8 @@ int main (void) /* * Define memory hyperslab. */ - hsize_t offset_out[3]; // hyperslab offset in memory - hsize_t count_out[3]; // size of the hyperslab in memory + hsize_t offset_out[3]; // hyperslab offset in memory + hsize_t count_out[3]; // size of the hyperslab in memory offset_out[0] = 3; offset_out[1] = 0; offset_out[2] = 0; @@ -164,9 +164,9 @@ int main (void) for (j = 0; j < NX; j++) { - for (i = 0; i < NY; i++) - cout << data_out[j][i][0] << " "; - cout << endl; + for (i = 0; i < NY; i++) + cout << data_out[j][i][0] << " "; + cout << endl; } /* * 0 0 0 0 0 0 0 diff --git a/c++/examples/writedata.cpp b/c++/examples/writedata.cpp index f5c06cf..eada2ed 100644 --- a/c++/examples/writedata.cpp +++ b/c++/examples/writedata.cpp @@ -34,19 +34,19 @@ using namespace H5; const H5std_string FILE_NAME( "Select.h5" ); const H5std_string DATASET_NAME( "Matrix in file" ); -const int MSPACE1_RANK = 1; // Rank of the first dataset in memory +const int MSPACE1_RANK = 1; // Rank of the first dataset in memory const int MSPACE1_DIM = 50; // Dataset size in memory -const int MSPACE2_RANK = 1; // Rank of the second dataset in memory -const int MSPACE2_DIM = 4; // Dataset size in memory -const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file -const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is -const int FSPACE_DIM2 = 12; // stored in the file -const int MSPACE_RANK = 2; // Rank of the first dataset in memory -const int MSPACE_DIM1 = 8; // We will read dataset back from the file -const int MSPACE_DIM2 = 9; // to the dataset in memory with these - // dataspace parameters -const int NPOINTS = 4; // Number of points that will be selected - // and overwritten +const int MSPACE2_RANK = 1; // Rank of the second dataset in memory +const int MSPACE2_DIM = 4; // Dataset size in memory +const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file +const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is +const int FSPACE_DIM2 = 12; // stored in the file +const int MSPACE_RANK = 2; // Rank of the first dataset in memory +const int MSPACE_DIM1 = 8; // We will read dataset back from the file +const int MSPACE_DIM2 = 9; // to the dataset in memory with these + // dataspace parameters +const int NPOINTS = 4; // Number of points that will be selected + // and overwritten int main (void) { @@ -57,271 +57,271 @@ int main (void) */ try { - /* - * Turn off the auto-printing when failure occurs so that we can - * handle the errors appropriately - */ - Exception::dontPrint(); - - /* - * Create a file. - */ - H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC ); - - /* - * Create property list for a dataset and set up fill values. - */ - int fillvalue = 0; /* Fill value for the dataset */ - DSetCreatPropList plist; - plist.setFillValue(PredType::NATIVE_INT, &fillvalue); - - /* - * Create dataspace for the dataset in the file. - */ - hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk) - DataSpace fspace( FSPACE_RANK, fdim ); - - /* - * Create dataset and write it into the file. - */ - DataSet* dataset = new DataSet(file->createDataSet( - DATASET_NAME, PredType::NATIVE_INT, fspace, plist)); - - /* - * Select hyperslab for the dataset in the file, using 3x2 blocks, - * (4,3) stride and (2,4) count starting at the position (0,1). - */ - hsize_t start[2]; // Start of hyperslab - hsize_t stride[2]; // Stride of hyperslab - hsize_t count[2]; // Block count - hsize_t block[2]; // Block sizes - start[0] = 0; start[1] = 1; - stride[0] = 4; stride[1] = 3; - count[0] = 2; count[1] = 4; - block[0] = 3; block[1] = 2; - fspace.selectHyperslab( H5S_SELECT_SET, count, start, stride, block); - - /* - * Create dataspace for the first dataset. - */ - hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset - (in memory) */ - DataSpace mspace1( MSPACE1_RANK, dim1 ); - - /* - * Select hyperslab. - * We will use 48 elements of the vector buffer starting at the - * second element. Selected elements are 1 2 3 . . . 48 - */ - start[0] = 1; - stride[0] = 1; - count[0] = 48; - block[0] = 1; - mspace1.selectHyperslab( H5S_SELECT_SET, count, start, stride, block); - - /* - * Write selection from the vector buffer to the dataset in the file. - * - * File dataset should look like this: - * 0 1 2 0 3 4 0 5 6 0 7 8 - * 0 9 10 0 11 12 0 13 14 0 15 16 - * 0 17 18 0 19 20 0 21 22 0 23 24 - * 0 0 0 0 0 0 0 0 0 0 0 0 - * 0 25 26 0 27 28 0 29 30 0 31 32 - * 0 33 34 0 35 36 0 37 38 0 39 40 - * 0 41 42 0 43 44 0 45 46 0 47 48 - * 0 0 0 0 0 0 0 0 0 0 0 0 - */ - int vector[MSPACE1_DIM]; // vector buffer for dset - - /* - * Buffer initialization. - */ - vector[0] = vector[MSPACE1_DIM - 1] = -1; - for (i = 1; i < MSPACE1_DIM - 1; i++) - vector[i] = i; - - dataset->write( vector, PredType::NATIVE_INT, mspace1, fspace ); - - /* - * Reset the selection for the file dataspace fid. - */ - fspace.selectNone(); - - /* - * Create dataspace for the second dataset. - */ - hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset - (in memory */ - DataSpace mspace2( MSPACE2_RANK, dim2 ); - - /* - * Select sequence of NPOINTS points in the file dataspace. - */ - hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points - from the file dataspace */ - coord[0][0] = 0; coord[0][1] = 0; - coord[1][0] = 3; coord[1][1] = 3; - coord[2][0] = 3; coord[2][1] = 5; - coord[3][0] = 5; coord[3][1] = 6; - - fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord); - - /* - * Write new selection of points to the dataset. - */ - int values[] = {53, 59, 61, 67}; /* New values to be written */ - dataset->write( values, PredType::NATIVE_INT, mspace2, fspace ); - - /* - * File dataset should look like this: - * 53 1 2 0 3 4 0 5 6 0 7 8 - * 0 9 10 0 11 12 0 13 14 0 15 16 - * 0 17 18 0 19 20 0 21 22 0 23 24 - * 0 0 0 59 0 61 0 0 0 0 0 0 - * 0 25 26 0 27 28 0 29 30 0 31 32 - * 0 33 34 0 35 36 67 37 38 0 39 40 - * 0 41 42 0 43 44 0 45 46 0 47 48 - * 0 0 0 0 0 0 0 0 0 0 0 0 - * - */ - - /* - * Close the dataset and the file. - */ - delete dataset; - delete file; - - /* - * Open the file. - */ - file = new H5File( FILE_NAME, H5F_ACC_RDONLY ); - - /* - * Open the dataset. - */ - dataset = new DataSet( file->openDataSet( DATASET_NAME )); - - /* - * Get dataspace of the dataset. - */ - fspace = dataset->getSpace(); - - /* - * Select first hyperslab for the dataset in the file. The following - * elements are selected: - * 10 0 11 12 - * 18 0 19 20 - * 0 59 0 61 - * - */ - start[0] = 1; start[1] = 2; - block[0] = 1; block[1] = 1; - stride[0] = 1; stride[1] = 1; - count[0] = 3; count[1] = 4; - fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); - - /* - * Add second selected hyperslab to the selection. - * The following elements are selected: - * 19 20 0 21 22 - * 0 61 0 0 0 - * 27 28 0 29 30 - * 35 36 67 37 38 - * 43 44 0 45 46 - * 0 0 0 0 0 - * Note that two hyperslabs overlap. Common elements are: - * 19 20 - * 0 61 - */ - start[0] = 2; start[1] = 4; - block[0] = 1; block[1] = 1; - stride[0] = 1; stride[1] = 1; - count[0] = 6; count[1] = 5; - fspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block); - - /* - * Create memory dataspace. - */ - hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the + /* + * Turn off the auto-printing when failure occurs so that we can + * handle the errors appropriately + */ + Exception::dontPrint(); + + /* + * Create a file. + */ + H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC ); + + /* + * Create property list for a dataset and set up fill values. + */ + int fillvalue = 0; /* Fill value for the dataset */ + DSetCreatPropList plist; + plist.setFillValue(PredType::NATIVE_INT, &fillvalue); + + /* + * Create dataspace for the dataset in the file. + */ + hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk) + DataSpace fspace( FSPACE_RANK, fdim ); + + /* + * Create dataset and write it into the file. + */ + DataSet* dataset = new DataSet(file->createDataSet( + DATASET_NAME, PredType::NATIVE_INT, fspace, plist)); + + /* + * Select hyperslab for the dataset in the file, using 3x2 blocks, + * (4,3) stride and (2,4) count starting at the position (0,1). + */ + hsize_t start[2]; // Start of hyperslab + hsize_t stride[2]; // Stride of hyperslab + hsize_t count[2]; // Block count + hsize_t block[2]; // Block sizes + start[0] = 0; start[1] = 1; + stride[0] = 4; stride[1] = 3; + count[0] = 2; count[1] = 4; + block[0] = 3; block[1] = 2; + fspace.selectHyperslab( H5S_SELECT_SET, count, start, stride, block); + + /* + * Create dataspace for the first dataset. + */ + hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset + (in memory) */ + DataSpace mspace1( MSPACE1_RANK, dim1 ); + + /* + * Select hyperslab. + * We will use 48 elements of the vector buffer starting at the + * second element. Selected elements are 1 2 3 . . . 48 + */ + start[0] = 1; + stride[0] = 1; + count[0] = 48; + block[0] = 1; + mspace1.selectHyperslab( H5S_SELECT_SET, count, start, stride, block); + + /* + * Write selection from the vector buffer to the dataset in the file. + * + * File dataset should look like this: + * 0 1 2 0 3 4 0 5 6 0 7 8 + * 0 9 10 0 11 12 0 13 14 0 15 16 + * 0 17 18 0 19 20 0 21 22 0 23 24 + * 0 0 0 0 0 0 0 0 0 0 0 0 + * 0 25 26 0 27 28 0 29 30 0 31 32 + * 0 33 34 0 35 36 0 37 38 0 39 40 + * 0 41 42 0 43 44 0 45 46 0 47 48 + * 0 0 0 0 0 0 0 0 0 0 0 0 + */ + int vector[MSPACE1_DIM]; // vector buffer for dset + + /* + * Buffer initialization. + */ + vector[0] = vector[MSPACE1_DIM - 1] = -1; + for (i = 1; i < MSPACE1_DIM - 1; i++) + vector[i] = i; + + dataset->write( vector, PredType::NATIVE_INT, mspace1, fspace ); + + /* + * Reset the selection for the file dataspace fid. + */ + fspace.selectNone(); + + /* + * Create dataspace for the second dataset. + */ + hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset + (in memory */ + DataSpace mspace2( MSPACE2_RANK, dim2 ); + + /* + * Select sequence of NPOINTS points in the file dataspace. + */ + hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points + from the file dataspace */ + coord[0][0] = 0; coord[0][1] = 0; + coord[1][0] = 3; coord[1][1] = 3; + coord[2][0] = 3; coord[2][1] = 5; + coord[3][0] = 5; coord[3][1] = 6; + + fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord); + + /* + * Write new selection of points to the dataset. + */ + int values[] = {53, 59, 61, 67}; /* New values to be written */ + dataset->write( values, PredType::NATIVE_INT, mspace2, fspace ); + + /* + * File dataset should look like this: + * 53 1 2 0 3 4 0 5 6 0 7 8 + * 0 9 10 0 11 12 0 13 14 0 15 16 + * 0 17 18 0 19 20 0 21 22 0 23 24 + * 0 0 0 59 0 61 0 0 0 0 0 0 + * 0 25 26 0 27 28 0 29 30 0 31 32 + * 0 33 34 0 35 36 67 37 38 0 39 40 + * 0 41 42 0 43 44 0 45 46 0 47 48 + * 0 0 0 0 0 0 0 0 0 0 0 0 + * + */ + + /* + * Close the dataset and the file. + */ + delete dataset; + delete file; + + /* + * Open the file. + */ + file = new H5File( FILE_NAME, H5F_ACC_RDONLY ); + + /* + * Open the dataset. + */ + dataset = new DataSet( file->openDataSet( DATASET_NAME )); + + /* + * Get dataspace of the dataset. + */ + fspace = dataset->getSpace(); + + /* + * Select first hyperslab for the dataset in the file. The following + * elements are selected: + * 10 0 11 12 + * 18 0 19 20 + * 0 59 0 61 + * + */ + start[0] = 1; start[1] = 2; + block[0] = 1; block[1] = 1; + stride[0] = 1; stride[1] = 1; + count[0] = 3; count[1] = 4; + fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); + + /* + * Add second selected hyperslab to the selection. + * The following elements are selected: + * 19 20 0 21 22 + * 0 61 0 0 0 + * 27 28 0 29 30 + * 35 36 67 37 38 + * 43 44 0 45 46 + * 0 0 0 0 0 + * Note that two hyperslabs overlap. Common elements are: + * 19 20 + * 0 61 + */ + start[0] = 2; start[1] = 4; + block[0] = 1; block[1] = 1; + stride[0] = 1; stride[1] = 1; + count[0] = 6; count[1] = 5; + fspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block); + + /* + * Create memory dataspace. + */ + hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the dataset in memory when we read selection from the dataset on the disk */ - DataSpace mspace(MSPACE_RANK, mdim); - - /* - * Select two hyperslabs in memory. Hyperslabs has the same - * size and shape as the selected hyperslabs for the file dataspace. - */ - start[0] = 0; start[1] = 0; - block[0] = 1; block[1] = 1; - stride[0] = 1; stride[1] = 1; - count[0] = 3; count[1] = 4; - mspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); - start[0] = 1; start[1] = 2; - block[0] = 1; block[1] = 1; - stride[0] = 1; stride[1] = 1; - count[0] = 6; count[1] = 5; - mspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block); - - /* - * Initialize data buffer. - */ - int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; - for (i = 0; i < MSPACE_DIM1; i++) - for (j = 0; j < MSPACE_DIM2; j++) - matrix_out[i][j] = 0; - - /* - * Read data back to the buffer matrix. - */ - dataset->read(matrix_out, PredType::NATIVE_INT, mspace, fspace); - - /* - * Display the result. Memory dataset is: - * - * 10 0 11 12 0 0 0 0 0 - * 18 0 19 20 0 21 22 0 0 - * 0 59 0 61 0 0 0 0 0 - * 0 0 27 28 0 29 30 0 0 - * 0 0 35 36 67 37 38 0 0 - * 0 0 43 44 0 45 46 0 0 - * 0 0 0 0 0 0 0 0 0 - * 0 0 0 0 0 0 0 0 0 - */ - for (i=0; i < MSPACE_DIM1; i++) - { - for(j=0; j < MSPACE_DIM2; j++) - cout << matrix_out[i][j] << " "; - cout << endl; - } - - /* - * Close the dataset and the file. - */ - delete dataset; - delete file; + DataSpace mspace(MSPACE_RANK, mdim); + + /* + * Select two hyperslabs in memory. Hyperslabs has the same + * size and shape as the selected hyperslabs for the file dataspace. + */ + start[0] = 0; start[1] = 0; + block[0] = 1; block[1] = 1; + stride[0] = 1; stride[1] = 1; + count[0] = 3; count[1] = 4; + mspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); + start[0] = 1; start[1] = 2; + block[0] = 1; block[1] = 1; + stride[0] = 1; stride[1] = 1; + count[0] = 6; count[1] = 5; + mspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block); + + /* + * Initialize data buffer. + */ + int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; + for (i = 0; i < MSPACE_DIM1; i++) + for (j = 0; j < MSPACE_DIM2; j++) + matrix_out[i][j] = 0; + + /* + * Read data back to the buffer matrix. + */ + dataset->read(matrix_out, PredType::NATIVE_INT, mspace, fspace); + + /* + * Display the result. Memory dataset is: + * + * 10 0 11 12 0 0 0 0 0 + * 18 0 19 20 0 21 22 0 0 + * 0 59 0 61 0 0 0 0 0 + * 0 0 27 28 0 29 30 0 0 + * 0 0 35 36 67 37 38 0 0 + * 0 0 43 44 0 45 46 0 0 + * 0 0 0 0 0 0 0 0 0 + * 0 0 0 0 0 0 0 0 0 + */ + for (i=0; i < MSPACE_DIM1; i++) + { + for(j=0; j < MSPACE_DIM2; j++) + cout << matrix_out[i][j] << " "; + cout << endl; + } + + /* + * Close the dataset and the file. + */ + delete dataset; + delete file; } // end of try block // catch failure caused by the H5File operations catch( FileIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch( DataSetIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch( DataSpaceIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; -- cgit v0.12 From 8cddc96f73e8f90f67792405f5142b419e9061d7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 19 Sep 2019 13:42:46 -0500 Subject: Change unused variable to generic form --- java/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 528b24f..56e1695 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -16,7 +16,7 @@ message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") if (WIN32) - set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre8") + set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre") else () set (HDF_JRE_DIRECTORY "/usr/lib/jvm/jre") endif () -- cgit v0.12 From a6930a2bcfd37ea3610baafb608faec883286315 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 19 Sep 2019 13:50:49 -0700 Subject: Renamed get/set_time() calls in the tools library to avoid name clash when building static parallel HDF5 w/ static linking to OpenMPI. --- tools/lib/io_timer.c | 13 ++++++++----- tools/lib/io_timer.h | 4 ++-- tools/test/perform/pio_engine.c | 40 ++++++++++++++++++++-------------------- tools/test/perform/pio_perf.c | 24 ++++++++++++------------ tools/test/perform/sio_engine.c | 24 ++++++++++++------------ tools/test/perform/sio_perf.c | 16 ++++++++-------- 6 files changed, 62 insertions(+), 59 deletions(-) diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index a6885df..cb89019 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -123,17 +123,17 @@ get_timer_type(io_time_t *pt) #endif /* - * Function: set_time + * Function: io_time_set * Purpose: Set the time in a ``io_time_t'' object. * Return: Pointer to the passed in ``io_time_t'' object if SUCCEED; Null otherwise. * Programmer: Bill Wendling, 01. October 2001 * Modifications: */ io_time_t * -set_time(io_time_t *pt, timer_type t, int start_stop) +io_time_set(io_time_t *pt, timer_type t, int start_stop) { /* sanity check */ - assert(pt); + HDassert(pt); switch(pt->type){ #ifdef H5_HAVE_PARALLEL @@ -207,15 +207,18 @@ set_time(io_time_t *pt, timer_type t, int start_stop) } /* - * Function: get_time + * Function: io_time_get * Purpose: Get the time from a ``io_time_t'' object. * Return: The number of seconds as a DOUBLE. * Programmer: Bill Wendling, 01. October 2001 * Modifications: */ H5_ATTR_PURE double -get_time(io_time_t *pt, timer_type t) +io_time_get(io_time_t *pt, timer_type t) { + /* sanity check */ + HDassert(pt); + return pt->total_time[t]; } diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h index 48b6c87..78bf676 100644 --- a/tools/lib/io_timer.h +++ b/tools/lib/io_timer.h @@ -72,8 +72,8 @@ extern "C" { #endif /* __cplusplus */ H5TOOLS_DLL io_time_t *io_time_new(clock_type t); H5TOOLS_DLL void io_time_destroy(io_time_t *pt); -H5TOOLS_DLL io_time_t *set_time(io_time_t *pt, timer_type t, int start_stop); -H5TOOLS_DLL double get_time(io_time_t *pt, timer_type t); +H5TOOLS_DLL io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop); +H5TOOLS_DLL double io_time_get(io_time_t *pt, timer_type t); #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index 798e32e..77c04ab 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -311,21 +311,21 @@ do_pio(parameters param) /* Need barrier to make sure everyone starts at the same time */ MPI_Barrier(pio_comm_g); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); + io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, PIO_CREATE | PIO_WRITE); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); + io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); hrc = do_write(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_write failed"); /* Close file for write */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); if (!param.h5_write_only) { @@ -339,20 +339,20 @@ do_pio(parameters param) MPI_Barrier(pio_comm_g); /* Open file for read */ - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); + io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, PIO_READ); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); + io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); hrc = do_read(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); + io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_read failed"); /* Close file for read */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); + io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); } @@ -958,7 +958,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end else */ /* Start "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); while (nbytes_xfer < bytes_count){ /* Write */ @@ -1389,7 +1389,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end while */ /* Stop "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); /* Calculate write time */ @@ -1889,7 +1889,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end else */ /* Start "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); while (nbytes_xfer < bytes_count){ /* Read */ @@ -2344,7 +2344,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end while */ /* Stop "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); /* Calculate read time */ @@ -2639,9 +2639,9 @@ int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_READ, TSTART); + io_time_set(timer_g, HDF5_MPI_READ, TSTART); err=PMPI_File_read_at(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_READ, TSTOP); + io_time_set(timer_g, HDF5_MPI_READ, TSTOP); return err; } @@ -2650,9 +2650,9 @@ int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_READ, TSTART); + io_time_set(timer_g, HDF5_MPI_READ, TSTART); err=PMPI_File_read_at_all(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_READ, TSTOP); + io_time_set(timer_g, HDF5_MPI_READ, TSTOP); return err; } @@ -2660,9 +2660,9 @@ int MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_WRITE, TSTART); + io_time_set(timer_g, HDF5_MPI_WRITE, TSTART); err=PMPI_File_write_at(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_WRITE, TSTOP); + io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP); return err; } @@ -2670,9 +2670,9 @@ int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_WRITE, TSTART); + io_time_set(timer_g, HDF5_MPI_WRITE, TSTART); err=PMPI_File_write_at_all(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_WRITE, TSTOP); + io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP); return err; } diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index 93741c4..9f4d116 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -587,74 +587,74 @@ run_test(iotype iot, parameters parms, struct options *opts) res = do_pio(parms); /* gather all of the "mpi write" times */ - t = get_time(res.timers, HDF5_MPI_WRITE); + t = io_time_get(res.timers, HDF5_MPI_WRITE); get_minmax(&write_mpi_mm, t); write_mpi_mm_table[i] = write_mpi_mm; /* gather all of the "write" times */ - t = get_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); get_minmax(&write_mm, t); write_mm_table[i] = write_mm; /* gather all of the "write" times from open to close */ - t = get_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); get_minmax(&write_gross_mm, t); write_gross_mm_table[i] = write_gross_mm; /* gather all of the raw "write" times */ - t = get_time(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); get_minmax(&write_raw_mm, t); write_raw_mm_table[i] = write_raw_mm; /* gather all of the file open times (time from open to first write) */ - t = get_time(res.timers, HDF5_FILE_WRITE_OPEN); + t = io_time_get(res.timers, HDF5_FILE_WRITE_OPEN); get_minmax(&write_open_mm, t); write_open_mm_table[i] = write_open_mm; /* gather all of the file close times (time from last write to close) */ - t = get_time(res.timers, HDF5_FILE_WRITE_CLOSE); + t = io_time_get(res.timers, HDF5_FILE_WRITE_CLOSE); get_minmax(&write_close_mm, t); write_close_mm_table[i] = write_close_mm; if (!parms.h5_write_only) { /* gather all of the "mpi read" times */ - t = get_time(res.timers, HDF5_MPI_READ); + t = io_time_get(res.timers, HDF5_MPI_READ); get_minmax(&read_mpi_mm, t); read_mpi_mm_table[i] = read_mpi_mm; /* gather all of the "read" times */ - t = get_time(res.timers, HDF5_FINE_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_FINE_READ_FIXED_DIMS); get_minmax(&read_mm, t); read_mm_table[i] = read_mm; /* gather all of the "read" times from open to close */ - t = get_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_GROSS_READ_FIXED_DIMS); get_minmax(&read_gross_mm, t); read_gross_mm_table[i] = read_gross_mm; /* gather all of the raw "read" times */ - t = get_time(res.timers, HDF5_RAW_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_RAW_READ_FIXED_DIMS); get_minmax(&read_raw_mm, t); read_raw_mm_table[i] = read_raw_mm; /* gather all of the file open times (time from open to first read) */ - t = get_time(res.timers, HDF5_FILE_READ_OPEN); + t = io_time_get(res.timers, HDF5_FILE_READ_OPEN); get_minmax(&read_open_mm, t); read_open_mm_table[i] = read_open_mm; /* gather all of the file close times (time from last read to close) */ - t = get_time(res.timers, HDF5_FILE_READ_CLOSE); + t = io_time_get(res.timers, HDF5_FILE_READ_CLOSE); get_minmax(&read_close_mm, t); read_close_mm_table[i] = read_close_mm; diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index 488f575..07a39cb 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -212,18 +212,18 @@ do_sio(parameters param, results *res) HDfprintf(output, "data filename=%s\n", fname); - set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, SIO_CREATE | SIO_WRITE); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); hrc = do_write(res, &fd, ¶m, buffer); - set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_write failed"); /* Close file for write */ hrc = do_fclose(iot, &fd); - set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); if (!param.h5_write_only) { @@ -232,19 +232,19 @@ do_sio(parameters param, results *res) */ /* Open file for read */ - set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, SIO_READ); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); hrc = do_read(res, &fd, ¶m, buffer); - set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_read failed"); /* Close file for read */ hrc = do_fclose(iot, &fd); - set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); } @@ -550,7 +550,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) } /* Start "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); /* Perform write */ hrc = dset_write(rank-1, fd, parms, buffer); @@ -562,7 +562,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) /* Stop "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); /* Calculate write time */ @@ -872,7 +872,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) } /* end switch */ /* Start "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); hrc = dset_read(rank-1, fd, parms, buffer, buffer2); if (hrc < 0) { @@ -881,7 +881,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) } /* Stop "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); /* Calculate read time */ diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index ff9e2b4..cbb9049 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -498,50 +498,50 @@ run_test(iotype iot, parameters parms, struct options *opts) do_sio(parms, &res); /* gather all of the "sys write" times */ - t = get_time(res.timers, HDF5_MPI_WRITE); + t = io_time_get(res.timers, HDF5_MPI_WRITE); get_minmax(&write_sys_mm, t); write_sys_mm_table[i] = write_sys_mm; /* gather all of the "write" times */ - t = get_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); get_minmax(&write_mm, t); write_mm_table[i] = write_mm; /* gather all of the "write" times from open to close */ - t = get_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); get_minmax(&write_gross_mm, t); write_gross_mm_table[i] = write_gross_mm; /* gather all of the raw "write" times */ - t = get_time(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); get_minmax(&write_raw_mm, t); write_raw_mm_table[i] = write_raw_mm; if (!parms.h5_write_only) { /* gather all of the "mpi read" times */ - t = get_time(res.timers, HDF5_MPI_READ); + t = io_time_get(res.timers, HDF5_MPI_READ); get_minmax(&read_sys_mm, t); read_sys_mm_table[i] = read_sys_mm; /* gather all of the "read" times */ - t = get_time(res.timers, HDF5_FINE_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_FINE_READ_FIXED_DIMS); get_minmax(&read_mm, t); read_mm_table[i] = read_mm; /* gather all of the "read" times from open to close */ - t = get_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_GROSS_READ_FIXED_DIMS); get_minmax(&read_gross_mm, t); read_gross_mm_table[i] = read_gross_mm; /* gather all of the raw "read" times */ - t = get_time(res.timers, HDF5_RAW_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_RAW_READ_FIXED_DIMS); get_minmax(&read_raw_mm, t); read_raw_mm_table[i] = read_gross_mm; -- cgit v0.12 From aa8c7b31d7cd91ce313268c53c3340db167ab5b0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 19 Sep 2019 16:32:40 -0500 Subject: small syntax changes --- java/examples/datasets/CMakeLists.txt | 4 +++- java/examples/datatypes/CMakeLists.txt | 4 +++- java/examples/groups/CMakeLists.txt | 15 +++++++++++---- java/examples/intro/CMakeLists.txt | 16 +++------------- java/test/TestH5.java | 2 +- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index c64e02e..8849524 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -112,6 +112,8 @@ if (BUILD_TESTING) -D "TEST_REFERENCE=datasets/${example}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - set_tests_properties (JAVA_datasets-${example} PROPERTIES DEPENDS JAVA_datasets-${example}-copy-objects) + set_tests_properties (JAVA_datasets-${example} PROPERTIES + DEPENDS JAVA_datasets-${example}-copy-objects + ) endforeach () endif () diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 70648e4..b83da0e 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -87,6 +87,8 @@ if (BUILD_TESTING) -D "TEST_REFERENCE=datatypes/${example}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - set_tests_properties (JAVA_datatypes-${example} PROPERTIES DEPENDS JAVA_datatypes-${example}-copy-objects) + set_tests_properties (JAVA_datatypes-${example} PROPERTIES + DEPENDS JAVA_datatypes-${example}-copy-objects + ) endforeach () endif () diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index e1ad108..9e43087 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -63,17 +63,22 @@ if (BUILD_TESTING) if (NOT example STREQUAL "H5Ex_G_Iterate" AND NOT example STREQUAL "H5Ex_G_Visit") if (example STREQUAL "H5Ex_G_Compact") add_test ( - NAME JAVA_groups-${example}-clear-h5s + NAME JAVA_groups-${example}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}1.h5 ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}2.h5 ) else () add_test ( - NAME JAVA_groups-${example}-clear-h5s + NAME JAVA_groups-${example}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) endif () + else () + add_test ( + NAME JAVA_groups-${example}-clear-objects + COMMAND ${CMAKE_COMMAND} -E echo "${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 exists" + ) endif () add_test ( @@ -82,7 +87,7 @@ if (BUILD_TESTING) ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.groups.${example}.txt ${HDFJAVA_EXAMPLES_GROUPS_BINARY_DIR}/${example}.txt ) - set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS JAVA_groups-${example}-clear-h5s) + set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS JAVA_groups-${example}-clear-objects) add_test ( NAME JAVA_groups-${example} COMMAND "${CMAKE_COMMAND}" @@ -97,6 +102,8 @@ if (BUILD_TESTING) -D "TEST_REFERENCE=groups/${example}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - set_tests_properties (JAVA_groups-${example} PROPERTIES DEPENDS JAVA_groups-${example}-copy-objects) + set_tests_properties (JAVA_groups-${example} PROPERTIES + DEPENDS JAVA_groups-${example}-copy-objects + ) endforeach () endif () diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index e60af88..b56e3ad 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -45,18 +45,6 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") endforeach () -foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) - file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt - "Main-Class: examples.intro.${example} -" - ) - add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) - get_target_property (${example}_JAR_FILE ${example} JAR_FILE) -# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) - get_target_property (${example}_CLASSPATH ${example} CLASSDIR) - add_dependencies (${example} ${HDFJAVA_H5_LIB_TARGET}) -endforeach () - if (BUILD_TESTING) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") @@ -89,7 +77,9 @@ if (BUILD_TESTING) -D "TEST_REFERENCE=intro/${example}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - set_tests_properties (JAVA_intro-${example} PROPERTIES DEPENDS JAVA_intro-${example}-copy-objects) + set_tests_properties (JAVA_intro-${example} PROPERTIES + DEPENDS JAVA_intro-${example}-copy-objects + ) endforeach () endif () diff --git a/java/test/TestH5.java b/java/test/TestH5.java index d63ef01..10c7c8f 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -81,7 +81,7 @@ public class TestH5 { int j2cValues[] = { HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5F_ACC_EXCL, H5F_ACC_DEBUG, + HDF5Constants.H5F_ACC_EXCL, HDF5Constants.H5F_ACC_DEBUG, HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE, HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, -- cgit v0.12 From cf9eff93e05c9e68d82ebb1fc1e02319e428af35 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 20 Sep 2019 09:30:36 -0500 Subject: Remove obsolete symbol --- java/test/TestH5.java | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 10c7c8f..1dbcce3 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -54,8 +54,8 @@ public class TestH5 { /** * Test method for {@link hdf.hdf5lib.H5#J2C(int)}. * NOTE: - * H5F_ACC_DEBUG no longer prints any special debug info. The symbol is - * being retained and will be listed as deprecated in HDF5 1.10.0. + * H5F_ACC_DEBUG no longer prints any special debug info. Even though the symbol is + * being retained hdf java does not access the symbol. */ @Test public void testJ2C() { @@ -63,7 +63,6 @@ public class TestH5 { int H5F_ACC_RDWR = 0x0001; int H5F_ACC_TRUNC = 0x0002; int H5F_ACC_EXCL = 0x0004; - int H5F_ACC_DEBUG = 0x0000; // HDFFV-1074 was 0x0008; int H5F_ACC_CREAT = 0x0010; int H5F_OBJ_FILE = 0x0001; int H5F_OBJ_DATASET = 0x0002; @@ -75,13 +74,13 @@ public class TestH5 { int H5F_OBJ_LOCAL = 0x0020; int definedValues[] = { H5F_ACC_RDONLY, H5F_ACC_RDWR, H5F_ACC_TRUNC, - H5F_ACC_EXCL, H5F_ACC_DEBUG, H5F_ACC_CREAT, H5F_OBJ_FILE, + H5F_ACC_EXCL, H5F_ACC_CREAT, H5F_OBJ_FILE, H5F_OBJ_DATASET, H5F_OBJ_GROUP, H5F_OBJ_DATATYPE, H5F_OBJ_ATTR, H5F_OBJ_ALL, H5F_OBJ_LOCAL }; int j2cValues[] = { HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5F_ACC_EXCL, HDF5Constants.H5F_ACC_DEBUG, + HDF5Constants.H5F_ACC_EXCL, HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE, HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, @@ -177,7 +176,7 @@ public class TestH5 { for (int i = 0; i < 2; i++) assertFalse(libversion[i] == 0); } - + /** * Test method for {@link hdf.hdf5lib.H5#H5get_libversion(int[])} * to ensure a null libversion parameter causes the function to @@ -185,14 +184,14 @@ public class TestH5 { */ @Test public void testH5get_libversion_null_param() { - try { - H5.H5get_libversion(null); - } - catch (Throwable err) { - return; - } - - fail("H5.H5get_libversion: succeeded with a null libversion parameter!"); + try { + H5.H5get_libversion(null); + } + catch (Throwable err) { + return; + } + + fail("H5.H5get_libversion: succeeded with a null libversion parameter!"); } /** -- cgit v0.12 From aa797af31b41773281ee55dab47cca278244f933 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Mon, 23 Sep 2019 16:21:37 -0500 Subject: Refactor h5repackgentest to have more modular internals, for easier addition of new tests. Update manifest and test script for new hdf5 external-storage .h5 files. --- MANIFEST | 20 +- tools/test/h5repack/h5repack.sh.in | 24 +- tools/test/h5repack/h5repackgentest.c | 355 ++++++++++++++------- tools/test/h5repack/testfiles/h5repack_f32le.h5 | Bin 0 -> 2336 bytes .../h5repack/testfiles/h5repack_f32le_ex-0.dat | Bin 0 -> 288 bytes tools/test/h5repack/testfiles/h5repack_f32le_ex.h5 | Bin 0 -> 1464 bytes tools/test/h5repack/testfiles/h5repack_int32le.h5 | Bin 4096 -> 0 bytes .../test/h5repack/testfiles/h5repack_int32le_1d.h5 | Bin 0 -> 2096 bytes .../testfiles/h5repack_int32le_1d_ex-0.dat | 1 + .../testfiles/h5repack_int32le_1d_ex-1.dat | Bin 0 -> 24 bytes .../h5repack/testfiles/h5repack_int32le_1d_ex.h5 | Bin 0 -> 1504 bytes .../test/h5repack/testfiles/h5repack_int32le_2d.h5 | Bin 0 -> 2304 bytes .../testfiles/h5repack_int32le_2d_ex-0.dat | Bin 0 -> 256 bytes .../h5repack/testfiles/h5repack_int32le_2d_ex.h5 | Bin 0 -> 1472 bytes .../test/h5repack/testfiles/h5repack_int32le_3d.h5 | Bin 0 -> 4096 bytes .../testfiles/h5repack_int32le_3d_ex-0.dat | Bin 0 -> 2048 bytes .../h5repack/testfiles/h5repack_int32le_3d_ex.h5 | Bin 0 -> 1472 bytes .../h5repack/testfiles/h5repack_int32le_ex-0.dat | Bin 2048 -> 0 bytes .../test/h5repack/testfiles/h5repack_int32le_ex.h5 | Bin 1472 -> 0 bytes tools/test/h5repack/testfiles/h5repack_uint8be.h5 | Bin 2560 -> 2304 bytes .../h5repack/testfiles/h5repack_uint8be_ex-4.dat | Bin 64 -> 0 bytes .../h5repack/testfiles/h5repack_uint8be_ex-5.dat | Bin 64 -> 0 bytes .../h5repack/testfiles/h5repack_uint8be_ex-6.dat | Bin 64 -> 0 bytes .../h5repack/testfiles/h5repack_uint8be_ex-7.dat | Bin 64 -> 0 bytes .../test/h5repack/testfiles/h5repack_uint8be_ex.h5 | Bin 1912 -> 1608 bytes 25 files changed, 262 insertions(+), 138 deletions(-) create mode 100644 tools/test/h5repack/testfiles/h5repack_f32le.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_f32le_ex-0.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_f32le_ex.h5 delete mode 100644 tools/test/h5repack/testfiles/h5repack_int32le.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_1d.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-0.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-1.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_1d_ex.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_2d.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_2d_ex-0.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_2d_ex.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_3d.h5 create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_3d_ex-0.dat create mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_3d_ex.h5 delete mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_ex-0.dat delete mode 100644 tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 delete mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat delete mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat delete mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat delete mode 100644 tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat diff --git a/MANIFEST b/MANIFEST index 98ca487..df29b8f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2552,16 +2552,26 @@ ./tools/test/h5repack/testfiles/h5repack_early.h5 ./tools/test/h5repack/testfiles/h5repack_ext.bin ./tools/test/h5repack/testfiles/h5repack_ext.h5 +./tools/test/h5repack/testfiles/h5repack_f32le.h5 +./tools/test/h5repack/testfiles/h5repack_f32le_ex-0.dat +./tools/test/h5repack/testfiles/h5repack_f32le_ex.h5 ./tools/test/h5repack/testfiles/h5repack_fill.h5 ./tools/test/h5repack/testfiles/h5repack_filters.h5 ./tools/test/h5repack/testfiles/h5repack_fletcher.h5 ./tools/test/h5repack/testfiles/h5repack_fsm_aggr_nopersist.h5 ./tools/test/h5repack/testfiles/h5repack_fsm_aggr_persist.h5 ./tools/test/h5repack/testfiles/h5repack_hlink.h5 +./tools/test/h5repack/testfiles/h5repack_int32le_1d.h5 +./tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-0.dat +./tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-1.dat +./tools/test/h5repack/testfiles/h5repack_int32le_1d_ex.h5 +./tools/test/h5repack/testfiles/h5repack_int32le_2d.h5 +./tools/test/h5repack/testfiles/h5repack_int32le_2d_ex-0.dat +./tools/test/h5repack/testfiles/h5repack_int32le_2d_ex.h5 +./tools/test/h5repack/testfiles/h5repack_int32le_3d.h5 +./tools/test/h5repack/testfiles/h5repack_int32le_3d_ex-0.dat +./tools/test/h5repack/testfiles/h5repack_int32le_3d_ex.h5 ./tools/test/h5repack/testfiles/h5repack.info -./tools/test/h5repack/testfiles/h5repack_int32le.h5 -./tools/test/h5repack/testfiles/h5repack_int32le_ex-0.dat -./tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 ./tools/test/h5repack/testfiles/h5repack_layout.h5 ./tools/test/h5repack/testfiles/h5repack_layouto.h5 ./tools/test/h5repack/testfiles/h5repack_layout2.h5 @@ -2584,10 +2594,6 @@ ./tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat ./tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat ./tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat -./tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat -./tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat -./tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat -./tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat ./tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 ./tools/test/h5repack/testfiles/ublock.bin ./tools/test/h5repack/testfiles/crtorder.tordergr.h5.ddl diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 1af4fd0..1232b33 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -115,8 +115,14 @@ $SRC_H5REPACK_TESTFILES/h5repack_fsm_aggr_persist.h5 $SRC_H5REPACK_TESTFILES/h5repack_none.h5 $SRC_H5REPACK_TESTFILES/h5repack_paged_nopersist.h5 $SRC_H5REPACK_TESTFILES/h5repack_paged_persist.h5 -$SRC_H5REPACK_TESTFILES/h5repack_int32le.h5 -$SRC_H5REPACK_TESTFILES/h5repack_int32le_ex.h5 +$SRC_H5REPACK_TESTFILES/h5repack_f32le.h5 +$SRC_H5REPACK_TESTFILES/h5repack_f32le_ex.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d_ex.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d_ex.h5 $SRC_H5REPACK_TESTFILES/h5repack_uint8be.h5 $SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr1.h5 @@ -164,7 +170,11 @@ $SRC_H5REPACK_TESTFILES/ublock.bin $SRC_H5REPACK_TESTFILES/h5repack.info $SRC_H5REPACK_TESTFILES/crtorder.tordergr.h5.ddl $SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl -$SRC_H5REPACK_TESTFILES/h5repack_int32le_ex-0.dat +$SRC_H5REPACK_TESTFILES/h5repack_f32le_ex-0.dat +$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex-0.dat +$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex-1.dat +$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d_ex-0.dat +$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d_ex-0.dat $SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl $SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst $SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst @@ -173,10 +183,6 @@ $SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-0.dat $SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-1.dat $SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-2.dat $SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-3.dat -$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-4.dat -$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-5.dat -$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-6.dat -$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-7.dat $SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst $SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_chunk20x10x5-v.ddl $SRC_H5REPACK_TESTFILES/2_vds.h5-vds_chunk3x6x9-v.ddl @@ -647,7 +653,7 @@ DIFFFAIL() # ----------------------------------------------------------------------------- VERIFY_EXTERNAL_CONSOLIDATION() { - for name in int32le uint8be + for name in f32le int32le_1d int32le_2d int32le_3d uint8be do basename="h5repack_${name}" base_ext="${basename}_ex" @@ -672,7 +678,7 @@ VERIFY_EXTERNAL_CONSOLIDATION() DIFFTEST $repacked $canonical DIFFTEST $repacked $external - # invalidate external file by moving its data file; verify + # invalidate external file by moving its first data file; verify ( cd $TESTDIR mv $ex_dat $ex_dat_mv ) diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 7242ebf..6e2c6bf 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -32,8 +32,11 @@ #include "H5private.h" #define MAX_NAME_SIZE 256 -#define FILE_INT32LE "h5repack_int32le" +#define FILE_INT32LE_1 "h5repack_int32le_1d" +#define FILE_INT32LE_2 "h5repack_int32le_2d" +#define FILE_INT32LE_3 "h5repack_int32le_3d" #define FILE_UINT8BE "h5repack_uint8be" +#define FILE_F32LE "h5repack_f32le" #define H5REPACKGENTEST_OOPS ret_value = -1; goto done; @@ -45,37 +48,43 @@ if ((space) != H5I_INVALID_HID) { (void)H5Sclose((space)); } \ } +struct external_def { + hsize_t type_size; + unsigned n_elts_per_file; + unsigned n_elts_total; +}; + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Helper function to create and write a dataset to file. * Returns 0 on success, -1 on failure. */ static int -make_dataset( - hid_t file, +__make_dataset( + hid_t file_id, const char *dset_name, hid_t mem_type_id, - hid_t space, - hid_t dcpl, + hid_t space_id, + hid_t dcpl_id, void *wdata) { - hid_t dset = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; int ret_value = 0; - dset = H5Dcreate2( - file, - "dset", + dset_id = H5Dcreate2( + file_id, + dset_name, mem_type_id, - space, + space_id, H5P_DEFAULT, - dcpl, + dcpl_id, H5P_DEFAULT); - if (dset == H5I_INVALID_HID) { + if (dset_id == H5I_INVALID_HID) { H5REPACKGENTEST_OOPS; } if (H5Dwrite( - dset, + dset_id, mem_type_id, H5S_ALL, H5S_ALL, @@ -87,102 +96,116 @@ make_dataset( } done: - if (dset != H5I_INVALID_HID) { (void)H5Dclose(dset); } + if (dset_id != H5I_INVALID_HID) { (void)H5Dclose(dset_id); } return ret_value; -} /* end make_dataset() */ +} /* end __make_dataset() */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Helper function to populate the DCPL external storage list. + * Creates external files for the DCPL, with each file name following the + * convention "_ex-.dat". Will append `n_external_files` to + * the filename list, with each file having space for `n_elts` items of the + * type (of size `elt_size`). The numeric inputs are not sanity-checked. * Returns 0 on success, -1 on failure. */ static int -set_dcpl_external_list( +__set_dcpl_external_list( hid_t dcpl, const char *filename, - hsize_t n_external_files, - hsize_t n_elts, - hsize_t elt_size) + unsigned n_elts_per_file, + unsigned n_elts_total, + hsize_t elt_size) { - hsize_t i = 0; - char name[MAX_NAME_SIZE]; + char name[MAX_NAME_SIZE]; + unsigned n_external_files = 0; + unsigned i = 0; + + if (NULL == filename || '\0' == *filename) { + return -1; + } + + n_external_files = n_elts_total / n_elts_per_file; + if (n_elts_total != (n_external_files * n_elts_per_file)) { + return -1; + } for (i = 0; i < n_external_files; i++) { - snprintf(name, MAX_NAME_SIZE, "%s_ex-%llu.dat", filename, i); - if (H5Pset_external(dcpl, name, 0, n_elts * elt_size) < 0) { + if (snprintf(name, MAX_NAME_SIZE, "%s_ex-%u.dat", filename, i) >= MAX_NAME_SIZE) { + return -1; + } + if (H5Pset_external(dcpl, name, 0, n_elts_per_file * elt_size) < 0) { return -1; } } return 0; -} /* end set_dcpl_external_list() */ +} /* end __set_dcpl_external_list() */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Generalized utility function to write a file with the specified data and + * dataset configuration. If `ext` is provided, will attempt to use external + * storage. + * Returns 0 on success, -1 on failure. */ static int -generate_int32le(hbool_t external) +__make_file( + const char *basename, + struct external_def *ext, + hid_t type_id, + hsize_t rank, + hsize_t *dims, + void *wdata) { char filename[MAX_NAME_SIZE]; - hid_t file = H5I_INVALID_HID; - hid_t dcpl = H5P_DEFAULT; - hid_t space = H5I_INVALID_HID; - hsize_t dims[] = {8, 8, 8}; - int32_t wdata[512]; /* 8^3, from dims */ - int32_t n = 0; - int i = 0; - int j = 0; - int k = 0; + hid_t file_id = H5I_INVALID_HID; + hid_t dcpl_id = H5P_DEFAULT; + hid_t space_id = H5I_INVALID_HID; int ret_value = 0; - /* generate values, alternating positive and negative - */ - for (i=0, n=0; i < 8; i++) { - for (j=0; j < 8; j++) { - for (k=0; k < 8; k++, n++) { - wdata[n] = (k + j*512 + i*4096) * ((n&1) ? (-1) : (1)); - } - } - } - - snprintf(filename, + if (snprintf(filename, MAX_NAME_SIZE, "%s%s.h5", - FILE_INT32LE, - (external) ? "_ex" : ""); + basename, + (NULL != ext) ? "_ex" : "") + >= MAX_NAME_SIZE) + { + H5REPACKGENTEST_OOPS; + } - if (external) { - dcpl = H5Pcreate(H5P_DATASET_CREATE); - if (dcpl == H5I_INVALID_HID) { + if (NULL != ext) { + dcpl_id = H5Pcreate(H5P_DATASET_CREATE); + if (dcpl_id == H5I_INVALID_HID) { H5REPACKGENTEST_OOPS; } - if (set_dcpl_external_list( - dcpl, - FILE_INT32LE, - 1, - 512, - sizeof(int32_t)) + if (__set_dcpl_external_list( + dcpl_id, + basename, + ext->n_elts_per_file, + ext->n_elts_total, + ext->type_size) < 0) { H5REPACKGENTEST_OOPS; } } - space = H5Screate_simple(3, dims, NULL); - if (space == H5I_INVALID_HID) { + space_id = H5Screate_simple(rank, dims, NULL); + if (space_id == H5I_INVALID_HID) { H5REPACKGENTEST_OOPS; } - file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (file == H5I_INVALID_HID) { + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (file_id == H5I_INVALID_HID) { H5REPACKGENTEST_OOPS; } - if (make_dataset( - file, + if (__make_dataset( + file_id, "dset", - H5T_STD_I32LE, - space, - dcpl, + type_id, + space_id, + dcpl_id, wdata) < 0) { @@ -190,106 +213,194 @@ generate_int32le(hbool_t external) } done: - H5REPACKGENTEST_COMMON_CLEANUP(dcpl, file, space); + H5REPACKGENTEST_COMMON_CLEANUP(dcpl_id, file_id, space_id); return ret_value; -} /* end generate_int32le() */ +} /* end __make_file() */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Returns 0 on success, -1 on failure. */ static int -generate_uint8be(hbool_t external) +generate_int32le_1d(hbool_t external) { - char filename[MAX_NAME_SIZE]; - hid_t file = H5I_INVALID_HID; - hid_t dcpl = H5P_DEFAULT; - hid_t space = H5I_INVALID_HID; - hsize_t dims[] = {8, 8, 8}; - uint8_t wdata[512]; /* 8^3, from dims */ - uint8_t n = 0; + int32_t wdata[12]; + hsize_t dims[] = {12}; + struct external_def *def_ptr = NULL; + struct external_def def = { (hsize_t)sizeof(int32_t), 6, 12 }; + int32_t n = 0; + int ret_value = 0; + + /* Generate values + */ + for (n = 0; n < 12; n++) { + wdata[n] = n-6; + } + + def_ptr = (TRUE == external) ? (&def) : NULL; + if (__make_file(FILE_INT32LE_1, def_ptr, H5T_STD_I32LE, 1, dims, wdata) < 0) { + ret_value = -1; + } + + return ret_value; +} /* end generate_int32le_1d() */ + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Returns 0 on success, -1 on failure. + */ +static int +generate_int32le_2d(hbool_t external) +{ + int32_t wdata[64]; + hsize_t dims[] = {8, 8}; + struct external_def *def_ptr = NULL; + struct external_def def = { (hsize_t)sizeof(int32_t), 64, 64 }; + int32_t n = 0; + int ret_value = 0; + + /* Generate values + */ + for (n = 0; n < 64; n++) { + wdata[n] = n-32; + } + + def_ptr = (TRUE == external) ? (&def) : NULL; + if (__make_file(FILE_INT32LE_2, def_ptr, H5T_STD_I32LE, 2, dims, wdata) < 0) { + ret_value = -1; + } + + return ret_value; +} /* end generate_int32le_2d() */ + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Returns 0 on success, -1 on failure. + */ +static int +generate_int32le_3d(hbool_t external) +{ + hsize_t dims[] = {8, 8, 8}; + int32_t wdata[512]; /* 8^3, from dims */ + struct external_def *def_ptr = NULL; + struct external_def def = { (hsize_t)sizeof(int32_t), 512, 512 }; + int32_t n = 0; int i = 0; int j = 0; int k = 0; int ret_value = 0; - /* Generate values, alternating positive and negative - * The latter half of the dataset is "overflow garbage" (TODO?) + /* generate values, alternating positive and negative */ - for (i=0, n=0; i < 8; i++) { - for (j=0; j < 8; j++) { - for (k=0; k < 8; k++, n++) { - wdata[n] = n * ((n&1) ? (-1) : (1)); + for (i=0, n=0; i < dims[0]; i++) { + for (j=0; j < dims[1]; j++) { + for (k=0; k < dims[2]; k++, n++) { + wdata[n] = (k + j*512 + i*4096) * ((n&1) ? (-1) : (1)); } } } - snprintf(filename, - MAX_NAME_SIZE, - "%s%s.h5", - FILE_UINT8BE, - (external) ? "_ex" : ""); + def_ptr = (TRUE == external) ? (&def) : NULL; + if (__make_file(FILE_INT32LE_3, def_ptr, H5T_STD_I32LE, 3, dims, wdata) < 0) { + ret_value = -1; + } - if (external) { - dcpl = H5Pcreate(H5P_DATASET_CREATE); - if (dcpl == H5I_INVALID_HID) { - H5REPACKGENTEST_OOPS; - } - if (set_dcpl_external_list( - dcpl, - FILE_UINT8BE, - 8, - 64, - sizeof(uint8_t)) - < 0) - { - H5REPACKGENTEST_OOPS; + return ret_value; +} /* end generate_int32le_3d() */ + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Returns 0 on success, -1 on failure. + */ +static int +generate_uint8be(hbool_t external) +{ + hsize_t dims[] = {4, 8, 8}; + uint8_t wdata[256]; /* 4*8*8, from dims */ + struct external_def *def_ptr = NULL; + struct external_def def = { (hsize_t)sizeof(uint8_t), 64, 256 }; + uint8_t n = 0; + int i = 0; + int j = 0; + int k = 0; + int ret_value = 0; + + /* Generate values, ping-pong from ends of range + */ + for (i=0, n=0; i < dims[0]; i++) { + for (j=0; j < dims[1]; j++) { + for (k=0; k < dims[2]; k++, n++) { + wdata[n] = n * ((n&1) ? (-1) : (1)); + } } } - space = H5Screate_simple(3, dims, NULL); - if (space == H5I_INVALID_HID) { - H5REPACKGENTEST_OOPS; + def_ptr = (TRUE == external) ? (&def) : NULL; + if (__make_file(FILE_UINT8BE, def_ptr, H5T_STD_U8BE, 3, dims, wdata) < 0) { + ret_value = -1; } - file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (file == H5I_INVALID_HID) { - H5REPACKGENTEST_OOPS; + return ret_value; +} /* end generate_uint8be() */ + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Returns 0 on success, -1 on failure. + */ +static int +generate_f32le(hbool_t external) +{ + hsize_t dims[] = {12, 6}; + float wdata[72]; /* 12*6, from dims */ + struct external_def *def_ptr = NULL; + struct external_def def = { + (hsize_t)sizeof(float), + 72, + 72 + }; + float n = 0; + int i = 0; + int j = 0; + int k = 0; + int ret_value = 0; + + /* Generate values */ + for (i=0, k=0, n=0; i < dims[0]; i++) { + for (j=0; j < dims[1]; j++, k++, n++) { + wdata[k] = n * 801.1 * ((k % 5 == 1) ? (-1) : (1)); + } } - if (make_dataset( - file, - "dset", - H5T_STD_U8BE, - space, - dcpl, - wdata) - < 0) - { - H5REPACKGENTEST_OOPS; + def_ptr = (TRUE == external) ? (&def) : NULL; + if (__make_file(FILE_F32LE, def_ptr, H5T_IEEE_F32LE, 2, dims, wdata) < 0) { + ret_value = -1; } -done: - H5REPACKGENTEST_COMMON_CLEANUP(dcpl, file, space); return ret_value; -} /* end generate_uint8be() */ +} /* end generate_f32le() */ /* ---------------------------------------------------------------------------- + * Create files. + * Return 0 on success, nonzero on failure. */ int main(void) { - int i = 0; /* loop variable */ + int i = 0; int ret_value = 0; for (i=0; i < 2; i++) { hbool_t external = (i&1) ? TRUE : FALSE; - if (ret_value == 0) { ret_value -= generate_int32le(external); } + if (ret_value == 0) { ret_value -= generate_int32le_1d(external); } + if (ret_value == 0) { ret_value -= generate_int32le_2d(external); } + if (ret_value == 0) { ret_value -= generate_int32le_3d(external); } if (ret_value == 0) { ret_value -= generate_uint8be(external); } + if (ret_value == 0) { ret_value -= generate_f32le(external); } } /* end for external data storage or not */ if (ret_value != 0) { - /* TODO: print warning message? */ + HDprintf("A problem occurred!\n"); } return ret_value; diff --git a/tools/test/h5repack/testfiles/h5repack_f32le.h5 b/tools/test/h5repack/testfiles/h5repack_f32le.h5 new file mode 100644 index 0000000..03a9b57 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_f32le.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_f32le_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_f32le_ex-0.dat new file mode 100644 index 0000000..8378fc2 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_f32le_ex-0.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_f32le_ex.h5 b/tools/test/h5repack/testfiles/h5repack_f32le_ex.h5 new file mode 100644 index 0000000..ca6c49d Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_f32le_ex.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le.h5 b/tools/test/h5repack/testfiles/h5repack_int32le.h5 deleted file mode 100644 index 4e9500f..0000000 Binary files a/tools/test/h5repack/testfiles/h5repack_int32le.h5 and /dev/null differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_1d.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_1d.h5 new file mode 100644 index 0000000..7d60566 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_1d.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-0.dat new file mode 100644 index 0000000..f75ada5 --- /dev/null +++ b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-0.dat @@ -0,0 +1 @@ +úÿÿÿûÿÿÿüÿÿÿýÿÿÿþÿÿÿÿÿÿÿ \ No newline at end of file diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-1.dat b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-1.dat new file mode 100644 index 0000000..1f8f3b6 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-1.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex.h5 new file mode 100644 index 0000000..ba4b534 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_2d.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_2d.h5 new file mode 100644 index 0000000..2f32bd1 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_2d.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex-0.dat new file mode 100644 index 0000000..c6bfc64 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex-0.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex.h5 new file mode 100644 index 0000000..f6cce59 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_3d.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_3d.h5 new file mode 100644 index 0000000..7a61ef5 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_3d.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex-0.dat new file mode 100644 index 0000000..b505eb4 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex-0.dat differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex.h5 new file mode 100644 index 0000000..7c4b750 Binary files /dev/null and b/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_int32le_ex-0.dat deleted file mode 100644 index b505eb4..0000000 Binary files a/tools/test/h5repack/testfiles/h5repack_int32le_ex-0.dat and /dev/null differ diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 deleted file mode 100644 index 8c8b644..0000000 Binary files a/tools/test/h5repack/testfiles/h5repack_int32le_ex.h5 and /dev/null differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be.h5 b/tools/test/h5repack/testfiles/h5repack_uint8be.h5 index f89bc03..0e25211 100644 Binary files a/tools/test/h5repack/testfiles/h5repack_uint8be.h5 and b/tools/test/h5repack/testfiles/h5repack_uint8be.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat deleted file mode 100644 index b5c4e7c..0000000 Binary files a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-4.dat and /dev/null differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat deleted file mode 100644 index b77f32c..0000000 Binary files a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-5.dat and /dev/null differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat deleted file mode 100644 index 1e335eb..0000000 Binary files a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-6.dat and /dev/null differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat deleted file mode 100644 index 3dadb7d..0000000 Binary files a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-7.dat and /dev/null differ diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 b/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 index 6f8c3fe..8787188 100644 Binary files a/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 and b/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 differ -- cgit v0.12 From 1070468dac5d0fd5e02b69514d7a0dfacfd28606 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Mon, 23 Sep 2019 16:25:25 -0500 Subject: Change print calls to HD-wrapped. Minor formatting tweaks (inc. regressions and in-file style-matching). --- test/external.c | 5 ++- tools/src/h5repack/h5repack.c | 63 ++++++++++++++++++------------------ tools/src/h5repack/h5repack_copy.c | 66 +++++++++++++++++++++----------------- 3 files changed, 70 insertions(+), 64 deletions(-) diff --git a/test/external.c b/test/external.c index 56cc816..50d94ab 100644 --- a/test/external.c +++ b/test/external.c @@ -457,8 +457,7 @@ test_multiple_files(hid_t file) TESTING("multiple external files"); - dcpl = H5Pcreate(H5P_DATASET_CREATE); - if(dcpl < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR max_ext_size = (hsize_t)(sizeof(int) * max_size[0] / n_external_files); @@ -596,7 +595,7 @@ test_overflow(void) TESTING("address overflow in external files"); - if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) FAIL_STACK_ERROR diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index d49a16b..f12c3b4 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -382,7 +382,8 @@ copy_attr( */ for (u = 0; u < (unsigned) oinfo.num_attrs; u++) { /* open attribute */ - if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0) + attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT); + if (attr_id < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); if (H5Aget_name(attr_id, (size_t) 255, name) < 0) @@ -504,7 +505,7 @@ copy_attr( } /*H5T_REFERENCE*/ if (options->verbose) - printf(FORMAT_OBJ_ATTR, "attr", name); + HDprintf(FORMAT_OBJ_ATTR, "attr", name); /*--------------------------------------------------------------------- * close @@ -567,7 +568,7 @@ check_options(pack_opt_t *options) */ if (options->verbose && have_request(options)) { if (options->all_layout == 1) { - printf("All objects to modify layout are...\n"); + HDprintf("All objects to modify layout are...\n"); switch (options->layout_g) { case H5D_COMPACT: strcpy(slayout, "compact"); @@ -588,17 +589,17 @@ check_options(pack_opt_t *options) strcpy(slayout, "invalid layout\n"); HGOTO_DONE(FAIL); } - printf(" Apply %s layout to all", slayout); + HDprintf(" Apply %s layout to all", slayout); if (H5D_CHUNKED == options->layout_g) { - printf("with dimension [ "); + HDprintf("with dimension [ "); for (j = 0; j < options->chunk_g.rank; j++) - printf("%d ", (int) options->chunk_g.chunk_lengths[j]); - printf("]"); + HDprintf("%d ", (int) options->chunk_g.chunk_lengths[j]); + HDprintf("]"); } - printf("\n"); + HDprintf("\n"); } else - printf("No all objects to modify layout\n"); + HDprintf("No all objects to modify layout\n"); } /* end if verbose */ for (i = 0; i < options->op_tbl->nelems; i++) { @@ -606,16 +607,16 @@ check_options(pack_opt_t *options) if (options->op_tbl->objs[i].chunk.rank > 0) { if (options->verbose) { - printf(" <%s> with chunk size ", name); + HDprintf(" <%s> with chunk size ", name); for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) - printf("%d ", (int)options->op_tbl->objs[i].chunk.chunk_lengths[k]); - printf("\n"); + HDprintf("%d ", (int)options->op_tbl->objs[i].chunk.chunk_lengths[k]); + HDprintf("\n"); } has_ck = 1; } else if (options->op_tbl->objs[i].chunk.rank == -2) { /* TODO: replace 'magic number' */ if (options->verbose) - printf(" <%s> %s\n", name, "NONE (contiguous)"); + HDprintf(" <%s> %s\n", name, "NONE (contiguous)"); has_ck = 1; } } /* end for each object in options */ @@ -631,35 +632,35 @@ check_options(pack_opt_t *options) if (options->verbose && have_request(options)) { if (options->all_filter == 1) { - printf("All objects to apply filter are...\n"); + HDprintf("All objects to apply filter are...\n"); for (k = 0; k < options->n_filter_g; k++) { H5Z_filter_t filtn = options->filter_g[k].filtn; if (filtn < 0) { - printf(" Unknown\n"); + HDprintf(" Unknown\n"); continue; } switch (filtn) { case H5Z_FILTER_NONE: - printf(" Uncompress all\n"); + HDprintf(" Uncompress all\n"); break; case H5Z_FILTER_SHUFFLE: case H5Z_FILTER_FLETCHER32: - printf(" All with %s\n", get_sfilter(filtn)); + HDprintf(" All with %s\n", get_sfilter(filtn)); break; case H5Z_FILTER_SZIP: case H5Z_FILTER_DEFLATE: - printf(" All with %s, parameter %d\n", + HDprintf(" All with %s, parameter %d\n", get_sfilter(filtn), options->filter_g[k].cd_values[0]); break; default: - printf(" User Defined %d\n", filtn); + HDprintf(" User Defined %d\n", filtn); break; } /* end switch */ } /* end for each filter */ } /* end if options->all_filter == 1 (TODO: meaning) */ else - printf("No all objects to apply filter\n"); + HDprintf("No all objects to apply filter\n"); } /* end if verbose */ for (i = 0; i < options->op_tbl->nelems; i++) { @@ -669,15 +670,16 @@ check_options(pack_opt_t *options) for (j = 0; j < pack.nfilters; j++) { if (options->verbose) { if (pack.filter[j].filtn >= 0) { - if (pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) - printf(" <%s> with %s filter %d\n", - name, + if (pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) { + HDprintf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), pack.filter[j].filtn); - else - printf(" <%s> with %s filter\n", + } + else { + HDprintf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn)); + } } } has_cp = 1; @@ -714,7 +716,7 @@ check_options(pack_opt_t *options) */ if (options->ublock_filename != NULL && options->ublock_size == 0) { if (options->verbose) { - printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", options->ublock_filename); + HDprintf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", options->ublock_filename); options->ublock_size = 1024; } } @@ -787,15 +789,14 @@ check_objects(const char* fname, pack_opt_t *options) */ if (options->verbose) - printf("Opening file. Searching %zu objects to modify ...\n", - travt->nobjs); + HDprintf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs); for (i = 0; i < options->op_tbl->nelems; i++) { pack_info_t obj = options->op_tbl->objs[i]; char* name = obj.path; if (options->verbose) - printf(" <%s>", name); + HDprintf(" <%s>", name); /* the input object names are present in the file and are valid */ if (h5trav_getindext(name, travt) < 0) @@ -803,7 +804,7 @@ check_objects(const char* fname, pack_opt_t *options) "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose ? "\n" : ""), name, fname); if (options->verbose) - printf("...Found\n"); + HDprintf("...Found\n"); for (ifil = 0; ifil < obj.nfilters; ifil++) { if (obj.filter[ifil].filtn < 0) @@ -849,7 +850,7 @@ check_objects(const char* fname, pack_opt_t *options) } /* end else (chunk rank is 0) */ if (csize < ppb) { - printf(" \n"); + HDprintf(" \n"); HGOTO_DONE(0); } } /* end case SZIP */ diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 5939df4..07defa5 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -296,7 +296,7 @@ print_user_block(fnamein, fidin); *------------------------------------------------------------------------- */ if (options->verbose) - printf("Making new file ...\n"); + HDprintf("Making new file ...\n"); if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fcreate could not create file <%s>:", fnameout); @@ -625,9 +625,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ if (options->verbose) { - printf("-----------------------------------------\n"); - printf(" Type Filter (Compression) Name\n"); - printf("-----------------------------------------\n"); + HDprintf("-----------------------------------------\n"); + HDprintf(" Type Filter (Compression) Name\n"); + HDprintf("-----------------------------------------\n"); } if (travt->objs) { @@ -646,7 +646,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ case H5TRAV_TYPE_GROUP: if (options->verbose) - printf(FORMAT_OBJ, "group", travt->objs[i].name); + HDprintf(FORMAT_OBJ, "group", travt->objs[i].name); /* open input group */ if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) @@ -782,17 +782,6 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); - /* If the input dataset has external storage, it must be contiguous. - * Accordingly, there would be no filter or chunk properties to preserve. - */ - if (H5Pget_external_count(dcpl_in)) { - if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); - } - else { - if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); - } if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); HDmemset(dims, 0, sizeof dims); @@ -801,6 +790,20 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (H5Dget_space_status(dset_in, &space_status) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space_status failed"); + /* If the input dataset has external storage, it must be contiguous. + * Accordingly, there would be no filter or chunk properties to preserve, + * so create a new DCPL. + * Otherwise, copy dcpl_in. + */ + if (H5Pget_external_count(dcpl_in)) { + if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + } + else + if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) { + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); + } + nelmts = 1; for (j = 0; j < rank; j++) nelmts *= dims[j]; @@ -844,12 +847,14 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, * changing to COMPACT. For the reference, COMPACT is limited * by size 64K by library. */ - if (options->layout_g != H5D_COMPACT) - if (size_dset < options->min_comp) + if (options->layout_g != H5D_COMPACT) { + if (size_dset < options->min_comp) { apply_s = 0; + } + } /* apply the filter */ - if (apply_s) + if (apply_s) { if (apply_filters( travt->objs[i].name, rank, @@ -860,6 +865,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, &has_filter) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "apply_filters failed"); + } /* only if layout change requested for entire file or * individual obj */ @@ -916,7 +922,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, H5E_tools_min_id_g, "H5Dcreate2 failed"); if (options->verbose) - printf(" warning: could not create dataset <%s>. Applying original settings\n", + HDprintf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name); dset_out = H5Dcreate2(fidout, travt->objs[i].name, @@ -1122,12 +1128,12 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, * (in case there was a filter) */ if (has_filter && apply_s == 0) - printf(" \n", + HDprintf(" \n", travt->objs[i].name, (int) options->min_comp); if (has_filter && apply_f == 0) - printf(" \n", travt->objs[i].name); + HDprintf(" \n", travt->objs[i].name); } /* end if verbose (print compression) */ /*------------------------------------------------------------------------- @@ -1201,7 +1207,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); if (options->verbose) - printf(FORMAT_OBJ, "dset", travt->objs[i].name); + HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name); } /* end whether we have request for filter/chunking */ break; @@ -1212,7 +1218,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ case H5TRAV_TYPE_NAMED_DATATYPE: if (options->verbose) - printf(FORMAT_OBJ, "type", travt->objs[i].name); + HDprintf(FORMAT_OBJ, "type", travt->objs[i].name); if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); @@ -1251,13 +1257,13 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, case H5TRAV_TYPE_LINK: case H5TRAV_TYPE_UDLINK: if (options->verbose) - printf(FORMAT_OBJ, "link", travt->objs[i].name); + HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcopy failed"); if (options->verbose) - printf(FORMAT_OBJ, "link", travt->objs[i].name); + HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); break; default: @@ -1400,7 +1406,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) } /* end for each filter */ if (!pr) - printf(FORMAT_OBJ, "dset", objname); + HDprintf(FORMAT_OBJ, "dset", objname); else { char str[512], temp[512]; @@ -1408,7 +1414,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) HDstrcat(str, strfilter); sprintf(temp, " (%.3f:1)", ratio); HDstrcat(str, temp); - printf(FORMAT_OBJ, str, objname); + HDprintf(FORMAT_OBJ, str, objname); } } /* end print_dataset_info() */ @@ -1535,10 +1541,10 @@ print_user_block(const char *filename, hid_t fid) for (i = 0; i < nread; i++) { - printf("%c ", rbuf[i]); + HDprintf("%c ", rbuf[i]); } - printf("\n"); + HDprintf("\n"); if (nread < 0) { HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "nread < 0"); -- cgit v0.12 From 40b2eae5e961c7f40b483ace05d3cf2b35d1fb62 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 24 Sep 2019 05:19:44 -0500 Subject: Revert "Fix for H5EA debug package when built in release mode." This reverts commit 911b1ca67fdf7c2f3a32dd42c591e4e9b2fa1950. --- src/H5EAtest.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/H5EAtest.c b/src/H5EAtest.c index f7731eb..b7064de 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -292,9 +292,7 @@ H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)) HDassert(raw); HDassert(elmt); HDassert(nelmts); -#ifdef H5EA_DEBUG HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); -#endif /* H5EA_DEBUG */ /* Decode raw elements into native elements */ while(nelmts) { -- cgit v0.12 From 6eb506eff76b5455f8aac8889c6809aca2d8be52 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 24 Sep 2019 05:20:30 -0500 Subject: Revert "Moved NDEBUG guards to H5EA_DEBUG in H5EA package." This reverts commit 431123503d387bce30b1f6db7dc4ad3a33bc51bb. --- configure.ac | 4 ++-- src/CMakeLists.txt | 8 ++++---- src/H5EA.c | 4 ++-- src/H5EAcache.c | 20 ++++++++++++++++++++ src/H5EAhdr.c | 12 ++++++------ src/H5EAprivate.h | 4 ++-- src/H5EAtest.c | 4 ++-- 7 files changed, 38 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index b4308f6..e119e0a 100644 --- a/configure.ac +++ b/configure.ac @@ -2280,8 +2280,8 @@ AC_SUBST([INTERNAL_DEBUG_OUTPUT]) ## too specialized or have huge performance hits. These ## are not listed in the "all" packages list. ## -## all_packages="AC,B,B2,D,EA,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -all_packages="AC,B2,CX,D,EA,F,HL,I,O,S,ST,T,Z" +## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" +all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" case "X-$INTERNAL_DEBUG_OUTPUT" in X-yes|X-all) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 26a3c26..6df8af3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1115,8 +1115,8 @@ if (BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () -## all_packages="AC,B,B2,D,EA,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -#all_packages="AC,B2,CX,D,EA,F,HL,I,O,S,ST,T,Z" +## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" +#all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- @@ -1137,7 +1137,7 @@ if (NOT ONLY_SHARED_LIBS) ${HDF_EXTRA_FLAGS} PRIVATE $<$:H5_DEBUG_API> # Enable tracing of the API - $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5EA_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> ) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} @@ -1175,7 +1175,7 @@ if (BUILD_SHARED_LIBS) PRIVATE $<$:H5_HAVE_THREADSAFE> $<$:H5_DEBUG_API> # Enable tracing of the API - $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5EA_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> ) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} diff --git a/src/H5EA.c b/src/H5EA.c index 604df5d..96eee12 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -877,7 +877,7 @@ H5EA_close(H5EA_t *ea)) if(pending_delete) { H5EA_hdr_t *hdr; /* Another pointer to extensible array header */ -#ifdef H5EA_DEBUG +#ifndef NDEBUG { unsigned hdr_status = 0; /* Header's status in the metadata cache */ @@ -890,7 +890,7 @@ H5EA_close(H5EA_t *ea)) HDassert(hdr_status & H5AC_ES__IS_PINNED); HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED)); } -#endif /* H5EA_DEBUG */ +#endif /* NDEBUG */ /* Lock the array header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index d55a2b4..da67e6b 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -581,7 +581,11 @@ H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)) break; default: +#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ } /* end switch */ } /* end if */ else @@ -974,7 +978,11 @@ H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing)) break; default: +#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ } /* end switch */ CATCH @@ -1382,7 +1390,11 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing)) break; default: +#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ } /* end switch */ CATCH @@ -1791,7 +1803,11 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)) break; default: +#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ } /* end switch */ CATCH @@ -2168,7 +2184,11 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)) break; default: +#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ } /* end switch */ CATCH diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 8a2e1d1..ec40298 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -49,10 +49,10 @@ /* Local Macros */ /****************/ -#ifdef H5EA_DEBUG +#ifndef NDEBUG /* Max. # of bits for max. nelmts index */ #define H5EA_MAX_NELMTS_IDX_MAX 64 -#endif /* H5EA_DEBUG */ +#endif /* NDEBUG */ /* # of elements in a data block for a particular super block */ #define H5EA_SBLK_DBLK_NELMTS(s, m) \ @@ -366,7 +366,7 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)) HDassert(f); HDassert(cparam); -#ifdef H5EA_DEBUG +#ifndef NDEBUG { unsigned sblk_idx; /* Super block index for first "actual" super block */ size_t dblk_nelmts; /* Number of data block elements */ @@ -398,7 +398,7 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)) if(cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits) H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be <= max. # of elements bits") } -#endif /* H5EA_DEBUG */ +#endif /* NDEBUG */ /* Allocate space for the shared information */ if(NULL == (hdr = H5EA__hdr_alloc(f))) @@ -724,7 +724,7 @@ H5EA__hdr_delete(H5EA_hdr_t *hdr)) HDassert(hdr); HDassert(!hdr->file_rc); -#ifdef H5EA_DEBUG +#ifndef NDEBUG { unsigned hdr_status = 0; /* Array header's status in the metadata cache */ @@ -736,7 +736,7 @@ H5EA__hdr_delete(H5EA_hdr_t *hdr)) HDassert(hdr_status & H5AC_ES__IN_CACHE); HDassert(hdr_status & H5AC_ES__IS_PROTECTED); } /* end block */ -#endif /* H5EA_DEBUG */ +#endif /* NDEBUG */ /* Check for index block */ if(H5F_addr_defined(hdr->idx_blk_addr)) { diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index 6067ed0..1195256 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -150,8 +150,8 @@ H5_DLL herr_t H5EA_patch_file(H5EA_t *fa, H5F_t *f); H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats); /* Debugging routines */ -#ifdef H5EA_DEBUG -#endif /* H5EA_DEBUG */ +#ifdef H5EA_DEBUGGING +#endif /* H5EA_DEBUGGING */ #endif /* _H5EAprivate_H */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index b7064de..814e64f 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -282,9 +282,9 @@ herr_t, SUCCEED, -, H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)) /* Local variables */ -#ifdef H5EA_DEBUG +#ifndef NDEBUG H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ -#endif /* H5EA_DEBUG */ +#endif /* NDEBUG */ uint64_t *elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ -- cgit v0.12 From 8a2a500fef227e4f813f0059b365869268354048 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 24 Sep 2019 14:48:52 -0500 Subject: Fix missing option and incorrect close --- tools/src/h5stat/h5stat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 9528d2c..3eea368 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -173,7 +173,7 @@ struct handler_t { char **obj; }; -static const char *s_opts ="Aa:Ddm:EFfhGgl:sSTO:Vw:"; +static const char *s_opts ="Aa:Ddm:EFfhGgl:sSTO:Vw:H:"; /* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */ static struct long_options l_opts[] = { {"help", no_arg, 'h'}, @@ -2014,7 +2014,7 @@ done: iter_free(&iter); if (fapl_id != H5P_DEFAULT) { - if (0 < H5Pclose(fapl_id)) { + if (H5Pclose(fapl_id) < 0) { error_msg("unable to close fapl entry\n"); h5tools_setstatus(EXIT_FAILURE); } -- cgit v0.12 From 1f7d556ccd7fd0421352dd91c7c934c206dcdc6d Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Tue, 24 Sep 2019 15:22:38 -0500 Subject: Revert else-if to single line. --- tools/src/h5repack/h5repack_main.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index c94a0bd..8c887a2 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -373,8 +373,7 @@ set_sort_by(const char *form) if (!HDstrcmp(form, "name")) idx_type = H5_INDEX_NAME; - else - if (!HDstrcmp(form, "creation_order")) + else if (!HDstrcmp(form, "creation_order")) idx_type = H5_INDEX_CRT_ORDER; return idx_type; @@ -397,8 +396,7 @@ set_sort_order(const char *form) if (!HDstrcmp(form, "ascending")) iter_order = H5_ITER_INC; - else - if (!HDstrcmp(form, "descending")) + else if (!HDstrcmp(form, "descending")) iter_order = H5_ITER_DEC; return iter_order; @@ -539,17 +537,13 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) ssize = HDatoi( opt_arg ); if (!HDstrncmp(msgType, "dspace", 6)) options->msg_size[0] = ssize; - else - if (!HDstrncmp(msgType, "dtype", 5)) + else if (!HDstrncmp(msgType, "dtype", 5)) options->msg_size[1] = ssize; - else - if (!HDstrncmp(msgType, "fill", 4)) + else if (!HDstrncmp(msgType, "fill", 4)) options->msg_size[2] = ssize; - else - if (!HDstrncmp(msgType, "pline", 5)) + else if (!HDstrncmp(msgType, "pline", 5)) options->msg_size[3] = ssize; - else - if (!HDstrncmp(msgType, "attr", 4)) + else if (!HDstrncmp(msgType, "attr", 4)) options->msg_size[4] = ssize; } } @@ -588,14 +582,11 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) HDstrcpy(strategy, opt_arg); if (!HDstrcmp(strategy, "FSM_AGGR")) options->fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; - else - if (!HDstrcmp(strategy, "PAGE")) + else if (!HDstrcmp(strategy, "PAGE")) options->fs_strategy = H5F_FSPACE_STRATEGY_PAGE; - else - if (!HDstrcmp(strategy, "AGGR")) + else if (!HDstrcmp(strategy, "AGGR")) options->fs_strategy = H5F_FSPACE_STRATEGY_AGGR; - else - if (!HDstrcmp(strategy, "NONE")) + else if (!HDstrcmp(strategy, "NONE")) options->fs_strategy = H5F_FSPACE_STRATEGY_NONE; else { error_msg("invalid file space management strategy\n", opt_arg); @@ -640,7 +631,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'z': - if (H5_ITER_UNKNOWN == set_sort_order(opt_arg)) { + if (set_sort_order(opt_arg) == H5_ITER_UNKNOWN) { error_msg(" failed to set sort order form <%s>\n", opt_arg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; @@ -662,7 +653,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) { infile = argv[opt_ind]; outfile = argv[opt_ind + 1]; - + if (!HDstrcmp(infile, outfile)) { error_msg("file names cannot be the same\n"); usage(h5tools_getprogname()); @@ -677,8 +668,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) ret_value = -1; } } - else - if (has_i != 1 || has_o != 1) { + else if (has_i != 1 || has_o != 1) { error_msg("filenames must be either both -i -o or both positional\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); -- cgit v0.12 From 4ecc50bc136e71329593bef9fc675b6044bcff86 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Tue, 24 Sep 2019 15:29:56 -0500 Subject: Update to current external file population. --- tools/test/h5repack/CMakeTests.cmake | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index eae1a7f..072dad2 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -26,13 +26,23 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_deflate.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_early.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_ext.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_f32le.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_f32le_ex-0.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_f32le_ex.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fill.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fletcher.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_hlink.h5 - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le.h5 - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_ex.h5 - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_ex-0.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_1d.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_1d_ex-0.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_1d_ex-1.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_1d_ex.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_2d.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_2d_ex-0.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_2d_ex.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_3d.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_3d_ex-0.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_3d_ex.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layouto.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout2.h5 @@ -47,6 +57,12 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_shuffle.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_soffset.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_szip.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-0.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-1.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-2.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-3.dat + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex.h5 # fsm ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_aggr.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fsm_aggr_nopersist.h5 @@ -54,16 +70,6 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_none.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_paged_nopersist.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_paged_persist.h5 - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be.h5 - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex.h5 - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-0.dat - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-1.dat - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-2.dat - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-3.dat - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-4.dat - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-5.dat - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-6.dat - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-7.dat # h5diff/testfile ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5 # tools/testfiles -- cgit v0.12 From 2a4bc8c63e842d5e7551e6e75a9ca95c0c2d2886 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 25 Sep 2019 14:30:54 -0500 Subject: Merge Binh-Minh's changes for code improvement to chunk_info.c (PR #1942) to develop branch. --- test/chunk_info.c | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/test/chunk_info.c b/test/chunk_info.c index d3e5751..70f6eb6 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -43,7 +43,9 @@ #include "H5Dpkg.h" #include "testhdf5.h" +#ifdef H5_HAVE_FILTER_DEFLATE #include "zlib.h" +#endif /* Test file names, using H5F_libver_t as indices */ const char *FILENAME[] = { @@ -467,7 +469,7 @@ test_get_chunk_info_highest_v18(hid_t fapl) hid_t dset = H5I_INVALID_HID; /* Dataset ID */ hid_t cparms = H5I_INVALID_HID; /* Creation plist */ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ - int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Data in chunks */ + int direct_buf[CHUNK_NX][CHUNK_NY]; /* Data chunk */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* 2 unlimited dims */ hsize_t out_offset[2]; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ @@ -480,11 +482,13 @@ test_get_chunk_info_highest_v18(hid_t fapl) int fillvalue = -1; /* Fill value */ int aggression = 9; /* Compression aggression setting */ hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ +#ifdef H5_HAVE_FILTER_DEFLATE const Bytef *z_src = (const Bytef*)(direct_buf); Bytef *z_dst; /*destination buffer */ uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(CHK_SIZE); uLong z_src_nbytes = (uLong)CHK_SIZE; - void *outbuf = NULL; /* Pointer to new buffer */ +#endif /* end H5_HAVE_FILTER_DEFLATE */ + void *inbuf = NULL; /* Pointer to new buffer */ hsize_t chunk_size = CHK_SIZE; /* Size of a chunk, can be compressed or not */ hsize_t ii, jj; /* Array indices */ int n; /* Used as chunk index, but int to avoid conversion warning */ @@ -523,16 +527,19 @@ test_get_chunk_info_highest_v18(hid_t fapl) dset = H5Dcreate2(chunkfile, SIMPLE_CHUNKED_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); if(dset < 0) TEST_ERROR - /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ - for(n = 0; n < NUM_CHUNKS; n++) - for(ii = 0; ii < CHUNK_NX; ii++) - for(jj = 0; jj < CHUNK_NY; jj++) - direct_buf[n][ii][jj] = (int)(ii*jj) + 1; + /* Initialize a chunk of data */ + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[ii][jj] = (int)(ii*jj) + 1; #ifdef H5_HAVE_FILTER_DEFLATE - /* Allocate output (compressed) buffer */ - outbuf = malloc(z_dst_nbytes); - z_dst = (Bytef *)outbuf; + /* Allocate input (compressed) buffer */ + inbuf = malloc(z_dst_nbytes); + + /* Set chunk size to the compressed chunk size and the chunk point + to the compressed data chunk */ + chunk_size = (hsize_t)z_dst_nbytes; + z_dst = (Bytef *)inbuf; /* Perform compression from the source to the destination buffer */ ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); @@ -548,6 +555,10 @@ test_get_chunk_info_highest_v18(hid_t fapl) fprintf(stderr, "other deflate error"); TEST_ERROR } +#else + /* Allocate input (non-compressed) buffer */ + inbuf = malloc(CHK_SIZE); + HDmemcpy(inbuf, direct_buf, CHK_SIZE); #endif /* end H5_HAVE_FILTER_DEFLATE */ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: @@ -555,21 +566,15 @@ test_get_chunk_info_highest_v18(hid_t fapl) n = 0; for(ii = START_CHK_X; ii < END_CHK_X; ii++) for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, n++) { - -#ifdef H5_HAVE_FILTER_DEFLATE - /* Set chunk size to the compressed chunk size and the chunk point - to the compressed data chunk */ - chunk_size = (hsize_t)z_dst_nbytes; -#endif /* end H5_HAVE_FILTER_DEFLATE */ offset[0] = ii * CHUNK_NX; offset[1] = jj * CHUNK_NY; - ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, chunk_size, (void*)outbuf); + ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, chunk_size, (void*)inbuf); if(ret < 0) TEST_ERROR } - /* Free the read buffer */ - if(outbuf) - HDfree(outbuf); + /* Free the input buffer */ + if(inbuf) + HDfree(inbuf); if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0) TEST_ERROR -- cgit v0.12 From b04e1ad058fd98fc0b303586dd5f6f19aa645ed0 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 25 Sep 2019 16:21:23 -0500 Subject: Update develop branch version to 1.13.0 after creation of hdf5_1_12 branch. --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/cmake/scripts/HDF5config.cmake | 2 +- configure.ac | 2 +- java/src/hdf/hdf5lib/H5.java | 4 ++-- java/test/TestH5.java | 4 ++-- release_docs/RELEASE.txt | 2 +- src/H5public.h | 6 +++--- .../testfiles/h5repack_layout.h5-plugin_version_test.ddl | 14 +++++++------- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.txt b/README.txt index 64f1345..88f1df0 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.6 currently under development +HDF5 version 1.13.0 currently under development ------------------------------------------------------------------------------ Please refer to the release_docs/INSTALL file for installation instructions. diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 14ca90c..71db7f6 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.11.6" +PROJECT_NUMBER = "1.13.0" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 3511d05..b5659c3 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -34,7 +34,7 @@ cmake_minimum_required (VERSION 3.10) # CTEST_SOURCE_NAME - source folder ############################################################################## -set (CTEST_SOURCE_VERSION "1.11.6") +set (CTEST_SOURCE_VERSION "1.13.0") set (CTEST_SOURCE_VERSEXT "") ############################################################################## diff --git a/configure.ac b/configure.ac index e119e0a..e40f750 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.11.6], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.13.0], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 4b563fd..adb50f1 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * exception handlers to print out the HDF-5 error stack. *
* - * @version HDF5 1.11.6
+ * @version HDF5 1.13.0
* See also: hdf.hdf5lib.HDFArray
* hdf.hdf5lib.HDF5Constants
* hdf.hdf5lib.HDF5CDataTypes
@@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 11, 6 }; + public final static int LIB_VERSION[] = { 1, 13, 0 }; public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 1dbcce3..2bee075 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -161,7 +161,7 @@ public class TestH5 { */ @Test public void testH5get_libversion() { - int libversion[] = { 1, 11, 6 }; + int libversion[] = { 1, 13, 0 }; try { H5.H5get_libversion(libversion); @@ -200,7 +200,7 @@ public class TestH5 { */ @Test public void testH5check_version() { - int majnum = 1, minnum = 11, relnum = 6; + int majnum = 1, minnum = 13, relnum = 0; try { H5.H5check_version(majnum, minnum, relnum); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index eb47648..f9547f3 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.6 currently under development +HDF5 version 1.13.0 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index b79fcfb..8021027 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -95,11 +95,11 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ -#define H5_VERS_MINOR 11 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 6 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_MINOR 13 /* For minor interface/format changes */ +#define H5_VERS_RELEASE 0 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.11.6" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.13.0" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index 3ff2170..eeb0f2d 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 6 } + PARAMS { 9 1 13 0 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 6 } + PARAMS { 9 1 13 0 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 6 } + PARAMS { 9 1 13 0 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 6 } + PARAMS { 9 1 13 0 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 6 } + PARAMS { 9 1 13 0 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 6 } + PARAMS { 9 1 13 0 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 6 } + PARAMS { 9 1 13 0 } } } FILLVALUE { -- cgit v0.12 From b2f52d0b07083fd3c5a84252bb7a982342a6b063 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 25 Sep 2019 17:28:17 -0500 Subject: Update versioning to next major version --- CMakeLists.txt | 17 +- bin/make_vers | 4 +- bin/release | 6 +- c++/src/H5FaccProp.cpp | 12 + config/cmake/H5pubconf.h.in | 3 + config/cmake/HDF5_Examples.cmake.in | 2 +- config/cmake/scripts/HDF5config.cmake | 4 +- config/cmake/scripts/HDF5options.cmake | 2 +- configure.ac | 16 +- java/src/hdf/hdf5lib/HDF5Constants.java | 3 + java/src/jni/h5Constants.c | 2 + release_docs/README_HDF5_CMake | 12 +- src/H5Aint.c | 425 +++++++-------- src/H5Dlayout.c | 49 +- src/H5Fpublic.h | 81 +-- src/H5Fsuper.c | 137 ++--- src/H5Ofill.c | 207 +++---- src/H5Ofsinfo.c | 93 ++-- src/H5Oint.c | 693 ++++++++++++------------ src/H5Opline.c | 343 ++++++------ src/H5S.c | 629 ++++++++++----------- src/H5Shyper.c | 429 +++++++-------- src/H5Spoint.c | 165 +++--- src/H5T.c | 139 ++--- src/H5trace.c | 14 +- test/h5test.c | 3 +- test/tfile.c | 1 + tools/src/h5repack/h5repack_main.c | 3 +- tools/test/h5repack/testfiles/h5repack-help.txt | 3 +- 29 files changed, 1777 insertions(+), 1720 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38ec775..7ae0833 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -646,9 +646,9 @@ if (H5_HAVE_PARALLEL) endif () endif () -#option (DEFAULT_API_VERSION "Enable v1.12 API (v16, v18, v110, v112)" "v112") -set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)") -set_property (CACHE DEFAULT_API_VERSION PROPERTY STRINGS v16 v18 v110 v112) +#option (DEFAULT_API_VERSION "Enable v1.14 API (v16, v18, v110, v112, v114)" "v114") +set (DEFAULT_API_VERSION "v114" CACHE STRING "Enable v1.14 API (v16, v18, v110, v112, v114)") +set_property (CACHE DEFAULT_API_VERSION PROPERTY STRINGS v16 v18 v110 v112 v114) #----------------------------------------------------------------------------- # Option to use 1.6.x API #----------------------------------------------------------------------------- @@ -685,6 +685,17 @@ if (DEFAULT_API_VERSION MATCHES "v112") endif () #----------------------------------------------------------------------------- +# Option to use 1.14.x API +#----------------------------------------------------------------------------- +if (NOT DEFAULT_API_VERSION) + set (DEFAULT_API_VERSION "v114") +endif () +set (H5_USE_114_API_DEFAULT 0) +if (DEFAULT_API_VERSION MATCHES "v114") + set (H5_USE_114_API_DEFAULT 1) +endif () + +#----------------------------------------------------------------------------- # Include user macros #----------------------------------------------------------------------------- include (UserMacros.cmake) diff --git a/bin/make_vers b/bin/make_vers index 4de2dbd..1ea1402 100755 --- a/bin/make_vers +++ b/bin/make_vers @@ -7,8 +7,8 @@ require 5.003; # is added (like support for 1.4, etc), the min_sup_idx parameter will # need to be decremented. - QAK) -# Max. library "index" (0 = v1.0, 1 = 1.2, 2 = 1.4, 3 = 1.6, 4 = 1.8, 5 = 1.10, 6 = 1.12, etc) -$max_idx = 6; +# Max. library "index" (0 = v1.0, 1 = 1.2, 2 = 1.4, 3 = 1.6, 4 = 1.8, 5 = 1.10, 6 = 1.12, 7 = 1.14, etc) +$max_idx = 7; # Min. supported previous library version "index" (0 = v1.0, 1 = 1.2, etc) $min_sup_idx = 3; diff --git a/bin/release b/bin/release index 96c2e78..a9cf3f0 100755 --- a/bin/release +++ b/bin/release @@ -233,7 +233,7 @@ tar2cmakezip() # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmziptmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.12.4-Source.zip $cmziptmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.0-Source.zip $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmziptmpsubdir @@ -328,7 +328,7 @@ tar2cmaketgz() # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.12.4-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.0-Source.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmgztmpsubdir @@ -411,7 +411,7 @@ tar2hpccmaketgz() # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.12.4-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.14.0-Source.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index 1657351..5a478e7 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -696,10 +696,16 @@ unsigned FileAccPropList::getGcReferences() const /// Valid values of \a libver_low are as follows: /// \li \c H5F_LIBVER_EARLIEST (Default) /// \li \c H5F_LIBVER_18 +/// \li \c H5F_LIBVER_110 +/// \li \c H5F_LIBVER_112 +/// \li \c H5F_LIBVER_114 /// \li \c H5F_LIBVER_LATEST /// /// Valid values of \a libver_high are as follows: /// \li \c H5F_LIBVER_18 +/// \li \c H5F_LIBVER_110 +/// \li \c H5F_LIBVER_112 +/// \li \c H5F_LIBVER_114 /// \li \c H5F_LIBVER_LATEST (Default) /// /// For more detail, please refer to the H5Pset_libver_bounds API in @@ -729,10 +735,16 @@ void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libv /// values: /// \li \c H5F_LIBVER_EARLIEST /// \li \c H5F_LIBVER_18 +/// \li \c H5F_LIBVER_110 +/// \li \c H5F_LIBVER_112 +/// \li \c H5F_LIBVER_114 /// \li \c H5F_LIBVER_LATEST /// /// and \a libver_high: /// \li \c H5F_LIBVER_18 +/// \li \c H5F_LIBVER_110 +/// \li \c H5F_LIBVER_112 +/// \li \c H5F_LIBVER_114 /// \li \c H5F_LIBVER_LATEST // Programmer Binh-Minh Ribler - March, 2015 //-------------------------------------------------------------------------- diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 120c023..0836168 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -720,6 +720,9 @@ /* Define using v1.12 public API symbols by default */ #cmakedefine H5_USE_112_API_DEFAULT @H5_USE_112_API_DEFAULT@ +/* Define using v1.14 public API symbols by default */ +#cmakedefine H5_USE_114_API_DEFAULT @H5_USE_114_API_DEFAULT@ + /* Define if a memory checking tool will be used on the library, to cause library to be very picky about memory operations and also disable the internal free list manager code. */ diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index bac174a..042b17b 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -74,7 +74,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.12.4-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.14.0-Source") #endif() ############################################################################################################### diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index b5659c3..ad5fbdc 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -40,9 +40,9 @@ set (CTEST_SOURCE_VERSEXT "") ############################################################################## # handle input parameters to script. #BUILD_GENERATOR - which CMake generator to use, required -#INSTALLDIR - HDF5-1.10.0 root folder +#INSTALLDIR - HDF5-1.13.0 root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo -#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 +#CTEST_SOURCE_NAME - name of source folder; HDF5-1.13.0 #MODEL - CDash group name #HPC - run alternate configurations for HPC machines; sbatch, bsub, raybsub, qsub #MPI - enable MPI diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 738c6c4..d1c14e9 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -67,7 +67,7 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") #### package examples #### -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.12.4-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.14.0-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") ############################################################################################# ### enable parallel builds diff --git a/configure.ac b/configure.ac index e40f750..3d0765b 100644 --- a/configure.ac +++ b/configure.ac @@ -943,7 +943,7 @@ fi AM_CONDITIONAL([FORTRAN_SHARED_CONDITIONAL], [test "X$H5_FORTRAN_SHARED" = "Xyes"]) ## ---------------------------------------------------------------------- -## Check if they would like to disable building tests +## Check if they would like to disable building tests ## ## This needs to be exposed for the library info file. @@ -3390,10 +3390,10 @@ esac AC_SUBST([DEFAULT_API_VERSION]) AC_MSG_CHECKING([which version of public symbols to use by default]) AC_ARG_WITH([default-api-version], - [AS_HELP_STRING([--with-default-api-version=(v16|v18|v110|v112)], + [AS_HELP_STRING([--with-default-api-version=(v16|v18|v110|v112|v114)], [Specify default release version of public symbols - [default=v112]])],, - [withval=v112]) + [default=v114]])],, + [withval=v114]) if test "X$withval" = "Xv16"; then AC_MSG_RESULT([v16]) @@ -3415,6 +3415,11 @@ elif test "X$withval" = "Xv112"; then DEFAULT_API_VERSION=v112 AC_DEFINE([USE_112_API_DEFAULT], [1], [Define using v1.12 public API symbols by default]) +elif test "X$withval" = "Xv114"; then + AC_MSG_RESULT([v114]) + DEFAULT_API_VERSION=v114 + AC_DEFINE([USE_114_API_DEFAULT], [1], + [Define using v1.14 public API symbols by default]) else AC_MSG_ERROR([invalid version of public symbols given]) fi @@ -3424,7 +3429,7 @@ fi ## if the user insists on doing this via the --enable-unsupported configure ## flag, we'll let them. if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then - if test "X${DEFAULT_API_VERSION}" != "Xv112" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then + if test "X${DEFAULT_API_VERSION}" != "Xv114" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then AC_MSG_ERROR([Removing old public API symbols not allowed when using them as default public API symbols. Use --enable-unsupported to override this error.]) fi fi @@ -3690,6 +3695,7 @@ AC_CONFIG_FILES([src/libhdf5.settings test/test_vol_plugin.sh testpar/Makefile testpar/testpflush.sh + testpar/test_cache_image.sh tools/Makefile tools/lib/Makefile tools/libtest/Makefile diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 2e80f2e..f5be38d 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -218,6 +218,7 @@ public class HDF5Constants { public static final int H5F_LIBVER_V18 = H5F_LIBVER_V18(); public static final int H5F_LIBVER_V110 = H5F_LIBVER_V110(); public static final int H5F_LIBVER_V112 = H5F_LIBVER_V112(); + public static final int H5F_LIBVER_V114 = H5F_LIBVER_V114(); public static final int H5F_LIBVER_NBOUNDS = H5F_LIBVER_NBOUNDS(); public static final int H5F_LIBVER_LATEST = H5F_LIBVER_LATEST(); public static final int H5F_OBJ_ALL = H5F_OBJ_ALL(); @@ -1059,6 +1060,8 @@ public class HDF5Constants { private static native final int H5F_LIBVER_V112(); + private static native final int H5F_LIBVER_V114(); + private static native final int H5F_LIBVER_NBOUNDS(); private static native final int H5F_LIBVER_LATEST(); diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 9f52b3c..69adebd 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -405,6 +405,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V110(JNIEnv *env, jclass cls){return JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V112(JNIEnv *env, jclass cls){return H5F_LIBVER_V112;} JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V114(JNIEnv *env, jclass cls){return H5F_LIBVER_V114;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1NBOUNDS(JNIEnv *env, jclass cls){return H5F_LIBVER_NBOUNDS;} JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;} diff --git a/release_docs/README_HDF5_CMake b/release_docs/README_HDF5_CMake index 1b02f0c..5737624 100644 --- a/release_docs/README_HDF5_CMake +++ b/release_docs/README_HDF5_CMake @@ -1,21 +1,21 @@ -This tar file contains +This tar file contains build-unix.sh script to build HDF5 with CMake on unix machines build-unix-hpc.sh script to build HDF5 with CMake on unix machines and run tests with batch scripts (sbatch). - CTestScript.cmake + CTestScript.cmake HDF5config.cmake CMake scripts for building HDF5 HDF5options.cmake - hdf5-1.11.6 HDF5 1.11.6 source + hdf5-1.13.0 HDF5 1.13.0 source SZip.tar.gz source for building SZIP ZLib.tar.gz source for building ZLIB For more information about building HDF5 with CMake, see USING_HDF5_CMake.txt in -hdf5-1.11.6/release_docs, or +hdf5-1.13.0/release_docs, or https://portal.hdfgroup.org/display/support/Building+HDF5+with+CMake. -For more information about building HDF5 with CMake on HPC machines, including -cross compiling on Cray XC40, see README_HPC in hdf5-1.11.6/release_docs. +For more information about building HDF5 with CMake on HPC machines, including +cross compiling on Cray XC40, see README_HPC in hdf5-1.13.0/release_docs. diff --git a/src/H5Aint.c b/src/H5Aint.c index 808d9b3..c1c0078 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Aint.c - * Dec 18 2006 - * Quincey Koziol + * Created: H5Aint.c + * Dec 18 2006 + * Quincey Koziol * - * Purpose: Internal routines for managing attributes. + * Purpose: Internal routines for managing attributes. * *------------------------------------------------------------------------- */ @@ -27,7 +27,7 @@ /****************/ #include "H5Amodule.h" /* This source code file is part of the H5A module */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -109,6 +109,7 @@ const unsigned H5O_attr_ver_bounds[] = { H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V110 */ + H5O_ATTR_VERSION_3, /* H5F_LIBVER_V112 */ H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; @@ -121,19 +122,19 @@ const unsigned H5O_attr_ver_bounds[] = { /* Local Variables */ /*******************/ -typedef H5A_t* H5A_t_ptr; +typedef H5A_t* H5A_t_ptr; H5FL_SEQ_DEFINE(H5A_t_ptr); - + /*------------------------------------------------------------------------- - * Function: H5A__create + * Function: H5A__create * * Purpose: This is the guts of creating an attribute. * * Return: Attribute structure on success, NULL on Failure. * - * Programmer: Quincey Koziol - * April 2, 1998 + * Programmer: Quincey Koziol + * April 2, 1998 * *------------------------------------------------------------------------- */ @@ -141,11 +142,11 @@ H5A_t * H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, const H5S_t *space, hid_t acpl_id) { - H5A_t *attr = NULL; /* Attribute created */ - hssize_t snelmts; /* elements in attribute */ - size_t nelmts; /* elements in attribute */ + H5A_t *attr = NULL; /* Attribute created */ + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute */ htri_t exists; /* Whether attribute exists */ - H5A_t *ret_value = NULL; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr) @@ -286,16 +287,16 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__create() */ - + /*------------------------------------------------------------------------- - * Function: H5A__create_by_name + * Function: H5A__create_by_name * - * Purpose: Create an attribute on object, according to it's name + * Purpose: Create an attribute on object, according to it's name * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * December 6, 2017 + * Programmer: Quincey Koziol + * December 6, 2017 * *------------------------------------------------------------------------- */ @@ -304,8 +305,8 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr const H5T_t *type, const H5S_t *space, hid_t acpl_id) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ @@ -347,9 +348,9 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__create_by_name() */ - + /*------------------------------------------------------------------------- - * Function: H5A__open_common + * Function: H5A__open_common * * Purpose: * Finishes initializing an attributes the open @@ -361,8 +362,8 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * December 18, 2006 + * Programmer: Quincey Koziol + * December 18, 2006 * *------------------------------------------------------------------------- */ @@ -404,7 +405,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_common() */ - + /*------------------------------------------------------------------------- * Function: H5A__open * @@ -412,8 +413,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 9, 2017 + * Programmer: Quincey Koziol + * December 9, 2017 * *------------------------------------------------------------------------- */ @@ -449,16 +450,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open() */ - + /*------------------------------------------------------------------------- - * Function: H5A__open_by_idx + * Function: H5A__open_by_idx * - * Purpose: Open an attribute according to its index order + * Purpose: Open an attribute according to its index order * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * April 2, 1998 + * Programmer: Quincey Koziol + * April 2, 1998 * *------------------------------------------------------------------------- */ @@ -467,8 +468,8 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type H5_iter_order_t order, hsize_t n) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ @@ -513,7 +514,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: H5A__open_by_name * @@ -521,8 +522,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 11, 2006 + * Programmer: Quincey Koziol + * December 11, 2006 * *------------------------------------------------------------------------- */ @@ -530,8 +531,8 @@ H5A_t * H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ @@ -577,7 +578,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_name() */ - + /*-------------------------------------------------------------------------- NAME H5A__read @@ -597,16 +598,16 @@ done: herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) { - uint8_t *tconv_buf = NULL; /* datatype conv buffer*/ - uint8_t *bkg_buf = NULL; /* background buffer */ - hssize_t snelmts; /* elements in attribute */ - size_t nelmts; /* elements in attribute*/ - H5T_path_t *tpath = NULL; /* type conversion info */ - hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/ - size_t src_type_size; /* size of source type */ - size_t dst_type_size; /* size of destination type */ - size_t buf_size; /* desired buffer size */ - herr_t ret_value = SUCCEED; + uint8_t *tconv_buf = NULL; /* datatype conv buffer*/ + uint8_t *bkg_buf = NULL; /* background buffer */ + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute*/ + H5T_path_t *tpath = NULL; /* type conversion info */ + hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/ + size_t src_type_size; /* size of source type */ + size_t dst_type_size; /* size of destination type */ + size_t buf_size; /* desired buffer size */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) @@ -675,12 +676,12 @@ done: if(tconv_buf) tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__read() */ - + /*-------------------------------------------------------------------------- NAME H5A__write @@ -700,17 +701,17 @@ done: herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) { - uint8_t *tconv_buf = NULL; /* datatype conv buffer */ + uint8_t *tconv_buf = NULL; /* datatype conv buffer */ hbool_t tconv_owned = FALSE; /* Whether the datatype conv buffer is owned by attribute */ - uint8_t *bkg_buf = NULL; /* temp conversion buffer */ - hssize_t snelmts; /* elements in attribute */ - size_t nelmts; /* elements in attribute */ - H5T_path_t *tpath = NULL; /* conversion information*/ - hid_t src_id = -1, dst_id = -1;/* temporary type atoms */ - size_t src_type_size; /* size of source type */ - size_t dst_type_size; /* size of destination type*/ - size_t buf_size; /* desired buffer size */ - herr_t ret_value = SUCCEED; + uint8_t *bkg_buf = NULL; /* temp conversion buffer */ + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute */ + H5T_path_t *tpath = NULL; /* conversion information*/ + hid_t src_id = -1, dst_id = -1;/* temporary type atoms */ + size_t src_type_size; /* size of source type */ + size_t dst_type_size; /* size of destination type*/ + size_t buf_size; /* desired buffer size */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) @@ -794,7 +795,7 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__write() */ - + /*-------------------------------------------------------------------------- NAME H5A__get_name @@ -815,7 +816,7 @@ ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) { size_t copy_len, nbytes; - ssize_t ret_value = -1; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -840,7 +841,7 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) FUNC_LEAVE_NOAPI(ret_value) } /* H5A__get_name() */ - + /*------------------------------------------------------------------------- * Function: H5A_get_space * @@ -877,7 +878,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_get_space() */ - + /*------------------------------------------------------------------------- * Function: H5A__get_type * @@ -885,7 +886,7 @@ done: * * Return: Success: A valid ID for the datatype of an attribute * - * Failure: H5I_INVALID_HID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -940,7 +941,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_type() */ - + /*-------------------------------------------------------------------------- NAME H5A__get_create_plist @@ -972,7 +973,7 @@ H5A__get_create_plist(H5A_t* attr) /* Create the property list object to return */ if((new_plist_id = H5P_copy_plist(plist, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy attribute creation properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy attribute creation properties") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_plist_id))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") @@ -986,16 +987,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_create_plist() */ - + /*------------------------------------------------------------------------- - * Function: H5A__get_info + * Function: H5A__get_info * - * Purpose: Retrieve information about an attribute. + * Purpose: Retrieve information about an attribute. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * February 6, 2007 * *------------------------------------------------------------------------- @@ -1027,7 +1028,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_info() */ - + /*------------------------------------------------------------------------- * Function: H5A__copy * @@ -1037,17 +1038,17 @@ done: * * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Programmer: Robb Matzke + * Thursday, December 4, 1997 * *------------------------------------------------------------------------- */ H5A_t * H5A__copy(H5A_t *_new_attr, const H5A_t *old_attr) { - H5A_t *new_attr = NULL; + H5A_t *new_attr = NULL; hbool_t allocated_attr = FALSE; /* Whether the attribute was allocated */ - H5A_t *ret_value = NULL; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1090,7 +1091,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__copy() */ - + /*------------------------------------------------------------------------- * Function: H5A__shared_free * @@ -1142,7 +1143,7 @@ H5A__shared_free(H5A_t *attr) FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__shared_free() */ - + /*------------------------------------------------------------------------- * Function: H5A__close_cb * @@ -1174,7 +1175,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__close_cb() */ - + /*------------------------------------------------------------------------- * Function: H5A__close * @@ -1182,8 +1183,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Monday, December 8, 1997 + * Programmer: Robb Matzke + * Monday, December 8, 1997 * *------------------------------------------------------------------------- */ @@ -1225,18 +1226,18 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__close() */ - + /*------------------------------------------------------------------------- - * Function: H5A_oloc + * Function: H5A_oloc * - * Purpose: Return the object location for an attribute. It's the - * object location for the object to which the attribute - * belongs, not the attribute itself. + * Purpose: Return the object location for an attribute. It's the + * object location for the object to which the attribute + * belongs, not the attribute itself. * - * Return: Success: Ptr to entry - * Failure: NULL + * Return: Success: Ptr to entry + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, August 6, 1998 * *------------------------------------------------------------------------- @@ -1257,18 +1258,18 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_oloc() */ - + /*------------------------------------------------------------------------- - * Function: H5A_nameof + * Function: H5A_nameof * - * Purpose: Return the group hier. path for an attribute. It's the - * group hier. path for the object to which the attribute - * belongs, not the attribute itself. + * Purpose: Return the group hier. path for an attribute. It's the + * group hier. path for the object to which the attribute + * belongs, not the attribute itself. * - * Return: Success: Ptr to entry - * Failure: NULL + * Return: Success: Ptr to entry + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, September 12, 2005 * *------------------------------------------------------------------------- @@ -1289,7 +1290,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_nameof() */ - + /*------------------------------------------------------------------------- * Function: H5A_type * @@ -1319,7 +1320,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_type() */ - + /*------------------------------------------------------------------------- * Function: H5A__exists_by_name * @@ -1327,7 +1328,7 @@ done: * * Return: TRUE/FALSE/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 1, 2007 * *------------------------------------------------------------------------- @@ -1336,10 +1337,10 @@ htri_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - htri_t ret_value = FAIL; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1365,18 +1366,18 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__exists_by_name() */ - + /*------------------------------------------------------------------------- - * Function: H5A__compact_build_table_cb + * Function: H5A__compact_build_table_cb * - * Purpose: Object header iterator callback routine to copy attribute + * Purpose: Object header iterator callback routine to copy attribute * into table. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 18 2006 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 18 2006 * * Modification:Raymond Lu * 24 June 2008 @@ -1426,9 +1427,9 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__compact_build_table_cb() */ - + /*------------------------------------------------------------------------- - * Function: H5A__compact_build_table + * Function: H5A__compact_build_table * * Purpose: Builds a table containing a sorted list of attributes for * an object @@ -1438,8 +1439,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18, 2006 + * Programmer: Quincey Koziol + * Dec 18, 2006 * *------------------------------------------------------------------------- */ @@ -1489,19 +1490,19 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__compact_build_table() */ - + /*------------------------------------------------------------------------- - * Function: H5A__dense_build_table_cb + * Function: H5A__dense_build_table_cb * - * Purpose: Callback routine for building table of attributes from dense + * Purpose: Callback routine for building table of attributes from dense * attribute storage. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 11 2006 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -1533,7 +1534,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_build_table_cb() */ - + /*------------------------------------------------------------------------- * Function: H5A__dense_build_table * @@ -1546,8 +1547,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11, 2006 + * Programmer: Quincey Koziol + * Dec 11, 2006 * *------------------------------------------------------------------------- */ @@ -1618,22 +1619,22 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_build_table() */ - + /*------------------------------------------------------------------------- - * Function: H5A__attr_cmp_name_inc + * Function: H5A__attr_cmp_name_inc * - * Purpose: Callback routine for comparing two attribute names, in + * Purpose: Callback routine for comparing two attribute names, in * increasing alphabetic order * - * Return: An integer less than, equal to, or greater than zero if the + * Return: An integer less than, equal to, or greater than zero if the * first argument is considered to be respectively less than, * equal to, or greater than the second. If two members compare * as equal, their order in the sorted array is undefined. * (i.e. same as strcmp()) * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 11 2006 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -1646,22 +1647,22 @@ H5A__attr_cmp_name_inc(const void *attr1, const void *attr2) (*(const H5A_t * const *)attr2)->shared->name)) } /* end H5A__attr_cmp_name_inc() */ - + /*------------------------------------------------------------------------- - * Function: H5A__attr_cmp_name_dec + * Function: H5A__attr_cmp_name_dec * - * Purpose: Callback routine for comparing two attribute names, in + * Purpose: Callback routine for comparing two attribute names, in * decreasing alphabetic order * - * Return: An integer less than, equal to, or greater than zero if the + * Return: An integer less than, equal to, or greater than zero if the * second argument is considered to be respectively less than, * equal to, or greater than the first. If two members compare * as equal, their order in the sorted array is undefined. * (i.e. opposite of strcmp()) * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 8 2007 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Feb 8 2007 * *------------------------------------------------------------------------- */ @@ -1674,21 +1675,21 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2) (*(const H5A_t * const *)attr1)->shared->name)) } /* end H5A__attr_cmp_name_dec() */ - + /*------------------------------------------------------------------------- - * Function: H5A__attr_cmp_corder_inc + * Function: H5A__attr_cmp_corder_inc * - * Purpose: Callback routine for comparing two attributes, in + * Purpose: Callback routine for comparing two attributes, in * increasing creation order * - * Return: An integer less than, equal to, or greater than zero if the + * Return: An integer less than, equal to, or greater than zero if the * first argument is considered to be respectively less than, * equal to, or greater than the second. If two members compare * as equal, their order in the sorted array is undefined. * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 8 2007 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Feb 8 2007 * *------------------------------------------------------------------------- */ @@ -1709,21 +1710,21 @@ H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2) FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__attr_cmp_corder_inc() */ - + /*------------------------------------------------------------------------- - * Function: H5A__attr_cmp_corder_dec + * Function: H5A__attr_cmp_corder_dec * - * Purpose: Callback routine for comparing two attributes, in + * Purpose: Callback routine for comparing two attributes, in * decreasing creation order * - * Return: An integer less than, equal to, or greater than zero if the + * Return: An integer less than, equal to, or greater than zero if the * second argument is considered to be respectively less than, * equal to, or greater than the first. If two members compare * as equal, their order in the sorted array is undefined. * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 8 2007 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Feb 8 2007 * *------------------------------------------------------------------------- */ @@ -1744,17 +1745,17 @@ H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2) FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__attr_cmp_corder_dec() */ - + /*------------------------------------------------------------------------- - * Function: H5A__attr_sort_table + * Function: H5A__attr_sort_table * * Purpose: Sort table containing a list of attributes for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * Dec 11, 2006 + * Programmer: Quincey Koziol + * Dec 11, 2006 * *------------------------------------------------------------------------- */ @@ -1789,7 +1790,7 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5A__attr_sort_table() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_iterate_table * @@ -1798,8 +1799,8 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18, 2006 + * Programmer: Quincey Koziol + * Dec 18, 2006 * *------------------------------------------------------------------------- */ @@ -1871,7 +1872,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__attr_iterate_table() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_release_table * @@ -1879,15 +1880,15 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11, 2006 + * Programmer: Quincey Koziol + * Dec 11, 2006 * *------------------------------------------------------------------------- */ herr_t H5A__attr_release_table(H5A_attr_table_t *atable) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1912,7 +1913,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__attr_release_table() */ - + /*------------------------------------------------------------------------- * Function: H5A__get_ainfo * @@ -1943,11 +1944,11 @@ H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo) /* Check if the "attribute info" message exists */ if((ret_value = H5O_msg_exists_oh(oh, H5O_AINFO_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "unable to check object header") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "unable to check object header") if(ret_value > 0) { /* Retrieve the "attribute info" structure */ if(NULL == H5O_msg_read_oh(f, oh, H5O_AINFO_ID, ainfo)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't read AINFO message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't read AINFO message") /* Check if we don't know how many attributes there are */ if(ainfo->nattrs == HSIZET_MAX) { @@ -1976,7 +1977,7 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5A__get_ainfo() */ - + /*------------------------------------------------------------------------- * Function: H5A__set_version * @@ -2038,7 +2039,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__set_version() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_copy_file * @@ -2069,11 +2070,11 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s hid_t tid_mem = -1; /* Datatype ID for memory datatype */ void *buf = NULL; /* Buffer for copying data */ void *reclaim_buf = NULL; /* Buffer for reclaiming data */ - void *bkg_buf = NULL; /* Background buffer */ + void *bkg_buf = NULL; /* Background buffer */ hid_t buf_sid = -1; /* ID for buffer dataspace */ - hssize_t sdst_nelmts; /* # of elements in destination attribute (signed) */ - size_t dst_nelmts; /* # of elements in destination attribute */ - size_t dst_dt_size; /* Size of destination attribute datatype */ + hssize_t sdst_nelmts; /* # of elements in destination attribute (signed) */ + size_t dst_nelmts; /* # of elements in destination attribute */ + size_t dst_dt_size; /* Size of destination attribute datatype */ H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -2248,10 +2249,10 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s H5MM_memcpy(buf, attr_src->shared->data, attr_src->shared->data_size); - /* Allocate background memory */ - if(H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst)) - if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed") + /* Allocate background memory */ + if(H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst)) + if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed") /* Convert from source file to memory */ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0) @@ -2259,9 +2260,9 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s H5MM_memcpy(reclaim_buf, buf, buf_size); - /* Set background buffer to all zeros */ - if(bkg_buf) - HDmemset(bkg_buf, 0, buf_size); + /* Set background buffer to all zeros */ + if(bkg_buf) + HDmemset(bkg_buf, 0, buf_size); /* Convert from memory to destination file */ if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0) @@ -2321,7 +2322,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__attr_copy_file() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_post_copy_file * @@ -2422,7 +2423,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__attr_post_copy_file() */ - + /*------------------------------------------------------------------------- * Function: H5A__dense_post_copy_file_cb * @@ -2480,7 +2481,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_post_copy_file_cb() */ - + /*------------------------------------------------------------------------- * Function: H5A__dense_post_copy_file_all * @@ -2527,7 +2528,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_post_copy_file_all */ - + /*------------------------------------------------------------------------- * Function: H5A__rename_by_name * @@ -2535,7 +2536,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * February 20, 2007 * *------------------------------------------------------------------------- @@ -2545,10 +2546,10 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na const char *new_attr_name) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2577,7 +2578,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__rename_by_name() */ - + /*------------------------------------------------------------------------- * Function: H5A__iterate_common * @@ -2585,7 +2586,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * December 6, 2017 * *------------------------------------------------------------------------- @@ -2612,7 +2613,7 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_common() */ - + /*------------------------------------------------------------------------- * Function: H5A__iterate * @@ -2677,7 +2678,7 @@ done: } /* end H5A__iterate() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: H5A__iterate_old * @@ -2685,7 +2686,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * December 6, 2017 * *------------------------------------------------------------------------- @@ -2719,15 +2720,15 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, } /* H5A__iterate_old() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- - * Function: H5A__delete_by_name + * Function: H5A__delete_by_name * * Purpose: Private version of H5Adelete_by_name * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * December 6, 2017 * *------------------------------------------------------------------------- @@ -2736,8 +2737,8 @@ herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2765,15 +2766,15 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_name() */ - + /*------------------------------------------------------------------------- - * Function: H5A__delete_by_idx + * Function: H5A__delete_by_idx * * Purpose: Private version of H5Adelete_by_idx * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * December 6, 2017 * *------------------------------------------------------------------------- @@ -2783,8 +2784,8 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty H5_iter_order_t order, hsize_t n) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index fb28489..b882578 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -51,6 +51,7 @@ const unsigned H5O_layout_ver_bounds[] = { H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */ H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */ + H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V112 */ H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; @@ -65,7 +66,7 @@ const unsigned H5O_layout_ver_bounds[] = { - + /*------------------------------------------------------------------------- * Function: H5D__layout_set_io_ops * @@ -82,7 +83,7 @@ const unsigned H5O_layout_ver_bounds[] = { herr_t H5D__layout_set_io_ops(const H5D_t *dataset) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -152,7 +153,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_set_io_ops() */ - + /*------------------------------------------------------------------------- * Function: H5D__layout_meta_size * @@ -283,7 +284,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_meta_size() */ - + /*------------------------------------------------------------------------- * Function: H5D__layout_set_version * @@ -321,7 +322,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_set_version() */ - + /*------------------------------------------------------------------------- * Function: H5D__layout_set_latest_indexing * @@ -335,7 +336,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, +H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, const H5D_dcpl_cache_t *dcpl_cache) { herr_t ret_value = SUCCEED; /* Return value */ @@ -361,9 +362,9 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, if(ndims > 0) { hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */ hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */ - unsigned unlim_count = 0; /* Count of unlimited max. dimensions */ + unsigned unlim_count = 0; /* Count of unlimited max. dimensions */ hbool_t single = TRUE; /* Fulfill single chunk indexing */ - unsigned u; /* Local index variable */ + unsigned u; /* Local index variable */ /* Query the dataspace's dimensions */ if(H5S_get_simple_extent_dims(space, cur_dims, max_dims) < 0) @@ -417,7 +418,7 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE; layout->storage.u.chunk.ops = H5D_COPS_SINGLE; } /* end if */ - else if(!dcpl_cache->pline.nused && + else if(!dcpl_cache->pline.nused && dcpl_cache->fill.alloc_time == H5D_ALLOC_TIME_EARLY) { /* Set the chunk index type to "none" Index */ @@ -445,7 +446,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_set_latest_indexing() */ - + /*------------------------------------------------------------------------- * Function: H5D__layout_oh_create * @@ -586,17 +587,17 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__layout_oh_create() */ - + /*------------------------------------------------------------------------- - * Function: H5D__layout_oh_read + * Function: H5D__layout_oh_read * - * Purpose: Read layout/pline/efl information for dataset + * Purpose: Read layout/pline/efl information for dataset * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 + * Programmer: Quincey Koziol + * Monday, July 27, 2009 * *------------------------------------------------------------------------- */ @@ -680,17 +681,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_oh_read() */ - + /*------------------------------------------------------------------------- - * Function: H5D__layout_oh_write + * Function: H5D__layout_oh_write * - * Purpose: Write layout information for dataset + * Purpose: Write layout information for dataset * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 + * Programmer: Quincey Koziol + * Monday, July 27, 2009 * *------------------------------------------------------------------------- */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index dd794e4..8338fb2 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -47,13 +47,13 @@ * We're assuming that these constants are used rather early in the hdf5 * session. */ -#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /*absence of rdwr => rd-only */ -#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /*open for read and write */ -#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /*overwrite existing files */ -#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /*fail if file already exists*/ +#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /*absence of rdwr => rd-only */ +#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /*open for read and write */ +#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /*overwrite existing files */ +#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /*fail if file already exists*/ /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ -#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /*create non-existing files */ -#define H5F_ACC_SWMR_WRITE (H5CHECK 0x0020u) /*indicate that this file is +#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /*create non-existing files */ +#define H5F_ACC_SWMR_WRITE (H5CHECK 0x0020u) /*indicate that this file is * open for writing in a * single-writer/multi-reader (SWMR) * scenario. Note that the @@ -62,7 +62,7 @@ * with RDONLY access, and use * the special "SWMR_READ" access * flag. */ -#define H5F_ACC_SWMR_READ (H5CHECK 0x0040u) /*indicate that this file is +#define H5F_ACC_SWMR_READ (H5CHECK 0x0040u) /*indicate that this file is * open for reading in a * single-writer/multi-reader (SWMR) * scenario. Note that the @@ -73,15 +73,15 @@ /* Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the * parent file. */ -#define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) /*ignore setting on lapl */ +#define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) /*ignore setting on lapl */ /* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */ -#define H5F_OBJ_FILE (0x0001u) /* File objects */ -#define H5F_OBJ_DATASET (0x0002u) /* Dataset objects */ -#define H5F_OBJ_GROUP (0x0004u) /* Group objects */ +#define H5F_OBJ_FILE (0x0001u) /* File objects */ +#define H5F_OBJ_DATASET (0x0002u) /* Dataset objects */ +#define H5F_OBJ_GROUP (0x0004u) /* Group objects */ #define H5F_OBJ_DATATYPE (0x0008u) /* Named datatype objects */ #define H5F_OBJ_ATTR (0x0010u) /* Attribute objects */ -#define H5F_OBJ_ALL (H5F_OBJ_FILE|H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR) +#define H5F_OBJ_ALL (H5F_OBJ_FILE|H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR) #define H5F_OBJ_LOCAL (0x0020u) /* Restrict search to objects opened through current file ID */ /* (as opposed to objects opened through any file ID accessing this file) */ @@ -99,20 +99,20 @@ /* The difference between a single file and a set of mounted files */ typedef enum H5F_scope_t { - H5F_SCOPE_LOCAL = 0, /*specified file handle only */ - H5F_SCOPE_GLOBAL = 1 /*entire virtual file */ + H5F_SCOPE_LOCAL = 0, /*specified file handle only */ + H5F_SCOPE_GLOBAL = 1 /*entire virtual file */ } H5F_scope_t; /* Unlimited file size for H5Pset_external() */ -#define H5F_UNLIMITED ((hsize_t)(-1L)) +#define H5F_UNLIMITED ((hsize_t)(-1L)) /* How does file close behave? * H5F_CLOSE_DEFAULT - Use the degree pre-defined by underlining VFL * H5F_CLOSE_WEAK - file closes only after all opened objects are closed * H5F_CLOSE_SEMI - if no opened objects, file is close; otherwise, file - close fails + close fails * H5F_CLOSE_STRONG - if there are opened objects, close them first, then - close file + close file */ typedef enum H5F_close_degree_t { H5F_CLOSE_DEFAULT = 0, @@ -124,19 +124,19 @@ typedef enum H5F_close_degree_t { /* Current "global" information about file */ typedef struct H5F_info2_t { struct { - unsigned version; /* Superblock version # */ - hsize_t super_size; /* Superblock size */ - hsize_t super_ext_size; /* Superblock extension size */ + unsigned version; /* Superblock version # */ + hsize_t super_size; /* Superblock size */ + hsize_t super_ext_size; /* Superblock extension size */ } super; struct { - unsigned version; /* Version # of file free space management */ - hsize_t meta_size; /* Free space manager metadata size */ - hsize_t tot_space; /* Amount of free space in the file */ + unsigned version; /* Version # of file free space management */ + hsize_t meta_size; /* Free space manager metadata size */ + hsize_t tot_space; /* Amount of free space in the file */ } free; struct { - unsigned version; /* Version # of shared object header info */ - hsize_t hdr_size; /* Shared object header message header size */ - H5_ih_info_t msgs_info; /* Shared object header message index & heap size */ + unsigned version; /* Version # of shared object header info */ + hsize_t hdr_size; /* Shared object header message header size */ + H5_ih_info_t msgs_info; /* Shared object header message index & heap size */ } sohm; } H5F_info2_t; @@ -180,10 +180,11 @@ typedef enum H5F_libver_t { H5F_LIBVER_V18 = 1, /* Use the latest v18 format for storing objects */ H5F_LIBVER_V110 = 2, /* Use the latest v110 format for storing objects */ H5F_LIBVER_V112 = 3, /* Use the latest v112 format for storing objects */ + H5F_LIBVER_V114 = 4, /* Use the latest v112 format for storing objects */ H5F_LIBVER_NBOUNDS } H5F_libver_t; -#define H5F_LIBVER_LATEST H5F_LIBVER_V112 +#define H5F_LIBVER_LATEST H5F_LIBVER_V114 /* File space handling strategy */ typedef enum H5F_fspace_strategy_t { @@ -200,16 +201,16 @@ typedef enum H5F_fspace_strategy_t { typedef enum H5F_file_space_type_t { H5F_FILE_SPACE_DEFAULT = 0, /* Default (or current) free space strategy setting */ H5F_FILE_SPACE_ALL_PERSIST = 1, /* Persistent free space managers, aggregators, virtual file driver */ - H5F_FILE_SPACE_ALL = 2, /* Non-persistent free space managers, aggregators, virtual file driver */ - /* This is the library default */ + H5F_FILE_SPACE_ALL = 2, /* Non-persistent free space managers, aggregators, virtual file driver */ + /* This is the library default */ H5F_FILE_SPACE_AGGR_VFD = 3, /* Aggregators, Virtual file driver */ - H5F_FILE_SPACE_VFD = 4, /* Virtual file driver */ - H5F_FILE_SPACE_NTYPES /* must be last */ + H5F_FILE_SPACE_VFD = 4, /* Virtual file driver */ + H5F_FILE_SPACE_NTYPES /* must be last */ } H5F_file_space_type_t; /* Data structure to report the collection of read retries for metadata items with checksum */ /* Used by public routine H5Fget_metadata_read_retry_info() */ -#define H5F_NUM_METADATA_READ_RETRY_TYPES 21 +#define H5F_NUM_METADATA_READ_RETRY_TYPES 21 typedef struct H5F_retry_info_t { unsigned nbins; uint32_t *retries[H5F_NUM_METADATA_READ_RETRY_TYPES]; @@ -227,9 +228,9 @@ extern "C" { H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id); H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, - hid_t create_plist, hid_t access_plist); + hid_t create_plist, hid_t access_plist); H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, - hid_t access_plist); + hid_t access_plist); H5_DLL hid_t H5Freopen(hid_t file_id); H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); H5_DLL herr_t H5Fclose(hid_t file_id); @@ -249,9 +250,9 @@ H5_DLL herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa); H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); H5_DLL ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len); H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, - H5AC_cache_config_t * config_ptr); + H5AC_cache_config_t * config_ptr); H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, - H5AC_cache_config_t * config_ptr); + H5AC_cache_config_t * config_ptr); H5_DLL herr_t H5Fget_mdc_hit_rate(hid_t file_id, double * hit_rate_ptr); H5_DLL herr_t H5Fget_mdc_size(hid_t file_id, size_t * max_size_ptr, @@ -292,16 +293,16 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); #ifndef H5_NO_DEPRECATED_SYMBOLS /* Macros */ -#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/ +#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/ /* Typedefs */ /* Current "global" information about file */ typedef struct H5F_info1_t { - hsize_t super_ext_size; /* Superblock extension size */ + hsize_t super_ext_size; /* Superblock extension size */ struct { - hsize_t hdr_size; /* Shared object header message header size */ - H5_ih_info_t msgs_info; /* Shared object header message index & heap size */ + hsize_t hdr_size; /* Shared object header message header size */ + H5_ih_info_t msgs_info; /* Shared object header message index & heap size */ } sohm; } H5F_info1_t; diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 5334c51..f8e8f3f 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -77,10 +77,11 @@ static const unsigned HDF5_superblock_ver_bounds[] = { HDF5_SUPERBLOCK_VERSION_DEF, /* H5F_LIBVER_EARLIEST */ HDF5_SUPERBLOCK_VERSION_2, /* H5F_LIBVER_V18 */ HDF5_SUPERBLOCK_VERSION_3, /* H5F_LIBVER_V110 */ + HDF5_SUPERBLOCK_VERSION_3, /* H5F_LIBVER_V112 */ HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; - + /*------------------------------------------------------------------------- * Function: H5F__super_ext_create * @@ -133,7 +134,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_create() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_ext_open * @@ -171,7 +172,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_open() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_ext_close * @@ -224,14 +225,14 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_close() */ - + /*------------------------------------------------------------------------- * Function: H5F__update_super_ext_driver_msg * - * Purpose: Update the superblock extension file driver info message if + * Purpose: Update the superblock extension file driver info message if * we are using a V 2 superblock. Observe that the function * is a NO-OP if the file driver info message does not exist. - * This is necessary, as the function is called whenever the + * This is necessary, as the function is called whenever the * EOA is updated, and were it to create the file driver info * message, it would find itself in an infinite recursion. * @@ -271,8 +272,8 @@ H5F__update_super_ext_driver_msg(H5F_t *f) /* Check for driver info */ H5_CHECKED_ASSIGN(driver_size, size_t, H5FD_sb_size(f->shared->lf), hsize_t); - /* Nothing to do unless there is both driver info and - * the driver info superblock extension message has + /* Nothing to do unless there is both driver info and + * the driver info superblock extension message has * already been created. */ if(driver_size > 0) { @@ -288,7 +289,7 @@ H5F__update_super_ext_driver_msg(H5F_t *f) /* Write the message to the superblock extension. * - * Note that the superblock extension and the + * Note that the superblock extension and the * file driver info message must already exist. */ drvinfo.len = driver_size; @@ -304,7 +305,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__update_super_ext_driver_msg() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_read * @@ -343,7 +344,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) FUNC_ENTER_PACKAGE_TAG(H5AC__SUPERBLOCK_TAG) /* initialize the drvinfo to NULL -- we will overwrite this if there - * is a driver information block + * is a driver information block */ f->shared->drvinfo = NULL; @@ -435,7 +436,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "can't get property list") /* Make certain we can read the fixed-size portion of the superblock */ - if(H5F__set_eoa(f, H5FD_MEM_SUPER, + if(H5F__set_eoa(f, H5FD_MEM_SUPER, (haddr_t)(H5F_SUPERBLOCK_FIXED_SIZE + H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "set end of space allocation request failed") @@ -455,12 +456,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, H5AC_SUPERBLOCK, (haddr_t)0, &udata, rw_flags))) HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock") - /* + /* * When opening a file with SWMR-write access, the library will first - * check to ensure that superblock version 3 is used. Otherwise fail + * check to ensure that superblock version 3 is used. Otherwise fail * file open. * - * Then the library will upgrade the file's low_bound depending on + * Then the library will upgrade the file's low_bound depending on * superblock version as follows: * --version 0 or 1: no change to low_bound * --version 2: upgrade low_bound to at least V18 @@ -590,8 +591,8 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * as the file can appear truncated if only part of it has been * been flushed to disk by the SWMR writer process. */ - /* The EOF check is also skipped when the private property - * H5F_ACS_SKIP_EOF_CHECK_NAME exists in the fapl. + /* The EOF check is also skipped when the private property + * H5F_ACS_SKIP_EOF_CHECK_NAME exists in the fapl. * This property is enabled by the tool h5clear with these * two options: (1) --filesize (2) --increment */ @@ -602,7 +603,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get skip EOF check value") if(H5F_INTENT(f) & H5F_ACC_SWMR_READ) { - /* + /* * When the file is opened for SWMR read access, skip the check if: * --the file is already marked for SWMR writing and * --the file has version 3 superblock for SWMR support @@ -644,10 +645,10 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) drvrinfo_udata.f = f; drvrinfo_udata.driver_addr = sblock->driver_addr; - /* extend EOA so we can read at least the fixed sized - * portion of the driver info block + /* extend EOA so we can read at least the fixed sized + * portion of the driver info block */ - if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_SUPER, sblock->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE) < 0) /* will extend eoa later if required */ + if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_SUPER, sblock->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE) < 0) /* will extend eoa later if required */ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "set end of space allocation request failed") /* Look up the driver info block */ @@ -660,7 +661,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(((rw_flags & H5AC__READ_ONLY_FLAG) == 0) && H5F_HAS_FEATURE(f, H5FD_FEAT_DIRTY_DRVRINFO_LOAD)) drvinfo_flags |= H5AC__DIRTIED_FLAG; - /* set the pin entry flag so that the driver information block + /* set the pin entry flag so that the driver information block * cache entry will be pinned in the cache. */ drvinfo_flags |= H5AC__PIN_ENTRY_FLAG; @@ -826,7 +827,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(f->shared->eoa_fsm_fsalloc != fsinfo.eoa_pre_fsm_fsalloc) f->shared->eoa_fsm_fsalloc = fsinfo.eoa_pre_fsm_fsalloc; - /* + /* * If the following two conditions are true: * (1) skipping EOF check (skip_eof_check) * (2) dropping free-space to the floor (f->shared->null_fsm_addr) @@ -838,9 +839,9 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(!skip_eof_check && !f->shared->null_fsm_addr) HDassert((!f->shared->fs_persist) || (f->shared->eoa_fsm_fsalloc != HADDR_UNDEF)); - /* + /* * A crashed file with persistent free-space managers may have - * undefined f->shared->eoa_fsm_fsalloc. + * undefined f->shared->eoa_fsm_fsalloc. * eoa_fsm_fsalloc is the final eoa which is saved in the free-space * info message's eoa_pre_fsm_fsalloc field for backward compatibility. * If the tool h5clear sets to dropping free-space to the floor @@ -856,7 +857,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * Because: * --there is no more f->shared->eoa_pre_fsm_fsalloc and * f->shared->first_alloc_dealloc - * --the check for null_fsm_addr is directly done in H5MF_settle_meta_data_fsm() + * --the check for null_fsm_addr is directly done in H5MF_settle_meta_data_fsm() * and H5MF_settle_raw_data_fsm() */ @@ -865,9 +866,9 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) f->shared->fs_addr[u] = fsinfo.fs_addr[u - 1]; /* If the following two conditions are true: - * (1) file is persisting free-space + * (1) file is persisting free-space * (2) dropping free-space to the floor (f->shared->null_fsm_addr) - * nullify the addresses of the FSMs + * nullify the addresses of the FSMs */ if(f->shared->fs_persist && f->shared->null_fsm_addr) for(u = 0; u < NELMTS(fsinfo.fs_addr); u++) @@ -882,7 +883,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ /* KLUGE ALERT!! * - * H5F__super_ext_write_msg() expects f->shared->sblock to + * H5F__super_ext_write_msg() expects f->shared->sblock to * be set -- verify that it is NULL, and then set it. * Set it back to NULL when we are done. */ @@ -919,12 +920,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* if the metadata cache image superblock extension message exists, * read its contents and pass the data on to the metadata cache. * Given this data, the cache will load and decode the metadata - * cache image block, decoded it and load its contents into the - * the cache on the test protect call. + * cache image block, decoded it and load its contents into the + * the cache on the test protect call. * - * Further, if the file is opened R/W, the metadata cache will + * Further, if the file is opened R/W, the metadata cache will * delete the metadata cache image superblock extension and free - * the cache image block. Don't do this now as f->shared + * the cache image block. Don't do this now as f->shared * is not fully setup, which complicates matters. */ @@ -975,7 +976,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ /* KLUGE ALERT!! * - * H5F__super_ext_write_msg() expects f->shared->sblock to + * H5F__super_ext_write_msg() expects f->shared->sblock to * be set -- verify that it is NULL, and then set it. * Set it back to NULL when we are done. */ @@ -1019,10 +1020,10 @@ done: if(sblock && H5AC_unprotect(f, H5AC_SUPERBLOCK, (haddr_t)0, sblock, sblock_flags) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock") - /* If we have failed, make sure no entries are left in the + /* If we have failed, make sure no entries are left in the * metadata cache, so that it can be shut down and discarded. */ - if(ret_value < 0) { + if(ret_value < 0) { /* Unpin and discard drvinfo cache entry */ if(f->shared->drvinfo) { if(H5AC_unpin_entry(f->shared->drvinfo) < 0) @@ -1048,7 +1049,7 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5F__super_read() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_init * @@ -1112,10 +1113,10 @@ H5F__super_init(H5F_t *f) if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF && f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF && f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF && - f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) + f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) non_default_fs_settings = TRUE; - /* + /* * When creating a file with write access, the library will: * -- set superblock version to 0, 1 or 2 based on feature enabled * -- no change to low_bound @@ -1124,9 +1125,9 @@ H5F__super_init(H5F_t *f) * -- set superblock version to 3 * -- upgrade low_bound to at least V110 * - * Then the library will finalize superblock version to that allowed by + * Then the library will finalize superblock version to that allowed by * low_bound if that is higher. - * Lastly, the library will check to ensure the superblock version does not + * Lastly, the library will check to ensure the superblock version does not * exceed the version allowed by high_bound. Otherwise fail file open. * * For details, please see RFC:Setting Bounds for Object Creation in HDF5 1.10.0. @@ -1136,12 +1137,12 @@ H5F__super_init(H5F_t *f) * the status_flags field in the superblock. The problem is discussed in * jira issue SWMR-79 and also in the RFC: File Format Changes in HDF5 1.10.0. * The file's low_bound is upgraded for SWMR so that the library will - * use the best format versions available in 1.10. - * Due to the possible upgrade, the fapl returned from H5Fget_access_plist() + * use the best format versions available in 1.10. + * Due to the possible upgrade, the fapl returned from H5Fget_access_plist() * might indicate a low_bound higher than what the user originally set. */ - /* + /* * Creating a file with SWMR-write access will * upgrade superblock version and low_bound */ @@ -1152,10 +1153,10 @@ H5F__super_init(H5F_t *f) /* Bump superblock version to create superblock extension for SOHM info */ } else if(f->shared->sohm_nindexes > 0) super_vers = HDF5_SUPERBLOCK_VERSION_2; - /* - * Bump superblock version to create superblock extension for: - * -- non-default file space strategy or - * -- non-default persisting free-space or + /* + * Bump superblock version to create superblock extension for: + * -- non-default file space strategy or + * -- non-default persisting free-space or * -- non-default free-space threshold or * -- non-default page_size */ @@ -1232,7 +1233,7 @@ H5F__super_init(H5F_t *f) /* Compute the size of the driver information block */ H5_CHECKED_ASSIGN(driver_size, size_t, H5FD_sb_size(f->shared->lf), hsize_t); - /* The following code sets driver_size to the valued needed + /* The following code sets driver_size to the valued needed * for the driver info block, and sets the driver info block * address regardless of the version of the superblock. */ @@ -1273,7 +1274,7 @@ H5F__super_init(H5F_t *f) /* Allocate space for the superblock */ if(HADDR_UNDEF == H5MF_alloc(f, H5FD_MEM_SUPER, superblock_size)) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for superblock") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for superblock") /* set the drvinfo filed to NULL -- will overwrite this later if needed */ f->shared->drvinfo = NULL; @@ -1324,7 +1325,7 @@ H5F__super_init(H5F_t *f) * be tuned if more information is added to the superblock * extension. */ - if(H5F__super_ext_create(f, &ext_loc) < 0) + if(H5F__super_ext_create(f, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create superblock extension") ext_created = TRUE; @@ -1398,7 +1399,7 @@ H5F__super_init(H5F_t *f) if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE | H5O_MSG_FLAG_MARK_IF_UNKNOWN, H5O_UPDATE_TIME, &fsinfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update free-space info header message") - } /* end if */ + } /* end if */ } /* end if */ else { /* Check for creating an "old-style" driver info block */ @@ -1481,7 +1482,7 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5F__super_init() */ - + /*------------------------------------------------------------------------- * Function: H5F_eoa_dirty * @@ -1511,8 +1512,8 @@ H5F_eoa_dirty(H5F_t *f) if(H5F_super_dirty(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") - /* If the driver information block exists, mark it dirty as well - * so that the change in eoa will be reflected there as well if + /* If the driver information block exists, mark it dirty as well + * so that the change in eoa will be reflected there as well if * appropriate. */ if(f->shared->drvinfo) { @@ -1529,7 +1530,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_eoa_dirty() */ - + /*------------------------------------------------------------------------- * Function: H5F_super_dirty * @@ -1563,7 +1564,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_super_dirty() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_free * @@ -1594,7 +1595,7 @@ H5F__super_free(H5F_super_t *sblock) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5F__super_free() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_size * @@ -1623,7 +1624,7 @@ H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_size) /* Set the superblock size */ if(super_size) - *super_size = (hsize_t)H5F_SUPERBLOCK_SIZE(f->shared->sblock); + *super_size = (hsize_t)H5F_SUPERBLOCK_SIZE(f->shared->sblock); /* Set the superblock extension size */ if(super_ext_size) { @@ -1659,7 +1660,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_size() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_ext_write_msg() * @@ -1678,9 +1679,9 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ hbool_t ext_created = FALSE; /* Whether superblock extension was created */ hbool_t ext_opened = FALSE; /* Whether superblock extension was opened */ - H5O_loc_t ext_loc; /* "Object location" for superblock extension */ - htri_t status; /* Indicate whether the message exists or not */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_loc_t ext_loc; /* "Object location" for superblock extension */ + htri_t status; /* Indicate whether the message exists or not */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1744,7 +1745,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_write_msg() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_ext_remove_msg * @@ -1760,11 +1761,11 @@ herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5O_loc_t ext_loc; /* "Object location" for superblock extension */ + H5O_loc_t ext_loc; /* "Object location" for superblock extension */ hbool_t ext_opened = FALSE; /* Whether the superblock extension was opened */ - int null_count = 0; /* # of null messages */ + int null_count = 0; /* # of null messages */ htri_t status; /* Indicate whether the message exists or not */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1784,7 +1785,7 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message") else if(status) { /* message exists */ - H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */ + H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */ /* Remove the message */ if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0) diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 53abff3..df39d19 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -14,15 +14,15 @@ /* Programmer: Robb Matzke * Wednesday, September 30, 1998 * - * Purpose: The fill message indicates a bit pattern to use for - * uninitialized data points of a dataset. + * Purpose: The fill message indicates a bit pattern to use for + * uninitialized data points of a dataset. */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ #include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ @@ -49,61 +49,61 @@ static herr_t H5O__fill_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ -#define H5O_SHARED_TYPE H5O_MSG_FILL -#define H5O_SHARED_DECODE H5O_fill_shared_decode -#define H5O_SHARED_DECODE_REAL H5O_fill_old_decode -#define H5O_SHARED_ENCODE H5O_fill_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_fill_old_encode -#define H5O_SHARED_SIZE H5O_fill_shared_size -#define H5O_SHARED_SIZE_REAL H5O_fill_old_size -#define H5O_SHARED_DELETE H5O__fill_shared_delete +#define H5O_SHARED_TYPE H5O_MSG_FILL +#define H5O_SHARED_DECODE H5O_fill_shared_decode +#define H5O_SHARED_DECODE_REAL H5O_fill_old_decode +#define H5O_SHARED_ENCODE H5O_fill_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O_fill_old_encode +#define H5O_SHARED_SIZE H5O_fill_shared_size +#define H5O_SHARED_SIZE_REAL H5O_fill_old_size +#define H5O_SHARED_DELETE H5O__fill_shared_delete #undef H5O_SHARED_DELETE_REAL -#define H5O_SHARED_LINK H5O__fill_shared_link +#define H5O_SHARED_LINK H5O__fill_shared_link #undef H5O_SHARED_LINK_REAL -#define H5O_SHARED_COPY_FILE H5O__fill_shared_copy_file +#define H5O_SHARED_COPY_FILE H5O__fill_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL -#define H5O_SHARED_POST_COPY_FILE H5O_fill_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O_fill_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_fill_shared_debug -#define H5O_SHARED_DEBUG_REAL H5O__fill_debug -#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ +#define H5O_SHARED_DEBUG H5O_fill_shared_debug +#define H5O_SHARED_DEBUG_REAL H5O__fill_debug +#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* Set up & include shared message "interface" info */ /* (Kludgy 'undef's in order to re-include the H5Oshared.h header) */ #undef H5O_SHARED_TYPE -#define H5O_SHARED_TYPE H5O_MSG_FILL_NEW +#define H5O_SHARED_TYPE H5O_MSG_FILL_NEW #undef H5O_SHARED_DECODE -#define H5O_SHARED_DECODE H5O_fill_new_shared_decode +#define H5O_SHARED_DECODE H5O_fill_new_shared_decode #undef H5O_SHARED_DECODE_REAL -#define H5O_SHARED_DECODE_REAL H5O_fill_new_decode +#define H5O_SHARED_DECODE_REAL H5O_fill_new_decode #undef H5O_SHARED_ENCODE -#define H5O_SHARED_ENCODE H5O_fill_new_shared_encode +#define H5O_SHARED_ENCODE H5O_fill_new_shared_encode #undef H5O_SHARED_ENCODE_REAL -#define H5O_SHARED_ENCODE_REAL H5O_fill_new_encode +#define H5O_SHARED_ENCODE_REAL H5O_fill_new_encode #undef H5O_SHARED_SIZE -#define H5O_SHARED_SIZE H5O_fill_new_shared_size +#define H5O_SHARED_SIZE H5O_fill_new_shared_size #undef H5O_SHARED_SIZE_REAL -#define H5O_SHARED_SIZE_REAL H5O_fill_new_size +#define H5O_SHARED_SIZE_REAL H5O_fill_new_size #undef H5O_SHARED_DELETE -#define H5O_SHARED_DELETE H5O__fill_new_shared_delete +#define H5O_SHARED_DELETE H5O__fill_new_shared_delete #undef H5O_SHARED_DELETE_REAL #undef H5O_SHARED_LINK -#define H5O_SHARED_LINK H5O__fill_new_shared_link +#define H5O_SHARED_LINK H5O__fill_new_shared_link #undef H5O_SHARED_LINK_REAL #undef H5O_SHARED_COPY_FILE -#define H5O_SHARED_COPY_FILE H5O__fill_new_shared_copy_file +#define H5O_SHARED_COPY_FILE H5O__fill_new_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE -#define H5O_SHARED_POST_COPY_FILE H5O_fill_new_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O_fill_new_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD #undef H5O_SHARED_DEBUG -#define H5O_SHARED_DEBUG H5O_fill_new_shared_debug +#define H5O_SHARED_DEBUG H5O_fill_new_shared_debug #undef H5O_SHARED_DEBUG_REAL -#define H5O_SHARED_DEBUG_REAL H5O__fill_debug +#define H5O_SHARED_DEBUG_REAL H5O__fill_debug #undef H5Oshared_H -#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ +#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* This message derives from H5O message class, for old fill value before version 1.5 */ const H5O_msg_class_t H5O_MSG_FILL[1] = {{ @@ -150,7 +150,7 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{ H5O_fill_new_shared_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ NULL, /* set creation index */ - H5O_fill_new_shared_debug /*debug the message */ + H5O_fill_new_shared_debug /*debug the message */ }}; /* Format version bounds for fill value */ @@ -158,6 +158,7 @@ const unsigned H5O_fill_ver_bounds[] = { H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_FILL_VERSION_3, /* H5F_LIBVER_V18 */ H5O_FILL_VERSION_3, /* H5F_LIBVER_V110 */ + H5O_FILL_VERSION_3, /* H5F_LIBVER_V112 */ H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; @@ -176,15 +177,15 @@ H5FL_DEFINE(H5O_fill_t); /* Declare extern the free list to manage blocks of type conversion data */ H5FL_BLK_EXTERN(type_conv); - + /*------------------------------------------------------------------------- - * Function: H5O_fill_new_decode + * Function: H5O_fill_new_decode * - * Purpose: Decode a new fill value message. The new fill value + * Purpose: Decode a new fill value message. The new fill value * message is fill value plus space allocation time and * fill value writing time and whether fill value is defined. * - * Return: Success: Ptr to new message in native struct. + * Return: Success: Ptr to new message in native struct. * Failure: NULL * * Programmer: Raymond Lu @@ -197,7 +198,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_fill_t *fill = NULL; + H5O_fill_t *fill = NULL; void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -295,7 +296,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fill_new_decode() */ - + /*------------------------------------------------------------------------- * Function: H5O_fill_old_decode * @@ -314,7 +315,7 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_fill_t *fill = NULL; /* Decoded fill value message */ + H5O_fill_t *fill = NULL; /* Decoded fill value message */ htri_t exists = FALSE; H5T_t *dt = NULL; void *ret_value = NULL; /* Return value */ @@ -376,15 +377,15 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fill_old_decode() */ - + /*------------------------------------------------------------------------- - * Function: H5O_fill_new_encode + * Function: H5O_fill_new_encode * - * Purpose: Encode a new fill value message. The new fill value + * Purpose: Encode a new fill value message. The new fill value * message is fill value plus space allocation time and * fill value writing time and whether fill value is defined. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Feb 26, 2002 @@ -394,7 +395,7 @@ done: static herr_t H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) { - const H5O_fill_t *fill = (const H5O_fill_t *)_fill; + const H5O_fill_t *fill = (const H5O_fill_t *)_fill; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -474,7 +475,7 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_fill_new_encode() */ - + /*------------------------------------------------------------------------- * Function: H5O_fill_old_encode * @@ -505,17 +506,17 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_fill_old_encode() */ - + /*------------------------------------------------------------------------- - * Function: H5O_fill_copy + * Function: H5O_fill_copy * - * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if - * necessary. The new fill value message is fill value plus - * space allocation time and fill value writing time and - * whether fill value is defined. + * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if + * necessary. The new fill value message is fill value plus + * space allocation time and fill value writing time and + * whether fill value is defined. * - * Return: Success: Ptr to _DEST - * Failure: NULL + * Return: Success: Ptr to _DEST + * Failure: NULL * * Programmer: Raymond Lu * Feb 26, 2002 @@ -622,18 +623,18 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fill_copy() */ - + /*------------------------------------------------------------------------- - * Function: H5O_fill_new_size + * Function: H5O_fill_new_size * - * Purpose: Returns the size of the raw message in bytes not counting the + * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. This * function doesn't take into account alignment. The new fill * value message is fill value plus space allocation time and * fill value writing time and whether fill value is defined. * - * Return: Success: Message data size in bytes w/o alignment. - * Failure: 0 + * Return: Success: Message data size in bytes w/o alignment. + * Failure: 0 * * Programmer: Raymond Lu * Feb 26, 2002 @@ -653,26 +654,26 @@ H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) /* Determine size for different versions */ if(fill->version < H5O_FILL_VERSION_3) { - ret_value = 1 + /* Version number */ - 1 + /* Space allocation time */ - 1 + /* Fill value write time */ - 1; /* Fill value defined */ + ret_value = 1 + /* Version number */ + 1 + /* Space allocation time */ + 1 + /* Fill value write time */ + 1; /* Fill value defined */ if(fill->fill_defined) - ret_value += 4 + /* Fill value size */ - (fill->size > 0 ? (size_t)fill->size : 0); /* Size of fill value */ + ret_value += 4 + /* Fill value size */ + (fill->size > 0 ? (size_t)fill->size : 0); /* Size of fill value */ } /* end if */ else { - ret_value = 1 + /* Version number */ - 1; /* Status flags */ + ret_value = 1 + /* Version number */ + 1; /* Status flags */ if(fill->size > 0) - ret_value += 4 + /* Fill value size */ - (size_t)fill->size; /* Size of fill value */ + ret_value += 4 + /* Fill value size */ + (size_t)fill->size; /* Size of fill value */ } /* end else */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fill_new_size() */ - + /*------------------------------------------------------------------------- * Function: H5O_fill_old_size * @@ -700,15 +701,15 @@ H5O_fill_old_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) FUNC_LEAVE_NOAPI(4 + (size_t)fill->size) } /* end H5O_fill_old_size() */ - + /*------------------------------------------------------------------------- - * Function: H5O_fill_reset_dyn + * Function: H5O_fill_reset_dyn * - * Purpose: Resets dynamic fill value fields + * Purpose: Resets dynamic fill value fields * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, January 22, 2007 * *------------------------------------------------------------------------- @@ -766,15 +767,15 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fill_reset_dyn() */ - + /*------------------------------------------------------------------------- - * Function: H5O__fill_reset + * Function: H5O__fill_reset * - * Purpose: Resets a message to an initial state. + * Purpose: Resets a message to an initial state. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * *------------------------------------------------------------------------- @@ -782,7 +783,7 @@ done: static herr_t H5O__fill_reset(void *_fill) { - H5O_fill_t *fill = (H5O_fill_t *)_fill; + H5O_fill_t *fill = (H5O_fill_t *)_fill; FUNC_ENTER_STATIC_NOERR @@ -799,15 +800,15 @@ H5O__fill_reset(void *_fill) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__fill_reset() */ - + /*------------------------------------------------------------------------- - * Function: H5O__fill_free + * Function: H5O__fill_free * - * Purpose: Frees the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, December 5, 2002 * *------------------------------------------------------------------------- @@ -824,7 +825,7 @@ H5O__fill_free(void *fill) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__fill_free() */ - + /*------------------------------------------------------------------------- * Function: H5O__fill_pre_copy_file * @@ -842,7 +843,7 @@ static herr_t H5O__fill_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) { - const H5O_fill_t *fill_src = (const H5O_fill_t *)mesg_src; /* Source fill value */ + const H5O_fill_t *fill_src = (const H5O_fill_t *)mesg_src; /* Source fill value */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -860,15 +861,15 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__fill_pre_copy_file() */ - + /*------------------------------------------------------------------------- - * Function: H5O__fill_debug + * Function: H5O__fill_debug * - * Purpose: Prints debugging info for the message. + * Purpose: Prints debugging info for the message. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * *------------------------------------------------------------------------- @@ -950,7 +951,7 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream, } /* end switch */ HDfprintf(stream, "%*s%-*s %Zd\n", indent, "", fwidth, - "Size:", fill->size); + "Size:", fill->size); HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:"); if(fill->type) { H5T_debug(fill->type, stream); @@ -962,18 +963,18 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__fill_debug() */ - + /*------------------------------------------------------------------------- - * Function: H5O_fill_convert + * Function: H5O_fill_convert * - * Purpose: Convert a fill value from whatever data type it currently has + * Purpose: Convert a fill value from whatever data type it currently has * to the specified dataset type. The `type' field of the fill * value struct will be set to NULL to indicate that it has the * same type as the dataset. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * *------------------------------------------------------------------------- @@ -981,10 +982,10 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream, herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed) { - H5T_path_t *tpath; /* Type conversion info */ - void *buf = NULL, *bkg = NULL; /* Conversion buffers */ - hid_t src_id = -1, dst_id = -1; /* Datatype identifiers */ - herr_t ret_value = SUCCEED; /* Return value */ + H5T_path_t *tpath; /* Type conversion info */ + void *buf = NULL, *bkg = NULL; /* Conversion buffers */ + hid_t src_id = -1, dst_id = -1; /* Datatype identifiers */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1065,7 +1066,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fill_convert() */ - + /*------------------------------------------------------------------------- * Function: H5O_fill_set_version * diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 2a71b05..72edf11 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -15,7 +15,7 @@ * * Created: H5Ofsinfo.c * Feb 2009 - * Vailin Choi + * Vailin Choi * * Purpose: File space info message. * @@ -25,11 +25,11 @@ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Opkg.h" /* Object headers */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ static void *H5O_fsinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, @@ -43,26 +43,26 @@ static herr_t H5O__fsinfo_debug(H5F_t *f, const void *_mesg, FILE * stream, /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{ - H5O_FSINFO_ID, /* message id number */ - "fsinfo", /* message name for debugging */ - sizeof(H5O_fsinfo_t), /* native message size */ - 0, /* messages are sharable? */ - H5O_fsinfo_decode, /* decode message */ - H5O_fsinfo_encode, /* encode message */ - H5O_fsinfo_copy, /* copy the native value */ - H5O_fsinfo_size, /* size of free-space manager info message */ - NULL, /* default reset method */ - H5O__fsinfo_free, /* free method */ - NULL, /* file delete method */ - NULL, /* link method */ - NULL, /* set share method */ - NULL, /* can share method */ - NULL, /* pre copy native value to file */ - NULL, /* copy native value to file */ - NULL, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O__fsinfo_debug /* debug the message */ + H5O_FSINFO_ID, /* message id number */ + "fsinfo", /* message name for debugging */ + sizeof(H5O_fsinfo_t), /* native message size */ + 0, /* messages are sharable? */ + H5O_fsinfo_decode, /* decode message */ + H5O_fsinfo_encode, /* encode message */ + H5O_fsinfo_copy, /* copy the native value */ + H5O_fsinfo_size, /* size of free-space manager info message */ + NULL, /* default reset method */ + H5O__fsinfo_free, /* free method */ + NULL, /* file delete method */ + NULL, /* link method */ + NULL, /* set share method */ + NULL, /* can share method */ + NULL, /* pre copy native value to file */ + NULL, /* copy native value to file */ + NULL, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__fsinfo_debug /* debug the message */ }}; /* Format version bounds for fsinfo message */ @@ -71,6 +71,7 @@ static const unsigned H5O_fsinfo_ver_bounds[] = { H5O_INVALID_VERSION, /* H5F_LIBVER_EARLIEST */ H5O_INVALID_VERSION, /* H5F_LIBVER_V18 */ H5O_FSINFO_VERSION_1, /* H5F_LIBVER_V110 */ + H5O_FSINFO_VERSION_1, /* H5F_LIBVER_V112 */ H5O_FSINFO_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; #define N_FSINFO_VERSION_BOUNDS 4 @@ -78,7 +79,7 @@ static const unsigned H5O_fsinfo_ver_bounds[] = { /* Declare a free list to manage the H5O_fsinfo_t struct */ H5FL_DEFINE_STATIC(H5O_fsinfo_t); - + /*------------------------------------------------------------------------- * Function: H5O_fsinfo_decode * @@ -109,7 +110,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Allocate space for message */ if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) fsinfo->fs_addr[ptype - 1] = HADDR_UNDEF; @@ -165,7 +166,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, fsinfo->version = H5O_FSINFO_VERSION_1; fsinfo->mapped = TRUE; - + } else { HDassert(vers >= H5O_FSINFO_VERSION_1); @@ -197,7 +198,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fsinfo_decode() */ - + /*------------------------------------------------------------------------- * Function: H5O_fsinfo_encode * @@ -213,7 +214,7 @@ static herr_t H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; - H5F_mem_page_t ptype; /* Memory type for iteration */ + H5F_mem_page_t ptype; /* Memory type for iteration */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -223,12 +224,12 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(fsinfo); *p++ = (uint8_t)fsinfo->version; /* message version */ - *p++ = fsinfo->strategy; /* File space strategy */ - *p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */ + *p++ = fsinfo->strategy; /* File space strategy */ + *p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */ H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */ - H5F_ENCODE_LENGTH(f, p, fsinfo->page_size); /* File space page size */ - UINT16ENCODE(p, fsinfo->pgend_meta_thres); /* Page end metadata threshold */ + H5F_ENCODE_LENGTH(f, p, fsinfo->page_size); /* File space page size */ + UINT16ENCODE(p, fsinfo->pgend_meta_thres); /* Page end metadata threshold */ H5F_addr_encode(f, &p, fsinfo->eoa_pre_fsm_fsalloc); /* EOA before free-space header and section info */ /* Store addresses of free-space managers, if persisting */ @@ -241,7 +242,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_fsinfo_encode() */ - + /*------------------------------------------------------------------------- * Function: H5O_fsinfo_copy * @@ -279,7 +280,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fsinfo_copy() */ - + /*------------------------------------------------------------------------- * Function: H5O_fsinfo_size * @@ -303,11 +304,11 @@ H5O_fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi FUNC_ENTER_NOAPI_NOINIT_NOERR ret_value = 3 /* Version, strategy & persist */ - + (size_t)H5F_SIZEOF_SIZE(f) /* Free-space section threshold */ - + (size_t)H5F_SIZEOF_SIZE(f) /* File space page size */ - + 2 /* Page end meta threshold */ - + (size_t)H5F_SIZEOF_ADDR(f); - + + (size_t)H5F_SIZEOF_SIZE(f) /* Free-space section threshold */ + + (size_t)H5F_SIZEOF_SIZE(f) /* File space page size */ + + 2 /* Page end meta threshold */ + + (size_t)H5F_SIZEOF_ADDR(f); + /* Free-space manager addresses */ if(fsinfo->persist) ret_value += (H5F_MEM_PAGE_NTYPES - 1) * (size_t)H5F_SIZEOF_ADDR(f); @@ -315,7 +316,7 @@ H5O_fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fsinfo_size() */ - + /*------------------------------------------------------------------------- * Function: H5O__fsinfo_free * @@ -339,7 +340,7 @@ H5O__fsinfo_free(void *mesg) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__fsinfo_free() */ - + /*------------------------------------------------------------------------- * Function: H5O_fsinfo_set_version * @@ -380,7 +381,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fsinfo_set_version() */ - + /*------------------------------------------------------------------------- * Function: H5O_fsinfo_check_version * @@ -412,7 +413,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fsinfo_check_version() */ - + /*------------------------------------------------------------------------- * Function: H5O__fsinfo_debug * @@ -428,7 +429,7 @@ static herr_t H5O__fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, int indent, int fwidth) { - const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *) _mesg; + const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *) _mesg; H5F_mem_page_t ptype; /* Free-space types for iteration */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Oint.c b/src/H5Oint.c index e37eea5..ecf347c 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -55,7 +55,7 @@ /* User data for recursive traversal over objects from a group */ typedef struct { hid_t obj_id; /* The ID for the starting group */ - H5G_loc_t *start_loc; /* Location of starting group */ + H5G_loc_t *start_loc; /* Location of starting group */ H5SL_t *visited; /* Skip list for tracking visited nodes */ H5O_iterate_t op; /* Application callback */ void *op_data; /* Application's op data */ @@ -94,36 +94,36 @@ hbool_t H5_PKG_INIT_VAR = FALSE; * message. */ const H5O_msg_class_t *const H5O_msg_class_g[] = { - H5O_MSG_NULL, /*0x0000 Null */ - H5O_MSG_SDSPACE, /*0x0001 Dataspace */ - H5O_MSG_LINFO, /*0x0002 Link information */ - H5O_MSG_DTYPE, /*0x0003 Datatype */ - H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */ - H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */ - H5O_MSG_LINK, /*0x0006 Link */ - H5O_MSG_EFL, /*0x0007 Data storage -- external data files */ - H5O_MSG_LAYOUT, /*0x0008 Data Layout */ + H5O_MSG_NULL, /*0x0000 Null */ + H5O_MSG_SDSPACE, /*0x0001 Dataspace */ + H5O_MSG_LINFO, /*0x0002 Link information */ + H5O_MSG_DTYPE, /*0x0003 Datatype */ + H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */ + H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */ + H5O_MSG_LINK, /*0x0006 Link */ + H5O_MSG_EFL, /*0x0007 Data storage -- external data files */ + H5O_MSG_LAYOUT, /*0x0008 Data Layout */ #ifdef H5O_ENABLE_BOGUS - H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */ + H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */ #else /* H5O_ENABLE_BOGUS */ - NULL, /*0x0009 "Bogus valid" (for testing) */ + NULL, /*0x0009 "Bogus valid" (for testing) */ #endif /* H5O_ENABLE_BOGUS */ - H5O_MSG_GINFO, /*0x000A Group information */ - H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */ - H5O_MSG_ATTR, /*0x000C Attribute */ - H5O_MSG_NAME, /*0x000D Object name */ - H5O_MSG_MTIME, /*0x000E Object modification date and time */ - H5O_MSG_SHMESG, /*0x000F File-wide shared message table */ - H5O_MSG_CONT, /*0x0010 Object header continuation */ - H5O_MSG_STAB, /*0x0011 Symbol table */ - H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */ - H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */ - H5O_MSG_DRVINFO, /*0x0014 Driver info settings */ - H5O_MSG_AINFO, /*0x0015 Attribute information */ - H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */ - H5O_MSG_FSINFO, /*0x0017 Free-space manager info */ + H5O_MSG_GINFO, /*0x000A Group information */ + H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */ + H5O_MSG_ATTR, /*0x000C Attribute */ + H5O_MSG_NAME, /*0x000D Object name */ + H5O_MSG_MTIME, /*0x000E Object modification date and time */ + H5O_MSG_SHMESG, /*0x000F File-wide shared message table */ + H5O_MSG_CONT, /*0x0010 Object header continuation */ + H5O_MSG_STAB, /*0x0011 Symbol table */ + H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */ + H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */ + H5O_MSG_DRVINFO, /*0x0014 Driver info settings */ + H5O_MSG_AINFO, /*0x0015 Attribute information */ + H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */ + H5O_MSG_FSINFO, /*0x0017 Free-space manager info */ H5O_MSG_MDCI, /*0x0018 Metadata cache image */ - H5O_MSG_UNKNOWN /*0x0019 Placeholder for unknown message */ + H5O_MSG_UNKNOWN /*0x0019 Placeholder for unknown message */ }; /* Format version bounds for object header */ @@ -131,6 +131,7 @@ const unsigned H5O_obj_ver_bounds[] = { H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_VERSION_2, /* H5F_LIBVER_V18 */ H5O_VERSION_2, /* H5F_LIBVER_V110 */ + H5O_VERSION_2, /* H5F_LIBVER_V112 */ H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; @@ -172,20 +173,20 @@ H5FL_EXTERN(H5_obj_t); * datatype message is a datatype but only some of them are datasets. */ static const H5O_obj_class_t *const H5O_obj_class_g[] = { - H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */ - H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */ - H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */ + H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */ + H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */ + H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */ }; - + /*------------------------------------------------------------------------- - * Function: H5O__init_package + * Function: H5O__init_package * - * Purpose: Initialize information specific to H5O interface. + * Purpose: Initialize information specific to H5O interface. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 18, 2007 * *------------------------------------------------------------------------- @@ -204,7 +205,7 @@ H5O__init_package(void) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__init_package() */ - + /*------------------------------------------------------------------------- * Function: H5O_set_version * @@ -251,27 +252,27 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_set_version() */ - + /*------------------------------------------------------------------------- - * Function: H5O_create + * Function: H5O_create * - * Purpose: Creates a new object header. Allocates space for it and + * Purpose: Creates a new object header. Allocates space for it and * then calls an initialization function. The object header * is opened for write access and should eventually be * closed by calling H5O_close(). * - * Return: Success: Non-negative, the ENT argument contains - * information about the object header, - * including its address. + * Return: Success: Non-negative, the ENT argument contains + * information about the object header, + * including its address. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 5 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 5 1997 * * Changes: 2018 August 17 - * Jacob Smith + * Jacob Smith * Refactor out the operations into two separate steps -- * preparation and application -- to facilitate overriding the * library-default size allocated for the object header. This @@ -311,7 +312,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_create() */ - + /*----------------------------------------------------------------------------- * Function: H5O__create_ohdr * @@ -321,7 +322,7 @@ done: * Failure: NULL * * Programmer: Jacob Smith - * 2018 August 17 + * 2018 August 17 * *----------------------------------------------------------------------------- */ @@ -368,7 +369,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5O__create_ohdr() */ - + /*----------------------------------------------------------------------------- * Function: H5O__apply_ohdr * @@ -543,17 +544,17 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* H5O__apply_ohdr() */ - + /*------------------------------------------------------------------------- - * Function: H5O_open + * Function: H5O_open * - * Purpose: Opens an object header which is described by the symbol table - * entry OBJ_ENT. + * Purpose: Opens an object header which is described by the symbol table + * entry OBJ_ENT. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, January 5, 1998 + * Programmer: Robb Matzke + * Monday, January 5, 1998 * * Modification: * Raymond Lu @@ -580,7 +581,7 @@ H5O_open(H5O_loc_t *loc) /* Turn off the variable for holding file or increment open-lock counters */ if(loc->holding_file) - loc->holding_file = FALSE; + loc->holding_file = FALSE; else H5F_INCR_NOPEN_OBJS(loc->file); @@ -588,7 +589,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open() */ - + /*------------------------------------------------------------------------- * Function: H5O_open_name * @@ -597,8 +598,8 @@ done: * Return: Success: Pointer to object data * Failure: NULL * - * Programmer: Quincey Koziol - * March 5 2007 + * Programmer: Quincey Koziol + * March 5 2007 * *------------------------------------------------------------------------- */ @@ -606,8 +607,8 @@ void * H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ void *ret_value = NULL; /* Return value */ @@ -639,7 +640,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_name() */ - + /*------------------------------------------------------------------------- * Function: H5O_open_by_idx * @@ -648,8 +649,8 @@ done: * Return: Success: Pointer to object data * Failure: NULL * - * Programmer: Quincey Koziol - * December 28, 2017 + * Programmer: Quincey Koziol + * December 28, 2017 * *------------------------------------------------------------------------- */ @@ -658,8 +659,8 @@ H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ void *ret_value = NULL; /* Return value */ @@ -691,7 +692,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: H5O_open_by_addr * @@ -700,8 +701,8 @@ done: * Return: Success: Pointer to object data * Failure: NULL * - * Programmer: Quincey Koziol - * December 28, 2017 + * Programmer: Quincey Koziol + * December 28, 2017 * *------------------------------------------------------------------------- */ @@ -709,8 +710,8 @@ void * H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -734,7 +735,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_by_addr() */ - + /*------------------------------------------------------------------------- * Function: H5O_open_by_loc * @@ -743,8 +744,8 @@ done: * Return: Success: Pointer to object data * Failure: NULL * - * Programmer: James Laird - * July 25 2006 + * Programmer: James Laird + * July 25 2006 * *------------------------------------------------------------------------- */ @@ -771,16 +772,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_by_loc() */ - + /*------------------------------------------------------------------------- - * Function: H5O_close + * Function: H5O_close * - * Purpose: Closes an object header that was previously open. + * Purpose: Closes an object header that was previously open. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, January 5, 1998 + * Programmer: Robb Matzke + * Monday, January 5, 1998 * *------------------------------------------------------------------------- */ @@ -834,7 +835,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_close() */ - + /*------------------------------------------------------------------------- * Function: H5O__link_oh * @@ -845,9 +846,9 @@ done: * * Failure: -1 * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 5 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 5 1997 * *------------------------------------------------------------------------- */ @@ -855,7 +856,7 @@ int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) { haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */ - int ret_value = -1; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE @@ -949,29 +950,29 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__link_oh() */ - + /*------------------------------------------------------------------------- - * Function: H5O_link + * Function: H5O_link * - * Purpose: Adjust the link count for an object header by adding - * ADJUST to the link count. + * Purpose: Adjust the link count for an object header by adding + * ADJUST to the link count. * - * Return: Success: New link count + * Return: Success: New link count * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 5 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 5 1997 * *------------------------------------------------------------------------- */ int H5O_link(const H5O_loc_t *loc, int adjust) { - H5O_t *oh = NULL; + H5O_t *oh = NULL; hbool_t deleted = FALSE; /* Whether the object was deleted */ - int ret_value = -1; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL) @@ -997,21 +998,21 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_link() */ - + /*------------------------------------------------------------------------- - * Function: H5O_protect + * Function: H5O_protect * - * Purpose: Wrapper around H5AC_protect for use during a H5O_protect-> + * Purpose: Wrapper around H5AC_protect for use during a H5O_protect-> * H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls * during an object's creation. * - * Return: Success: Pointer to the object header structure for the + * Return: Success: Pointer to the object header structure for the * object. - * Failure: NULL + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Dec 31 2002 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Dec 31 2002 * *------------------------------------------------------------------------- */ @@ -1183,21 +1184,21 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_protect() */ - + /*------------------------------------------------------------------------- - * Function: H5O_pin + * Function: H5O_pin * - * Purpose: Pin an object header down for use during a sequence of message + * Purpose: Pin an object header down for use during a sequence of message * operations, which prevents the object header from being * evicted from the cache. * - * Return: Success: Pointer to the object header structure for the + * Return: Success: Pointer to the object header structure for the * object. - * Failure: NULL + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 13 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jul 13 2008 * *------------------------------------------------------------------------- */ @@ -1232,19 +1233,19 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_pin() */ - + /*------------------------------------------------------------------------- - * Function: H5O_unpin + * Function: H5O_unpin * - * Purpose: Unpin an object header, allowing it to be evicted from the + * Purpose: Unpin an object header, allowing it to be evicted from the * metadata cache. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 13 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jul 13 2008 * *------------------------------------------------------------------------- */ @@ -1267,20 +1268,20 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_unpin() */ - + /*------------------------------------------------------------------------- - * Function: H5O_unprotect + * Function: H5O_unprotect * - * Purpose: Wrapper around H5AC_unprotect for use during a H5O_protect-> + * Purpose: Wrapper around H5AC_unprotect for use during a H5O_protect-> * H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls * during an object's creation. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Dec 31 2002 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Dec 31 2002 * *------------------------------------------------------------------------- */ @@ -1324,17 +1325,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_unprotect() */ - + /*------------------------------------------------------------------------- - * Function: H5O_touch_oh + * Function: H5O_touch_oh * - * Purpose: If FORCE is non-zero then create a modification time message - * unless one already exists. Then update any existing - * modification time message with the current time. + * Purpose: If FORCE is non-zero then create a modification time message + * unless one already exists. Then update any existing + * modification time message with the current time. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 27, 1998 * *------------------------------------------------------------------------- @@ -1344,7 +1345,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ - time_t now; /* Current time */ + time_t now; /* Current time */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1359,7 +1360,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) /* Check version, to determine how to store time information */ if(oh->version == H5O_VERSION_1) { - size_t idx; /* Index of modification time message to update */ + size_t idx; /* Index of modification time message to update */ /* Look for existing message */ for(idx = 0; idx < oh->nmesgs; idx++) @@ -1419,18 +1420,18 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_touch_oh() */ - + /*------------------------------------------------------------------------- - * Function: H5O_touch + * Function: H5O_touch * - * Purpose: Touch an object by setting the modification time to the - * current time and marking the object as dirty. Unless FORCE - * is non-zero, nothing happens if there is no MTIME message in - * the object header. + * Purpose: Touch an object by setting the modification time to the + * current time and marking the object as dirty. Unless FORCE + * is non-zero, nothing happens if there is no MTIME message in + * the object header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 27, 1998 * *------------------------------------------------------------------------- @@ -1438,8 +1439,8 @@ done: herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force) { - H5O_t *oh = NULL; /* Object header to modify */ - unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */ + H5O_t *oh = NULL; /* Object header to modify */ + unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1466,15 +1467,15 @@ done: } /* end H5O_touch() */ #ifdef H5O_ENABLE_BOGUS - + /*------------------------------------------------------------------------- - * Function: H5O_bogus_oh + * Function: H5O_bogus_oh * - * Purpose: Create a "bogus" message unless one already exists. + * Purpose: Create a "bogus" message unless one already exists. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * * Tuesday, January 21, 2003 * @@ -1483,8 +1484,8 @@ done: herr_t H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) { - size_t idx; /* Local index variable */ - H5O_msg_class_t *type; /* Message class type */ + size_t idx; /* Local index variable */ + H5O_msg_class_t *type; /* Message class type */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1535,20 +1536,20 @@ done: } /* end H5O_bogus_oh() */ #endif /* H5O_ENABLE_BOGUS */ - + /*------------------------------------------------------------------------- - * Function: H5O_delete + * Function: H5O_delete * - * Purpose: Delete an object header from a file. This frees the file + * Purpose: Delete an object header from a file. This frees the file * space used for the object header (and it's continuation blocks) * and also walks through each header message and asks it to * remove all the pieces of the file referenced by the header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Mar 19 2003 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 19 2003 * *------------------------------------------------------------------------- */ @@ -1597,21 +1598,21 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_delete() */ - + /*------------------------------------------------------------------------- - * Function: H5O__delete_oh + * Function: H5O__delete_oh * - * Purpose: Internal function to: + * Purpose: Internal function to: * Delete an object header from a file. This frees the file * space used for the object header (and it's continuation blocks) * and also walks through each header message and asks it to * remove all the pieces of the file referenced by the header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Mar 19 2003 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 19 2003 * *------------------------------------------------------------------------- */ @@ -1619,7 +1620,7 @@ static herr_t H5O__delete_oh(H5F_t *f, H5O_t *oh) { H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ - unsigned u; + unsigned u; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1641,16 +1642,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__delete_oh() */ - + /*------------------------------------------------------------------------- - * Function: H5O_obj_type + * Function: H5O_obj_type * - * Purpose: Retrieves the type of object pointed to by `loc'. + * Purpose: Retrieves the type of object pointed to by `loc'. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, November 4, 1998 * *------------------------------------------------------------------------- @@ -1658,7 +1659,7 @@ done: herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type) { - H5O_t *oh = NULL; /* Object header for location */ + H5O_t *oh = NULL; /* Object header for location */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL) @@ -1673,21 +1674,21 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_obj_type() */ - + /*------------------------------------------------------------------------- - * Function: H5O__obj_type_real + * Function: H5O__obj_type_real * - * Purpose: Returns the type of object pointed to by `oh'. + * Purpose: Returns the type of object pointed to by `oh'. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, November 21, 2005 * *------------------------------------------------------------------------- @@ -1719,7 +1720,7 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__obj_type_real() */ - + /*------------------------------------------------------------------------- * Function: H5O__obj_class * @@ -1728,7 +1729,7 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) * Return: Success: An object class * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, November 6, 2006 * *------------------------------------------------------------------------- @@ -1736,7 +1737,7 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) const H5O_obj_class_t * H5O__obj_class(const H5O_loc_t *loc) { - H5O_t *oh = NULL; /* Object header for location */ + H5O_t *oh = NULL; /* Object header for location */ const H5O_obj_class_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE_TAG(loc->addr) @@ -1756,16 +1757,16 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__obj_class() */ - + /*------------------------------------------------------------------------- - * Function: H5O__obj_class_real + * Function: H5O__obj_class_real * - * Purpose: Returns the class of object pointed to by `oh'. + * Purpose: Returns the class of object pointed to by `oh'. * - * Return: Success: An object class - * Failure: NULL + * Return: Success: An object class + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, November 21, 2005 * *------------------------------------------------------------------------- @@ -1773,7 +1774,7 @@ done: static const H5O_obj_class_t * H5O__obj_class_real(const H5O_t *oh) { - size_t i; /* Local index variable */ + size_t i; /* Local index variable */ const H5O_obj_class_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1784,7 +1785,7 @@ H5O__obj_class_real(const H5O_t *oh) /* Test whether entry qualifies as a particular type of object */ /* (Note: loop is in reverse order, to test specific objects first) */ for(i = NELMTS(H5O_obj_class_g); i > 0; --i) { - htri_t isa; /* Is entry a particular type? */ + htri_t isa; /* Is entry a particular type? */ if((isa = (H5O_obj_class_g[i - 1]->isa)(oh)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") @@ -1799,17 +1800,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__obj_class_real() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_loc + * Function: H5O_get_loc * - * Purpose: Gets the object location for an object given its ID. + * Purpose: Gets the object location for an object given its ID. * - * Return: Success: Pointer to H5O_loc_t - * Failure: NULL + * Return: Success: Pointer to H5O_loc_t + * Failure: NULL * - * Programmer: James Laird - * July 25 2006 + * Programmer: James Laird + * July 25 2006 * *------------------------------------------------------------------------- */ @@ -1861,16 +1862,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_loc() */ - + /*------------------------------------------------------------------------- - * Function: H5O_loc_reset + * Function: H5O_loc_reset * - * Purpose: Reset a object location to an empty state + * Purpose: Reset a object location to an empty state * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, September 19, 2005 * *------------------------------------------------------------------------- @@ -1890,16 +1891,16 @@ H5O_loc_reset(H5O_loc_t *loc) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_loc_reset() */ - + /*------------------------------------------------------------------------- * Function: H5O_loc_copy * * Purpose: Copy object location information * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * Monday, September 19, 2005 * @@ -1941,17 +1942,17 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_loc_copy() */ - + /*------------------------------------------------------------------------- - * Function: H5O_loc_hold_file + * Function: H5O_loc_hold_file * - * Purpose: Have this object header hold a file open until it is + * Purpose: Have this object header hold a file open until it is * released. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: James Laird + * Programmer: James Laird * Wednesday, August 16, 2006 * *------------------------------------------------------------------------- @@ -1974,18 +1975,18 @@ H5O_loc_hold_file(H5O_loc_t *loc) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_loc_hold_file() */ - + /*------------------------------------------------------------------------- - * Function: H5O_loc_free + * Function: H5O_loc_free * - * Purpose: Release resources used by this object header location. + * Purpose: Release resources used by this object header location. * Not to be confused with H5O_close; this is used on * locations that don't correspond to open objects. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: James Laird + * Programmer: James Laird * Wednesday, August 16, 2006 * *------------------------------------------------------------------------- @@ -2014,17 +2015,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_loc_free() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_hdr_info + * Function: H5O_get_hdr_info * - * Purpose: Retrieve the object header information for an object + * Purpose: Retrieve the object header information for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * September 22 2009 + * Programmer: Quincey Koziol + * September 22 2009 * *------------------------------------------------------------------------- */ @@ -2053,22 +2054,22 @@ H5O_get_hdr_info(const H5O_loc_t *loc, H5O_hdr_info_t *hdr) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_hdr_info() */ - + /*------------------------------------------------------------------------- - * Function: H5O__get_hdr_info_real + * Function: H5O__get_hdr_info_real * - * Purpose: Internal routine to retrieve the object header information for an object + * Purpose: Internal routine to retrieve the object header information for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * September 22 2009 + * Programmer: Quincey Koziol + * September 22 2009 * *------------------------------------------------------------------------- */ @@ -2076,7 +2077,7 @@ static herr_t H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) { const H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ - const H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */ + const H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */ unsigned u; /* Local index variable */ FUNC_ENTER_STATIC_NOERR @@ -2139,16 +2140,16 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__get_hdr_info_real() */ - + /*------------------------------------------------------------------------- * Function: H5O_get_info * * Purpose: Retrieve the information for an object * * Note: Add a parameter "fields" to indicate selection of object info. - * - * Return: Success: Non-negative - * Failure: Negative + * + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * November 21 2006 @@ -2269,7 +2270,7 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_get_info() */ - + /*------------------------------------------------------------------------- * Function: H5O__get_info_by_idx * @@ -2279,8 +2280,8 @@ done: * * Note: Add a parameter "fields" to indicate selection of object info. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * December 28, 2017 @@ -2292,10 +2293,10 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2326,17 +2327,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__get_info_by_idx() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_create_plist + * Function: H5O_get_create_plist * - * Purpose: Retrieve the object creation properties for an object + * Purpose: Retrieve the object creation properties for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * November 28 2006 + * Programmer: Quincey Koziol + * November 28 2006 * *------------------------------------------------------------------------- */ @@ -2381,17 +2382,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_create_plist() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_nlinks + * Function: H5O_get_nlinks * - * Purpose: Retrieve the number of link messages read in from the file + * Purpose: Retrieve the number of link messages read in from the file * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * March 11 2007 + * Programmer: Quincey Koziol + * March 11 2007 * *------------------------------------------------------------------------- */ @@ -2421,17 +2422,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_nlinks() */ - + /*------------------------------------------------------------------------- - * Function: H5O_obj_create + * Function: H5O_obj_create * - * Purpose: Creates an object, in an abstract manner. + * Purpose: Creates an object, in an abstract manner. * - * Return: Success: Pointer to object opened - * Failure: NULL + * Return: Success: Pointer to object opened + * Failure: NULL * - * Programmer: Quincey Koziol - * April 9 2007 + * Programmer: Quincey Koziol + * April 9 2007 * *------------------------------------------------------------------------- */ @@ -2452,7 +2453,7 @@ H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc /* Iterate through the object classes */ for(u = 0; u < NELMTS(H5O_obj_class_g); u++) { /* Check for correct type of object to create */ - if(H5O_obj_class_g[u]->type == obj_type) { + if(H5O_obj_class_g[u]->type == obj_type) { /* Call the object class's 'create' routine */ HDassert(H5O_obj_class_g[u]->create); if(NULL == (ret_value = H5O_obj_class_g[u]->create(f, crt_info, obj_loc))) @@ -2468,21 +2469,21 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_obj_create() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_oh_addr + * Function: H5O_get_oh_addr * - * Purpose: Retrieve the address of the object header + * Purpose: Retrieve the address of the object header * - * Note: This routine participates in the "Inlining C struct access" - * pattern, don't call it directly, use the appropriate macro - * defined in H5Oprivate.h. + * Note: This routine participates in the "Inlining C struct access" + * pattern, don't call it directly, use the appropriate macro + * defined in H5Oprivate.h. * - * Return: Success: Valid haddr_t - * Failure: HADDR_UNDEF + * Return: Success: Valid haddr_t + * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol - * March 15 2007 + * Programmer: Quincey Koziol + * March 15 2007 * *------------------------------------------------------------------------- */ @@ -2498,12 +2499,12 @@ H5O_get_oh_addr(const H5O_t *oh) FUNC_LEAVE_NOAPI(oh->chunk[0].addr) } /* end H5O_get_oh_addr() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_oh_flags + * Function: H5O_get_oh_flags * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2515,16 +2516,16 @@ H5O_get_oh_flags(const H5O_t *oh) FUNC_LEAVE_NOAPI(oh->flags); /* flags can be 0 */ } /* H5O_get_oh_flags() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_oh_mtime + * Function: H5O_get_oh_mtime * - * Purpose: Retrieve an object's modification time. Assumes that the + * Purpose: Retrieve an object's modification time. Assumes that the * caller has verified that accessing this variable is appropriate * to the header in question. * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2537,12 +2538,12 @@ H5O_get_oh_mtime(const H5O_t *oh) FUNC_LEAVE_NOAPI(oh->mtime); } /* H5O_get_oh_mtime() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_oh_version + * Function: H5O_get_oh_version * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2555,17 +2556,17 @@ H5O_get_oh_version(const H5O_t *oh) FUNC_LEAVE_NOAPI(oh->version); } /* H5O_get_oh_version() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_rc_and_type + * Function: H5O_get_rc_and_type * - * Purpose: Retrieve an object's reference count and type + * Purpose: Retrieve an object's reference count and type * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * November 4 2007 + * Programmer: Quincey Koziol + * November 4 2007 * *------------------------------------------------------------------------- */ @@ -2600,7 +2601,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_rc_and_type() */ - + /*------------------------------------------------------------------------- * Function: H5O__free_visit_visited * @@ -2609,7 +2610,7 @@ done: * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol - * Nov 25, 2007 + * Nov 25, 2007 * *------------------------------------------------------------------------- */ @@ -2623,17 +2624,17 @@ H5O__free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSE FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__free_visit_visited() */ - + /*------------------------------------------------------------------------- - * Function: H5O__visit_cb + * Function: H5O__visit_cb * * Purpose: Callback function for recursively visiting objects from a group * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * Nov 25, 2007 + * Programmer: Quincey Koziol + * Nov 25, 2007 * *------------------------------------------------------------------------- */ @@ -2643,8 +2644,8 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *li { H5O_iter_visit_ud_t *udata = (H5O_iter_visit_ud_t *)_udata; /* User data for callback */ H5G_loc_t obj_loc; /* Location of object */ - H5G_name_t obj_path; /* Object's group hier. path */ - H5O_loc_t obj_oloc; /* Object's object location */ + H5G_name_t obj_path; /* Object's group hier. path */ + H5O_loc_t obj_oloc; /* Object's object location */ hbool_t obj_found = FALSE; /* Object at 'name' found */ herr_t ret_value = H5_ITER_CONT; /* Return value */ @@ -2715,7 +2716,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__visit_cb() */ - + /*------------------------------------------------------------------------- * Function: H5O__visit * @@ -2745,7 +2746,7 @@ done: * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * November 24 2007 * *------------------------------------------------------------------------- @@ -2806,8 +2807,8 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, /* Check for object being a group */ if(oinfo.type == H5O_TYPE_GROUP) { - H5G_loc_t start_loc; /* Location of starting group */ - H5G_loc_t vis_loc; /* Location of visited group */ + H5G_loc_t start_loc; /* Location of starting group */ + H5G_loc_t vis_loc; /* Location of visited group */ /* Get the location of the starting group */ if(H5G_loc(obj_id, &start_loc) < 0) @@ -2866,17 +2867,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__visit() */ - + /*------------------------------------------------------------------------- - * Function: H5O__inc_rc + * Function: H5O__inc_rc * - * Purpose: Increments the reference count on an object header + * Purpose: Increments the reference count on an object header * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 13 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jul 13 2008 * *------------------------------------------------------------------------- */ @@ -2902,17 +2903,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__inc_rc() */ - + /*------------------------------------------------------------------------- - * Function: H5O__dec_rc + * Function: H5O__dec_rc * - * Purpose: Decrements the reference count on an object header + * Purpose: Decrements the reference count on an object header * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 13 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jul 13 2008 * *------------------------------------------------------------------------- */ @@ -2938,7 +2939,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dec_rc() */ - + /*------------------------------------------------------------------------- * Function: H5O_dec_rc_by_loc * @@ -2981,16 +2982,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_dec_rc_by_loc() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_proxy + * Function: H5O_get_proxy * - * Purpose: Retrieve the proxy for the object header. + * Purpose: Retrieve the proxy for the object header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 24 2016 + * Programmer: Quincey Koziol + * July 24 2016 * *------------------------------------------------------------------------- */ @@ -3005,24 +3006,24 @@ H5O_get_proxy(const H5O_t *oh) FUNC_LEAVE_NOAPI(oh->proxy) } /* end H5O_get_proxy() */ - + /*------------------------------------------------------------------------- - * Function: H5O__free + * Function: H5O__free * - * Purpose: Destroys an object header. + * Purpose: Destroys an object header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jan 15 2003 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Jan 15 2003 * *------------------------------------------------------------------------- */ herr_t H5O__free(H5O_t *oh) { - unsigned u; /* Local index variable */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Opline.c b/src/H5Opline.c index eae7cd6..a956725 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -12,23 +12,23 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 + * Programmer: Robb Matzke + * Wednesday, April 15, 1998 * - * Purpose: Data filter pipeline message. + * Purpose: Data filter pipeline message. */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#define H5Z_FRIEND /*suppress error about including H5Zpkg */ +#define H5Z_FRIEND /*suppress error about including H5Zpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Zpkg.h" /* Data filters */ /* PRIVATE PROTOTYPES */ @@ -45,48 +45,48 @@ static herr_t H5O__pline_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ -#define H5O_SHARED_TYPE H5O_MSG_PLINE -#define H5O_SHARED_DECODE H5O_pline_shared_decode -#define H5O_SHARED_DECODE_REAL H5O__pline_decode -#define H5O_SHARED_ENCODE H5O_pline_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_pline_encode -#define H5O_SHARED_SIZE H5O_pline_shared_size -#define H5O_SHARED_SIZE_REAL H5O_pline_size -#define H5O_SHARED_DELETE H5O__pline_shared_delete +#define H5O_SHARED_TYPE H5O_MSG_PLINE +#define H5O_SHARED_DECODE H5O_pline_shared_decode +#define H5O_SHARED_DECODE_REAL H5O__pline_decode +#define H5O_SHARED_ENCODE H5O_pline_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O_pline_encode +#define H5O_SHARED_SIZE H5O_pline_shared_size +#define H5O_SHARED_SIZE_REAL H5O_pline_size +#define H5O_SHARED_DELETE H5O__pline_shared_delete #undef H5O_SHARED_DELETE_REAL -#define H5O_SHARED_LINK H5O__pline_shared_link +#define H5O_SHARED_LINK H5O__pline_shared_link #undef H5O_SHARED_LINK_REAL -#define H5O_SHARED_COPY_FILE H5O__pline_shared_copy_file +#define H5O_SHARED_COPY_FILE H5O__pline_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL -#define H5O_SHARED_POST_COPY_FILE H5O_pline_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O_pline_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_pline_shared_debug -#define H5O_SHARED_DEBUG_REAL H5O__pline_debug -#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ +#define H5O_SHARED_DEBUG H5O_pline_shared_debug +#define H5O_SHARED_DEBUG_REAL H5O__pline_debug +#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{ - H5O_PLINE_ID, /* message id number */ - "filter pipeline", /* message name for debugging */ - sizeof(H5O_pline_t), /* native message size */ - H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_pline_shared_decode, /* decode message */ - H5O_pline_shared_encode, /* encode message */ - H5O_pline_copy, /* copy the native value */ - H5O_pline_shared_size, /* size of raw message */ - H5O__pline_reset, /* reset method */ - H5O__pline_free, /* free method */ - H5O__pline_shared_delete, /* file delete method */ - H5O__pline_shared_link, /* link method */ - NULL, /* set share method */ - NULL, /*can share method */ - H5O_pline_pre_copy_file, /* pre copy native value to file */ - H5O__pline_shared_copy_file, /* copy native value to file */ - H5O_pline_shared_post_copy_file, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O_pline_shared_debug /* debug the message */ + H5O_PLINE_ID, /* message id number */ + "filter pipeline", /* message name for debugging */ + sizeof(H5O_pline_t), /* native message size */ + H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */ + H5O_pline_shared_decode, /* decode message */ + H5O_pline_shared_encode, /* encode message */ + H5O_pline_copy, /* copy the native value */ + H5O_pline_shared_size, /* size of raw message */ + H5O__pline_reset, /* reset method */ + H5O__pline_free, /* free method */ + H5O__pline_shared_delete, /* file delete method */ + H5O__pline_shared_link, /* link method */ + NULL, /* set share method */ + NULL, /*can share method */ + H5O_pline_pre_copy_file, /* pre copy native value to file */ + H5O__pline_shared_copy_file, /* copy native value to file */ + H5O_pline_shared_post_copy_file, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O_pline_shared_debug /* debug the message */ }}; /* Format version bounds for filter pipleline */ @@ -94,22 +94,23 @@ const unsigned H5O_pline_ver_bounds[] = { H5O_PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_PLINE_VERSION_2, /* H5F_LIBVER_V18 */ H5O_PLINE_VERSION_2, /* H5F_LIBVER_V110 */ + H5O_PLINE_VERSION_2, /* H5F_LIBVER_V112 */ H5O_PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; /* Declare a free list to manage the H5O_pline_t struct */ H5FL_DEFINE(H5O_pline_t); - + /*------------------------------------------------------------------------- - * Function: H5O__pline_decode + * Function: H5O__pline_decode * - * Purpose: Decodes a filter pipeline message. + * Purpose: Decodes a filter pipeline message. * - * Return: Success: Ptr to the native message. - * Failure: NULL + * Return: Success: Ptr to the native message. + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -119,12 +120,12 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_pline_t *pline = NULL; /* Pipeline message */ + H5O_pline_t *pline = NULL; /* Pipeline message */ H5Z_filter_info_t *filter; /* Filter to decode */ - size_t name_length; /* Length of filter name */ - size_t i; /* Local index variable */ + size_t name_length; /* Length of filter name */ + size_t i; /* Local index variable */ const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -204,7 +205,7 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Filter parameters */ if(filter->cd_nelmts) { - size_t j; /* Local index variable */ + size_t j; /* Local index variable */ /* Allocate space for the client data elements, or use the internal buffer */ if(filter->cd_nelmts > H5Z_COMMON_CD_VALUES) { @@ -243,15 +244,15 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__pline_decode() */ - + /*------------------------------------------------------------------------- - * Function: H5O_pline_encode + * Function: H5O_pline_encode * - * Purpose: Encodes message MESG into buffer P. + * Purpose: Encodes message MESG into buffer P. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -259,9 +260,9 @@ done: static herr_t H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) { - const H5O_pline_t *pline = (const H5O_pline_t*)mesg; /* Pipeline message to encode */ + const H5O_pline_t *pline = (const H5O_pline_t*)mesg; /* Pipeline message to encode */ const H5Z_filter_info_t *filter; /* Filter to encode */ - size_t i, j; /* Local index variables */ + size_t i, j; /* Local index variables */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -273,21 +274,21 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) *p++ = (uint8_t)pline->version; *p++ = (uint8_t)(pline->nused); if(pline->version == H5O_PLINE_VERSION_1) { - *p++ = 0; /*reserved 1*/ - *p++ = 0; /*reserved 2*/ - *p++ = 0; /*reserved 3*/ - *p++ = 0; /*reserved 4*/ - *p++ = 0; /*reserved 5*/ - *p++ = 0; /*reserved 6*/ + *p++ = 0; /*reserved 1*/ + *p++ = 0; /*reserved 2*/ + *p++ = 0; /*reserved 3*/ + *p++ = 0; /*reserved 4*/ + *p++ = 0; /*reserved 5*/ + *p++ = 0; /*reserved 6*/ } /* end if */ /* Encode filters */ for(i = 0, filter = &pline->filter[0]; i < pline->nused; i++, filter++) { - const char *name; /* Filter name */ - size_t name_length; /* Length of filter name */ + const char *name; /* Filter name */ + size_t name_length; /* Length of filter name */ /* Filter ID */ - UINT16ENCODE(p, filter->id); + UINT16ENCODE(p, filter->id); /* Skip writing the name length & name if the filter is an internal filter */ if(pline->version > H5O_PLINE_VERSION_1 && filter->id < H5Z_FILTER_RESERVED) { @@ -295,7 +296,7 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) name = NULL; } /* end if */ else { - H5Z_class2_t *cls; /* Filter class */ + H5Z_class2_t *cls; /* Filter class */ /* * Get the filter name. If the pipeline message has a name in it then @@ -311,26 +312,26 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) } /* end else */ /* Filter flags */ - UINT16ENCODE(p, filter->flags); + UINT16ENCODE(p, filter->flags); /* # of filter parameters */ - UINT16ENCODE(p, filter->cd_nelmts); + UINT16ENCODE(p, filter->cd_nelmts); /* Encode name, if there is one to encode */ - if(name_length > 0) { + if(name_length > 0) { /* Store name, with null terminator */ - H5MM_memcpy(p, name, name_length); - p += name_length; + H5MM_memcpy(p, name, name_length); + p += name_length; /* Pad out name to alignment, in older versions */ if(pline->version == H5O_PLINE_VERSION_1) while(name_length++ % 8) *p++ = 0; - } /* end if */ + } /* end if */ /* Filter parameters */ - for(j = 0; j < filter->cd_nelmts; j++) - UINT32ENCODE(p, filter->cd_values[j]); + for(j = 0; j < filter->cd_nelmts; j++) + UINT32ENCODE(p, filter->cd_values[j]); /* Align the parameters for older versions of the format */ if(pline->version == H5O_PLINE_VERSION_1) @@ -341,19 +342,19 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_pline_encode() */ - + /*------------------------------------------------------------------------- - * Function: H5O_pline_copy + * Function: H5O_pline_copy * - * Purpose: Copies a filter pipeline message from SRC to DST allocating - * DST if necessary. If DST is already allocated then we assume - * that it isn't initialized. + * Purpose: Copies a filter pipeline message from SRC to DST allocating + * DST if necessary. If DST is already allocated then we assume + * that it isn't initialized. * - * Return: Success: Ptr to DST or allocated result. + * Return: Success: Ptr to DST or allocated result. * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -361,16 +362,16 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) static void * H5O_pline_copy(const void *_src, void *_dst/*out*/) { - const H5O_pline_t *src = (const H5O_pline_t *)_src; /* Source pipeline message */ - H5O_pline_t *dst = (H5O_pline_t *)_dst; /* Destination pipeline message */ - size_t i; /* Local index variable */ - H5O_pline_t *ret_value = NULL; /* Return value */ + const H5O_pline_t *src = (const H5O_pline_t *)_src; /* Source pipeline message */ + H5O_pline_t *dst = (H5O_pline_t *)_dst; /* Destination pipeline message */ + size_t i; /* Local index variable */ + H5O_pline_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Allocate pipeline message, if not provided */ if(!dst && NULL == (dst = H5FL_MALLOC(H5O_pline_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Shallow copy basic fields */ *dst = *src; @@ -379,8 +380,8 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/) dst->nalloc = dst->nused; if(dst->nalloc) { /* Allocate array to hold filters */ - if(NULL == (dst->filter = (H5Z_filter_info_t *)H5MM_calloc(dst->nalloc * sizeof(dst->filter[0])))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + if(NULL == (dst->filter = (H5Z_filter_info_t *)H5MM_calloc(dst->nalloc * sizeof(dst->filter[0])))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Deep-copy filters */ for(i = 0; i < src->nused; i++) { @@ -419,7 +420,7 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/) } /* end for */ } /* end if */ else - dst->filter = NULL; + dst->filter = NULL; /* Set return value */ ret_value = dst; @@ -427,24 +428,24 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/) done: if(!ret_value && dst) { H5O__pline_reset(dst); - if(!_dst) + if(!_dst) H5O__pline_free(dst); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_pline_copy() */ - + /*------------------------------------------------------------------------- - * Function: H5O_pline_size + * Function: H5O_pline_size * - * Purpose: Determines the size of a raw filter pipeline message. + * Purpose: Determines the size of a raw filter pipeline message. * - * Return: Success: Size of message. + * Return: Success: Size of message. * - * Failure: zero + * Failure: zero * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -452,27 +453,27 @@ done: static size_t H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) { - const H5O_pline_t *pline = (const H5O_pline_t*)mesg; /* Pipeline message */ + const H5O_pline_t *pline = (const H5O_pline_t*)mesg; /* Pipeline message */ size_t i; /* Local index variable */ size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR /* Message header */ - ret_value = (size_t)(1 + /*version */ - 1 + /*number of filters */ - (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0)); /*reserved */ + ret_value = (size_t)(1 + /*version */ + 1 + /*number of filters */ + (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0)); /*reserved */ /* Calculate size of each filter in pipeline */ for(i = 0; i < pline->nused; i++) { - size_t name_len; /* Length of filter name */ + size_t name_len; /* Length of filter name */ const char *name; /* Filter name */ /* Don't write the name length & name if the filter is an internal filter */ if(pline->version > H5O_PLINE_VERSION_1 && pline->filter[i].id < H5Z_FILTER_RESERVED) name_len = 0; else { - H5Z_class2_t *cls; /* Filter class */ + H5Z_class2_t *cls; /* Filter class */ /* Get the name of the filter, same as done with H5O_pline_encode() */ if(NULL == (name = pline->filter[i].name) && (cls = H5Z_find(pline->filter[i].id))) @@ -480,13 +481,13 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) name_len = name ? HDstrlen(name) + 1 : 0; } /* end else */ - ret_value += 2 + /*filter identification number */ - (size_t)((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ - 2 + /*flags */ - 2 + /*number of client data values */ - (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */ + ret_value += 2 + /*filter identification number */ + (size_t)((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ + 2 + /*flags */ + 2 + /*number of client data values */ + (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */ - ret_value += pline->filter[i].cd_nelmts * 4; + ret_value += pline->filter[i].cd_nelmts * 4; if(pline->version == H5O_PLINE_VERSION_1) if(pline->filter[i].cd_nelmts % 2) ret_value += 4; @@ -495,16 +496,16 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_pline_size() */ - + /*------------------------------------------------------------------------- - * Function: H5O__pline_reset + * Function: H5O__pline_reset * - * Purpose: Resets a filter pipeline message by clearing all filters. - * The MESG buffer is not freed. + * Purpose: Resets a filter pipeline message by clearing all filters. + * The MESG buffer is not freed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -512,8 +513,8 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) static herr_t H5O__pline_reset(void *mesg) { - H5O_pline_t *pline = (H5O_pline_t*)mesg; /* Pipeline message */ - size_t i; /* Local index variable */ + H5O_pline_t *pline = (H5O_pline_t*)mesg; /* Pipeline message */ + size_t i; /* Local index variable */ FUNC_ENTER_STATIC_NOERR @@ -551,15 +552,15 @@ H5O__pline_reset(void *mesg) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__pline_reset() */ - + /*------------------------------------------------------------------------- - * Function: H5O__pline_free + * Function: H5O__pline_free * - * Purpose: Frees the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2000 * *------------------------------------------------------------------------- @@ -576,7 +577,7 @@ H5O__pline_free(void *mesg) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__pline_free() */ - + /*------------------------------------------------------------------------- * Function: H5O_pline_pre_copy_file * @@ -624,17 +625,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_pline_pre_copy_file() */ - + /*------------------------------------------------------------------------- - * Function: H5O__pline_debug + * Function: H5O__pline_debug * - * Purpose: Prints debugging information for filter pipeline message MESG - * on output stream STREAM. Each line is indented INDENT - * characters and the field name takes up FWIDTH characters. + * Purpose: Prints debugging information for filter pipeline message MESG + * on output stream STREAM. Each line is indented INDENT + * characters and the field name takes up FWIDTH characters. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -643,8 +644,8 @@ static herr_t H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int indent, int fwidth) { - const H5O_pline_t *pline = (const H5O_pline_t *)mesg; - size_t i, j; + const H5O_pline_t *pline = (const H5O_pline_t *)mesg; + size_t i, j; FUNC_ENTER_STATIC_NOERR @@ -656,48 +657,48 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, HDassert(fwidth >= 0); HDfprintf(stream, "%*s%-*s %Zu/%Zu\n", indent, "", fwidth, - "Number of filters:", - pline->nused, - pline->nalloc); + "Number of filters:", + pline->nused, + pline->nalloc); /* Loop over all the filters */ for(i = 0; i < pline->nused; i++) { - char name[32]; - - HDsnprintf(name, sizeof(name), "Filter at position %u", (unsigned)i); - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); - HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter identification:", - (unsigned)(pline->filter[i].id)); - if(pline->filter[i].name) - HDfprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter name:", - pline->filter[i].name); - else - HDfprintf(stream, "%*s%-*s NONE\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter name:"); - HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), - "Flags:", - pline->filter[i].flags); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), - "Num CD values:", - pline->filter[i].cd_nelmts); + char name[32]; + + HDsnprintf(name, sizeof(name), "Filter at position %u", (unsigned)i); + HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); + HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter identification:", + (unsigned)(pline->filter[i].id)); + if(pline->filter[i].name) + HDfprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter name:", + pline->filter[i].name); + else + HDfprintf(stream, "%*s%-*s NONE\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter name:"); + HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), + "Flags:", + pline->filter[i].flags); + HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + "Num CD values:", + pline->filter[i].cd_nelmts); /* Filter parameters */ - for(j = 0; j < pline->filter[i].cd_nelmts; j++) { - char field_name[32]; - - HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); - HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), - field_name, - pline->filter[i].cd_values[j]); - } /* end for */ + for(j = 0; j < pline->filter[i].cd_nelmts; j++) { + char field_name[32]; + + HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); + HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), + field_name, + pline->filter[i].cd_values[j]); + } /* end for */ } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__pline_debug() */ - + /*------------------------------------------------------------------------- * Function: H5O_pline_set_version * diff --git a/src/H5S.c b/src/H5S.c index 5153045..6018798 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -21,15 +21,15 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Fprivate.h" /* Files */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Spkg.h" /* Dataspaces */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Spkg.h" /* Dataspaces */ /****************/ @@ -68,6 +68,7 @@ const unsigned H5O_sdspace_ver_bounds[] = { H5O_SDSPACE_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V18 */ H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V110 */ + H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V112 */ H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; @@ -87,18 +88,18 @@ H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK); /* Dataspace ID class */ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ - H5I_DATASPACE, /* ID class value */ - 0, /* Class flags */ - 2, /* # of reserved IDs for class */ - (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */ + H5I_DATASPACE, /* ID class value */ + 0, /* Class flags */ + 2, /* # of reserved IDs for class */ + (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */ }}; /* Dataspace selection iterator ID class */ static const H5I_class_t H5I_SPACE_SEL_ITER_CLS[1] = {{ - H5I_SPACE_SEL_ITER, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5S_sel_iter_close /* Callback routine for closing objects of this class */ + H5I_SPACE_SEL_ITER, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5S_sel_iter_close /* Callback routine for closing objects of this class */ }}; @@ -106,7 +107,7 @@ static const H5I_class_t H5I_SPACE_SEL_ITER_CLS[1] = {{ static hbool_t H5S_top_package_initialize_s = FALSE; - + /*-------------------------------------------------------------------------- NAME H5S__init_package -- Initialize interface-specific information @@ -126,11 +127,11 @@ H5S__init_package(void) /* Initialize the atom group for the dataspace IDs */ if(H5I_register_type(H5I_DATASPACE_CLS) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class") /* Initialize the atom group for the dataspace selction iterator IDs */ if(H5I_register_type(H5I_SPACE_SEL_ITER_CLS) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace selection iterator ID class") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace selection iterator ID class") /* Mark "top" of interface as initialized, too */ H5S_top_package_initialize_s = TRUE; @@ -139,7 +140,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__init_package() */ - + /*-------------------------------------------------------------------------- NAME H5S_top_term_package @@ -161,22 +162,22 @@ done: int H5S_top_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5S_top_package_initialize_s) { - if(H5I_nmembers(H5I_DATASPACE) > 0) { - (void)H5I_clear_type(H5I_DATASPACE, FALSE, FALSE); + if(H5I_nmembers(H5I_DATASPACE) > 0) { + (void)H5I_clear_type(H5I_DATASPACE, FALSE, FALSE); n++; /*H5I*/ - } /* end if */ + } /* end if */ - if(H5I_nmembers(H5I_SPACE_SEL_ITER) > 0) { - (void)H5I_clear_type(H5I_SPACE_SEL_ITER, FALSE, FALSE); + if(H5I_nmembers(H5I_SPACE_SEL_ITER) > 0) { + (void)H5I_clear_type(H5I_SPACE_SEL_ITER, FALSE, FALSE); n++; /*H5I*/ - } /* end if */ + } /* end if */ - /* Mark "top" of interface as closed */ + /* Mark "top" of interface as closed */ if(0 == n) H5S_top_package_initialize_s = FALSE; } /* end if */ @@ -184,7 +185,7 @@ H5S_top_term_package(void) FUNC_LEAVE_NOAPI(n) } /* end H5S_top_term_package() */ - + /*-------------------------------------------------------------------------- NAME H5S_term_package @@ -208,7 +209,7 @@ H5S_top_term_package(void) int H5S_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -224,7 +225,7 @@ H5S_term_package(void) /* Destroy the dataspace selection iterator object id group */ n += (H5I_dec_type_ref(H5I_SPACE_SEL_ITER) > 0); - /* Mark interface as closed */ + /* Mark interface as closed */ if(0 == n) H5_PKG_INIT_VAR = FALSE; } /* end if */ @@ -233,7 +234,7 @@ H5S_term_package(void) } /* end H5S_term_package() */ - + /*-------------------------------------------------------------------------- NAME H5S_get_validiated_dataspace @@ -265,7 +266,7 @@ H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space) /* Check for invalid ID */ if(space_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid space_id (ID cannot be a negative number)") - + /* No special dataspace struct for H5S_ALL */ if(H5S_ALL == space_id) *space = NULL; @@ -283,7 +284,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_validated_dataspace() */ - + /*-------------------------------------------------------------------------- NAME H5S_create @@ -361,7 +362,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_create() */ - + /*-------------------------------------------------------------------------- NAME H5Screate @@ -408,16 +409,16 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Screate() */ - + /*------------------------------------------------------------------------- - * Function: H5S__extent_release + * Function: H5S__extent_release * - * Purpose: Releases all memory associated with a dataspace extent. + * Purpose: Releases all memory associated with a dataspace extent. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 * *------------------------------------------------------------------------- */ @@ -439,16 +440,16 @@ H5S__extent_release(H5S_extent_t *extent) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__extent_release() */ - + /*------------------------------------------------------------------------- - * Function: H5S_close + * Function: H5S_close * - * Purpose: Releases all memory associated with a dataspace. + * Purpose: Releases all memory associated with a dataspace. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -480,16 +481,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_close() */ - + /*------------------------------------------------------------------------- - * Function: H5Sclose + * Function: H5Sclose * - * Purpose: Release access to a dataspace object. + * Purpose: Release access to a dataspace object. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -513,26 +514,26 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sclose() */ - + /*------------------------------------------------------------------------- - * Function: H5Scopy + * Function: H5Scopy * - * Purpose: Copies a dataspace. + * Purpose: Copies a dataspace. * - * Return: Success: ID of the new dataspace - * Failure: Negative + * Return: Success: ID of the new dataspace + * Failure: Negative * - * Programmer: Robb Matzke - * Friday, January 30, 1998 + * Programmer: Robb Matzke + * Friday, January 30, 1998 * *------------------------------------------------------------------------- */ hid_t H5Scopy(hid_t space_id) { - H5S_t *src; - H5S_t *dst = NULL; - hid_t ret_value; + H5S_t *src; + H5S_t *dst = NULL; + hid_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", space_id); @@ -557,25 +558,25 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Scopy() */ - + /*------------------------------------------------------------------------- - * Function: H5Sextent_copy + * Function: H5Sextent_copy * - * Purpose: Copies a dataspace extent. + * Purpose: Copies a dataspace extent. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 * *------------------------------------------------------------------------- */ herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id) { - H5S_t *src; - H5S_t *dst; - herr_t ret_value = SUCCEED; + H5S_t *src; + H5S_t *dst; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "ii", dst_id, src_id); @@ -594,7 +595,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sextent_copy() */ - + /*------------------------------------------------------------------------- * Function: H5S_extent_copy * @@ -631,16 +632,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_extent_copy() */ - + /*------------------------------------------------------------------------- - * Function: H5S__extent_copy_real + * Function: H5S__extent_copy_real * - * Purpose: Copies a dataspace extent + * Purpose: Copies a dataspace extent * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 3, 1998 + * Programmer: Quincey Koziol + * Wednesday, June 3, 1998 * *------------------------------------------------------------------------- */ @@ -700,29 +701,29 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__extent_copy_real() */ - + /*------------------------------------------------------------------------- - * Function: H5S_copy + * Function: H5S_copy * - * Purpose: Copies a dataspace, by copying the extent and selection through + * Purpose: Copies a dataspace, by copying the extent and selection through * H5S_extent_copy and H5S_select_copy. If the SHARE_SELECTION flag * is set, then the selection can be shared between the source and * destination dataspaces. (This should only occur in situations * where the destination dataspace will immediately change to a new * selection) * - * Return: Success: A pointer to a new copy of SRC - * Failure: NULL + * Return: Success: A pointer to a new copy of SRC + * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Programmer: Robb Matzke + * Thursday, December 4, 1997 * *------------------------------------------------------------------------- */ H5S_t * H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max) { - H5S_t *dst = NULL; + H5S_t *dst = NULL; H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -749,17 +750,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_copy() */ - + /*------------------------------------------------------------------------- - * Function: H5S_get_simple_extent_npoints + * Function: H5S_get_simple_extent_npoints * - * Purpose: Determines how many data points a dataset extent has. + * Purpose: Determines how many data points a dataset extent has. * - * Return: Success: Number of data points in the dataset extent. - * Failure: negative + * Return: Success: Number of data points in the dataset extent. + * Failure: negative * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro @@ -784,25 +785,25 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_simple_extent_npoints() */ - + /*------------------------------------------------------------------------- - * Function: H5Sget_simple_extent_npoints + * Function: H5Sget_simple_extent_npoints * - * Purpose: Determines how many data points a dataset extent has. + * Purpose: Determines how many data points a dataset extent has. * - * Return: Success: Number of data points in the dataset. - * Failure: negative + * Return: Success: Number of data points in the dataset. + * Failure: negative * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ hssize_t H5Sget_simple_extent_npoints(hid_t space_id) { - H5S_t *ds; - hssize_t ret_value; + H5S_t *ds; + hssize_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE1("Hs", "i", space_id); @@ -817,30 +818,30 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_simple_extent_npoints() */ - + /*------------------------------------------------------------------------- - * Function: H5S_get_npoints_max + * Function: H5S_get_npoints_max * - * Purpose: Determines the maximum number of data points a dataspace may - * have. If the `max' array is null then the maximum number of - * data points is the same as the current number of data points - * without regard to the hyperslab. If any element of the `max' - * array is zero then the maximum possible size is returned. + * Purpose: Determines the maximum number of data points a dataspace may + * have. If the `max' array is null then the maximum number of + * data points is the same as the current number of data points + * without regard to the hyperslab. If any element of the `max' + * array is zero then the maximum possible size is returned. * - * Return: Success: Maximum number of data points the dataspace - * may have. - * Failure: 0 + * Return: Success: Maximum number of data points the dataspace + * may have. + * Failure: 0 * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ hsize_t H5S_get_npoints_max(const H5S_t *ds) { - unsigned u; - hsize_t ret_value = 0; /* Return value */ + unsigned u; + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -882,17 +883,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_npoints_max() */ - + /*------------------------------------------------------------------------- - * Function: H5Sget_simple_extent_ndims + * Function: H5Sget_simple_extent_ndims * - * Purpose: Determines the dimensionality of a dataspace. + * Purpose: Determines the dimensionality of a dataspace. * - * Return: Success: The number of dimensions in a dataspace. - * Failure: Negative + * Return: Success: The number of dimensions in a dataspace. + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 + * Programmer: Robb Matzke + * Thursday, December 11, 1997 * *------------------------------------------------------------------------- */ @@ -900,7 +901,7 @@ int H5Sget_simple_extent_ndims(hid_t space_id) { H5S_t *ds; - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("Is", "i", space_id); @@ -915,18 +916,18 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_simple_extent_ndims() */ - + /*------------------------------------------------------------------------- - * Function: H5S_get_simple_extent_ndims + * Function: H5S_get_simple_extent_ndims * - * Purpose: Returns the number of dimensions in a dataspace. + * Purpose: Returns the number of dimensions in a dataspace. * - * Return: Success: Non-negative number of dimensions. Zero - * implies a scalar. - * Failure: Negative + * Return: Success: Non-negative number of dimensions. Zero + * implies a scalar. + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 + * Programmer: Robb Matzke + * Thursday, December 11, 1997 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro @@ -937,7 +938,7 @@ done: int H5S_get_simple_extent_ndims(const H5S_t *ds) { - int ret_value = -1; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -961,19 +962,19 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_simple_extent_ndims() */ - + /*------------------------------------------------------------------------- - * Function: H5Sget_simple_extent_dims + * Function: H5Sget_simple_extent_dims * - * Purpose: Returns the size and maximum sizes in each dimension of - * a dataspace DS through the DIMS and MAXDIMS arguments. + * Purpose: Returns the size and maximum sizes in each dimension of + * a dataspace DS through the DIMS and MAXDIMS arguments. * - * Return: Success: Number of dimensions, the same value as - * returned by H5Sget_simple_extent_ndims(). - * Failure: Negative + * Return: Success: Number of dimensions, the same value as + * returned by H5Sget_simple_extent_ndims(). + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 + * Programmer: Robb Matzke + * Thursday, December 11, 1997 * *------------------------------------------------------------------------- */ @@ -982,7 +983,7 @@ H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/, hsize_t maxdims[]/*out*/) { H5S_t *ds; - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("Is", "ixx", space_id, dims, maxdims); @@ -997,26 +998,26 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_simple_extent_dims() */ - + /*------------------------------------------------------------------------- - * Function: H5S_extent_get_dims + * Function: H5S_extent_get_dims * - * Purpose: Returns the size in each dimension of a dataspace. This - * function may not be meaningful for all types of dataspaces. + * Purpose: Returns the size in each dimension of a dataspace. This + * function may not be meaningful for all types of dataspaces. * - * Return: Success: Number of dimensions. Zero implies scalar. - * Failure: Negative + * Return: Success: Number of dimensions. Zero implies scalar. + * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, June 30, 2009 + * Programmer: Quincey Koziol + * Tuesday, June 30, 2009 * *------------------------------------------------------------------------- */ int H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[]) { - int i; /* Local index variable */ - int ret_value = -1; /* Return value */ + int i; /* Local index variable */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1053,25 +1054,25 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_extent_get_dims() */ - + /*------------------------------------------------------------------------- - * Function: H5S_get_simple_extent_dims + * Function: H5S_get_simple_extent_dims * - * Purpose: Returns the size in each dimension of a dataspace. This - * function may not be meaningful for all types of dataspaces. + * Purpose: Returns the size in each dimension of a dataspace. This + * function may not be meaningful for all types of dataspaces. * - * Return: Success: Number of dimensions. Zero implies scalar. - * Failure: Negative + * Return: Success: Number of dimensions. Zero implies scalar. + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 + * Programmer: Robb Matzke + * Thursday, December 11, 1997 * *------------------------------------------------------------------------- */ int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[]) { - int ret_value = -1; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1086,17 +1087,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_simple_extent_dims() */ - + /*------------------------------------------------------------------------- - * Function: H5S_write + * Function: H5S_write * - * Purpose: Updates a dataspace by writing a message to an object - * header. + * Purpose: Updates a dataspace by writing a message to an object + * header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -1120,17 +1121,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_write() */ - + /*------------------------------------------------------------------------- - * Function: H5S_append + * Function: H5S_append * - * Purpose: Updates a dataspace by adding a message to an object - * header. + * Purpose: Updates a dataspace by adding a message to an object + * header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, December 31, 2002 + * Programmer: Quincey Koziol + * Tuesday, December 31, 2002 * *------------------------------------------------------------------------- */ @@ -1154,24 +1155,24 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_append() */ - + /*------------------------------------------------------------------------- - * Function: H5S_read + * Function: H5S_read * - * Purpose: Reads the dataspace from an object header. + * Purpose: Reads the dataspace from an object header. * - * Return: Success: Pointer to a new dataspace. - * Failure: NULL + * Return: Success: Pointer to a new dataspace. + * Failure: NULL * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ H5S_t * H5S_read(const H5O_loc_t *loc) { - H5S_t *ds = NULL; /* Dataspace to return */ + H5S_t *ds = NULL; /* Dataspace to return */ H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1200,7 +1201,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_read() */ - + /*-------------------------------------------------------------------------- NAME H5S__is_simple @@ -1208,11 +1209,11 @@ done: Check if a dataspace is simple (internal) USAGE htri_t H5S__is_simple(sdim) - H5S_t *sdim; IN: Pointer to dataspace object to query + H5S_t *sdim; IN: Pointer to dataspace object to query RETURNS TRUE/FALSE/FAIL DESCRIPTION - This function determines the if a dataspace is "simple". ie. if it + This function determines the if a dataspace is "simple". ie. if it has orthogonal, evenly spaced dimensions. --------------------------------------------------------------------------*/ static htri_t @@ -1232,7 +1233,7 @@ H5S__is_simple(const H5S_t *sdim) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__is_simple() */ - + /*-------------------------------------------------------------------------- NAME H5Sis_simple @@ -1240,17 +1241,17 @@ H5S__is_simple(const H5S_t *sdim) Check if a dataspace is simple USAGE htri_t H5Sis_simple(space_id) - hid_t space_id; IN: ID of dataspace object to query + hid_t space_id; IN: ID of dataspace object to query RETURNS TRUE/FALSE/FAIL DESCRIPTION - This function determines the if a dataspace is "simple". ie. if it + This function determines the if a dataspace is "simple". ie. if it has orthogonal, evenly spaced dimensions. --------------------------------------------------------------------------*/ htri_t H5Sis_simple(hid_t space_id) { - H5S_t *space; /* Dataspace to check */ + H5S_t *space; /* Dataspace to check */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1258,7 +1259,7 @@ H5Sis_simple(hid_t space_id) /* Check args and all the boring stuff. */ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") ret_value = H5S__is_simple(space); @@ -1266,7 +1267,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sis_simple() */ - + /*-------------------------------------------------------------------------- NAME H5Sset_extent_simple @@ -1274,11 +1275,11 @@ done: Sets the size of a simple dataspace USAGE herr_t H5Sset_extent_simple(space_id, rank, dims, max) - hid_t space_id; IN: Dataspace object to query - int rank; IN: # of dimensions for the dataspace + hid_t space_id; IN: Dataspace object to query + int rank; IN: # of dimensions for the dataspace const size_t *dims; IN: Size of each dimension for the dataspace - const size_t *max; IN: Maximum size of each dimension for the - dataspace + const size_t *max; IN: Maximum size of each dimension for the + dataspace RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -1297,8 +1298,8 @@ herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], const hsize_t max[/*rank*/]) { - H5S_t *space; /* Dataspace to modify */ - int u; /* Local counting variable */ + H5S_t *space; /* Dataspace to modify */ + int u; /* Local counting variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1325,22 +1326,22 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], /* Do it */ if(H5S_set_extent_simple(space, (unsigned)rank, dims, max) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent") done: FUNC_LEAVE_API(ret_value) } /* end H5Sset_extent_simple() */ - + /*------------------------------------------------------------------------- - * Function: H5S_set_extent_simple + * Function: H5S_set_extent_simple * - * Purpose: This is where the real work happens for - * H5Sset_extent_simple(). + * Purpose: This is where the real work happens for + * H5Sset_extent_simple(). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, July 8, 1998 * *------------------------------------------------------------------------- @@ -1362,10 +1363,10 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, if(H5S__extent_release(&space->extent) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "failed to release previous dataspace extent") - if(rank == 0) { /* scalar variable */ + if(rank == 0) { /* scalar variable */ space->extent.type = H5S_SCALAR; space->extent.nelem = 1; - space->extent.rank = 0; /* set to scalar rank */ + space->extent.rank = 0; /* set to scalar rank */ } /* end if */ else { hsize_t nelem; /* Number of elements in extent */ @@ -1383,7 +1384,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, } /* end for */ space->extent.nelem = nelem; - /* Copy the maximum dimensions if specified. Otherwise, the maximal dimensions are the + /* Copy the maximum dimensions if specified. Otherwise, the maximal dimensions are the * same as the dimension */ space->extent.max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank); if(max != NULL) @@ -1408,24 +1409,24 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_set_extent_simple() */ - + /*------------------------------------------------------------------------- - * Function: H5Screate_simple + * Function: H5Screate_simple * - * Purpose: Creates a new simple dataspace object and opens it for - * access. The DIMS argument is the size of the simple dataset - * and the MAXDIMS argument is the upper limit on the size of - * the dataset. MAXDIMS may be the null pointer in which case - * the upper limit is the same as DIMS. If an element of - * MAXDIMS is H5S_UNLIMITED then the corresponding dimension is - * unlimited, otherwise no element of MAXDIMS should be smaller - * than the corresponding element of DIMS. + * Purpose: Creates a new simple dataspace object and opens it for + * access. The DIMS argument is the size of the simple dataset + * and the MAXDIMS argument is the upper limit on the size of + * the dataset. MAXDIMS may be the null pointer in which case + * the upper limit is the same as DIMS. If an element of + * MAXDIMS is H5S_UNLIMITED then the corresponding dimension is + * unlimited, otherwise no element of MAXDIMS should be smaller + * than the corresponding element of DIMS. * - * Return: Success: The ID for the new simple dataspace object. - * Failure: Negative + * Return: Success: The ID for the new simple dataspace object. + * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, January 27, 1998 + * Programmer: Quincey Koziol + * Tuesday, January 27, 1998 * *------------------------------------------------------------------------- */ @@ -1433,9 +1434,9 @@ hid_t H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]) { - H5S_t *space = NULL; - int i; - hid_t ret_value; /* Return value */ + H5S_t *space = NULL; + int i; + hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "Is*[a0]h*[a0]h", rank, dims, maxdims); @@ -1476,17 +1477,17 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Screate_simple() */ - + /*------------------------------------------------------------------------- - * Function: H5S_create_simple + * Function: H5S_create_simple * - * Purpose: Internal function to create simple dataspace + * Purpose: Internal function to create simple dataspace * - * Return: Success: The ID for the new simple dataspace object. - * Failure: Negative + * Return: Success: The ID for the new simple dataspace object. + * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, April 3, 2003 + * Programmer: Quincey Koziol + * Thursday, April 3, 2003 * *------------------------------------------------------------------------- */ @@ -1511,19 +1512,19 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_create_simple() */ - + /*------------------------------------------------------------------------- - * Function: H5Sencode2 + * Function: H5Sencode2 * - * Purpose: Given a dataspace ID, converts the object description + * Purpose: Given a dataspace ID, converts the object description * (including selection) into binary in a buffer. - * The selection will be encoded according to the file + * The selection will be encoded according to the file * format setting in fapl. * - * Return: Success: non-negative + * Return: Success: non-negative * Failure: negative * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * slu@ncsa.uiuc.edu * July 14, 2004 * @@ -1554,18 +1555,18 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Sencode2() */ - + /*------------------------------------------------------------------------- - * Function: H5S_encode + * Function: H5S_encode * - * Purpose: Private function for H5Sencode. Converts an object + * Purpose: Private function for H5Sencode. Converts an object * description for dataspace and its selection into binary * in a buffer. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * slu@ncsa.uiuc.edu * July 14, 2004 * @@ -1584,15 +1585,15 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) /* Allocate "fake" file structure */ if(NULL == (f = H5F_fake_alloc((uint8_t)0))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed for extent */ if((extent_size = H5O_msg_raw_size(f, H5O_SDSPACE_ID, TRUE, obj)) == 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size") /* Find out the size of buffer needed for selection */ if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size") H5_CHECKED_ASSIGN(select_size, size_t, sselect_size, hssize_t); /* Verify the size of buffer. If it's not big enough, simply return the @@ -1633,17 +1634,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_encode() */ - + /*------------------------------------------------------------------------- - * Function: H5Sdecode + * Function: H5Sdecode * - * Purpose: Decode a binary object description of dataspace and + * Purpose: Decode a binary object description of dataspace and * return a new object handle. * - * Return: Success: dataspace ID(non-negative) - * Failure: negative + * Return: Success: dataspace ID(non-negative) + * Failure: negative * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * slu@ncsa.uiuc.edu * July 14, 2004 * @@ -1659,30 +1660,30 @@ H5Sdecode(const void *buf) H5TRACE1("i", "*x", buf); if(buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer") if((ds = H5S_decode((const unsigned char **)&buf)) == NULL) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, FAIL, "can't decode object") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, FAIL, "can't decode object") /* Register the type and return the ID */ if((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace") done: FUNC_LEAVE_API(ret_value) } /* end H5Sdecode() */ - + /*------------------------------------------------------------------------- - * Function: H5S_decode + * Function: H5S_decode * - * Purpose: Private function for H5Sdecode. Reconstructs a binary + * Purpose: Private function for H5Sdecode. Reconstructs a binary * description of dataspace and returns a new object handle. * - * Return: Success: dataspace ID(non-negative) - * Failure: negative + * Return: Success: dataspace ID(non-negative) + * Failure: negative * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * slu@ncsa.uiuc.edu * July 14, 2004 * @@ -1703,18 +1704,18 @@ H5S_decode(const unsigned char **p) /* Decode the type of the information */ if(*pp++ != H5O_SDSPACE_ID) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADMESG, NULL, "not an encoded dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADMESG, NULL, "not an encoded dataspace") /* Decode the version of the dataspace information */ if(*pp++ != H5S_ENCODE_VERSION) - HGOTO_ERROR(H5E_DATASPACE, H5E_VERSION, NULL, "unknown version of encoded dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_VERSION, NULL, "unknown version of encoded dataspace") /* Decode the "size of size" information */ sizeof_size = *pp++; /* Allocate "fake" file structure */ if(NULL == (f = H5F_fake_alloc(sizeof_size))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode size of extent information */ UINT32DECODE(pp, extent_size); @@ -1729,7 +1730,7 @@ H5S_decode(const unsigned char **p) if(NULL == (ds = H5FL_CALLOC(H5S_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for dataspace conversion path table") if(NULL == H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object") if(H5S__extent_release(extent) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace") extent = H5FL_FREE(H5S_extent_t, extent); @@ -1754,17 +1755,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_decode() */ - + /*------------------------------------------------------------------------- - * Function: H5S_get_simple_extent_type + * Function: H5S_get_simple_extent_type * - * Purpose: Internal function for retrieving the type of extent for a dataspace object + * Purpose: Internal function for retrieving the type of extent for a dataspace object * - * Return: Success: The class of the dataspace object - * Failure: N5S_NO_CLASS + * Return: Success: The class of the dataspace object + * Failure: N5S_NO_CLASS * - * Programmer: Quincey Koziol - * Thursday, September 28, 2000 + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro @@ -1775,7 +1776,7 @@ done: H5S_class_t H5S_get_simple_extent_type(const H5S_t *space) { - H5S_class_t ret_value = H5S_NO_CLASS; /* Return value */ + H5S_class_t ret_value = H5S_NO_CLASS; /* Return value */ FUNC_ENTER_NOAPI(H5S_NO_CLASS) @@ -1787,25 +1788,25 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_simple_extent_type() */ - + /*------------------------------------------------------------------------- - * Function: H5Sget_simple_extent_type + * Function: H5Sget_simple_extent_type * - * Purpose: Retrieves the type of extent for a dataspace object + * Purpose: Retrieves the type of extent for a dataspace object * - * Return: Success: The class of the dataspace object - * Failure: N5S_NO_CLASS + * Return: Success: The class of the dataspace object + * Failure: N5S_NO_CLASS * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 * *------------------------------------------------------------------------- */ H5S_class_t H5Sget_simple_extent_type(hid_t sid) { - H5S_t *space; - H5S_class_t ret_value; /* Return value */ + H5S_t *space; + H5S_class_t ret_value; /* Return value */ FUNC_ENTER_API(H5S_NO_CLASS) H5TRACE1("Sc", "i", sid); @@ -1820,7 +1821,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_simple_extent_type() */ - + /*-------------------------------------------------------------------------- NAME H5Sset_extent_none @@ -1828,17 +1829,17 @@ done: Resets the extent of a dataspace back to "none" USAGE herr_t H5Sset_extent_none(space_id) - hid_t space_id; IN: Dataspace object to reset + hid_t space_id; IN: Dataspace object to reset RETURNS Non-negative on success/Negative on failure DESCRIPTION - This function resets the type of a dataspace back to "none" with no + This function resets the type of a dataspace back to "none" with no extent information stored for the dataspace. --------------------------------------------------------------------------*/ herr_t H5Sset_extent_none(hid_t space_id) { - H5S_t *space; /* Dataspace to modify */ + H5S_t *space; /* Dataspace to modify */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1858,7 +1859,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sset_extent_none() */ - + /*------------------------------------------------------------------------- * Function: H5S_set_extent * @@ -1905,7 +1906,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_set_extent() */ - + /*------------------------------------------------------------------------- * Function: H5S_has_extent * @@ -1938,7 +1939,7 @@ H5S_has_extent(const H5S_t *ds) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_has_extent() */ - + /*------------------------------------------------------------------------- * Function: H5S_set_extent_real * @@ -1985,25 +1986,25 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_set_extent_real() */ - + /*------------------------------------------------------------------------- - * Function: H5Sextent_equal + * Function: H5Sextent_equal * - * Purpose: Determines if two dataspace extents are equal. + * Purpose: Determines if two dataspace extents are equal. * - * Return: Success: TRUE if equal, FALSE if unequal - * Failure: Negative + * Return: Success: TRUE if equal, FALSE if unequal + * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, October 24, 2005 + * Programmer: Quincey Koziol + * Monday, October 24, 2005 * *------------------------------------------------------------------------- */ htri_t H5Sextent_equal(hid_t space1_id, hid_t space2_id) { - const H5S_t *ds1, *ds2; /* Dataspaces to compare */ - htri_t ret_value; /* Return value */ + const H5S_t *ds1, *ds2; /* Dataspaces to compare */ + htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("t", "ii", space1_id, space2_id); @@ -2011,17 +2012,17 @@ H5Sextent_equal(hid_t space1_id, hid_t space2_id) /* check args */ if(NULL == (ds1 = (const H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE)) || NULL == (ds2 = (const H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Check dataspaces for extent's equality */ if((ret_value = H5S_extent_equal(ds1, ds2)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "dataspace comparison failed") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "dataspace comparison failed") done: FUNC_LEAVE_API(ret_value) } /* end H5Sextent_equal() */ - + /*-------------------------------------------------------------------------- NAME H5S_extent_equal @@ -2029,11 +2030,11 @@ done: Check if two dataspaces have equal extents USAGE htri_t H5S_extent_equal(ds1, ds2) - H5S_t *ds1, *ds2; IN: Dataspace objects to compare + H5S_t *ds1, *ds2; IN: Dataspace objects to compare RETURNS TRUE if equal, FALSE if unequal on succeess/Negative on failure DESCRIPTION - Compare two dataspaces if their extents are identical. + Compare two dataspaces if their extents are identical. --------------------------------------------------------------------------*/ H5_ATTR_PURE htri_t H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2) @@ -2082,17 +2083,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_extent_equal() */ - + /*------------------------------------------------------------------------- - * Function: H5S_extent_nelem + * Function: H5S_extent_nelem * - * Purpose: Determines how many elements a dataset extent describes. + * Purpose: Determines how many elements a dataset extent describes. * - * Return: Success: Number of data points in the dataset extent. - * Failure: negative + * Return: Success: Number of data points in the dataset extent. + * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, November 30, 2006 + * Programmer: Quincey Koziol + * Thursday, November 30, 2006 * *------------------------------------------------------------------------- */ @@ -2108,7 +2109,7 @@ H5S_extent_nelem(const H5S_extent_t *ext) FUNC_LEAVE_NOAPI(ext->nelem) } /* end H5S_extent_nelem() */ - + /*------------------------------------------------------------------------- * Function: H5S_set_version * diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 153f4be..9d19056 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -15,7 +15,7 @@ * Programmer: Quincey Koziol * Thursday, June 18, 1998 * - * Purpose: Hyperslab selection dataspace I/O functions. + * Purpose: Hyperslab selection dataspace I/O functions. */ /****************/ @@ -30,8 +30,8 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* ID Functions */ #include "H5MMprivate.h" /* Memory management */ #include "H5Spkg.h" /* Dataspace functions */ @@ -246,6 +246,7 @@ const unsigned H5O_sds_hyper_ver_bounds[] = { H5S_HYPER_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5S_HYPER_VERSION_1, /* H5F_LIBVER_V18 */ H5S_HYPER_VERSION_2, /* H5F_LIBVER_V110 */ + H5S_HYPER_VERSION_2, /* H5F_LIBVER_V112 */ H5S_HYPER_VERSION_3 /* H5F_LIBVER_LATEST */ }; @@ -378,7 +379,7 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space) FUNC_LEAVE_NOAPI(SUCCEED) } - + /*-------------------------------------------------------------------------- NAME H5S__hyper_print_spans_dfs @@ -451,7 +452,7 @@ H5S__hyper_print_spans_dfs(FILE *f, const H5S_hyper_span_info_t *span_lst, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_print_spans_dfs() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_print_space_dfs @@ -524,15 +525,15 @@ H5S__hyper_print_space_dfs(FILE *f, const H5S_t *space) } /* end H5S__hyper_print_space_dfs() */ #endif /* H5S_HYPER_DEBUG */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_get_op_gen + * Function: H5S__hyper_get_op_gen * - * Purpose: Acquire a unique operation generation value + * Purpose: Acquire a unique operation generation value * - * Return: Operation generation value (can't fail) + * Return: Operation generation value (can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 19, 2019 * * Notes: Assumes that a 64-bit value will not wrap around during @@ -548,15 +549,15 @@ H5S__hyper_get_op_gen(void) FUNC_LEAVE_NOAPI(H5S_hyper_op_gen_g++); } /* end H5S__hyper_op_gen() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_iter_init + * Function: H5S__hyper_iter_init * - * Purpose: Initializes iteration information for hyperslab selection. + * Purpose: Initializes iteration information for hyperslab selection. * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, February 24, 2001 * * Notes: If the 'iter->elmt_size' field is set to zero, the regular @@ -721,14 +722,14 @@ H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter) /* If this iterator is created from an API call, by default we clone the * selection now, as the dataspace could be modified or go out of scope. - * + * * However, if the H5S_SEL_ITER_SHARE_WITH_DATASPACE flag is given, * the selection is shared between the selection iterator and the * dataspace. In this case, the application _must_not_ modify or * close the dataspace that the iterator is operating on, or undefined * behavior will occur. */ - if((iter->flags & H5S_SEL_ITER_API_CALL) && + if((iter->flags & H5S_SEL_ITER_API_CALL) && !(iter->flags & H5S_SEL_ITER_SHARE_WITH_DATASPACE)) { /* Copy the span tree */ if(NULL == (iter->u.hyp.spans = H5S__hyper_copy_span(space->select.sel_info.hslab->span_lst, space->extent.rank))) @@ -787,16 +788,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_iter_init() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_iter_coords + * Function: H5S__hyper_iter_coords * - * Purpose: Retrieve the current coordinates of iterator for current + * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, April 22, 2003 * *------------------------------------------------------------------------- @@ -872,16 +873,16 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_coords() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_iter_block + * Function: H5S__hyper_iter_block * - * Purpose: Retrieve the current block of iterator for current + * Purpose: Retrieve the current block of iterator for current * selection * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, June 2, 2003 * * Notes: This routine assumes that the iterator is always located at @@ -922,15 +923,15 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_block() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_iter_nelmts + * Function: H5S__hyper_iter_nelmts * - * Purpose: Return number of elements left to process in iterator + * Purpose: Return number of elements left to process in iterator * - * Return: Non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * *------------------------------------------------------------------------- @@ -946,7 +947,7 @@ H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter) FUNC_LEAVE_NOAPI(iter->elmt_left) } /* end H5S__hyper_iter_nelmts() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_has_next_block @@ -1002,17 +1003,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_iter_has_next_block() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_iter_next + * Function: H5S__hyper_iter_next * - * Purpose: Moves a hyperslab iterator to the beginning of the next sequence + * Purpose: Moves a hyperslab iterator to the beginning of the next sequence * of elements to read. Handles walking off the end in all dimensions. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, September 8, 2000 * *------------------------------------------------------------------------- @@ -1209,17 +1210,17 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_next() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_iter_next_block + * Function: H5S__hyper_iter_next_block * - * Purpose: Moves a hyperslab iterator to the beginning of the next sequence + * Purpose: Moves a hyperslab iterator to the beginning of the next sequence * of elements to read. Handles walking off the end in all dimensions. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 3, 2003 * *------------------------------------------------------------------------- @@ -1384,7 +1385,7 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_next_block() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_get_seq_list_gen @@ -1701,9 +1702,9 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max /* Set the location of the last span's end */ last_span_end = loc_off + span_size; - /* Move to next span in fastest changing dimension */ + /* Move to next span in fastest changing dimension */ prev_span = curr_span; - curr_span = curr_span->next; + curr_span = curr_span->next; } /* end while */ /* Check if we are done */ @@ -1749,7 +1750,7 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max /* Work back up through the dimensions */ while(curr_dim >= 0) { /* Reset the current span */ - curr_span = ispan[curr_dim]; + curr_span = ispan[curr_dim]; /* Increment absolute position */ abs_arr[curr_dim]++; @@ -1836,7 +1837,7 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_get_seq_list_gen() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_get_seq_list_opt @@ -2103,15 +2104,15 @@ H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxseq, size_t max /* Read in data until an entire sequence can't be written out any longer */ while(curr_rows > 0) { -#define DUFF_GUTS \ -/* Store the sequence information */ \ -off[curr_seq] = loc; \ -len[curr_seq] = actual_bytes; \ +#define DUFF_GUTS \ +/* Store the sequence information */ \ +off[curr_seq] = loc; \ +len[curr_seq] = actual_bytes; \ \ -/* Increment sequence count */ \ -curr_seq++; \ +/* Increment sequence count */ \ +curr_seq++; \ \ -/* Increment information to reflect block just processed */ \ +/* Increment information to reflect block just processed */ \ loc += fast_dim_buf_off; #ifdef NO_DUFFS_DEVICE @@ -2280,7 +2281,7 @@ loc += fast_dim_buf_off; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_get_seq_list_opt() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_get_seq_list_single @@ -2558,7 +2559,7 @@ H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_get_seq_list_single() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_get_seq_list @@ -2720,7 +2721,7 @@ H5S__hyper_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_iter_get_seq_list() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_release @@ -2753,7 +2754,7 @@ H5S__hyper_iter_release(H5S_sel_iter_t *iter) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_release() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_new_span @@ -2801,7 +2802,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_new_span() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_new_span_info @@ -2844,7 +2845,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_new_span_info() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_copy_span_helper @@ -2939,7 +2940,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_copy_span_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_copy_span @@ -2982,7 +2983,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_copy_span() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_cmp_spans @@ -3078,7 +3079,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_cmp_spans() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_free_span_info @@ -3135,7 +3136,7 @@ H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info) FUNC_LEAVE_NOAPI_VOID } /* end H5S__hyper_free_span_info() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_free_span @@ -3173,7 +3174,7 @@ H5S__hyper_free_span(H5S_hyper_span_t *span) FUNC_LEAVE_NOAPI_VOID } /* end H5S__hyper_free_span() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_copy @@ -3248,7 +3249,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_copy() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_is_valid @@ -3307,7 +3308,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_is_valid() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_span_nblocks_helper @@ -3373,7 +3374,7 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_span_nblocks_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_span_nblocks @@ -3411,7 +3412,7 @@ H5S__hyper_span_nblocks(H5S_hyper_span_info_t *spans) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_span_nblocks() */ - + /*-------------------------------------------------------------------------- NAME H5S__get_select_hyper_nblocks @@ -3456,7 +3457,7 @@ H5S__get_select_hyper_nblocks(const H5S_t *space, hbool_t app_ref) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__get_select_hyper_nblocks() */ - + /*-------------------------------------------------------------------------- NAME H5Sget_select_hyper_nblocks @@ -3497,7 +3498,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_select_hyper_nblocks() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_get_enc_size_real @@ -3533,7 +3534,7 @@ H5S__hyper_get_enc_size_real(hsize_t max_size) FUNC_LEAVE_NOAPI(ret_value) } /* H5S__hyper_get_enc_size_real() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_get_version_enc_size @@ -3544,7 +3545,7 @@ H5S__hyper_get_enc_size_real(hsize_t max_size) const H5S_t *space: IN: The dataspace hsize_t block_count: IN: The number of blocks in the selection uint32_t *version: OUT: The version to use for encoding - uint8_t *enc_size: OUT: The encoded size to use + uint8_t *enc_size: OUT: The encoded size to use RETURNS The version and the size to encode hyperslab selection info @@ -3557,7 +3558,7 @@ H5S__hyper_get_enc_size_real(hsize_t max_size) Determine the encoded size based on version: For version 3, the encoded size is determined according to: (a) regular hyperslab - (1) The maximum needed to store start/stride/count/block + (1) The maximum needed to store start/stride/count/block (2) Special handling for count/block: need to provide room for H5S_UNLIMITED (b) irregular hyperslab The maximum size needed to store: @@ -3698,7 +3699,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S__hyper_get_version_enc_size() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_serial_size @@ -3746,14 +3747,14 @@ H5S__hyper_serial_size(const H5S_t *space) * 14 + (4 * enc_size * rank) bytes */ if(H5S__hyper_is_regular(space)) - ret_value = (hssize_t)14 + + ret_value = (hssize_t)14 + ((hssize_t)4 * (hssize_t)enc_size * (hssize_t)space->extent.rank); else { /* Version 3: irregular */ /* Size required is always: * + + + * + + - * < # of blocks (depend on enc_size) > + + * < # of blocks (depend on enc_size) > + * (2 (starting/ending offset) * * * <# of blocks) = * = 14 bytes + enc_size (block_count) + (2 * enc_size * rank * block_count) bytes */ @@ -3792,7 +3793,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_serial_size() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_serialize_helper @@ -3876,7 +3877,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, /* Encode previous ending points */ for(u=0; uhigh); break; @@ -3913,7 +3914,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, FUNC_LEAVE_NOAPI_VOID } /* end H5S__hyper_serialize_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_serialize @@ -4066,7 +4067,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) } /* end if */ else { HDassert(version == H5S_HYPER_VERSION_1); - + /* Set some convienence values */ fast_dim = ndims - 1; @@ -4100,7 +4101,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) /* Move the offset to the next sequence to start */ offset[fast_dim]+=diminfo[fast_dim].stride; - + /* Decrement the block count */ tmp_count[fast_dim]--; } /* end while */ @@ -4189,7 +4190,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_serialize() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_deserialize @@ -4350,7 +4351,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab") break; } /* end switch */ - + /* Select the hyperslab to the current selection */ if((ret_value = H5S_select_hyperslab(tmp_space, H5S_SELECT_SET, start, stride, count, block)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection") @@ -4370,7 +4371,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) case H5S_SELECT_INFO_ENC_SIZE_2: UINT16DECODE(pp, num_elem); break; - + case H5S_SELECT_INFO_ENC_SIZE_4: UINT32DECODE(pp, num_elem); break; @@ -4443,7 +4444,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_deserialize() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_span_blocklist @@ -4548,7 +4549,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_span_blocklist() */ - + /*-------------------------------------------------------------------------- NAME H5S__get_select_hyper_blocklist @@ -4730,7 +4731,7 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__get_select_hyper_blocklist() */ - + /*-------------------------------------------------------------------------- NAME H5Sget_select_hyper_blocklist @@ -4791,7 +4792,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_select_hyper_blocklist() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_bounds @@ -4872,7 +4873,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_bounds() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_offset @@ -4981,7 +4982,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_offset() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_unlim_dim @@ -5008,7 +5009,7 @@ H5S__hyper_unlim_dim(const H5S_t *space) FUNC_LEAVE_NOAPI(space->select.sel_info.hslab->unlim_dim); } /* end H5S__hyper_unlim_dim() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_num_elem_non_unlim @@ -5050,7 +5051,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_num_elem_non_unlim() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_is_contiguous @@ -5100,8 +5101,8 @@ H5S__hyper_is_contiguous(const H5S_t *space) */ /* Initialize flags */ - large_contiguous = TRUE; /* assume true and reset if the dimensions don't match */ - small_contiguous = FALSE; /* assume false initially */ + large_contiguous = TRUE; /* assume true and reset if the dimensions don't match */ + small_contiguous = FALSE; /* assume false initially */ /* Check for a "large contigous" block */ for(u = 0; u < space->extent.rank; u++) { @@ -5146,8 +5147,8 @@ H5S__hyper_is_contiguous(const H5S_t *space) * block size must be 1 in all but the fastest changing dimension. */ /* Initialize flags */ - large_contiguous = TRUE; /* assume true and reset if the dimensions don't match */ - small_contiguous = FALSE; /* assume false initially */ + large_contiguous = TRUE; /* assume true and reset if the dimensions don't match */ + small_contiguous = FALSE; /* assume false initially */ /* Get information for slowest changing information */ spans = space->select.sel_info.hslab->span_lst; @@ -5236,7 +5237,7 @@ H5S__hyper_is_contiguous(const H5S_t *space) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_is_contiguous() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_is_single @@ -5309,7 +5310,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_is_single() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_is_regular @@ -5354,7 +5355,7 @@ H5S__hyper_is_regular(const H5S_t *space) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_is_regular() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_spans_shape_same_helper @@ -5463,7 +5464,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_spans_shape_same_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_spans_shape_same @@ -5560,7 +5561,7 @@ H5S__hyper_spans_shape_same(const H5S_hyper_span_info_t *span_info1, FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_spans_shape_same() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_shape_same @@ -5706,7 +5707,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_shape_same() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_release @@ -5747,7 +5748,7 @@ H5S__hyper_release(H5S_t *space) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_release() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_coord_to_span @@ -5810,7 +5811,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_coord_to_span() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_add_span_element_helper @@ -6041,7 +6042,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_add_span_element_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S_hyper_add_span_element @@ -6151,7 +6152,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_add_span_element() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_intersect_block_helper @@ -6239,7 +6240,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_intersect_block_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_intersect_block @@ -6369,7 +6370,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_intersect_block() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_adjust_u_helper @@ -6435,7 +6436,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank, FUNC_LEAVE_NOAPI_VOID } /* end H5S__hyper_adjust_u_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_adjust_u @@ -6492,16 +6493,16 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_adjust_u() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_project_scalar + * Function: H5S__hyper_project_scalar * - * Purpose: Projects a single element hyperslab selection into a scalar + * Purpose: Projects a single element hyperslab selection into a scalar * dataspace * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- @@ -6568,16 +6569,16 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_project_scalar() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_project_simple_lower + * Function: H5S__hyper_project_simple_lower * - * Purpose: Projects a hyperslab selection onto/into a simple dataspace + * Purpose: Projects a hyperslab selection onto/into a simple dataspace * of a lower rank * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- @@ -6615,16 +6616,16 @@ H5S__hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_project_simple_lower() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_project_simple_higher + * Function: H5S__hyper_project_simple_higher * - * Purpose: Projects a hyperslab selection onto/into a simple dataspace + * Purpose: Projects a hyperslab selection onto/into a simple dataspace * of a higher rank * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- @@ -6715,16 +6716,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_project_simple_higher() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_project_simple + * Function: H5S__hyper_project_simple * - * Purpose: Projects a hyperslab selection onto/into a simple dataspace + * Purpose: Projects a hyperslab selection onto/into a simple dataspace * of a different rank * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- @@ -6889,7 +6890,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_project_simple() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_adjust_s_helper @@ -6955,7 +6956,7 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank, FUNC_LEAVE_NOAPI_VOID } /* end H5S__hyper_adjust_s_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S_hyper_adjust_s @@ -7066,7 +7067,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Shyper_adjust_s() */ - + /*-------------------------------------------------------------------------- NAME H5S_hyper_normalize_offset @@ -7124,7 +7125,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_normalize_offset() */ - + /*-------------------------------------------------------------------------- NAME H5S_hyper_denormalize_offset @@ -7168,7 +7169,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_denormalize_offset() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_append_span @@ -7306,7 +7307,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_append_span() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_clip_spans @@ -7902,7 +7903,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_clip_spans() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_merge_spans_helper @@ -8218,7 +8219,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_merge_spans_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_merge_spans @@ -8273,7 +8274,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_merge_spans() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_spans_nelem_helper @@ -8344,7 +8345,7 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_spans_nelem_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_spans_nelem @@ -8382,7 +8383,7 @@ H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_spans_nelem() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_add_disjoint_spans @@ -8431,7 +8432,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_add_disjoint_spans */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_make_spans @@ -8580,7 +8581,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_make_spans() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_update_diminfo @@ -8798,7 +8799,7 @@ H5S__hyper_update_diminfo(H5S_t *space, H5S_seloper_t op, FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_update_diminfo() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_rebuild_helper @@ -8909,7 +8910,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_rebuild_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_rebuild @@ -8959,7 +8960,7 @@ H5S__hyper_rebuild(H5S_t *space) FUNC_LEAVE_NOAPI_VOID } /* end H5S__hyper_rebuild() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_generate_spans @@ -9018,7 +9019,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_generate_spans() */ - + /*-------------------------------------------------------------------------- NAME H5S__check_spans_overlap @@ -9099,7 +9100,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__check_spans_overlap() */ - + /*-------------------------------------------------------------------------- NAME H5S__fill_in_new_space @@ -9398,15 +9399,15 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__fill_in_new_space() */ - + /*------------------------------------------------------------------------- - * Function: H5S__generate_hyperlab + * Function: H5S__generate_hyperlab * - * Purpose: Generate hyperslab information from H5S_select_hyperslab() + * Purpose: Generate hyperslab information from H5S_select_hyperslab() * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, September 12, 2000 * *------------------------------------------------------------------------- @@ -9488,15 +9489,15 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__generate_hyperslab() */ - + /*------------------------------------------------------------------------- - * Function: H5S__set_regular_hyperslab + * Function: H5S__set_regular_hyperslab * - * Purpose: Set a regular hyperslab + * Purpose: Set a regular hyperslab * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, October 2, 2014 * *------------------------------------------------------------------------- @@ -9584,19 +9585,19 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__set_regular_hyperslab() */ - + /*------------------------------------------------------------------------- - * Function: H5S__hyper_regular_and_single_block + * Function: H5S__hyper_regular_and_single_block * - * Purpose: Optimized routine to perform "AND" operation of a single - * block against a regular hyperslab selection. + * Purpose: Optimized routine to perform "AND" operation of a single + * block against a regular hyperslab selection. * - * Note: This algorithm is invoked when constructing the chunk map + * Note: This algorithm is invoked when constructing the chunk map * and a regular hyperslab is selected in the file's dataspace. * - * Return: Non-negative on success / Negative on failure + * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, February 9, 2019 * *------------------------------------------------------------------------- @@ -9818,15 +9819,15 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_regular_and_single_block() */ - + /*------------------------------------------------------------------------- - * Function: H5S_select_hyperslab + * Function: H5S_select_hyperslab * - * Purpose: Internal version of H5Sselect_hyperslab(). + * Purpose: Internal version of H5Sselect_hyperslab(). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, January 10, 2001 * *------------------------------------------------------------------------- @@ -10136,7 +10137,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_hyperslab() */ - + /*-------------------------------------------------------------------------- NAME H5Sselect_hyperslab @@ -10200,7 +10201,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sselect_hyperslab() */ - + /*-------------------------------------------------------------------------- NAME H5S_combine_hyperslab @@ -10406,16 +10407,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_combine_hyperslab() */ - + /*------------------------------------------------------------------------- - * Function: H5S__fill_in_select + * Function: H5S__fill_in_select * - * Purpose: Combines two hyperslabs with an operation, putting the + * Purpose: Combines two hyperslabs with an operation, putting the * result into a third hyperslab selection * - * Return: Non-negative on success/negative on failure + * Return: Non-negative on success/negative on failure * - * Programmer: Chao Mei + * Programmer: Chao Mei * Tuesday, July 5, 2011 * *------------------------------------------------------------------------- @@ -10459,7 +10460,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__fill_in_select() */ - + /*-------------------------------------------------------------------------- NAME H5Scombine_hyperslab @@ -10493,9 +10494,9 @@ hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { - H5S_t *space; /* Dataspace to modify selection of */ - H5S_t *new_space = NULL; /* New dataspace created */ - hid_t ret_value; /* Return value */ + H5S_t *space; /* Dataspace to modify selection of */ + H5S_t *new_space = NULL; /* New dataspace created */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE6("i", "iSs*h*h*h*h", space_id, op, start, stride, count, block); @@ -10523,15 +10524,15 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Scombine_hyperslab() */ - + /*------------------------------------------------------------------------- - * Function: H5S__combine_select + * Function: H5S__combine_select * - * Purpose: Internal version of H5Scombine_select(). + * Purpose: Internal version of H5Scombine_select(). * - * Return: New dataspace on success/NULL on failure + * Return: New dataspace on success/NULL on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, October 30, 2001 * *------------------------------------------------------------------------- @@ -10591,7 +10592,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__combine_select() */ - + /*-------------------------------------------------------------------------- NAME H5Scombine_select @@ -10617,10 +10618,10 @@ done: hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) { - H5S_t *space1; /* First Dataspace */ - H5S_t *space2; /* Second Dataspace */ - H5S_t *new_space = NULL; /* New Dataspace */ - hid_t ret_value; /* Return value */ + H5S_t *space1; /* First Dataspace */ + H5S_t *space2; /* Second Dataspace */ + H5S_t *new_space = NULL; /* New Dataspace */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iSsi", space1_id, op, space2_id); @@ -10666,15 +10667,15 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Scombine_select() */ - + /*------------------------------------------------------------------------- - * Function: H5S__modify_select + * Function: H5S__modify_select * - * Purpose: Internal version of H5Smodify_select(). + * Purpose: Internal version of H5Smodify_select(). * - * Return: New dataspace on success/NULL on failure + * Return: New dataspace on success/NULL on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, October 30, 2001 * *------------------------------------------------------------------------- @@ -10726,7 +10727,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__modify_select() */ - + /*-------------------------------------------------------------------------- NAME H5Smodify_select @@ -10752,8 +10753,8 @@ done: herr_t H5Smodify_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) { - H5S_t *space1; /* First Dataspace */ - H5S_t *space2; /* Second Dataspace */ + H5S_t *space1; /* First Dataspace */ + H5S_t *space2; /* Second Dataspace */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -10808,7 +10809,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Smodify_select() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_proj_int_build_proj @@ -11130,7 +11131,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_proj_int_build_proj() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_proj_int_iterate @@ -11381,7 +11382,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_proj_int_iterate() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_project_intersection @@ -11567,7 +11568,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_project_intersection() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_get_clip_diminfo @@ -11622,7 +11623,7 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count, FUNC_LEAVE_NOAPI_VOID } /* end H5S__hyper_get_clip_diminfo() */ - + /*-------------------------------------------------------------------------- NAME H5S_hyper_clip_unlim @@ -11748,7 +11749,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_clip_unlim() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_get_clip_extent_real @@ -11830,7 +11831,7 @@ H5S__hyper_get_clip_extent_real(const H5S_t *clip_space, hsize_t num_slices, FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_get_clip_extent_real() */ - + /*-------------------------------------------------------------------------- NAME H5S_hyper_get_clip_extent @@ -11893,7 +11894,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_get_clip_extent() */ - + /*-------------------------------------------------------------------------- NAME H5S_hyper_get_clip_extent_match @@ -11983,7 +11984,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_get_clip_extent_match() */ - + /*-------------------------------------------------------------------------- NAME H5S_hyper_get_unlim_block @@ -12066,7 +12067,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_get_unlim_block */ - + /*-------------------------------------------------------------------------- NAME H5S_hyper_get_first_inc_block @@ -12134,7 +12135,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_get_first_inc_block */ - + /*-------------------------------------------------------------------------- NAME H5Sis_regular_hyperslab @@ -12176,7 +12177,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sis_regular_hyperslab() */ - + /*-------------------------------------------------------------------------- NAME H5Sget_regular_hyperslab diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 8e1175a..1a2cbff 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -15,7 +15,7 @@ * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Purpose: Point selection dataspace I/O functions. + * Purpose: Point selection dataspace I/O functions. */ /****************/ @@ -30,8 +30,8 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* ID Functions */ #include "H5MMprivate.h" /* Memory management */ #include "H5Spkg.h" /* Dataspace functions */ @@ -138,6 +138,7 @@ const unsigned H5O_sds_point_ver_bounds[] = { H5S_POINT_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5S_POINT_VERSION_1, /* H5F_LIBVER_V18 */ H5S_POINT_VERSION_1, /* H5F_LIBVER_V110 */ + H5S_POINT_VERSION_1, /* H5F_LIBVER_V112 */ H5S_POINT_VERSION_2 /* H5F_LIBVER_LATEST */ }; @@ -167,15 +168,15 @@ H5FL_BARR_DEFINE_STATIC(H5S_pnt_node_t, hcoords_t, H5S_MAX_RANK); H5FL_DEFINE_STATIC(H5S_pnt_list_t); - + /*------------------------------------------------------------------------- - * Function: H5S__point_iter_init + * Function: H5S__point_iter_init * - * Purpose: Initializes iteration information for point selection. + * Purpose: Initializes iteration information for point selection. * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * *------------------------------------------------------------------------- @@ -193,14 +194,14 @@ H5S__point_iter_init(const H5S_t *space, H5S_sel_iter_t *iter) /* If this iterator is created from an API call, by default we clone the * selection now, as the dataspace could be modified or go out of scope. - * + * * However, if the H5S_SEL_ITER_SHARE_WITH_DATASPACE flag is given, * the selection is shared between the selection iterator and the * dataspace. In this case, the application _must_not_ modify or * close the dataspace that the iterator is operating on, or undefined * behavior will occur. */ - if((iter->flags & H5S_SEL_ITER_API_CALL) && + if((iter->flags & H5S_SEL_ITER_API_CALL) && !(iter->flags & H5S_SEL_ITER_SHARE_WITH_DATASPACE)) { /* Copy the point list */ if(NULL == (iter->u.pnt.pnt_lst = H5S__copy_pnt_list(space->select.sel_info.pnt_lst, space->extent.rank))) @@ -220,16 +221,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_iter_init() */ - + /*------------------------------------------------------------------------- - * Function: H5S__point_iter_coords + * Function: H5S__point_iter_coords * - * Purpose: Retrieve the current coordinates of iterator for current + * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, April 22, 2003 * *------------------------------------------------------------------------- @@ -249,16 +250,16 @@ H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_iter_coords() */ - + /*------------------------------------------------------------------------- - * Function: H5S__point_iter_block + * Function: H5S__point_iter_block * - * Purpose: Retrieve the current block of iterator for current + * Purpose: Retrieve the current block of iterator for current * selection * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, June 2, 2003 * *------------------------------------------------------------------------- @@ -280,15 +281,15 @@ H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_iter_block() */ - + /*------------------------------------------------------------------------- - * Function: H5S__point_iter_nelmts + * Function: H5S__point_iter_nelmts * - * Purpose: Return number of elements left to process in iterator + * Purpose: Return number of elements left to process in iterator * - * Return: Non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * *------------------------------------------------------------------------- @@ -304,7 +305,7 @@ H5S__point_iter_nelmts(const H5S_sel_iter_t *iter) FUNC_LEAVE_NOAPI(iter->elmt_left) } /* end H5S__point_iter_nelmts() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_iter_has_next_block @@ -340,7 +341,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_iter_has_next_block() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_iter_next @@ -377,7 +378,7 @@ H5S__point_iter_next(H5S_sel_iter_t *iter, size_t nelem) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_iter_next() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_iter_next_block @@ -409,7 +410,7 @@ H5S__point_iter_next_block(H5S_sel_iter_t *iter) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_iter_next_block() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_iter_get_seq_list @@ -446,9 +447,9 @@ H5S__point_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem size_t io_left; /* The number of bytes left in the selection */ size_t start_io_left; /* The initial number of bytes left in the selection */ H5S_pnt_node_t *node; /* Point node */ - unsigned ndims; /* Dimensionality of dataspace*/ - hsize_t acc; /* Coordinate accumulator */ - hsize_t loc; /* Coordinate offset */ + unsigned ndims; /* Dimensionality of dataspace*/ + hsize_t acc; /* Coordinate accumulator */ + hsize_t loc; /* Coordinate offset */ size_t curr_seq; /* Current sequence being operated on */ int i; /* Local index variable */ herr_t ret_value = SUCCEED; /* return value */ @@ -540,7 +541,7 @@ H5S__point_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_iter_get_seq_list() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_iter_release @@ -567,14 +568,14 @@ H5S__point_iter_release(H5S_sel_iter_t * iter) HDassert(iter); /* If this iterator copied the point list, we must free it */ - if((iter->flags & H5S_SEL_ITER_API_CALL) && + if((iter->flags & H5S_SEL_ITER_API_CALL) && !(iter->flags & H5S_SEL_ITER_SHARE_WITH_DATASPACE)) H5S__free_pnt_list(iter->u.pnt.pnt_lst); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_iter_release() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_add @@ -691,7 +692,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_add() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_release @@ -729,7 +730,7 @@ H5S__point_release(H5S_t *space) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_release() */ - + /*-------------------------------------------------------------------------- NAME H5S_select_elements @@ -799,7 +800,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_elements() */ - + /*-------------------------------------------------------------------------- NAME H5S__copy_pnt_list @@ -875,7 +876,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__copy_pnt_list() */ - + /*-------------------------------------------------------------------------- NAME H5S__free_pnt_list @@ -917,7 +918,7 @@ H5S__free_pnt_list(H5S_pnt_list_t *pnt_lst) FUNC_LEAVE_NOAPI_VOID } /* end H5S__free_pnt_list() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_copy @@ -957,7 +958,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_copy() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_is_valid @@ -1001,7 +1002,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_is_valid() */ - + /*-------------------------------------------------------------------------- NAME H5Sget_select_elem_npoints @@ -1040,7 +1041,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_select_elem_npoints() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_get_version_enc_size @@ -1060,7 +1061,7 @@ done: (2) whether the number of points or selection high bounds exceeds H5S_UINT32_MAX or not Determine the encoded size based on version: - --For version 2, the encoded size of point selection info is determined + --For version 2, the encoded size of point selection info is determined by the maximum size for: (a) storing the number of points (b) storing the selection high bounds @@ -1158,7 +1159,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S__point_get_version_enc_size() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_serial_size @@ -1196,19 +1197,19 @@ H5S__point_serial_size(const H5S_t *space) /* Basic number of bytes required to serialize point selection: */ if(version >= H5S_POINT_VERSION_2) /* - * + + + * + + * + rank (4 bytes)> */ ret_value=13; - else + else /* * + + + - * + + * + */ ret_value = 20; /* */ - ret_value += enc_size; + ret_value += enc_size; /* Count points in selection */ ret_value += (hssize_t) (enc_size * space->extent.rank * space->select.num_elem); @@ -1217,7 +1218,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_serial_size() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_serialize @@ -1350,7 +1351,7 @@ done: } /* H5S__point_serialize() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_deserialize @@ -1440,13 +1441,13 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p) /* decode the number of points */ switch(enc_size) { case H5S_SELECT_INFO_ENC_SIZE_2: - UINT16DECODE(pp, num_elem); + UINT16DECODE(pp, num_elem); break; case H5S_SELECT_INFO_ENC_SIZE_4: UINT32DECODE(pp, num_elem); break; case H5S_SELECT_INFO_ENC_SIZE_8: - UINT64DECODE(pp, num_elem); + UINT64DECODE(pp, num_elem); break; default: HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size") @@ -1502,7 +1503,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_deserialize() */ - + /*-------------------------------------------------------------------------- NAME H5S__get_select_elem_pointlist @@ -1567,7 +1568,7 @@ H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__get_select_elem_pointlist() */ - + /*-------------------------------------------------------------------------- NAME H5Sget_select_elem_pointlist @@ -1621,7 +1622,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_select_elem_pointlist() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_bounds @@ -1679,7 +1680,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_bounds() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_offset @@ -1743,7 +1744,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_offset() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_unlim_dim @@ -1772,7 +1773,7 @@ H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) FUNC_LEAVE_NOAPI(-1) } /* end H5S__point_unlim_dim() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_is_contiguous @@ -1805,14 +1806,14 @@ H5S__point_is_contiguous(const H5S_t *space) /* One point is definitely contiguous */ if(space->select.num_elem == 1) - ret_value = TRUE; - else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */ - ret_value = FALSE; + ret_value = TRUE; + else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */ + ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_is_contiguous() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_is_single @@ -1842,14 +1843,14 @@ H5S__point_is_single(const H5S_t *space) /* One point is definitely 'single' :-) */ if(space->select.num_elem == 1) - ret_value = TRUE; + ret_value = TRUE; else - ret_value = FALSE; + ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_is_single() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_is_regular @@ -1883,14 +1884,14 @@ H5S__point_is_regular(const H5S_t *space) /* Only simple check for regular points for now... */ if(space->select.num_elem == 1) - ret_value = TRUE; + ret_value = TRUE; else - ret_value = FALSE; + ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_is_regular() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_shape_same @@ -1998,7 +1999,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_shape_same() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_intersect_block @@ -2055,7 +2056,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_intersect_block() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_adjust_u @@ -2112,16 +2113,16 @@ H5S__point_adjust_u(H5S_t *space, const hsize_t *offset) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_adjust_u() */ - + /*------------------------------------------------------------------------- - * Function: H5S__point_project_scalar + * Function: H5S__point_project_scalar * - * Purpose: Projects a single element point selection into a scalar + * Purpose: Projects a single element point selection into a scalar * dataspace * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- @@ -2152,16 +2153,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_project_scalar() */ - + /*------------------------------------------------------------------------- - * Function: H5S__point_project_simple + * Function: H5S__point_project_simple * - * Purpose: Projects a point selection onto/into a simple dataspace + * Purpose: Projects a point selection onto/into a simple dataspace * of a different rank * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- @@ -2288,7 +2289,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_project_simple() */ - + /*-------------------------------------------------------------------------- NAME H5Sselect_elements diff --git a/src/H5T.c b/src/H5T.c index 6ef9478..fd48d6a 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -514,6 +514,7 @@ const unsigned H5O_dtype_ver_bounds[] = { H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V110 */ + H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V112 */ H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; @@ -550,7 +551,7 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{ static hbool_t H5T_top_package_initialize_s = FALSE; - + /*------------------------------------------------------------------------- * Function: H5T_init * @@ -576,7 +577,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_init() */ - + /*------------------------------------------------------------------------- * Function: H5T__init_inf * @@ -689,7 +690,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__init_inf() */ - + /*-------------------------------------------------------------------------- NAME H5T__init_package -- Initialize interface-specific information @@ -1313,7 +1314,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__init_package() */ - + /*------------------------------------------------------------------------- * Function: H5T__unlock_cb * @@ -1346,7 +1347,7 @@ H5T__unlock_cb(void *_dt, hid_t H5_ATTR_UNUSED id, void *_udata) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T__unlock_cb() */ - + /*------------------------------------------------------------------------- * Function: H5T_top_term_package * @@ -1547,7 +1548,7 @@ H5T_top_term_package(void) FUNC_LEAVE_NOAPI(n) } /* end H5T_top_term_package() */ - + /*------------------------------------------------------------------------- * Function: H5T_term_package * @@ -1589,7 +1590,7 @@ H5T_term_package(void) FUNC_LEAVE_NOAPI(n) } /* end H5T_term_package() */ - + /*------------------------------------------------------------------------- * Function: H5T__close_cb * @@ -1632,7 +1633,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__close_cb() */ - + /*------------------------------------------------------------------------- * Function: H5Tcreate * @@ -1677,7 +1678,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tcreate() */ - + /*------------------------------------------------------------------------- * Function: H5Tcopy * @@ -1777,7 +1778,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tcopy() */ - + /*------------------------------------------------------------------------- * Function: H5Tclose * @@ -1812,7 +1813,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tclose() */ - + /*------------------------------------------------------------------------- * Function: H5Tequal * @@ -1849,7 +1850,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tequal() */ - + /*------------------------------------------------------------------------- * Function: H5Tlock * @@ -1896,7 +1897,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tlock() */ - + /*------------------------------------------------------------------------- * Function: H5Tget_class * @@ -1931,7 +1932,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tget_class() */ - + /*------------------------------------------------------------------------- * Function: H5T_get_class * @@ -1973,7 +1974,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_get_class() */ - + /*------------------------------------------------------------------------- * Function: H5Tdetect_class * @@ -2009,7 +2010,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tdetect_class() */ - + /*------------------------------------------------------------------------- * Function: H5T_detect_class * @@ -2085,7 +2086,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_detect_class() */ - + /*------------------------------------------------------------------------- * Function: H5Tis_variable_str * @@ -2119,7 +2120,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tis_variable_str() */ - + /*------------------------------------------------------------------------- * Function: H5T_is_variable_str * @@ -2140,7 +2141,7 @@ H5T_is_variable_str(const H5T_t *dt) FUNC_LEAVE_NOAPI(H5T_IS_VL_STRING(dt->shared)) } /* end H5T_is_variable_str() */ - + /*------------------------------------------------------------------------- * Function: H5Tget_size * @@ -2177,7 +2178,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tget_size() */ - + /*------------------------------------------------------------------------- * Function: H5Tset_size * @@ -2233,7 +2234,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tset_size() */ - + /*------------------------------------------------------------------------- * Function: H5Tget_super * @@ -2273,7 +2274,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tget_super() */ - + /*------------------------------------------------------------------------- * Function: H5T_get_super * @@ -2307,7 +2308,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_get_super() */ - + /*------------------------------------------------------------------------- * Function: H5T__register_int * @@ -2347,7 +2348,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__register_int() */ - + /*------------------------------------------------------------------------- * Function: H5T__register * @@ -2531,7 +2532,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__register() */ - + /*------------------------------------------------------------------------- * Function: H5Tregister * @@ -2587,7 +2588,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tregister() */ - + /*------------------------------------------------------------------------- * Function: H5T__unregister * @@ -2691,7 +2692,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T__unregister() */ - + /*------------------------------------------------------------------------- * Function: H5Tunregister * @@ -2731,7 +2732,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tunregister() */ - + /*------------------------------------------------------------------------- * Function: H5Tfind * @@ -2781,7 +2782,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tfind() */ - + /*------------------------------------------------------------------------- * Function: H5Tcompiler_conv * @@ -2821,7 +2822,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tcompiler_conv() */ - + /*------------------------------------------------------------------------- * Function: H5Tconvert * @@ -2880,7 +2881,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tconvert() */ - + /*------------------------------------------------------------------------- * Function: H5Tencode * @@ -2919,7 +2920,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Tencode() */ - + /*------------------------------------------------------------------------- * Function: H5Tdecode * @@ -2974,7 +2975,7 @@ done: *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * Function: H5T_encode * @@ -3030,7 +3031,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_encode() */ - + /*------------------------------------------------------------------------- * Function: H5T_decode * @@ -3084,7 +3085,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_decode() */ - + /*------------------------------------------------------------------------- * Function: H5T__create * @@ -3216,7 +3217,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__create() */ - + /*------------------------------------------------------------------------- * Function: H5T_copy * @@ -3506,7 +3507,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_copy() */ - + /*------------------------------------------------------------------------- * Function: H5T_lock * @@ -3553,7 +3554,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5T__alloc * @@ -3603,7 +3604,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__alloc() */ - + /*------------------------------------------------------------------------- * Function: H5T__free * @@ -3683,7 +3684,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__free() */ - + /*------------------------------------------------------------------------- * Function: H5T_close_real * @@ -3727,7 +3728,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_close_real() */ - + /*------------------------------------------------------------------------- * Function: H5T_close * @@ -3812,7 +3813,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_close() */ - + /*------------------------------------------------------------------------- * Function: H5T__set_size * @@ -4012,7 +4013,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__set_size() */ - + /*------------------------------------------------------------------------- * Function: H5T_get_size * @@ -4040,7 +4041,7 @@ H5T_get_size(const H5T_t *dt) FUNC_LEAVE_NOAPI(dt->shared->size) } /* end H5T_get_size() */ - + /*------------------------------------------------------------------------- * Function: H5T_cmp * @@ -4502,7 +4503,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5T_path_find * @@ -4549,7 +4550,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_path_find() */ - + /*------------------------------------------------------------------------- * Function: H5T__path_find_real * @@ -4856,7 +4857,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__path_find_real() */ - + /*------------------------------------------------------------------------- * Function: H5T_path_noop * @@ -4881,7 +4882,7 @@ H5T_path_noop(const H5T_path_t *p) FUNC_LEAVE_NOAPI(p->is_noop || (p->is_hard && 0==H5T_cmp(p->src, p->dst, FALSE))) } /* end H5T_path_noop() */ - + /*------------------------------------------------------------------------- * Function: H5T_path_compound_subset * @@ -4925,7 +4926,7 @@ H5T_path_compound_subset(const H5T_path_t *p) FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_path_compound_subset */ - + /*------------------------------------------------------------------------- * Function: H5T_path_bkg * @@ -4947,7 +4948,7 @@ H5T_path_bkg(const H5T_path_t *p) FUNC_LEAVE_NOAPI(p->cdata.need_bkg) } /* end H5T_path_bkg() */ - + /*------------------------------------------------------------------------- * Function: H5T__compiler_conv * @@ -4981,7 +4982,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__compiler_conv() */ - + /*------------------------------------------------------------------------- * Function: H5T_convert * @@ -5032,7 +5033,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_convert() */ - + /*------------------------------------------------------------------------- * Function: H5T_oloc * @@ -5073,7 +5074,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_oloc() */ - + /*------------------------------------------------------------------------- * Function: H5T_nameof * @@ -5113,7 +5114,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_nameof() */ - + /*------------------------------------------------------------------------- * Function: H5T_is_immutable * @@ -5143,7 +5144,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5T_is_named * @@ -5228,7 +5229,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_convert_committed_datatype() */ - + /*-------------------------------------------------------------------------- * Function: H5T_get_ref_type * @@ -5257,7 +5258,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_get_ref_type() */ - + /*------------------------------------------------------------------------- * Function: H5T_is_sensible * @@ -5319,7 +5320,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } - + /*-------------------------------------------------------------------------- NAME H5T_set_loc @@ -5485,7 +5486,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_set_loc() */ - + /*------------------------------------------------------------------------- * Function: H5T_is_relocatable * @@ -5524,7 +5525,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_is_relocatable() */ - + /*------------------------------------------------------------------------- * Function: H5T_detect_reg_ref * @@ -5532,7 +5533,7 @@ done: * datatype. * * Return: TRUE (1) or FALSE (0) on success - * (Can't fail) + * (Can't fail) * * Programmer: Quincey Koziol * Saturday, January 5, 2019 @@ -5587,7 +5588,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__detect_reg_ref() */ - + /*------------------------------------------------------------------------- * Function: H5T_is_vl_storage * @@ -5629,7 +5630,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_is_vl_storage() */ - + /*------------------------------------------------------------------------- * Function: H5T_upgrade_version_cb * @@ -5687,7 +5688,7 @@ H5T_upgrade_version_cb(H5T_t *dt, void *op_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T_upgrade_version_cb() */ - + /*------------------------------------------------------------------------- * Function: H5T__upgrade_version * @@ -5720,12 +5721,12 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__upgrade_version() */ - + /*------------------------------------------------------------------------- * Function: H5T_set_version * * Purpose: Set the encoding for a datatype to the version indicated by - * the file's low bound if that is higher than the datatype's + * the file's low bound if that is higher than the datatype's * version. * * Return: Non-negative on success/Negative on failure @@ -5752,7 +5753,7 @@ H5T_set_version(H5F_t *f, H5T_t *dt) if(H5T__upgrade_version(dt, vers) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade datatype encoding") } - + /* Version bounds check */ if(dt->shared->version > H5O_dtype_ver_bounds[H5F_HIGH_BOUND(f)]) HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "Datatype version out of bounds") @@ -5761,7 +5762,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_set_version() */ - + /*------------------------------------------------------------------------- * Function: H5T_patch_file * @@ -5797,7 +5798,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_patch_file() */ - + /*------------------------------------------------------------------------- * Function: H5T_patch_vlen_file * diff --git a/src/H5trace.c b/src/H5trace.c index de761f8..b1301dd 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -25,7 +25,7 @@ /****************/ /* Module Setup */ /****************/ -#define H5I_FRIEND /*suppress error about including H5Ipkg */ +#define H5I_FRIEND /*suppress error about including H5Ipkg */ /***********/ /* Headers */ @@ -79,7 +79,7 @@ /*******************/ - + /*------------------------------------------------------------------------- * Function: H5_trace * @@ -134,7 +134,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) /* FUNC_ENTER() should not be called */ if(!out) - return 0.0F; /*tracing is off*/ + return 0.0F; /*tracing is off*/ HDva_start(ap, type); if(H5_debug_g.ttop) { @@ -767,7 +767,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if(status >= 0) HDfprintf(out, "SUCCEED"); - else + else HDfprintf(out, "FAIL"); } /* end else */ break; @@ -1058,7 +1058,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...) break; case H5F_LIBVER_V112: - HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V112); + HDfprintf(out, "H5F_LIBVER_V112"); + break; + + case H5F_LIBVER_V114: + HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V114); HDfprintf(out, "H5F_LIBVER_LATEST"); break; diff --git a/test/h5test.c b/test/h5test.c index dd8d906..c8f4132 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -106,7 +106,8 @@ const char *LIBVER_NAMES[] = { "earliest", /* H5F_LIBVER_EARLIEST = 0 */ "v18", /* H5F_LIBVER_V18 = 1 */ "v110", /* H5F_LIBVER_V110 = 2 */ - "latest", /* H5F_LIBVER_V112 = 3 */ + "v112", /* H5F_LIBVER_V112 = 3 */ + "latest", /* H5F_LIBVER_V114 = 4 */ NULL }; diff --git a/test/tfile.c b/test/tfile.c index f39da5a..cf4403c 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5769,6 +5769,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n case H5F_LIBVER_V110: case H5F_LIBVER_V112: + case H5F_LIBVER_V114: ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3); VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); break; diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 8c887a2..db821ef 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -139,7 +139,8 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " 1: This is H5F_LIBVER_V18 in H5F_libver_t struct\n"); PRINTVALSTREAM(rawoutstream, " 2: This is H5F_LIBVER_V110 in H5F_libver_t struct\n"); PRINTVALSTREAM(rawoutstream, " 3: This is H5F_LIBVER_V112 in H5F_libver_t struct\n"); - PRINTVALSTREAM(rawoutstream, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V112 for this release\n"); + PRINTVALSTREAM(rawoutstream, " 4: This is H5F_LIBVER_V114 in H5F_libver_t struct\n"); + PRINTVALSTREAM(rawoutstream, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V114 for this release\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " FS_STRATEGY is a string indicating the file space strategy used:\n"); PRINTVALSTREAM(rawoutstream, " FSM_AGGR:\n"); diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt index e55eed9..29a3803 100644 --- a/tools/test/h5repack/testfiles/h5repack-help.txt +++ b/tools/test/h5repack/testfiles/h5repack-help.txt @@ -61,7 +61,8 @@ usage: h5repack [OPTIONS] file1 file2 1: This is H5F_LIBVER_V18 in H5F_libver_t struct 2: This is H5F_LIBVER_V110 in H5F_libver_t struct 3: This is H5F_LIBVER_V112 in H5F_libver_t struct - (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V112 for this release + 4: This is H5F_LIBVER_V114 in H5F_libver_t struct + (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V114 for this release FS_STRATEGY is a string indicating the file space strategy used: FSM_AGGR: -- cgit v0.12 From d08db4f8550ee023f2303f3064308c1fa9854552 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 25 Sep 2019 17:35:52 -0500 Subject: Remove file script --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3d0765b..2ffbf0f 100644 --- a/configure.ac +++ b/configure.ac @@ -3695,7 +3695,6 @@ AC_CONFIG_FILES([src/libhdf5.settings test/test_vol_plugin.sh testpar/Makefile testpar/testpflush.sh - testpar/test_cache_image.sh tools/Makefile tools/lib/Makefile tools/libtest/Makefile -- cgit v0.12 From d931415bb96aae645832898c2f9eee0d02fe69b4 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 25 Sep 2019 17:56:39 -0500 Subject: Update N_FSINFO_VERSION_BOUNDS to H5F_LIBVER_NBOUND. --- src/H5Ofsinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 72edf11..e5e6741 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -74,7 +74,7 @@ static const unsigned H5O_fsinfo_ver_bounds[] = { H5O_FSINFO_VERSION_1, /* H5F_LIBVER_V112 */ H5O_FSINFO_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; -#define N_FSINFO_VERSION_BOUNDS 4 +#define N_FSINFO_VERSION_BOUNDS H5F_LIBVER_NBOUNDS /* Declare a free list to manage the H5O_fsinfo_t struct */ H5FL_DEFINE_STATIC(H5O_fsinfo_t); -- cgit v0.12 From a08b3adecea1034cf0a20a6ff35b9980fb3d8cb8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 26 Sep 2019 08:43:41 -0500 Subject: Add new versioned filename to list --- test/chunk_info.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/test/chunk_info.c b/test/chunk_info.c index 70f6eb6..057991c 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -53,6 +53,7 @@ const char *FILENAME[] = { "tchunk_info_v18", "tchunk_info_v110", "tchunk_info_v112", + "tchunk_info_v114", NULL }; @@ -786,7 +787,7 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR @@ -840,7 +841,7 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Get and verify info of the first and only chunk */ if(verify_get_chunk_info(dset, H5S_ALL, 0, SINGLE_CHK_SIZE, offset, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); - + /* Get and verify info of the chunk at logical coordinates (0,0) */ if(verify_get_chunk_info_by_coord(dset, offset, SINGLE_CHK_SIZE, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); @@ -912,7 +913,7 @@ test_chunk_info_implicit(char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR @@ -984,7 +985,7 @@ error: H5_FAILED(); return FAIL; } /* test_chunk_info_implicit() */ - + /*------------------------------------------------------------------------- * Function: test_chunk_info_fixed_array * @@ -1029,7 +1030,7 @@ test_chunk_info_fixed_array(const char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR @@ -1115,7 +1116,7 @@ error: H5_FAILED(); return FAIL; } /* test_chunk_info_fixed_array() */ - + /*------------------------------------------------------------------------- * Function: test_chunk_info_extensible_array * @@ -1161,7 +1162,7 @@ test_chunk_info_extensible_array(const char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR @@ -1298,7 +1299,7 @@ test_chunk_info_version2_btrees(const char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR @@ -1475,7 +1476,7 @@ test_basic_query(hid_t fapl) /* Get and verify info of the first and only chunk */ if(verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); - + /* Get and verify info of the chunk at the offset (CHUNK_NX,CHUNK_NY) */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); @@ -1504,7 +1505,7 @@ test_basic_query(hid_t fapl) offset should be (0,0) */ if(verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); - + /* Get and verify info of the chunk at the offset (0,0) */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); @@ -1515,12 +1516,12 @@ test_basic_query(hid_t fapl) offset[1] = CHUNK_NY; if(verify_get_chunk_info(dset, H5S_ALL, 1, CHK_SIZE, offset, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); - + /* Get and verify info of the chunk at the offset (CHUNK_NX, CHUNK_NY) */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); - /* Get and verify info of an empty chunk, at offset + /* Get and verify info of an empty chunk, at offset (2*CHUNK_NX, 2*CHUNK_NY) */ offset[0] = 2*CHUNK_NX; offset[1] = 2*CHUNK_NY; @@ -1591,7 +1592,7 @@ test_failed_attempts(const char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR -- cgit v0.12 From e6b029e77e799292eb1ee074b24a224f4613a3b2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 26 Sep 2019 10:48:37 -0500 Subject: add missing version to list --- src/H5Fpublic.h | 2 +- test/dtypes.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 8338fb2..02568c9 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -180,7 +180,7 @@ typedef enum H5F_libver_t { H5F_LIBVER_V18 = 1, /* Use the latest v18 format for storing objects */ H5F_LIBVER_V110 = 2, /* Use the latest v110 format for storing objects */ H5F_LIBVER_V112 = 3, /* Use the latest v112 format for storing objects */ - H5F_LIBVER_V114 = 4, /* Use the latest v112 format for storing objects */ + H5F_LIBVER_V114 = 4, /* Use the latest v114 format for storing objects */ H5F_LIBVER_NBOUNDS } H5F_libver_t; diff --git a/test/dtypes.c b/test/dtypes.c index 5eaa77c..4ccb951 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -7650,8 +7650,8 @@ test_versionbounds(void) hsize_t arr_dim[] = {ARRAY_LEN}; /* Length of the array */ int i, j; /* Indices for iterating over versions */ H5F_libver_t low, high; /* File format bounds */ - H5F_libver_t versions[] = {H5F_LIBVER_EARLIEST, H5F_LIBVER_V18, H5F_LIBVER_V110}; - int versions_count = 3; /* Number of version bounds in the array */ + H5F_libver_t versions[] = {H5F_LIBVER_EARLIEST, H5F_LIBVER_V18, H5F_LIBVER_V110, H5F_LIBVER_V112, H5F_LIBVER_V114}; + int versions_count = 5; /* Number of version bounds in the array */ unsigned highest_version; /* Highest version in nested datatypes */ color_t enum_val; /* Enum type index */ herr_t ret = 0; /* Generic return value */ -- cgit v0.12 From 50ba969a61f8f90212c97aa6e11674fe19fb89f4 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 26 Sep 2019 12:35:11 -0500 Subject: Fix the errors when updating the versions in the new 1.13 develop branch. --- src/H5Shyper.c | 2 +- src/H5Spoint.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 9d19056..9feb8de 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -246,7 +246,7 @@ const unsigned H5O_sds_hyper_ver_bounds[] = { H5S_HYPER_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5S_HYPER_VERSION_1, /* H5F_LIBVER_V18 */ H5S_HYPER_VERSION_2, /* H5F_LIBVER_V110 */ - H5S_HYPER_VERSION_2, /* H5F_LIBVER_V112 */ + H5S_HYPER_VERSION_3, /* H5F_LIBVER_V112 */ H5S_HYPER_VERSION_3 /* H5F_LIBVER_LATEST */ }; diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 1a2cbff..ea6c9c5 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -138,7 +138,7 @@ const unsigned H5O_sds_point_ver_bounds[] = { H5S_POINT_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5S_POINT_VERSION_1, /* H5F_LIBVER_V18 */ H5S_POINT_VERSION_1, /* H5F_LIBVER_V110 */ - H5S_POINT_VERSION_1, /* H5F_LIBVER_V112 */ + H5S_POINT_VERSION_2, /* H5F_LIBVER_V112 */ H5S_POINT_VERSION_2 /* H5F_LIBVER_LATEST */ }; -- cgit v0.12