diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-11-03 15:46:53 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-11-03 15:46:53 (GMT) |
commit | 84787e3085874639ced844666f902297a7b5148b (patch) | |
tree | 6cff7240264960ccf9261d2fb2b3c8b7bcda4fa6 /tools | |
parent | da0f0391aebbb3b145f8be021b93ec42686367aa (diff) | |
download | hdf5-84787e3085874639ced844666f902297a7b5148b.zip hdf5-84787e3085874639ced844666f902297a7b5148b.tar.gz hdf5-84787e3085874639ced844666f902297a7b5148b.tar.bz2 |
Uncomment line in test/objcopy.c, clean up whitespace and POSIX call wrapping
in tools code.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 194 | ||||
-rw-r--r-- | tools/test/h5dump/h5dumpgentest.c | 70 |
2 files changed, 132 insertions, 132 deletions
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 2d48a04..657e1a9 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -235,130 +235,130 @@ static void leave(int ret) { static int read_info(const char *filename, pack_opt_t *options) { - char stype[10]; - char comp_info[1024]; - FILE *fp = NULL; - char c; - int i, rc = 1; - int ret_value = EXIT_SUCCESS; - - if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) { - error_msg("cannot open options file %s\n", filename); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } + char stype[10]; + char comp_info[1024]; + FILE *fp = NULL; + char c; + int i, rc = 1; + int ret_value = EXIT_SUCCESS; + + if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) { + error_msg("cannot open options file %s\n", filename); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } - /* cycle until end of file reached */ - while (1) { - rc = fscanf(fp, "%s", stype); - if (rc == -1) - break; + /* cycle until end of file reached */ + while (1) { + rc = fscanf(fp, "%s", stype); + if (rc == -1) + break; - /*------------------------------------------------------------------------- - * filter - *------------------------------------------------------------------------- - */ - if (HDstrcmp(stype,"-f") == 0) { - /* find begining of info */ - i = 0; - c = '0'; - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + /*------------------------------------------------------------------------- + * filter + *------------------------------------------------------------------------- + */ + if (HDstrcmp(stype,"-f") == 0) { + /* find begining of info */ + i = 0; + c = '0'; + while (c != ' ') { + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; goto done; } /* end if */ - if (HDfeof(fp)) - break; - } - c = '0'; - /* go until end */ - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + if (HDfeof(fp)) + break; + } + c = '0'; + /* go until end */ + while (c != ' ') { + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; goto done; } /* end if */ - comp_info[i] = c; - i++; - if (HDfeof(fp)) - break; - if (c == 10 /*eol*/) - break; - } - comp_info[i - 1] = '\0'; /*cut the last " */ + comp_info[i] = c; + i++; + if (HDfeof(fp)) + break; + if (c == 10 /*eol*/) + break; + } + comp_info[i - 1] = '\0'; /*cut the last " */ - if (h5repack_addfilter(comp_info, options) == -1) { - error_msg("could not add compression option\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - } - /*------------------------------------------------------------------------- - * layout - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(stype,"-l") == 0) { - - /* find begining of info */ - i = 0; - c = '0'; - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + if (h5repack_addfilter(comp_info, options) == -1) { + error_msg("could not add compression option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } + /*------------------------------------------------------------------------- + * layout + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(stype,"-l") == 0) { + + /* find begining of info */ + i = 0; + c = '0'; + while (c != ' ') { + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; goto done; } /* end if */ - if (HDfeof(fp)) - break; - } - c = '0'; - /* go until end */ - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + if (HDfeof(fp)) + break; + } + c = '0'; + /* go until end */ + while (c != ' ') { + if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; goto done; } /* end if */ - comp_info[i] = c; - i++; - if (HDfeof(fp)) - break; - if (c == 10 /*eol*/) - break; - } - comp_info[i - 1] = '\0'; /*cut the last " */ + comp_info[i] = c; + i++; + if (HDfeof(fp)) + break; + if (c == 10 /*eol*/) + break; + } + comp_info[i - 1] = '\0'; /*cut the last " */ - if (h5repack_addlayout(comp_info, options) == -1) { - error_msg("could not add chunck option\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - } - /*------------------------------------------------------------------------- - * not valid - *------------------------------------------------------------------------- - */ - else { - error_msg("bad file format for %s", filename); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - } + if (h5repack_addlayout(comp_info, options) == -1) { + error_msg("could not add chunck option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } + /*------------------------------------------------------------------------- + * not valid + *------------------------------------------------------------------------- + */ + else { + error_msg("bad file format for %s", filename); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } done: - if (fp) - HDfclose(fp); + if (fp) + HDfclose(fp); - return ret_value; + return ret_value; } /*------------------------------------------------------------------------- diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index bbec813..315210b 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -635,7 +635,7 @@ static int gent_softlink2(void) fileid1 = H5Fcreate(FILE4_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fileid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", FILE4_1); status = FAIL; goto out; } @@ -646,7 +646,7 @@ static int gent_softlink2(void) gid1 = H5Gcreate2(fileid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -654,7 +654,7 @@ static int gent_softlink2(void) gid2 = H5Gcreate2(fileid1, "group_empty", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -666,7 +666,7 @@ static int gent_softlink2(void) status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -694,7 +694,7 @@ static int gent_softlink2(void) H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dset1 < 0) { - fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -702,7 +702,7 @@ static int gent_softlink2(void) status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1); status = FAIL; goto out; } @@ -715,7 +715,7 @@ static int gent_softlink2(void) H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dset2 < 0) { - fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -723,7 +723,7 @@ static int gent_softlink2(void) status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1); status = FAIL; goto out; } @@ -738,7 +738,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/dset1", fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -747,7 +747,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/dtype", fileid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -756,7 +756,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/group1", fileid1, "soft_group1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -765,7 +765,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/group_empty", fileid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -774,7 +774,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("not_yet", fileid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -786,7 +786,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/dset1", gid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -795,7 +795,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/dset2", gid1, "soft_dset2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -804,7 +804,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/dtype", gid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -813,7 +813,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("/group_empty", gid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -822,7 +822,7 @@ static int gent_softlink2(void) status = H5Lcreate_soft("not_yet", gid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1); status = FAIL; goto out; } @@ -832,31 +832,31 @@ static int gent_softlink2(void) * Close/release resources. */ if(dataspace >= 0 && H5Sclose(dataspace) < 0) { - fprintf(stderr, "Error: %s> H5Sclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Sclose failed.\n", FILE4_1); status = FAIL; } if(gid1 >= 0 && H5Gclose(gid1) < 0) { - fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1); status = FAIL; } if(gid2 >= 0 && H5Gclose(gid2) < 0) { - fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1); status = FAIL; } if(datatype >= 0 && H5Tclose(datatype) < 0) { - fprintf(stderr, "Error: %s> H5Tclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Tclose failed.\n", FILE4_1); status = FAIL; } if(dset1 >= 0 && H5Dclose(dset1) < 0) { - fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1); status = FAIL; } if(dset2 >= 0 && H5Dclose(dset2) < 0) { - fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1); status = FAIL; } if(fileid1 >= 0 && H5Fclose(fileid1) < 0) { - fprintf(stderr, "Error: %s> H5Fclose failed.\n", FILE4_1); + HDfprintf(stderr, "Error: %s> H5Fclose failed.\n", FILE4_1); status = FAIL; } @@ -932,7 +932,7 @@ static void gent_udlink(void) /* This ud link will dangle, but that's okay */ fid = H5Fcreate(FILE54, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); H5Lcreate_ud(fid, "udlink1", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT); - strcpy(buf, "foo"); + HDstrcpy(buf, "foo"); H5Lcreate_ud(fid, "udlink2", (H5L_type_t)MY_LINKCLASS, buf, 4, H5P_DEFAULT, H5P_DEFAULT); H5Fclose(fid); @@ -1837,7 +1837,7 @@ static void gent_str(void) { for(l = 0; l < 10; l++) comp1[i][j].a[k][l] = (l + j + k) * (l + j + k); for(k = 0 ; k < 12; k++) - strcpy(comp1[i][j].s[k], "abcdefgh12345678abcdefgh12345678"); + HDstrcpy(comp1[i][j].s[k], "abcdefgh12345678abcdefgh12345678"); } dataset = H5Dcreate2(fid, "/comp1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -2469,7 +2469,7 @@ static void gent_nestcomp(void) */ status = H5Dwrite(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1); if(status < 0) - fprintf(stderr, "gent_nestcomp H5Dwrite failed\n"); + HDfprintf(stderr, "gent_nestcomp H5Dwrite failed\n"); /* * Release resources @@ -10088,10 +10088,10 @@ static void gent_compound_complex2(void) /* Set up first nested compound */ buf[i].d.nested_a = (double) i; - strcpy(buf[i].d.nested_string, "This is a test string."); + HDstrcpy(buf[i].d.nested_string, "This is a test string."); for (j = 0; j < 4; j++) - strcpy(buf[i].d.nested_string_array[j], "String test"); + HDstrcpy(buf[i].d.nested_string_array[j], "String test"); /* Set up multiple nested compound */ buf[i].e.a = (float) i; @@ -10103,9 +10103,9 @@ static void gent_compound_complex2(void) buf[i].e.b.multiple_nested_d[j] = (long)(j - i*10); } - strcpy(buf[i].e.c.further_nested_string, "1234567890"); + HDstrcpy(buf[i].e.c.further_nested_string, "1234567890"); for (j = 0; j < 4; j++) - strcpy(buf[i].e.c.further_nested_string_array[j], "STRING ARRAY"); + HDstrcpy(buf[i].e.c.further_nested_string_array[j], "STRING ARRAY"); for (j = 0; j < 10; j++) { buf[i].e.c.deep_nest.deep_nested_short[j] = (short)(j + i*10); @@ -10117,7 +10117,7 @@ static void gent_compound_complex2(void) } if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - fprintf(stderr, "gent_tcompound_complex2 H5Dwrite failed\n"); + HDfprintf(stderr, "gent_tcompound_complex2 H5Dwrite failed\n"); H5Dclose(dset); } @@ -10252,7 +10252,7 @@ static void gent_vlenstr_array(void) if ((type = H5Tarray_create2(array_tid, F83_RANK, arraydim)) >= 0) { if ((dset = H5Dcreate2(file, F83_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0) - fprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n"); + HDfprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n"); H5Dclose(dset); } @@ -10273,7 +10273,7 @@ static void gent_vlenstr_array(void) if ((dset = H5Dcreate2(file, F83_DATASETNAME2, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - fprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n"); + HDfprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n"); H5Dclose(dset); } |