]> git.sesse.net Git - vlc/commitdiff
Fixed some warnings
authorRémi Denis-Courmont <rem@videolan.org>
Wed, 1 Feb 2006 13:28:59 +0000 (13:28 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Wed, 1 Feb 2006 13:28:59 +0000 (13:28 +0000)
include/vlc_common.h
modules/control/http/http.c
modules/control/http/http.h
src/network/httpd.c

index 0921ae44c6a61235b504df5f40df17deeee214b2..77670e2ddb169fe5448bf91e8b20735e49782eba 100644 (file)
@@ -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;
 
index ee53459b3c2a18f92304add38eec3b2f7c3ebac9..1ce647d0f03111c76923885f8c2b2224b5a5fe9b 100644 (file)
@@ -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,
index 7ea57255474f86091125cbc49616a4dbe5c964d0..bfafb2c33704c9bcb60af9e04db98316cb141073 100644 (file)
@@ -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,
index 37b9c5c3ae614b0205821ee6135a6fa0eb1ae6f9..931798b38626970b6cbe9d0b52a224079f32836a 100644 (file)
@@ -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;