From e8120de2e70de2c2bae79b611be689994e2de7df Mon Sep 17 00:00:00 2001 From: David Phillips Date: Fri, 11 Mar 2016 17:12:11 +1300 Subject: Remove disgusting EXIT_SUCCESS and EXIT_FAILURE swarf --- cue-bin-split.c | 6 +++--- cue-bin-split.h | 1 - misc.c | 14 ++++++-------- misc.h | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/cue-bin-split.c b/cue-bin-split.c index 4b47701..9959d82 100644 --- a/cue-bin-split.c +++ b/cue-bin-split.c @@ -92,7 +92,7 @@ int main(int argc, char **argv) { fprintf(stderr,"Failed to open '%s': ", in_fname); perror("fopen"); - return EXIT_FAILURE; + return -1; } track = 0; @@ -102,7 +102,7 @@ int main(int argc, char **argv) if (start_sec < 0) { fprintf(stderr, "ERROR: At least one start timestamp must be specified\n"); - return EXIT_FAILURE; + return -1; } /* finish_sample equals ULONG_MAX if a run was to EOF (the last track) */ @@ -124,7 +124,7 @@ int main(int argc, char **argv) fprintf(stderr,"Failed to open '%s': ", out_fname); perror("fopen"); fclose(fin); - return EXIT_FAILURE; + return -1; } start_sample = start_sec * rate * channels; diff --git a/cue-bin-split.h b/cue-bin-split.h index 54dd89d..604bea5 100644 --- a/cue-bin-split.h +++ b/cue-bin-split.h @@ -29,7 +29,6 @@ #define CUE_BIN_SPLIT_H #include -#include #include #include diff --git a/misc.c b/misc.c index eb48628..5b9e773 100644 --- a/misc.c +++ b/misc.c @@ -37,15 +37,13 @@ double get_sec() /* EOF means this is the last track; return invalid time */ if (items == EOF) - { - return -1.f; - } + return -1; if (items != 3) { /* FIXME doesn't explicitly close fin from cue-bin-split.c upon exit() */ fprintf(stderr, "Timestamp malformed\n"); - exit(EXIT_FAILURE); + exit(-1); } return SEC_FROM_TS(mm, ss, ff); } @@ -53,14 +51,14 @@ double get_sec() /* Constructs an output filename in the specified buffer based on the given format and track number * Main purpose is to catch buffer overflow with snprintf */ -void construct_out_name(char *buffer, size_t buffer_size, char* format, unsigned int track) +int construct_out_name(char *buffer, size_t buffer_size, char* format, unsigned int track) { if (snprintf(buffer, buffer_size, format, track) == buffer_size) { fprintf(stderr, "Filename too large for buffer (max %zd)\n", buffer_size); - return EXIT_FAILURE; + return -1; } - return EXIT_SUCCESS; + return 0; } /* Displays the help/syntax message and dies @@ -77,5 +75,5 @@ void die_help() " -s size of a single channel's sample (bytes)\n" " -f name_format (%%d and co are replaced with track number)\n" ); - exit(EXIT_FAILURE); + exit(-1); } diff --git a/misc.h b/misc.h index 65e29e0..ceb00fd 100644 --- a/misc.h +++ b/misc.h @@ -38,7 +38,7 @@ #define SEC_FROM_TS(mm, ss, ff) (mm*60 + ss + ((double)ff)/FRAMES_PER_SEC) double get_sec(); -void construct_out_name(char *buffer, size_t buffer_size, char* format, unsigned int track); +int construct_out_name(char *buffer, size_t buffer_size, char* format, unsigned int track); void die_help(); -- cgit v1.1