From: RĂ©mi Denis-Courmont Date: Wed, 1 Feb 2006 13:28:59 +0000 (+0000) Subject: Fixed some warnings X-Git-Tag: 0.9.0-test0~12545 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=7b93bebca5e874523e286558cb945cad41136a01;p=vlc Fixed some warnings --- diff --git a/include/vlc_common.h b/include/vlc_common.h index 0921ae44c6..77670e2ddb 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -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 struct httpd_handler_t httpd_handler_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_stream_t httpd_stream_t; diff --git a/modules/control/http/http.c b/modules/control/http/http.c index ee53459b3c..1ce647d0f0 100644 --- a/modules/control/http/http.c +++ b/modules/control/http/http.c @@ -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 ****************************************************************************/ 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_in, int i_in, char *psz_remote_addr, char *psz_remote_host, diff --git a/modules/control/http/http.h b/modules/control/http/http.h index 7ea5725547..bfafb2c337 100644 --- a/modules/control/http/http.h +++ b/modules/control/http/http.h @@ -394,7 +394,7 @@ int E_(HttpCallback)( httpd_file_sys_t *p_args, uint8_t **pp_data, int *pi_data ); /** This function is the HTTPD Callback used for CGIs */ 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_in, int i_in, char *psz_remote_addr, char *psz_remote_host, diff --git a/src/network/httpd.c b/src/network/httpd.c index 37b9c5c3ae..931798b386 100644 --- a/src/network/httpd.c +++ b/src/network/httpd.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 ) { - char *p = answer->p_body; + char *p = (char *)answer->p_body; while ( (p = strchr( p, '\r' )) != NULL ) { 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 if( p != NULL ) { 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 ); } } - if( strncmp( answer->p_body, "HTTP/1.", 7 ) ) + if( strncmp( (char *)answer->p_body, "HTTP/1.", 7 ) ) { int i_status, i_headers; 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 */ - 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++; 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 else { i_status = 200; - psz_headers = answer->p_body; + psz_headers = (char *)answer->p_body; i_headers = answer->i_body; } switch( i_status ) @@ -668,17 +668,18 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c psz_status = "Unauthorized"; break; default: + if( (i_status < 0) || (i_status > 999) ) + i_status = 500; psz_status = "Undefined"; break; } - snprintf( psz_code, sizeof(psz_code), "%d", i_status ); - answer->i_body = sizeof("HTTP/1.0 \r\n") + strlen(psz_code) - + strlen(psz_status) + i_headers - 1; - psz_new = malloc( answer->i_body + 1); - sprintf( psz_new, "HTTP/1.0 %s %s\r\n", psz_code, psz_status ); + answer->i_body = sizeof("HTTP/1.0 xxx \r\n") + + strlen(psz_status) + i_headers - 1; + psz_new = (char *)malloc( answer->i_body + 1); + sprintf( psz_new, "HTTP/1.0 %03d %s\r\n", i_status, psz_status ); memcpy( &psz_new[strlen(psz_new)], psz_headers, i_headers ); free( answer->p_body ); - answer->p_body = psz_new; + answer->p_body = (uint8_t *)psz_new; } return VLC_SUCCESS;