]> git.sesse.net Git - vlc/commitdiff
By definition of sizeof, sizeof(char) = 1
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Mon, 17 Nov 2008 02:25:35 +0000 (04:25 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 30 Nov 2008 11:46:16 +0000 (13:46 +0200)
16 files changed:
modules/access/dvb/en50221.c
modules/access/rtsp/real.c
modules/access/rtsp/real_rmff.c
modules/access/rtsp/real_sdpplin.c
modules/codec/cmml/xtag.c
modules/codec/cmml/xurl.c
modules/demux/mkv/matroska_segment.hpp
modules/demux/playlist/asx.c
modules/gui/ncurses.c
modules/gui/pda/pda_callbacks.c
modules/gui/wxwidgets/dialogs/wizard.cpp
modules/misc/notify/xosd.c
modules/misc/playlist/xspf.c
modules/misc/svg.c
modules/misc/testsuite/test4.c
modules/misc/xml/xtag.c

index 65b3919e412d842103443d7c928b1549757d7a22..f8c1dadc644b7bbd07d7c495599f00c125929ba6 100644 (file)
@@ -2429,7 +2429,7 @@ char *dvbsi_to_utf8( char *psz_instring, size_t i_length )
     iconv_handle = vlc_iconv_open( "UTF-8", psz_encoding );
     i_in = i_length - (psz_stringstart - psz_instring );
     i_out = i_in * 6;
-    psz_outstring = psz_tmp = (char*)malloc( i_out * sizeof(char) + 1 );
+    psz_outstring = psz_tmp = (char*)malloc( i_out + 1 );
     vlc_iconv( iconv_handle, &psz_stringstart, &i_in, &psz_tmp, &i_out );
     vlc_iconv_close( iconv_handle );
     *psz_tmp = '\0';
index 66a36ce709157a5d2a429e33c81c68c01d981979..7743491bca4cfdcecdb06652d7a2f2582c9bdf02 100644 (file)
@@ -439,7 +439,7 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt
   desc=sdpplin_parse(data);
   if( !desc ) return NULL;
 
-  buf= (char *)malloc(sizeof(char)*2048);
+  buf= (char *)malloc(2048);
   if( !buf ) goto error;
 
   header = (rmff_header_t*)malloc(sizeof(rmff_header_t));
@@ -615,7 +615,7 @@ rmff_header_t  *real_setup_and_get_header(rtsp_client_t *rtsp_session, int bandw
   char challenge2[64];
   char checksum[34];
   char *subscribe=NULL;
-  char *buf=(char*)malloc(sizeof(char)*256);
+  char *buf=(char*)malloc(256);
   char *mrl=rtsp_get_mrl(rtsp_session);
   unsigned int size;
   int status;
@@ -668,7 +668,7 @@ rmff_header_t  *real_setup_and_get_header(rtsp_client_t *rtsp_session, int bandw
 
   lprintf("Stream description size: %i\n", size);
 
-  description = (char*)malloc(sizeof(char)*(size+1));
+  description = (char*)malloc(size+1);
   if( !description )
     goto error;
   if( rtsp_read_data(rtsp_session, (uint8_t*)description, size) <= 0)
@@ -677,7 +677,7 @@ rmff_header_t  *real_setup_and_get_header(rtsp_client_t *rtsp_session, int bandw
   //fprintf(stderr, "%s", description);
 
   /* parse sdp (sdpplin) and create a header and a subscribe string */
-  subscribe = (char *) malloc(sizeof(char)*256);
+  subscribe = (char *) malloc(256);
   if( !subscribe )
     goto error;
 
index 73dc65580715bd8f5b68394f4527ef6bc5a695d4..945c6729e342dceb9cb6c7cb14c0200a79ff13a8 100644 (file)
@@ -381,7 +381,7 @@ rmff_mdpr_t *rmff_new_mdpr(
   }
   mdpr->type_specific_len=type_specific_len;
 
-  mdpr->type_specific_data = malloc(sizeof(char)*type_specific_len);
+  mdpr->type_specific_data = malloc(type_specific_len);
   if( !mdpr->type_specific_data ) {
     free( mdpr->stream_name );
     free( mdpr );
index be950c2f07d9ea409ccd829abeef31e7ddf326df..d8456bfbe0c3300afbf5608f08e4ff10fdebb162 100644 (file)
@@ -193,7 +193,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
     if(filter(*data,"a=OpaqueData:buffer;",&buf, BUFLEN)) {
       decoded = b64_decode(buf, decoded, &(desc->mlti_data_size));
       if ( decoded != NULL ) {
-          desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size);
+          desc->mlti_data = malloc(desc->mlti_data_size);
           memcpy(desc->mlti_data, decoded, desc->mlti_data_size);
           handled=1;
           *data=nl(*data);
index 14590a0abcffa3480672c9d522c58ab89b04669e..44fe169466b45d0bf1319557f1f4e79134a89b35 100644 (file)
@@ -201,7 +201,7 @@ xtag_slurp_to (XTagParser * parser, int good_end, int bad_end)
   xi = xtag_index (parser, good_end | bad_end);
 
   if (xi > 0 && xtag_cin (s[xi], good_end)) {
-    ret = malloc ((xi+1) * sizeof(char));
+    ret = malloc (xi+1);
     strncpy (ret, s, xi);
     ret[xi] = '\0';
     parser->start = &s[xi];
@@ -255,7 +255,7 @@ xtag_slurp_quoted (XTagParser * parser)
     }
   }
 
-  ret = malloc ((xi+1) * sizeof(char));
+  ret = malloc (xi+1);
   strncpy (ret, s, xi);
   ret[xi] = '\0';
   parser->start = &s[xi];
index 7e65c16092a1b89d19a689cf5a1f28e2eaf60e3c..ec4ad75da6bb295d50af821d7dabd4f19cc32e3e 100644 (file)
@@ -382,8 +382,7 @@ char *XURL_GetHead( const char *psz_path )
         size_t i_characters_until_last_slash;
 
         i_characters_until_last_slash = pc_last_slash - psz_path;
-        psz_path_head = malloc(
-                ( i_characters_until_last_slash + 1 ) * sizeof(char) );
+        psz_path_head = malloc( i_characters_until_last_slash + 1 );
         strncpy( psz_path_head, psz_path, i_characters_until_last_slash + 1 );
 
         /* terminate the resulting string with '\0' */
index ddb902be4142b33c0a43a0db0064c7e1c839bb7f..424e73230d74a34c6a57f5c07f64952ec07520fa 100644 (file)
@@ -172,7 +172,7 @@ static void MkvTree( demux_t & demuxer, int i_level, const char *psz_format, ...
     }
     va_start( args, psz_format );
     static const char psz_foo[] = "|   |   |   |   |   |   |   |   |   |";
-    char *psz_foo2 = (char*)malloc( ( i_level * 4 + 3 + strlen( psz_format ) ) * sizeof(char) );
+    char *psz_foo2 = (char*)malloc( i_level * 4 + 3 + strlen( psz_format ) );
     strncpy( psz_foo2, psz_foo, 4 * i_level );
     psz_foo2[ 4 * i_level ] = '+';
     psz_foo2[ 4 * i_level + 1 ] = ' ';
index 9fb8b15192c6711e5799bcddc5619165f631b0da..a1aa34f6490a02971c087d580ae76aebadc93138 100644 (file)
@@ -240,7 +240,7 @@ static int Demux( demux_t *p_demux )
         int64_t i_pos = 0;
         p_sys->i_data_len = stream_Size( p_demux->s ) +1; /* This is a cheat to prevent unnecessary realloc */
         if( p_sys->i_data_len <= 0 && p_sys->i_data_len < 16384 ) p_sys->i_data_len = 1024;
-        p_sys->psz_data = malloc( p_sys->i_data_len * sizeof(char) +1);
+        p_sys->psz_data = malloc( p_sys->i_data_len +1);
 
         /* load the complete file */
         for( ;; )
@@ -310,7 +310,7 @@ static int Demux( demux_t *p_demux )
                             i_strlen = psz_parse-psz_backup;
                             if( i_strlen < 1 ) continue;
                             msg_Dbg( p_demux, "param name strlen: %d", i_strlen);
-                            psz_string = malloc( i_strlen *sizeof( char ) +1);
+                            psz_string = malloc( i_strlen 1);
                             memcpy( psz_string, psz_backup, i_strlen );
                             psz_string[i_strlen] = '\0';
                             msg_Dbg( p_demux, "param name: %s", psz_string);
@@ -332,7 +332,7 @@ static int Demux( demux_t *p_demux )
                             i_strlen = psz_parse-psz_backup;
                             if( i_strlen < 1 ) continue;
                             msg_Dbg( p_demux, "param value strlen: %d", i_strlen);
-                            psz_string = malloc( i_strlen *sizeof( char ) +1);
+                            psz_string = malloc( i_strlen +1);
                             memcpy( psz_string, psz_backup, i_strlen );
                             psz_string[i_strlen] = '\0';
                             msg_Dbg( p_demux, "param value: %s", psz_string);
@@ -455,7 +455,7 @@ static int Demux( demux_t *p_demux )
                         {
                             i_strlen = psz_parse-psz_backup;
                             if( i_strlen < 1 ) continue;
-                            psz_string = malloc( i_strlen*sizeof( char ) +1);
+                            psz_string = malloc( i_strlen +1);
                             memcpy( psz_string, psz_backup, i_strlen );
                             psz_string[i_strlen] = '\0';
                             input_item_t *p_input;
@@ -603,7 +603,7 @@ static int Demux( demux_t *p_demux )
                             if( i_strlen < 1 ) continue;
 
                             FREENULL(psz_href);
-                            psz_href = malloc( i_strlen*sizeof( char ) +1);
+                            psz_href = malloc( i_strlen +1);
                             memcpy( psz_href, psz_backup, i_strlen );
                             psz_href[i_strlen] = '\0';
                             psz_tmp = psz_href + (i_strlen-1);
index b850e2832e25f3610e806394b4b579373def3f7e..aa04a67108dc34a025685b08eb0ca7e0b1ce7d6d 100644 (file)
@@ -2557,8 +2557,7 @@ static void ReadDir( intf_thread_t *p_intf )
                 continue;
             }
 
-            psz_uri = (char *)malloc( sizeof(char)*i_size_entry);
-            sprintf( psz_uri, "%s/%s", p_sys->psz_current_dir, psz_entry );
+            asprintf( &psz_uri, "%s/%s", p_sys->psz_current_dir, psz_entry );
 
             if( !( p_dir_entry = malloc( sizeof( struct dir_entry_t) ) ) )
             {
index 9165fcda6ed5444ec40a15a8d990fd90f9a1bc1a..7a49be35155c6e0c8731002970b9e3e6554a86dd 100644 (file)
@@ -270,7 +270,7 @@ static char *get_file_perms(const struct stat st)
 {
     char  *psz_perm;
 
-    psz_perm = (char *) malloc(sizeof(char)*10);
+    psz_perm = (char *) malloc(10);
     strncpy( psz_perm, "----------", sizeof("----------"));
 
     /* determine permission modes */
@@ -658,7 +658,7 @@ void onAddCameraToPlaylist(GtkButton *button, gpointer user_data)
         return;
     for (i=0; i<11; i++)
     {
-        ppsz_options[i] = (char *) malloc(VLC_MAX_MRL * sizeof(char));
+        ppsz_options[i] = (char *) malloc(VLC_MAX_MRL);
         if (ppsz_options[i] == NULL)
         {
             for (i-=1; i>=0; i--)
@@ -1020,7 +1020,7 @@ void onAddTranscodeToPlaylist(GtkButton *button, gpointer user_data)
         return;
     for (i=0; i<3; i++)
     {
-        ppsz_options[i] = (char *) malloc(VLC_MAX_MRL * sizeof(char));
+        ppsz_options[i] = (char *) malloc(VLC_MAX_MRL);
         if (ppsz_options[i] == NULL)
         {
             for (i-=1; i>=0; i--)
index 9a677355d040271d6c97898002d463fa55419f8b..b019e61e28826f47de2f71bb537e0b5d27291673 100644 (file)
@@ -1554,7 +1554,7 @@ void WizardDialog::Run()
                 else if( ab < 0 )
                     ab = 0;
 
-                psz_transcode = (char *)malloc( i_tr_size * sizeof(char) );
+                psz_transcode = (char *)malloc( i_tr_size );
 
                 strcpy( psz_transcode, "transcode{" );
                 if( vcodec != NULL )
index 0b7615da9715075bab95f170a38b792e4a037701..ff72f8c0ba701fd748913a3905e7fa109a2ad5d2 100644 (file)
@@ -266,7 +266,7 @@ static void Run( intf_thread_t *p_intf )
                     sprintf( psz_duration," " );
                 }
 
-                psz_display = (char *)malloc( sizeof(char )*
+                psz_display = (char *)malloc(
                                           (strlen( p_input->psz_name ) +
                                           MSTRTIME_MAX_SIZE + 2+6 + 10 +10 ));
                 sprintf( psz_display,"%s %s",
index 7ec9f123b3c3777ceeade66a5fe422866bd8bf62..3b8fc8b0b03cec22f50dd14cd57b7cbe05b31cb6 100644 (file)
@@ -319,7 +319,7 @@ static char *assertUTF8URI( char *psz_name )
 
     /* max. 3x for URI conversion (percent escaping) and
        8 bytes for "file://" and NULL-termination */
-    psz_ret = (char *)malloc( sizeof(char)*strlen(psz_name)*6*3+8 );
+    psz_ret = (char *)malloc( strlen(psz_name)*6*3+8 );
     if( !psz_ret )
         return NULL;
 
@@ -378,5 +378,5 @@ static char *assertUTF8URI( char *psz_name )
     }
     *psz_d = '\0';
 
-    return (char *)realloc( psz_ret, sizeof(char)*strlen( psz_ret ) + 1 );
+    return (char *)realloc( psz_ret, strlen( psz_ret ) + 1 );
 }
index aaa94c896e3f11eb84406253a024b653dc32b1f8..afaa6f7ea182dac4876c3b66b1c1695f0d87b571 100644 (file)
@@ -198,7 +198,7 @@ static char *svg_GetTemplate( vlc_object_t *p_this )
                 msg_Dbg( p_this, "reading %ld bytes from template %s",
                          (unsigned long)s.st_size, psz_filename );
 
-                psz_template = malloc( ( s.st_size + 42 ) * sizeof( char ) );
+                psz_template = malloc( s.st_size + 42 );
                 if( !psz_template )
                 {
                     fclose( file );
@@ -471,7 +471,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
         int length;
         char* psz_template = p_sys->psz_template;
         length = strlen( psz_string ) + strlen( psz_template ) + 42;
-        p_svg->psz_text = malloc( ( length + 1 ) * sizeof( char ) );
+        p_svg->psz_text = malloc( length + 1 );
         if( !p_svg->psz_text )
         {
             free( p_svg );
index 56fad6d91dc49240257f9d815e2972558fc43ce3..a7280a5f286b620a16a699d1e3b61df70cbb8e26 100644 (file)
@@ -289,7 +289,7 @@ static int Stress( vlc_object_t *p_this, char const *psz_cmd,
 
     /* Allocate required data */
     ppsz_name = malloc( MAXVAR * i_level * sizeof(char*) );
-    psz_blob = malloc( 20 * MAXVAR * i_level * sizeof(char) );
+    psz_blob = malloc( 20 * MAXVAR * i_level );
     for( i = 0; i < MAXVAR * i_level; i++ )
     {
         ppsz_name[i] = psz_blob + 20 * i;
index e59a1c125ded33de7eab3e9be07ab313c4858e7b..475cef8303f38d295fcd395ca39509009eac1ce8 100644 (file)
@@ -449,7 +449,7 @@ static char *xtag_slurp_to( XTagParser *parser, int good_end, int bad_end )
 
     if( xi > 0 && xtag_cin (s[xi], good_end) )
     {
-        ret = malloc( (xi+1) * sizeof(char) );
+        ret = malloc( xi+1 );
         strncpy( ret, s, xi );
         ret[xi] = '\0';
         parser->start = &s[xi];
@@ -502,7 +502,7 @@ static char *xtag_slurp_quoted( XTagParser *parser )
         }
     }
 
-    ret = malloc( (xi+1) * sizeof(char) );
+    ret = malloc( xi+1 );
     strncpy( ret, s, xi );
     ret[xi] = '\0';
     parser->start = &s[xi];
@@ -644,7 +644,7 @@ static XTag *xtag_parse_tag( XTagParser *parser )
         while (parser->end - s > 2) {
             if (strncmp( s, "]]>", 3 ) == 0) {
                 if ( !(tag = malloc( sizeof(*tag))) ) return NULL;
-                if ( !(pcdata = malloc( sizeof(char)*(s - parser->start + 1))) )
+                if ( !(pcdata = malloc( s - parser->start + 1)) )
                 {
                     free( tag );
                     return NULL;