diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-06-14 23:07:03 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-06-14 23:07:03 (GMT) |
commit | d3396a79532601bf22e385f94b12e55dfb2c3bd0 (patch) | |
tree | dedf3566ea2ebf40c2d7475e8a50a3f2f0d57774 /hl | |
parent | 7a9e13afdb134bafc070cf8bd2087a84fd0d2334 (diff) | |
download | hdf5-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')
-rw-r--r-- | hl/test/test_ds.c | 18 | ||||
-rw-r--r-- | hl/test/test_image.c | 55 |
2 files changed, 60 insertions, 13 deletions
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 7b6fb82..47929e6 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -4870,8 +4870,16 @@ static int read_data( const char* fname, } for(i=0, nelms=1; i < ndims; i++) { - fscanf( f, "%s %u", str, &j); - fscanf( f, "%d",&n ); + if(fscanf( f, "%s %u", str, &j) && HDferror(f)) { + printf( "fscanf error in file %s\n", data_file ); + HDfclose(f); + return -1; + } /* end if */ + if(fscanf( f, "%d",&n ) < 0 && HDferror(f)) { + printf( "fscanf error in file %s\n", data_file ); + HDfclose(f); + return -1; + } /* end if */ dims[i] = (hsize_t)n; nelms *= (size_t)n; } @@ -4885,7 +4893,11 @@ static int read_data( const char* fname, } for(j = 0; j < nelms; j++) { - fscanf( f, "%f",&val ); + if(fscanf( f, "%f",&val ) < 0 && HDferror(f)) { + printf( "fscanf error in file %s\n", data_file ); + HDfclose(f); + return -1; + } /* end if */ (*buf)[j] = val; } HDfclose(f); 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 */ |