summaryrefslogtreecommitdiffstats
path: root/hl/test/test_image.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-06-14 23:07:03 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-06-14 23:07:03 (GMT)
commitd3396a79532601bf22e385f94b12e55dfb2c3bd0 (patch)
treededf3566ea2ebf40c2d7475e8a50a3f2f0d57774 /hl/test/test_image.c
parent7a9e13afdb134bafc070cf8bd2087a84fd0d2334 (diff)
downloadhdf5-d3396a79532601bf22e385f94b12e55dfb2c3bd0.zip
hdf5-d3396a79532601bf22e385f94b12e55dfb2c3bd0.tar.gz
hdf5-d3396a79532601bf22e385f94b12e55dfb2c3bd0.tar.bz2
[svn-r30075] Description:
Bring object/dataset/group/named datatype features from revise_chunks branch to trunk. Also CMake support for h5format_convert and a bunch of misc. cleanups. Tested on: MacOSX/64 10.11.5 (amazon) w/serial, parallel & production (h5committest forthcoming)
Diffstat (limited to 'hl/test/test_image.c')
-rw-r--r--hl/test/test_image.c55
1 files changed, 45 insertions, 10 deletions
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 8ba0083..8bc6f95 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -603,8 +603,14 @@ static int test_generate(void)
*/
- fscanf( f, "%d %d %d", &imax, &jmax, &kmax );
- fscanf( f, "%f %f %f", &valex, &xmin, &xmax );
+ if(fscanf( f, "%d %d %d", &imax, &jmax, &kmax ) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s.\n", data_file );
+ goto out;
+ } /* end if */
+ if(fscanf( f, "%f %f %f", &valex, &xmin, &xmax ) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s.\n", data_file );
+ goto out;
+ } /* end if */
/* Sanity check on scanned-in values */
if(imax < 1 || jmax < 1 || kmax < 1)
@@ -633,7 +639,10 @@ static int test_generate(void)
for ( i = 0; i < n_elements; i++ )
{
- fscanf( f, "%f ", &value );
+ if(fscanf( f, "%f ", &value ) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s.\n", data_file );
+ goto out;
+ } /* end if */
data[i] = value;
}
HDfclose(f);
@@ -794,12 +803,35 @@ static int read_data(const char* fname, /*IN*/
goto out;
}
- fscanf(f, "%s", str);
- fscanf(f, "%d", &color_planes);
- fscanf(f, "%s", str);
- fscanf(f, "%d", &h);
- fscanf(f, "%s", str);
- fscanf(f, "%d", &w);
+ if(fscanf(f, "%s", str) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s.\n", data_file );
+ goto out;
+ } /* end if */
+
+ if(fscanf(f, "%d", &color_planes) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s.\n", data_file );
+ goto out;
+ } /* end if */
+
+ if(fscanf(f, "%s", str) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s.\n", data_file );
+ goto out;
+ } /* end if */
+
+ if(fscanf(f, "%d", &h) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s.\n", data_file );
+ goto out;
+ } /* end if */
+
+ if(fscanf(f, "%s", str) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s.\n", data_file );
+ goto out;
+ } /* end if */
+
+ if(fscanf(f, "%d", &w) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s.\n", data_file );
+ goto out;
+ } /* end if */
/* Check product for overflow */
if(w < 1 || h < 1 || color_planes < 1)
@@ -830,7 +862,10 @@ static int read_data(const char* fname, /*IN*/
/* Read data elements */
for(i = 0; i < n_elements; i++) {
- fscanf(f, "%d",&n);
+ if(fscanf(f, "%d", &n) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s.\n", data_file );
+ goto out;
+ } /* end if */
image_data[i] = (unsigned char)n;
} /* end for */