]> git.sesse.net Git - vlc/blobdiff - modules/access/mms/mmstu.c
Mark unreachable code on GCC even if NDEBUG
[vlc] / modules / access / mms / mmstu.c
index 7ffc20672d2ba86f948ca51ed40e2bca00a5c3a1..4c0a8c21240dcfa8955ba1b2544f905129ed79bd 100644 (file)
@@ -1,24 +1,24 @@
 /*****************************************************************************
  * mmstu.c: MMS access plug-in
  *****************************************************************************
- * Copyright (C) 2001, 2002 the VideoLAN team
+ * Copyright (C) 2001, 2002 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 
 #include <errno.h>
 #include <assert.h>
 
-#ifdef HAVE_UNISTD_H
-#   include <unistd.h>
-#endif
 #include <sys/types.h>
+#include <unistd.h>
 #ifdef HAVE_POLL
 #   include <poll.h>
 #endif
@@ -176,7 +174,7 @@ int  MMSTUOpen( access_t *p_access )
     else
     {
         p_sys->b_seekable = true;
-        p_access->info.i_size =
+        p_sys->i_size =
             (uint64_t)p_sys->i_header +
             (uint64_t)p_sys->i_packet_count * (uint64_t)p_sys->i_packet_length;
     }
@@ -224,7 +222,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
 
     switch( i_query )
     {
-        /* */
         case ACCESS_CAN_SEEK:
             pb_bool = (bool*)va_arg( args, bool* );
             *pb_bool = p_sys->b_seekable;
@@ -250,7 +247,10 @@ static int Control( access_t *p_access, int i_query, va_list args )
             *pb_bool = true;
             break;
 
-        /* */
+        case ACCESS_GET_SIZE:
+            *va_arg( args, uint64_t * ) = p_sys->i_size;
+            break;
+
         case ACCESS_GET_PTS_DELAY:
             pi_64 = (int64_t*)va_arg( args, int64_t * );
             *pi_64 = INT64_C(1000)
@@ -266,7 +266,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
             *pb_bool =  p_sys->asfh.stream[i_int].i_selected ? true : false;
             break;
 
-        /* */
         case ACCESS_SET_PAUSE_STATE:
             b_bool = (bool)va_arg( args, int );
             if( b_bool )
@@ -281,19 +280,8 @@ static int Control( access_t *p_access, int i_query, va_list args )
             }
             break;
 
-        case ACCESS_GET_TITLE_INFO:
-        case ACCESS_SET_TITLE:
-        case ACCESS_SET_SEEKPOINT:
-        case ACCESS_SET_PRIVATE_ID_STATE:
-        case ACCESS_GET_CONTENT_TYPE:
-        case ACCESS_GET_META:
-            return VLC_EGENERIC;
-
-
         default:
-            msg_Warn( p_access, "unimplemented query in control" );
             return VLC_EGENERIC;
-
     }
     return VLC_SUCCESS;
 }
@@ -412,7 +400,7 @@ static block_t *Block( access_t *p_access )
     {
         const size_t i_copy = p_sys->i_header - p_access->info.i_pos;
 
-        block_t *p_block = block_New( p_access, i_copy );
+        block_t *p_block = block_Alloc( i_copy );
         if( !p_block )
             return NULL;
 
@@ -430,7 +418,7 @@ static block_t *Block( access_t *p_access )
         if( __MAX( p_sys->i_media, p_sys->i_media_used ) < p_sys->i_packet_length )
             i_padding = p_sys->i_packet_length - __MAX( p_sys->i_media, p_sys->i_media_used );
 
-        block_t *p_block = block_New( p_access, i_copy + i_padding );
+        block_t *p_block = block_Alloc( i_copy + i_padding );
         if( !p_block )
             return NULL;
 
@@ -1100,7 +1088,7 @@ static int NetFillBuffer( access_t *p_access )
 
     if( i_ret < 0 )
     {
-        msg_Err( p_access, "network poll error (%m)" );
+        msg_Err( p_access, "network poll error: %s", vlc_strerror_c(errno) );
         return -1;
     }
 
@@ -1585,7 +1573,7 @@ static void *KeepAliveThread( void *p_data )
 
         msleep( 10 * CLOCK_FREQ );
     }
-    assert(0);
+    vlc_assert_unreachable();
 }
 
 static void KeepAliveStart( access_t *p_access )