From 1644a6f7181fb8dd2367775aa26a74a2ecd3fefb Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 14 Feb 2003 10:31:21 +0000 Subject: [PATCH] Fix incorrect use of enum that was leading to crashes on source connect for unknown mimetype. svn path=/trunk/icecast/; revision=4344 --- src/connection.c | 2 +- src/format.c | 2 +- src/format.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/connection.c b/src/connection.c index 12e58bc2..87ff3a0d 100644 --- a/src/connection.c +++ b/src/connection.c @@ -313,7 +313,7 @@ int connection_create_source(client_t *client, connection_t *con, http_parser_t if (contenttype != NULL) { format_type_t format = format_get_type(contenttype); - if (format < 0) { + if (format == FORMAT_ERROR) { WARN1("Content-type \"%s\" not supported, dropping source", contenttype); goto fail; } else { diff --git a/src/format.c b/src/format.c index 5daf5c72..93df48ed 100644 --- a/src/format.c +++ b/src/format.c @@ -36,7 +36,7 @@ format_type_t format_get_type(char *contenttype) else if(strcmp(contenttype, "audio/mpeg") == 0) return FORMAT_TYPE_MP3; else - return -1; + return FORMAT_ERROR; } char *format_get_mimetype(format_type_t type) diff --git a/src/format.h b/src/format.h index 6f11c859..74af72e9 100644 --- a/src/format.h +++ b/src/format.h @@ -14,7 +14,8 @@ struct source_tag; typedef enum _format_type_tag { FORMAT_TYPE_VORBIS, - FORMAT_TYPE_MP3 + FORMAT_TYPE_MP3, + FORMAT_ERROR /* No format, source not processable */ } format_type_t; typedef struct _format_plugin_tag