Commit 7b93bebc authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fixed some warnings

parent e0ec6a30
...@@ -373,7 +373,7 @@ typedef struct httpd_file_sys_t httpd_file_sys_t; ...@@ -373,7 +373,7 @@ typedef struct httpd_file_sys_t httpd_file_sys_t;
typedef int (*httpd_file_callback_t)( httpd_file_sys_t *, httpd_file_t *, uint8_t *psz_request, uint8_t **pp_data, int *pi_data ); typedef int (*httpd_file_callback_t)( httpd_file_sys_t *, httpd_file_t *, uint8_t *psz_request, uint8_t **pp_data, int *pi_data );
typedef struct httpd_handler_t httpd_handler_t; typedef struct httpd_handler_t httpd_handler_t;
typedef struct httpd_handler_sys_t httpd_handler_sys_t; typedef struct httpd_handler_sys_t httpd_handler_sys_t;
typedef int (*httpd_handler_callback_t)( httpd_handler_sys_t *, httpd_handler_t *, uint8_t *psz_url, uint8_t *psz_request, int i_type, uint8_t *p_in, int i_in, char *psz_remote_addr, char *psz_remote_host, uint8_t **pp_data, int *pi_data ); typedef int (*httpd_handler_callback_t)( httpd_handler_sys_t *, httpd_handler_t *, char *psz_url, uint8_t *psz_request, int i_type, uint8_t *p_in, int i_in, char *psz_remote_addr, char *psz_remote_host, uint8_t **pp_data, int *pi_data );
typedef struct httpd_redirect_t httpd_redirect_t; typedef struct httpd_redirect_t httpd_redirect_t;
typedef struct httpd_stream_t httpd_stream_t; typedef struct httpd_stream_t httpd_stream_t;
......
...@@ -605,7 +605,7 @@ int E_(HttpCallback)( httpd_file_sys_t *p_args, ...@@ -605,7 +605,7 @@ int E_(HttpCallback)( httpd_file_sys_t *p_args,
* call the external handler and parse vlc macros if Content-Type is HTML * call the external handler and parse vlc macros if Content-Type is HTML
****************************************************************************/ ****************************************************************************/
int E_(HandlerCallback)( httpd_handler_sys_t *p_args, int E_(HandlerCallback)( httpd_handler_sys_t *p_args,
httpd_handler_t *p_handler, uint8_t *_p_url, httpd_handler_t *p_handler, char *_p_url,
uint8_t *_p_request, int i_type, uint8_t *_p_request, int i_type,
uint8_t *_p_in, int i_in, uint8_t *_p_in, int i_in,
char *psz_remote_addr, char *psz_remote_host, char *psz_remote_addr, char *psz_remote_host,
......
...@@ -394,7 +394,7 @@ int E_(HttpCallback)( httpd_file_sys_t *p_args, ...@@ -394,7 +394,7 @@ int E_(HttpCallback)( httpd_file_sys_t *p_args,
uint8_t **pp_data, int *pi_data ); uint8_t **pp_data, int *pi_data );
/** This function is the HTTPD Callback used for CGIs */ /** This function is the HTTPD Callback used for CGIs */
int E_(HandlerCallback)( httpd_handler_sys_t *p_args, int E_(HandlerCallback)( httpd_handler_sys_t *p_args,
httpd_handler_t *p_handler, uint8_t *_p_url, httpd_handler_t *p_handler, char *_p_url,
uint8_t *_p_request, int i_type, uint8_t *_p_request, int i_type,
uint8_t *_p_in, int i_in, uint8_t *_p_in, int i_in,
char *psz_remote_addr, char *psz_remote_host, char *psz_remote_addr, char *psz_remote_host,
......
...@@ -623,7 +623,7 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c ...@@ -623,7 +623,7 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c
if( query->i_type == HTTPD_MSG_HEAD ) if( query->i_type == HTTPD_MSG_HEAD )
{ {
char *p = answer->p_body; char *p = (char *)answer->p_body;
while ( (p = strchr( p, '\r' )) != NULL ) while ( (p = strchr( p, '\r' )) != NULL )
{ {
if( p[1] && p[1] == '\n' && p[2] && p[2] == '\r' if( p[1] && p[1] == '\n' && p[2] && p[2] == '\r'
...@@ -635,20 +635,20 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c ...@@ -635,20 +635,20 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c
if( p != NULL ) if( p != NULL )
{ {
p[4] = '\0'; p[4] = '\0';
answer->i_body = strlen(answer->p_body) + 1; answer->i_body = strlen((char*)answer->p_body) + 1;
answer->p_body = realloc( answer->p_body, answer->i_body ); answer->p_body = realloc( answer->p_body, answer->i_body );
} }
} }
if( strncmp( answer->p_body, "HTTP/1.", 7 ) ) if( strncmp( (char *)answer->p_body, "HTTP/1.", 7 ) )
{ {
int i_status, i_headers; int i_status, i_headers;
char *psz_headers, *psz_new, *psz_status; char *psz_headers, *psz_new, *psz_status;
char psz_code[12];
if( !strncmp( answer->p_body, "Status: ", 8 ) ) if( !strncmp( (char *)answer->p_body, "Status: ", 8 ) )
{ {
/* Apache-style */ /* Apache-style */
i_status = strtol( &answer->p_body[8], &psz_headers, 0 ); i_status = strtol( (char *)&answer->p_body[8], &psz_headers, 0 );
if( *psz_headers ) psz_headers++; if( *psz_headers ) psz_headers++;
if( *psz_headers ) psz_headers++; if( *psz_headers ) psz_headers++;
i_headers = answer->i_body - (psz_headers - (char *)answer->p_body); i_headers = answer->i_body - (psz_headers - (char *)answer->p_body);
...@@ -656,7 +656,7 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c ...@@ -656,7 +656,7 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c
else else
{ {
i_status = 200; i_status = 200;
psz_headers = answer->p_body; psz_headers = (char *)answer->p_body;
i_headers = answer->i_body; i_headers = answer->i_body;
} }
switch( i_status ) switch( i_status )
...@@ -668,17 +668,18 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c ...@@ -668,17 +668,18 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c
psz_status = "Unauthorized"; psz_status = "Unauthorized";
break; break;
default: default:
if( (i_status < 0) || (i_status > 999) )
i_status = 500;
psz_status = "Undefined"; psz_status = "Undefined";
break; break;
} }
snprintf( psz_code, sizeof(psz_code), "%d", i_status ); answer->i_body = sizeof("HTTP/1.0 xxx \r\n")
answer->i_body = sizeof("HTTP/1.0 \r\n") + strlen(psz_code) + strlen(psz_status) + i_headers - 1;
+ strlen(psz_status) + i_headers - 1; psz_new = (char *)malloc( answer->i_body + 1);
psz_new = malloc( answer->i_body + 1); sprintf( psz_new, "HTTP/1.0 %03d %s\r\n", i_status, psz_status );
sprintf( psz_new, "HTTP/1.0 %s %s\r\n", psz_code, psz_status );
memcpy( &psz_new[strlen(psz_new)], psz_headers, i_headers ); memcpy( &psz_new[strlen(psz_new)], psz_headers, i_headers );
free( answer->p_body ); free( answer->p_body );
answer->p_body = psz_new; answer->p_body = (uint8_t *)psz_new;
} }
return VLC_SUCCESS; return VLC_SUCCESS;
......
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