From 4d787b10a32cd7c4bed2d2b17789245a0cbbce55 Mon Sep 17 00:00:00 2001 From: Moritz Grimm Date: Thu, 19 May 2016 14:12:34 +0200 Subject: [PATCH] Streamline set_metadata() behavior on error/success --- src/ezstream.c | 4 ++-- src/stream.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ezstream.c b/src/ezstream.c index e4cf42f..67eb006 100644 --- a/src/ezstream.c +++ b/src/ezstream.c @@ -295,7 +295,7 @@ openResource(stream_t stream, const char *fileName, int *popenFlag, if (cfg_get_metadata_program()) { if ((mdata = getMetadata(cfg_get_metadata_program())) == NULL) return (NULL); - if (stream_set_metadata(stream, mdata, NULL) != SHOUTERR_SUCCESS) { + if (0 > stream_set_metadata(stream, mdata, NULL)) { metadata_free(&mdata); return (NULL); } @@ -667,7 +667,7 @@ streamFile(stream_t stream, const char *fileName) ret = STREAM_DONE; continue; } - if (stream_set_metadata(stream, prog_mdata, &mdataStr) != SHOUTERR_SUCCESS) { + if (0> stream_set_metadata(stream, prog_mdata, &mdataStr)) { retval = 0; ret = STREAM_DONE; continue; diff --git a/src/stream.c b/src/stream.c index 11663af..2c7c205 100644 --- a/src/stream.c +++ b/src/stream.c @@ -338,10 +338,10 @@ stream_set_metadata(struct stream *s, metadata_t md, char **md_str) int ret = SHOUTERR_SUCCESS; if (cfg_get_metadata_no_updates()) - return (SHOUTERR_SUCCESS); + return (0); if (md == NULL) - return 1; + return (-1); if ((shout_md = shout_metadata_new()) == NULL) { log_syserr(ALERT, ENOMEM, "shout_metadata_new"); @@ -403,7 +403,7 @@ stream_set_metadata(struct stream *s, metadata_t md, char **md_str) } xfree(songInfo); - return (ret); + return (ret == SHOUTERR_SUCCESS ? 0 : -1); } char *