1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00

Fix regression in handling of refresh_interval

This commit is contained in:
Moritz Grimm 2015-05-14 23:23:48 +02:00
parent bd04a66c79
commit b62d4b4317
4 changed files with 26 additions and 6 deletions

View File

@ -56,6 +56,8 @@ _cfg_reset(struct cfg *c)
xfree(c->metadata.format_str);
memset(c, 0, sizeof(*c));
c->metadata.refresh_interval = -1;
}
static void
@ -517,7 +519,7 @@ cfg_set_metadata_format_str(const char *format_str, const char **errstrp)
int
cfg_set_metadata_refresh_interval(const char *num_str, const char **errstrp)
{
SET_UINTNUM(cfg.metadata.refresh_interval, num_str, errstrp);
SET_INTNUM(cfg.metadata.refresh_interval, num_str, errstrp);
return (0);
}
@ -756,7 +758,7 @@ cfg_get_metadata_format_str(void)
return (cfg.metadata.format_str);
}
unsigned int
int
cfg_get_metadata_refresh_interval(void)
{
return (cfg.metadata.refresh_interval);

View File

@ -182,8 +182,7 @@ const char *
cfg_get_metadata_program(void);
const char *
cfg_get_metadata_format_str(void);
unsigned int
cfg_get_metadata_refresh_interval(void);
int cfg_get_metadata_refresh_interval(void);
int cfg_get_metadata_normalize_strings(void);
int cfg_get_metadata_no_updates(void);

View File

@ -73,7 +73,7 @@ struct cfg {
struct metadata {
char program[PATH_MAX];
char *format_str;
unsigned int refresh_interval;
int refresh_interval;
int normalize_strings;
int no_updates;
} metadata;
@ -146,6 +146,25 @@ struct cfg {
(t) = num; \
} while (0)
#define SET_INTNUM(t, s, e) do { \
const char *errstr; \
unsigned int num; \
\
if (!(s) || !(s)[0]) { \
if ((e)) \
*(e) = "empty"; \
return (-1); \
} \
\
num = strtonum((s), INT_MIN, INT_MAX, &errstr); \
if (errstr) { \
if ((e)) \
*(e) = errstr; \
return (-1); \
} \
(t) = num; \
} while (0)
#define CHECKPH_PROHIBITED(s, p) do { \
if (NULL != strstr((s), (p))) { \
if (errstrp) \

View File

@ -747,7 +747,7 @@ sendStream(shout_t *shout, FILE *filepstream, const char *fileName,
ez_gettimeofday((void *)&currentTime);
if (queryMetadata ||
(cfg_get_metadata_refresh_interval() &&
(0 <= cfg_get_metadata_refresh_interval() &&
(currentTime.tv_sec - callTime.tv_sec >=
cfg_get_metadata_refresh_interval()))) {
queryMetadata = 0;