summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-03-25 15:58:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-03-25 15:58:48 (GMT)
commita7d3f5b5b1591c6cbf77b07383fc6de51e11d0b1 (patch)
treeea5b56bde574d082b6f82dd36d307aa7426eb639 /hl
parent708e8077c2c1bc5c1a28d8804e6a0ee670fe4600 (diff)
downloadhdf5-a7d3f5b5b1591c6cbf77b07383fc6de51e11d0b1.zip
hdf5-a7d3f5b5b1591c6cbf77b07383fc6de51e11d0b1.tar.gz
hdf5-a7d3f5b5b1591c6cbf77b07383fc6de51e11d0b1.tar.bz2
[svn-r24894] Description:
Bring r24869 & r24875 from trunk to 1.8 branch: Clean up more compiler warnings, plus merge a few Coverity bug fixes from the hdf5_1_8_coverity branch back to the trunk: r20877: Purpose: Fix coverity issue 1723 Description: Modified test_generate in hl/test_image to close file "f" before exit, even if an error occurs. r20879: Issue 63: change check of return of H5Tget_nmembers to <=0. No need to go futher if call fails as well as empty. r20881: Coverity #659 in Run 46: I changed the Line 442 where it tries to check whether FLAG_PRINTED is TRUE. But it had just been set to FALSE. I took out the condition check in the print statement. Tested on: Mac OSX/64 10.9.2 (amazon) w/C++, FORTRAN & Parallel (daily tested on trunk)
Diffstat (limited to 'hl')
-rw-r--r--hl/src/H5LT.c6
-rw-r--r--hl/src/H5LTanalyze.c8
-rw-r--r--hl/src/H5LTanalyze.l8
-rw-r--r--hl/src/H5LTparse.y2
-rw-r--r--hl/test/test_image.c7
5 files changed, 13 insertions, 18 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 98f2ff2..96cd014 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -27,7 +27,7 @@
#define INCREMENT 1024
#define TMP_LEN 256
#define MAX(a,b) (((a)>(b)) ? (a) : (b))
-int input_len;
+size_t input_len;
char *myinput;
size_t indent = 0;
@@ -2291,9 +2291,9 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
size_t dst_size; /*destination value type size */
int i;
- if((nmembs = H5Tget_nmembers(type))==0)
+ if((nmembs = H5Tget_nmembers(type))<=0)
goto out;
- assert(nmembs>0);
+
if((super = H5Tget_super(type)) < 0)
goto out;
diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c
index f02bed6..b25db7e 100644
--- a/hl/src/H5LTanalyze.c
+++ b/hl/src/H5LTanalyze.c
@@ -820,7 +820,7 @@ int my_yyinput(char *, int);
#define YY_BUF_SIZE 262144 /*Define read buffer to be 256K*/
extern char *myinput;
-extern int input_len;
+extern size_t input_len;
#define STACK_SIZE 16
@@ -855,10 +855,6 @@ extern hbool_t is_opq_tag;
hbool_t first_quote = 1;
-/* For Lex and Yacc */
-/*int input_len;
-char *myinput;*/
-
#define TAG_STRING 1
#line 843 "H5LTanalyze.c"
@@ -2342,7 +2338,7 @@ int my_yyinput(char *buf, int max_size)
int ret;
memcpy(buf, myinput, input_len);
- ret = input_len;
+ ret = (int)input_len;
return ret;
}
diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l
index 581672b..7407520 100644
--- a/hl/src/H5LTanalyze.l
+++ b/hl/src/H5LTanalyze.l
@@ -30,7 +30,7 @@ int my_yyinput(char *, int);
#define YY_BUF_SIZE 262144 /*Define read buffer to be 256K*/
extern char *myinput;
-extern int input_len;
+extern size_t input_len;
#define STACK_SIZE 16
@@ -65,10 +65,6 @@ extern hbool_t is_opq_tag;
hbool_t first_quote = 1;
-/* For Lex and Yacc */
-/*int input_len;
-char *myinput;*/
-
%}
%s TAG_STRING
@@ -181,7 +177,7 @@ int my_yyinput(char *buf, int max_size)
int ret;
memcpy(buf, myinput, input_len);
- ret = input_len;
+ ret = (int)input_len;
return ret;
}
diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y
index b91e97e..973f2cb 100644
--- a/hl/src/H5LTparse.y
+++ b/hl/src/H5LTparse.y
@@ -51,7 +51,7 @@ int asindex = -1; /*pointer to the top of array stack*/
hbool_t is_str_size = 0; /*flag to lexer for string size*/
hbool_t is_str_pad = 0; /*flag to lexer for string padding*/
-H5T_pad_t str_pad; /*variable for string padding*/
+H5T_str_t str_pad; /*variable for string padding*/
H5T_cset_t str_cset; /*variable for string character set*/
hbool_t is_variable = 0; /*variable for variable-length string*/
size_t str_size; /*variable for string size*/
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index d2d9cab..3109a36 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -544,7 +544,7 @@ static int test_generate(void)
int imax, jmax, kmax;
int n_elements;
float valex, xmin, xmax, value;
- FILE *f;
+ FILE *f = NULL;
char *srcdir = getenv("srcdir"); /* the source directory */
char data_file[512]=""; /* buffer to hold name of existing data file */
int i;
@@ -648,7 +648,8 @@ static int test_generate(void)
fscanf( f, "%f ", &value );
data[i] = value;
}
- HDfclose( f );
+ HDfclose(f);
+ f = NULL;
/*-------------------------------------------------------------------------
* transform the data from floating point to unsigned char
@@ -758,6 +759,8 @@ out:
H5E_BEGIN_TRY {
H5Fclose(fid);
} H5E_END_TRY;
+ if(f)
+ HDfclose(f);
H5_FAILED();
return retval;
}