diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2009-10-21 00:34:06 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2009-10-21 00:34:06 (GMT) |
commit | e0b41d0b015c4899402018df2018d63c095e4ac7 (patch) | |
tree | 52a96680940b8bf6995c876e4330d62cc5a0ef11 | |
parent | bb5633b566d3fbef9d1d59a7fac0251a560865cb (diff) | |
download | hdf5-e0b41d0b015c4899402018df2018d63c095e4ac7.zip hdf5-e0b41d0b015c4899402018df2018d63c095e4ac7.tar.gz hdf5-e0b41d0b015c4899402018df2018d63c095e4ac7.tar.bz2 |
[svn-r17703] 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 e6b95a0..c67eb0a 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -652,7 +652,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 930397f..40ddf45 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -71,7 +71,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 * @@ -524,7 +526,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 */ @@ -561,7 +563,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); } } /*------------------------------------------------------------------------- @@ -591,7 +593,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); } } /*------------------------------------------------------------------------- @@ -600,7 +602,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; } |