diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2009-10-21 00:34:42 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2009-10-21 00:34:42 (GMT) |
commit | ce5e8b2a3961f5c429d7c25aaf68e85081a69bd0 (patch) | |
tree | eb89f7667de1c1c28070b45245c37fd8c79eccfd | |
parent | aa46073801c8e6cc00a11cc0bda3fb1f70330535 (diff) | |
download | hdf5-ce5e8b2a3961f5c429d7c25aaf68e85081a69bd0.zip hdf5-ce5e8b2a3961f5c429d7c25aaf68e85081a69bd0.tar.gz hdf5-ce5e8b2a3961f5c429d7c25aaf68e85081a69bd0.tar.bz2 |
[svn-r17704] Bug fix: (1192)
Changed exit(1) to exit(EXIT_FAILURE) and exit(0) to exit(EXIT_SUCCESS) for
better coding.
Tested: jam.
-rw-r--r-- | tools/h5repack/h5repack.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack_main.c | 12 | ||||
-rw-r--r-- | tools/h5repack/h5repack_opttable.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack_parse.c | 46 |
4 files changed, 32 insertions, 30 deletions
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index d8a503c..3c8cec8 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -649,7 +649,7 @@ static const char* get_sfilter(H5Z_filter_t filtn) return "SOFF"; else { error_msg(progname, "input error in filter type\n"); - exit(1); + exit(EXIT_FAILURE); } } diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 801ee34..d873a4b 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -69,7 +69,9 @@ static struct long_options l_opts[] = { * * Purpose: h5repack main program * - * Return: 1, error, 0, no error + * Return: Success: EXIT_SUCCESS(0) + * + * Failure: EXIT_FAILURE(1) * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -488,7 +490,7 @@ void read_info(const char *filename, if ((fp = fopen(data_file, "r")) == (FILE *)NULL) { error_msg(progname, "cannot open options file %s\n", filename); - exit(1); + exit(EXIT_FAILURE); } /* cycle until end of file reached */ @@ -525,7 +527,7 @@ void read_info(const char *filename, if (h5repack_addfilter(comp_info,options)==-1){ error_msg(progname, "could not add compression option\n"); - exit(1); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -555,7 +557,7 @@ void read_info(const char *filename, if (h5repack_addlayout(comp_info,options)==-1){ error_msg(progname, "could not add chunck option\n"); - exit(1); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -564,7 +566,7 @@ void read_info(const char *filename, */ else { error_msg(progname, "bad file format for %s", filename); - exit(1); + exit(EXIT_FAILURE); } } diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index 8572837..5b6d5d0 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -231,7 +231,7 @@ int options_add_layout( obj_list_t *obj_list, if (table->objs[i].chunk.rank>0) { error_msg(progname, "chunk information already inserted for <%s>\n",obj_list[j].obj); - exit(1); + exit(EXIT_FAILURE); } /* insert the layout info */ else diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 154d6e5..15dc812 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -122,7 +122,7 @@ obj_list_t* parse_filter(const char *str, { if (obj_list) free(obj_list); error_msg(progname, "input Error: Invalid compression type in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } @@ -160,7 +160,7 @@ obj_list_t* parse_filter(const char *str, if (!isdigit(c) && l==-1){ if (obj_list) free(obj_list); error_msg(progname, "compression parameter not digit in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } if (l==-1) stype[m]=c; @@ -180,7 +180,7 @@ obj_list_t* parse_filter(const char *str, else { error_msg(progname, "szip mask must be 'NN' or 'EC' \n"); - exit(1); + exit(EXIT_FAILURE); } @@ -220,7 +220,7 @@ obj_list_t* parse_filter(const char *str, if (!isdigit(c) && l==-1){ if (obj_list) free(obj_list); error_msg(progname, "compression parameter is not a digit in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } if (l==-1) stype[m]=c; @@ -240,7 +240,7 @@ obj_list_t* parse_filter(const char *str, else { error_msg(progname, "scale type must be 'IN' or 'DS' \n"); - exit(1); + exit(EXIT_FAILURE); } } @@ -264,7 +264,7 @@ obj_list_t* parse_filter(const char *str, if (!isdigit(c)){ if (obj_list) free(obj_list); error_msg(progname, "compression parameter is not a digit in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } stype[m]=c; } /* u */ @@ -310,7 +310,7 @@ obj_list_t* parse_filter(const char *str, { /*no more parameters, GZIP must have parameter */ if (obj_list) free(obj_list); error_msg(progname, "missing compression parameter in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } } @@ -326,7 +326,7 @@ obj_list_t* parse_filter(const char *str, { /*no more parameters, SZIP must have parameter */ if (obj_list) free(obj_list); error_msg(progname, "missing compression parameter in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } } @@ -342,7 +342,7 @@ obj_list_t* parse_filter(const char *str, { /*shuffle does not have parameter */ if (obj_list) free(obj_list); error_msg(progname, "extra parameter in SHUF <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -357,7 +357,7 @@ obj_list_t* parse_filter(const char *str, { /*shuffle does not have parameter */ if (obj_list) free(obj_list); error_msg(progname, "extra parameter in FLET <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -372,7 +372,7 @@ obj_list_t* parse_filter(const char *str, { /*nbit does not have parameter */ if (obj_list) free(obj_list); error_msg(progname, "extra parameter in NBIT <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -387,13 +387,13 @@ obj_list_t* parse_filter(const char *str, { /*no more parameters, SOFF must have parameter */ if (obj_list) free(obj_list); error_msg(progname, "missing compression parameter in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } } else { if (obj_list) free(obj_list); error_msg(progname, "invalid filter type in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } } } /*i*/ @@ -416,7 +416,7 @@ obj_list_t* parse_filter(const char *str, { if (obj_list) free(obj_list); error_msg(progname, "invalid compression parameter in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } break; @@ -431,19 +431,19 @@ obj_list_t* parse_filter(const char *str, { if (obj_list) free(obj_list); error_msg(progname, "pixels_per_block is not even in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) { if (obj_list) free(obj_list); error_msg(progname, "pixels_per_block is too large in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } if ( (strcmp(smask,"NN")!=0) && (strcmp(smask,"EC")!=0) ) { if (obj_list) free(obj_list); error_msg(progname, "szip mask must be 'NN' or 'EC' \n"); - exit(1); + exit(EXIT_FAILURE); } break; default: @@ -544,7 +544,7 @@ obj_list_t* parse_layout(const char *str, { if (obj_list) free(obj_list); error_msg(progname, "in parse layout, no characters after : in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } /* get layout info */ @@ -561,7 +561,7 @@ obj_list_t* parse_layout(const char *str, pack->layout=H5D_CHUNKED; else { error_msg(progname, "in parse layout, not a valid layout in <%s>\n",str); - exit(1); + exit(EXIT_FAILURE); } } else @@ -585,7 +585,7 @@ obj_list_t* parse_layout(const char *str, { if (obj_list) free(obj_list); error_msg(progname, "in parse layout, <%s> Chunk dimensions missing\n",str); - exit(1); + exit(EXIT_FAILURE); } for ( i=j, c_index=0; i<len; i++) @@ -600,7 +600,7 @@ obj_list_t* parse_layout(const char *str, if (obj_list) free(obj_list); error_msg(progname, "in parse layout, <%s> Not a valid character in <%s>\n", sdim,str); - exit(1); + exit(EXIT_FAILURE); } if ( c=='x' || i==len-1) @@ -613,7 +613,7 @@ obj_list_t* parse_layout(const char *str, if (obj_list) free(obj_list); error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n", sdim,str); - exit(1); + exit(EXIT_FAILURE); } c_index++; } @@ -631,7 +631,7 @@ obj_list_t* parse_layout(const char *str, if (obj_list) free(obj_list); error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n", sdim,str); - exit(1); + exit(EXIT_FAILURE); } pack->chunk.rank=c_index+1; } |