summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-11-01 20:12:01 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-11-01 20:12:01 (GMT)
commita46c177ddfdb8578718eb3694811e634653c20de (patch)
tree219ff3377cd214ce9b282af02056651ca3df2611 /tools
parent65597415a3faf5f68c5c638d6e65b45ce473b34b (diff)
downloadhdf5-a46c177ddfdb8578718eb3694811e634653c20de.zip
hdf5-a46c177ddfdb8578718eb3694811e634653c20de.tar.gz
hdf5-a46c177ddfdb8578718eb3694811e634653c20de.tar.bz2
[svn-r23000] Description:
Bring r22998 from trunk to 1.8 branch: Clean up warnings and bring changes from Coverity branch back to trunk: r20451: Fixed coverity 810 r20454: Purpose: Fix coverity issue 816 Description: Modified various file drivers to always check the return value from H5P_get_driver_info. r20455: Purpose: Cleanup fix for coverity issue 816 Description: Removed redundant check for "fa" in H5FD_core_open. Tested on: Mac OSX/64 10.8.2 (amazon) w/debug (Too minor to require h5committest)
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5tools_dump.c50
-rw-r--r--tools/lib/h5tools_dump.h3
2 files changed, 30 insertions, 23 deletions
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 7555f03..a940d9c 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -30,10 +30,6 @@
#include "h5tools_utils.h"
#include "H5private.h"
-#define SANITY_CHECK
-
-#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z))
-
h5tool_format_t h5tools_dataformat = {
0, /*raw */
@@ -214,6 +210,12 @@ hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
hsize_t *curr_pos/*total data element position*/,
size_t ncols, hsize_t region_elmt_counter/*element counter*/,
hsize_t elmt_counter);
+
+void h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims);
+
+void h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx, struct subset_t *sset, int dims);
+
void
h5tools_dump_init(void)
{
@@ -627,7 +629,11 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL)
- HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+{
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+ HGOTO_DONE(dimension_break);
+ //HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+}
H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
@@ -688,7 +694,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin);
- h5tools_print_dataspace(stream, buffer, info, ctx, region_space);
+ h5tools_print_dataspace(buffer, region_space);
if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) {
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
@@ -1007,7 +1013,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
ctx->need_prefix = TRUE;
h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin);
- h5tools_print_dataspace(stream, buffer, info, ctx, region_space);
+ h5tools_print_dataspace(buffer, region_space);
if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) {
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
@@ -2211,7 +2217,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
/* Check C variable-length string first. Are the two types equal? */
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_C_S1;");
- goto done;
+ goto found_string_type;
}
/* Change the endianness and see if they're equal. */
@@ -2223,7 +2229,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_C_S1;");
- goto done;
+ goto found_string_type;
}
/* If not equal to C variable-length string, check Fortran type. */
@@ -2238,7 +2244,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
/* Are the two types equal? */
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_FORTRAN_S1;");
- goto done;
+ goto found_string_type;
}
/* Change the endianness and see if they're equal. */
@@ -2250,13 +2256,13 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_FORTRAN_S1;");
- goto done;
+ goto found_string_type;
}
/* Type doesn't match any of above. */
h5tools_str_append(buffer, "unknown_one_character_type;");
- done:
+ found_string_type:
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0);
ctx->indent_level--;
@@ -2307,7 +2313,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0);
ctx->indent_level++;
{
- char *ttag = H5Tget_tag(type);
+ char *ttag;
+
+ if(NULL == (ttag = H5Tget_tag(type)))
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed");
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, 0, 0);
@@ -2316,8 +2325,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag);
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0);
- if (ttag)
- HDfree(ttag);
+ HDfree(ttag);
}
ctx->indent_level--;
@@ -2478,8 +2486,7 @@ CATCH
*-------------------------------------------------------------------------
*/
int
-h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info,
- h5tools_context_t *ctx, hid_t space)
+h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
{
HERR_INIT(int, SUCCEED)
hsize_t size[H5TOOLS_DUMP_MAX_RANK];
@@ -2769,7 +2776,7 @@ h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info,
h5tools_str_append(&buffer, "%s ",
h5tools_dump_header_format->dataspacebegin);
- h5tools_print_dataspace(stream, &buffer, info, ctx, type);
+ h5tools_print_dataspace(&buffer, type);
if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
@@ -2841,7 +2848,6 @@ h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t
{
size_t size;
hid_t n_type;
- hsize_t nelmts = 1;
void *buf = NULL;
n_type = h5tools_get_native_type(type_id);
@@ -3563,7 +3569,8 @@ h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims)
for (i = 0; i < dims; i++) {
h5tools_str_append(buffer, HSIZE_T_FORMAT, s[i]);
- if (i + 1 != dims) h5tools_str_append(buffer, ", ");
+ if (i + 1 != dims)
+ h5tools_str_append(buffer, ", ");
}
}
@@ -3866,7 +3873,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
buf = HDmalloc((size_t)alloc_size);
HDassert(buf);
- if (H5Aread(obj_id, p_type, buf) >= 0)
+ if (H5Aread(obj_id, p_type, buf) >= 0) {
if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) {
/*
* Print 1-byte integer data as an ASCII character string
@@ -3895,6 +3902,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
}
else
datactx.need_prefix = TRUE;
+ }
status = h5tools_dump_mem(stream, info, &datactx, obj_id, p_type, space, buf);
if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) {
diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h
index 55e046b..86f9f99 100644
--- a/tools/lib/h5tools_dump.h
+++ b/tools/lib/h5tools_dump.h
@@ -67,8 +67,7 @@ H5TOOLS_DLL void h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
H5TOOLS_DLL int h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer/*in,out*/,
const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
hid_t type, int object_search);
-H5TOOLS_DLL int h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer/*in,out*/,
- const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+H5TOOLS_DLL int h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/,
hid_t space);
H5TOOLS_DLL int h5tools_print_enum(FILE *stream, h5tools_str_t *buffer/*in,out*/,
const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,