1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-12-04 14:46:31 -05:00

Streamline set_metadata() behavior on error/success

This commit is contained in:
Moritz Grimm 2016-05-19 14:12:34 +02:00
parent 3ba4b06478
commit 4d787b10a3
2 changed files with 5 additions and 5 deletions

View File

@ -295,7 +295,7 @@ openResource(stream_t stream, const char *fileName, int *popenFlag,
if (cfg_get_metadata_program()) { if (cfg_get_metadata_program()) {
if ((mdata = getMetadata(cfg_get_metadata_program())) == NULL) if ((mdata = getMetadata(cfg_get_metadata_program())) == NULL)
return (NULL); return (NULL);
if (stream_set_metadata(stream, mdata, NULL) != SHOUTERR_SUCCESS) { if (0 > stream_set_metadata(stream, mdata, NULL)) {
metadata_free(&mdata); metadata_free(&mdata);
return (NULL); return (NULL);
} }
@ -667,7 +667,7 @@ streamFile(stream_t stream, const char *fileName)
ret = STREAM_DONE; ret = STREAM_DONE;
continue; continue;
} }
if (stream_set_metadata(stream, prog_mdata, &mdataStr) != SHOUTERR_SUCCESS) { if (0> stream_set_metadata(stream, prog_mdata, &mdataStr)) {
retval = 0; retval = 0;
ret = STREAM_DONE; ret = STREAM_DONE;
continue; continue;

View File

@ -338,10 +338,10 @@ stream_set_metadata(struct stream *s, metadata_t md, char **md_str)
int ret = SHOUTERR_SUCCESS; int ret = SHOUTERR_SUCCESS;
if (cfg_get_metadata_no_updates()) if (cfg_get_metadata_no_updates())
return (SHOUTERR_SUCCESS); return (0);
if (md == NULL) if (md == NULL)
return 1; return (-1);
if ((shout_md = shout_metadata_new()) == NULL) { if ((shout_md = shout_metadata_new()) == NULL) {
log_syserr(ALERT, ENOMEM, "shout_metadata_new"); 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); xfree(songInfo);
return (ret); return (ret == SHOUTERR_SUCCESS ? 0 : -1);
} }
char * char *