]> git.sesse.net Git - vlc/blobdiff - modules/access/rtsp/rtsp.c
dvdnav: fully fix the still image assertion
[vlc] / modules / access / rtsp / rtsp.c
index 62ef640bfeccf5e78dc6c12666316c0d122fde3f..3793c23e5b51f3396d7621a43d50588dd72537ad 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
-#include <stdio.h>
 
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
 
 #include "rtsp.h"
 
@@ -125,6 +128,7 @@ static int rtsp_put( rtsp_client_t *rtsp, const char *psz_string )
 
 static int rtsp_get_status_code( rtsp_client_t *rtsp, const char *psz_string )
 {
+    VLC_UNUSED(rtsp);
     char psz_buffer[4];
     int i_code = 0;
 
@@ -237,7 +241,7 @@ static int rtsp_get_answers( rtsp_client_t *rtsp )
       {
           char *buf = malloc( strlen(answer) );
           sscanf( answer, "%*s %s", buf );
-          if( rtsp->p_private->server ) free( rtsp->p_private->server );
+          free( rtsp->p_private->server );
           rtsp->p_private->server = buf;
       }
       if( !strncasecmp( answer, "Session:", 8 ) )
@@ -248,7 +252,7 @@ static int rtsp_get_answers( rtsp_client_t *rtsp )
           {
               if( strcmp( buf, rtsp->p_private->session ) )
               {
-                  //fprintf( stderr, 
+                  //fprintf( stderr,
                   //         "rtsp: warning: setting NEW session: %s\n", buf );
                   free( rtsp->p_private->session );
                   rtsp->p_private->session = strdup( buf );
@@ -492,7 +496,7 @@ int rtsp_connect( rtsp_client_t *rtsp, const char *psz_mrl,
     colon = strchr( mrl_ptr, ':' );
 
     if( !slash ) slash = mrl_ptr + strlen(mrl_ptr) + 1;
-    if( !colon ) colon = slash; 
+    if( !colon ) colon = slash;
     if( colon > slash ) colon = slash;
 
     pathbegin = slash - mrl_ptr;
@@ -545,7 +549,7 @@ int rtsp_connect( rtsp_client_t *rtsp, const char *psz_mrl,
 }
 
 /*
- * closes an rtsp connection 
+ * closes an rtsp connection
  */
 
 void rtsp_close( rtsp_client_t *rtsp )
@@ -556,12 +560,12 @@ void rtsp_close( rtsp_client_t *rtsp )
         rtsp->pf_disconnect( rtsp->p_userdata );
     }
 
-    if( rtsp->p_private->path ) free( rtsp->p_private->path );
-    if( rtsp->p_private->host ) free( rtsp->p_private->host );
-    if( rtsp->p_private->mrl ) free( rtsp->p_private->mrl );
-    if( rtsp->p_private->session ) free( rtsp->p_private->session );
-    if( rtsp->p_private->user_agent ) free( rtsp->p_private->user_agent );
-    if( rtsp->p_private->server ) free( rtsp->p_private->server );
+    free( rtsp->p_private->path );
+    free( rtsp->p_private->host );
+    free( rtsp->p_private->mrl );
+    free( rtsp->p_private->session );
+    free( rtsp->p_private->user_agent );
+    free( rtsp->p_private->server );
     rtsp_free_answers( rtsp );
     rtsp_unschedule_all( rtsp );
     free( rtsp->p_private );
@@ -601,7 +605,7 @@ char *rtsp_search_answers( rtsp_client_t *rtsp, const char *tag )
 
 void rtsp_set_session( rtsp_client_t *rtsp, const char *id )
 {
-    if( rtsp->p_private->session ) free( rtsp->p_private->session );
+    free( rtsp->p_private->session );
     rtsp->p_private->session = strdup(id);
 }
 
@@ -631,7 +635,7 @@ void rtsp_schedule_field( rtsp_client_t *rtsp, const char *string )
 }
 
 /*
- * removes the first scheduled field which prefix matches string. 
+ * removes the first scheduled field which prefix matches string.
  */
 
 void rtsp_unschedule_field( rtsp_client_t *rtsp, const char *string )
@@ -644,7 +648,7 @@ void rtsp_unschedule_field( rtsp_client_t *rtsp, const char *string )
     {
       if( !strncmp(*ptr, string, strlen(string)) ) break;
     }
-    if( *ptr ) free( *ptr );
+    free( *ptr );
     ptr++;
     do
     {