Commit 1644a6f7 authored by Michael Smith's avatar Michael Smith
Browse files

Fix incorrect use of enum that was leading to crashes on source connect for

unknown mimetype.

svn path=/trunk/icecast/; revision=4344
parent 5d88044b
...@@ -313,7 +313,7 @@ int connection_create_source(client_t *client, connection_t *con, http_parser_t ...@@ -313,7 +313,7 @@ int connection_create_source(client_t *client, connection_t *con, http_parser_t
if (contenttype != NULL) { if (contenttype != NULL) {
format_type_t format = format_get_type(contenttype); format_type_t format = format_get_type(contenttype);
if (format < 0) { if (format == FORMAT_ERROR) {
WARN1("Content-type \"%s\" not supported, dropping source", contenttype); WARN1("Content-type \"%s\" not supported, dropping source", contenttype);
goto fail; goto fail;
} else { } else {
......
...@@ -36,7 +36,7 @@ format_type_t format_get_type(char *contenttype) ...@@ -36,7 +36,7 @@ format_type_t format_get_type(char *contenttype)
else if(strcmp(contenttype, "audio/mpeg") == 0) else if(strcmp(contenttype, "audio/mpeg") == 0)
return FORMAT_TYPE_MP3; return FORMAT_TYPE_MP3;
else else
return -1; return FORMAT_ERROR;
} }
char *format_get_mimetype(format_type_t type) char *format_get_mimetype(format_type_t type)
......
...@@ -14,7 +14,8 @@ struct source_tag; ...@@ -14,7 +14,8 @@ struct source_tag;
typedef enum _format_type_tag typedef enum _format_type_tag
{ {
FORMAT_TYPE_VORBIS, FORMAT_TYPE_VORBIS,
FORMAT_TYPE_MP3 FORMAT_TYPE_MP3,
FORMAT_ERROR /* No format, source not processable */
} format_type_t; } format_type_t;
typedef struct _format_plugin_tag typedef struct _format_plugin_tag
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment