Commit dc016bc0 authored by Philipp Schafft's avatar Philipp Schafft 🦁

Fix: Fixed compiler warnings

This fixes some compiler warnings. The code should be warning free
if gcc with -Wall is used but for the following:
{{{
admin.c: In function 'command_manageauth':
admin.c:790: warning: unused variable 'mountinfo'
}}}
This warning is due <role> migration. See #2123 for more details on
this warning. Please test with care. closes 2063
parent 8dc069f3
......@@ -303,12 +303,12 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
0, 200, NULL,
"text/xml", "utf-8",
NULL, NULL);
if (ret == -1) {
if (ret < 0) {
ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
client_send_error(client, 500, 0, "Header generation failed.");
xmlFree(buff);
return;
} else if (buf_len < (len + ret + 64)) {
} else if (buf_len < (size_t)(len + ret + 64)) {
void *new_data;
buf_len = ret + len + 64;
new_data = realloc(client->refbuf->data, buf_len);
......
......@@ -203,8 +203,8 @@ void client_send_100(client_t *client)
static inline void client_send_500(client_t *client, const char *message) {
const char header[] = "HTTP/1.0 500 Internal Server Error\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n"
"500 - Internal Server Error\n---------------------------\n";
const size_t header_len = sizeof(header) - 1;
int ret;
const ssize_t header_len = sizeof(header) - 1;
ssize_t ret;
ret = client_send_bytes(client, header, header_len);
......
......@@ -234,7 +234,7 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
ssize_t ret;
int failed = 0;
refbuf_t *refbuf;
size_t full_len = strlen (mediatype) + len + 1024;
ssize_t full_len = strlen(mediatype) + (ssize_t)len + (ssize_t)1024;
if (full_len < 4096)
full_len = 4096;
refbuf = refbuf_new (full_len);
......@@ -246,9 +246,9 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
client_send_error(client, 500, 0, "Header generation failed.");
} else {
if ( full_len < (ret + len + 64) ) {
if ( full_len < (ret + (ssize_t)len + (ssize_t)64) ) {
void *new_data;
full_len = ret + len + 64;
full_len = ret + (ssize_t)len + (ssize_t)64;
new_data = realloc(refbuf->data, full_len);
if (new_data) {
ICECAST_LOG_DEBUG("Client buffer reallocation succeeded.");
......
......@@ -103,10 +103,10 @@ static void yp_destroy_ypdata(ypdata_t *ypdata);
/* curl callback used to parse headers coming back from the YP server */
static int handle_returned_header (void *ptr, size_t size, size_t nmemb, void *stream)
static size_t handle_returned_header (void *ptr, size_t size, size_t nmemb, void *stream)
{
ypdata_t *yp = stream;
unsigned bytes = size * nmemb;
size_t bytes = size * nmemb;
/* ICECAST_LOG_DEBUG("header from YP is \"%.*s\"", bytes, ptr); */
if (strncasecmp (ptr, "YPResponse: 1", 13) == 0)
......@@ -114,7 +114,7 @@ static int handle_returned_header (void *ptr, size_t size, size_t nmemb, void *s
if (strncasecmp (ptr, "YPMessage: ", 11) == 0)
{
unsigned len = bytes - 11;
size_t len = bytes - 11;
free (yp->error_msg);
yp->error_msg = calloc (1, len);
if (yp->error_msg)
......@@ -125,7 +125,7 @@ static int handle_returned_header (void *ptr, size_t size, size_t nmemb, void *s
{
if (strncasecmp (ptr, "SID: ", 5) == 0)
{
unsigned len = bytes - 5;
size_t len = bytes - 5;
free (yp->sid);
yp->sid = calloc (1, len);
if (yp->sid)
......@@ -142,14 +142,14 @@ static int handle_returned_header (void *ptr, size_t size, size_t nmemb, void *s
ICECAST_LOG_DEBUG("server touch interval is %u", secs);
yp->touch_interval = secs;
}
return (int)bytes;
return (size_t)bytes;
}
/* capture returned data, but don't do anything with it, shouldn't be any */
static int handle_returned_data (void *ptr, size_t size, size_t nmemb, void *stream)
static size_t handle_returned_data (void *ptr, size_t size, size_t nmemb, void *stream)
{
return (int)(size*nmemb);
return (size_t)(size*nmemb);
}
......
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