mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
[svn-r25197] Description:
Bring changes from hdf5_1_8_coverity branch back to trunk: r20878: Issue 76: Check if H5Tget_nmembers(type) fails and simply return(FALSE). Also move printf to after check. r20880: Issue 192: Create ret_val var set to -1. Add out label for failures to jump to, return ret_val at bottom. r20882: Fixes for coverity: 1) bug #1679: remove dead code in test/mf.c 2) bug #1680: remove dead code in tools/lib/h5diff_dset.c r20883: Fix coverity issue 585 Description: Changed variable "c" in processStrData in h5import.c to an int, to match fgetc return value, and removed call to feof, instead checking if c == EOF. Tested on: MacOSX/64 10.9.3 (amazon) w/C++, FORTRAN & parallel (too minor to require h5committest)
This commit is contained in:
parent
896a5e7992
commit
a613b70f93
@ -771,9 +771,9 @@ out:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int read_data( const char* fname, /*IN*/
|
||||
static int read_data(const char* fname, /*IN*/
|
||||
hsize_t *width, /*OUT*/
|
||||
hsize_t *height /*OUT*/ )
|
||||
hsize_t *height /*OUT*/)
|
||||
{
|
||||
int i, n;
|
||||
int color_planes;
|
||||
|
@ -385,10 +385,9 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz
|
||||
if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.addr, data_size, dxpl_id, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
|
||||
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
|
||||
}
|
||||
} /* end H5D__chunk_direct_write() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -2798,7 +2797,7 @@ void *
|
||||
H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
|
||||
hbool_t relax)
|
||||
{
|
||||
const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */
|
||||
const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */
|
||||
const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info - always equal to the pline passed to H5D__chunk_alloc */
|
||||
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
|
||||
const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
|
||||
|
@ -1307,8 +1307,6 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5D__multi_chunk_collective_io */
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5D__inter_collective_io
|
||||
|
@ -874,12 +874,9 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
while (!HDfeof(strm)) {
|
||||
c = HDfgetc(strm);
|
||||
|
||||
while(EOF != (c = HDfgetc(strm)))
|
||||
if (c == 10) /* eol */
|
||||
nlines++;
|
||||
}
|
||||
|
||||
if (!nlines)
|
||||
return 0;
|
||||
@ -940,9 +937,7 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
|
||||
|
||||
line = 0;
|
||||
|
||||
while (!HDfeof(strm)) {
|
||||
c = HDfgetc(strm);
|
||||
|
||||
while(EOF != (c = HDfgetc(strm))) {
|
||||
str[i] = (char)c;
|
||||
|
||||
i++;
|
||||
|
@ -816,8 +816,6 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, November 5, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static hbool_t
|
||||
@ -832,8 +830,7 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
|
||||
|
||||
if(H5T_COMPOUND != H5Tget_class(type))
|
||||
return FALSE;
|
||||
nmembs = H5Tget_nmembers(type);
|
||||
if(nmembs <= 0)
|
||||
if((nmembs = H5Tget_nmembers(type)) < 0)
|
||||
return FALSE;
|
||||
|
||||
h5tools_str_append(buffer, "struct {");
|
||||
@ -855,6 +852,7 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
|
||||
size = H5Tget_size(type);
|
||||
h5tools_str_append(buffer, "\n%*s} %lu byte%s",
|
||||
ind, "", (unsigned long)size, 1==size?"":"s");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -883,8 +881,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
|
||||
|
||||
if(H5T_ENUM != H5Tget_class(type))
|
||||
return FALSE;
|
||||
nmembs = H5Tget_nmembers(type);
|
||||
if(nmembs < 0)
|
||||
if((nmembs = H5Tget_nmembers(type)) < 0)
|
||||
return FALSE;
|
||||
|
||||
super = H5Tget_super(type);
|
||||
|
@ -441,13 +441,13 @@ hsize_t diff_datasetid( hid_t did1,
|
||||
HDassert(sm_nbytes > 0);
|
||||
} /* end for */
|
||||
|
||||
/* malloc return code should be verified.
|
||||
/* malloc return code should be verified.
|
||||
* If fail, need to handle the error.
|
||||
* This else branch should be recoded as a separate function.
|
||||
* Note that there are many "goto error" within this branch
|
||||
* that fails to address freeing other objects created here.
|
||||
* E.g., sm_space.
|
||||
*/
|
||||
* E.g., sm_space.
|
||||
*/
|
||||
sm_buf1 = HDmalloc((size_t)sm_nbytes);
|
||||
HDassert(sm_buf1);
|
||||
sm_buf2 = HDmalloc((size_t)sm_nbytes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user