]> git.sesse.net Git - vlc/blobdiff - modules/demux/nsc.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / demux / nsc.c
index 1649dbc4ed121d0ab9d178cf3284bf6cb2111a6a..9a78cd3ed0a71aeded34b9d63b977cfa39ade080 100644 (file)
@@ -2,7 +2,7 @@
  * nsc.c: NSC file demux and encoding decoder
  *****************************************************************************
  * Copyright (C) 2005 the VideoLAN team
- * $Id$
+ * $Id$
  *
  * Authors: Jon Lech Johansen <jon@nanocrew.net>
  *          Derk-Jan Hartman <hartman at videolan dot org>
  *
  * 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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <ctype.h>
 #include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_demux.h>
 #include <vlc_playlist.h>
 
+#include <ctype.h>
 #define MAX_LINE 16024
 
 /*****************************************************************************
@@ -136,7 +135,7 @@ static int load_byte( unsigned char encoding_type,
     return 0;
 }
 
-char *nscdec( vlc_object_t *p_demux, char* p_encoded )
+static char *nscdec( vlc_object_t *p_demux, char* p_encoded )
 {
     unsigned int i;
     unsigned char tmp;
@@ -147,7 +146,7 @@ char *nscdec( vlc_object_t *p_demux, char* p_encoded )
     vlc_iconv_t conv;
     size_t buf16_size;
     unsigned char *buf16;
-    char *p_buf16;
+    const char *p_buf16;
     size_t buf8_size;
     char *buf8;
     char *p_buf8;
@@ -208,10 +207,10 @@ char *nscdec( vlc_object_t *p_demux, char* p_encoded )
     }
 
     buf16_size = length;
-    buf16 = (unsigned char *)malloc( buf16_size );
+    buf16 = malloc( buf16_size );
     if( buf16 == NULL )
     {
-        msg_Err( p_demux, "Out of memory" );
+        msg_Err( p_demux, "out of memory" );
         return NULL;
     }
 
@@ -220,33 +219,33 @@ char *nscdec( vlc_object_t *p_demux, char* p_encoded )
         if( load_byte( encoding_type, &buf16[ i ], &p_input, &j, &k ) )
         {
             msg_Err( p_demux, "load_byte failed" );
-            free( (void *)buf16 );
+            free( buf16 );
             return NULL;
         }
     }
 
     buf8_size = length;
-    buf8 = (char *)malloc( buf8_size + 1 );
+    buf8 = malloc( buf8_size + 1 );
     if( buf8 == NULL )
     {
-        msg_Err( p_demux, "Out of memory" );
-        free( (void *)buf16 );
+        msg_Err( p_demux, "out of memory" );
+        free( buf16 );
         return NULL;
     }
 
     conv = vlc_iconv_open( "UTF-8", "UTF-16LE" );
-    if( conv == (vlc_iconv_t)-1 )
+    if( conv == (vlc_iconv_t)(-1) )
     {
         msg_Err( p_demux, "iconv_open failed" );
-        free( (void *)buf16 );
-        free( (void *)buf8 );
+        free( buf16 );
+        free( buf8 );
         return NULL;
     }
 
-    p_buf8 = &buf8[ 0 ];
-    p_buf16 = (char *)&buf16[ 0 ];
+    p_buf8 = buf8;
+    p_buf16 = (const char *)buf16;
 
-    if( vlc_iconv( conv, &p_buf16, &buf16_size, &p_buf8, &buf8_size ) < 0 )
+    if( vlc_iconv( conv, &p_buf16, &buf16_size, &p_buf8, &buf8_size ) == (size_t)(-1) )
     {
         msg_Err( p_demux, "iconv failed" );
         return NULL;
@@ -258,7 +257,7 @@ char *nscdec( vlc_object_t *p_demux, char* p_encoded )
 
     vlc_iconv_close( conv );
 
-    free( (void *)buf16 );
+    free( buf16 );
     return buf8;
 }
 
@@ -274,13 +273,13 @@ static int DemuxOpen( vlc_object_t * p_this )
 
     if ( i_size > 0 )
     {
-        while ( i_size && strncasecmp( p_peek, "NSC Format Version=",
+        while ( i_size && strncasecmp( (char *)p_peek, "NSC Format Version=",
                                        (int) sizeof("NSC Format Version=") - 1 ) )
         {
             p_peek++;
             i_size--;
         }
-        if ( !strncasecmp( p_peek, "NSC Format Version=",
+        if ( !strncasecmp( (char *)p_peek, "NSC Format Version=",
                            (int) sizeof("NSC Format Version=") -1 ) )
         {
             p_demux->pf_demux = Demux;
@@ -319,7 +318,7 @@ static int ParseLine ( demux_t *p_demux, char *psz_line )
     }
     *psz_value = '\0';
     psz_value++;
-    
     if( !strncasecmp( psz_value, "0x", 2 ) )
     {
         int i_value;