Commit 9ad4af7c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Const fixes

parent 6f1095eb
...@@ -183,9 +183,9 @@ VLC_EXPORT( int, httpd_StreamSend, ( httpd_stream_t *, uint8_t *p ...@@ -183,9 +183,9 @@ VLC_EXPORT( int, httpd_StreamSend, ( httpd_stream_t *, uint8_t *p
/* Msg functions facilities */ /* Msg functions facilities */
VLC_EXPORT( void, httpd_MsgInit, ( httpd_message_t * ) ); VLC_EXPORT( void, httpd_MsgInit, ( httpd_message_t * ) );
VLC_EXPORT( void, httpd_MsgAdd, ( httpd_message_t *, char *psz_name, char *psz_value, ... ) ); VLC_EXPORT( void, httpd_MsgAdd, ( httpd_message_t *, const char *psz_name, const char *psz_value, ... ) );
/* return "" if not found. The string is not allocated */ /* return "" if not found. The string is not allocated */
VLC_EXPORT( char *, httpd_MsgGet, ( httpd_message_t *, char *psz_name ) ); VLC_EXPORT( const char *, httpd_MsgGet, ( httpd_message_t *, const char *psz_name ) );
VLC_EXPORT( void, httpd_MsgClean, ( httpd_message_t * ) ); VLC_EXPORT( void, httpd_MsgClean, ( httpd_message_t * ) );
#endif /* _VLC_HTTPD_H */ #endif /* _VLC_HTTPD_H */
...@@ -214,8 +214,8 @@ struct module_symbols_t ...@@ -214,8 +214,8 @@ struct module_symbols_t
int (*httpd_StreamHeader_inner) (httpd_stream_t *, uint8_t *p_data, int i_data); int (*httpd_StreamHeader_inner) (httpd_stream_t *, uint8_t *p_data, int i_data);
int (*httpd_StreamSend_inner) (httpd_stream_t *, uint8_t *p_data, int i_data); int (*httpd_StreamSend_inner) (httpd_stream_t *, uint8_t *p_data, int i_data);
void (*httpd_MsgInit_inner) (httpd_message_t *); void (*httpd_MsgInit_inner) (httpd_message_t *);
void (*httpd_MsgAdd_inner) (httpd_message_t *, char *psz_name, char *psz_value, ...); void (*httpd_MsgAdd_inner) (httpd_message_t *, const char *psz_name, const char *psz_value, ...);
char * (*httpd_MsgGet_inner) (httpd_message_t *, char *psz_name); const char * (*httpd_MsgGet_inner) (httpd_message_t *, const char *psz_name);
void (*httpd_MsgClean_inner) (httpd_message_t *); void (*httpd_MsgClean_inner) (httpd_message_t *);
tls_server_t * (*tls_ServerCreate_inner) (vlc_object_t *, const char *, const char *); tls_server_t * (*tls_ServerCreate_inner) (vlc_object_t *, const char *, const char *);
void (*tls_ServerDelete_inner) (tls_server_t *); void (*tls_ServerDelete_inner) (tls_server_t *);
......
...@@ -142,7 +142,7 @@ struct httpd_client_t ...@@ -142,7 +142,7 @@ struct httpd_client_t
* Various functions * Various functions
*****************************************************************************/ *****************************************************************************/
/*char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";*/ /*char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";*/
static void b64_decode( char *dest, char *src ) static void b64_decode( char *restrict dest, const char *restrict src )
{ {
int i_level; int i_level;
int last = 0; int last = 0;
...@@ -369,7 +369,7 @@ static int httpd_FileCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl, ...@@ -369,7 +369,7 @@ static int httpd_FileCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
httpd_file_t *file = (httpd_file_t*)p_sys; httpd_file_t *file = (httpd_file_t*)p_sys;
uint8_t *psz_args = query->psz_args; uint8_t *psz_args = query->psz_args;
uint8_t **pp_body, *p_body; uint8_t **pp_body, *p_body;
char *psz_connection = NULL; const char *psz_connection;
int *pi_body, i_body; int *pi_body, i_body;
if( answer == NULL || query == NULL ) if( answer == NULL || query == NULL )
...@@ -532,7 +532,8 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c ...@@ -532,7 +532,8 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c
if( strncmp( (char *)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;
const char *psz_status;
if( !strncmp( (char *)answer->p_body, "Status: ", 8 ) ) if( !strncmp( (char *)answer->p_body, "Status: ", 8 ) )
{ {
...@@ -1336,7 +1337,7 @@ void httpd_MsgClean( httpd_message_t *msg ) ...@@ -1336,7 +1337,7 @@ void httpd_MsgClean( httpd_message_t *msg )
httpd_MsgInit( msg ); httpd_MsgInit( msg );
} }
char *httpd_MsgGet( httpd_message_t *msg, char *name ) const char *httpd_MsgGet( httpd_message_t *msg, const char *name )
{ {
int i; int i;
...@@ -1350,7 +1351,7 @@ char *httpd_MsgGet( httpd_message_t *msg, char *name ) ...@@ -1350,7 +1351,7 @@ char *httpd_MsgGet( httpd_message_t *msg, char *name )
return NULL; return NULL;
} }
void httpd_MsgAdd( httpd_message_t *msg, char *name, char *psz_value, ... ) void httpd_MsgAdd( httpd_message_t *msg, const char *name, const char *psz_value, ... )
{ {
va_list args; va_list args;
char *value = NULL; char *value = NULL;
...@@ -1581,7 +1582,7 @@ static void httpd_ClientRecv( httpd_client_t *cl ) ...@@ -1581,7 +1582,7 @@ static void httpd_ClientRecv( httpd_client_t *cl )
{ {
static const struct static const struct
{ {
char *name; const char *name;
int i_type; int i_type;
int i_proto; int i_proto;
} }
...@@ -2058,7 +2059,7 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -2058,7 +2059,7 @@ static void httpd_HostThread( httpd_host_t *host )
} }
else if( i_msg == HTTPD_MSG_OPTIONS ) else if( i_msg == HTTPD_MSG_OPTIONS )
{ {
char *psz_cseq = NULL; const char *psz_cseq;
int i_cseq; int i_cseq;
/* unimplemented */ /* unimplemented */
...@@ -2163,14 +2164,11 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -2163,14 +2164,11 @@ static void httpd_HostThread( httpd_host_t *host )
if( answer && ( *url->psz_user || *url->psz_password ) ) if( answer && ( *url->psz_user || *url->psz_password ) )
{ {
/* create the headers */ /* create the headers */
char *b64 = httpd_MsgGet( query, "Authorization" ); /* BASIC id */ const char *b64 = httpd_MsgGet( query, "Authorization" ); /* BASIC id */
char *auth; char *auth;
char *id; char *id;
asprintf( &id, "%s:%s", url->psz_user, url->psz_password ); asprintf( &id, "%s:%s", url->psz_user, url->psz_password );
if( b64 ) auth = malloc( strlen(b64) + 1 );
else auth = malloc( strlen("") + 1 );
if( b64 != NULL if( b64 != NULL
&& !strncasecmp( b64, "BASIC", 5 ) ) && !strncasecmp( b64, "BASIC", 5 ) )
{ {
...@@ -2179,11 +2177,12 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -2179,11 +2177,12 @@ static void httpd_HostThread( httpd_host_t *host )
{ {
b64++; b64++;
} }
auth = malloc( strlen(b64) + 1 );
b64_decode( auth, b64 ); b64_decode( auth, b64 );
} }
else else
{ {
strcpy( auth, "" ); auth = strdup( "" );
} }
if( strcmp( id, auth ) ) if( strcmp( id, auth ) )
...@@ -2306,8 +2305,8 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -2306,8 +2305,8 @@ static void httpd_HostThread( httpd_host_t *host )
{ {
if( cl->i_mode == HTTPD_CLIENT_FILE || cl->answer.i_body_offset == 0 ) if( cl->i_mode == HTTPD_CLIENT_FILE || cl->answer.i_body_offset == 0 )
{ {
char *psz_connection = httpd_MsgGet( &cl->answer, "Connection" ); const char *psz_connection = httpd_MsgGet( &cl->answer, "Connection" );
char *psz_query = httpd_MsgGet( &cl->query, "Connection" ); const char *psz_query = httpd_MsgGet( &cl->query, "Connection" );
vlc_bool_t b_connection = VLC_FALSE; vlc_bool_t b_connection = VLC_FALSE;
vlc_bool_t b_keepalive = VLC_FALSE; vlc_bool_t b_keepalive = VLC_FALSE;
vlc_bool_t b_query = VLC_FALSE; vlc_bool_t b_query = VLC_FALSE;
...@@ -2666,13 +2665,13 @@ void httpd_MsgInit ( httpd_message_t *a ) ...@@ -2666,13 +2665,13 @@ void httpd_MsgInit ( httpd_message_t *a )
{ {
} }
void httpd_MsgAdd ( httpd_message_t *a, char *b, char *c, ... ) void httpd_MsgAdd ( httpd_message_t *a, const char *b, const char *c, ... )
{ {
} }
char *httpd_MsgGet ( httpd_message_t *a, char *b ) const char *httpd_MsgGet ( httpd_message_t *a, const char *b )
{ {
return NULL; return "";
} }
void httpd_MsgClean( httpd_message_t *a ) void httpd_MsgClean( httpd_message_t *a )
......
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