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';
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));
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;
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)
//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;
}
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 );
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);
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];
}
}
- ret = malloc ((xi+1) * sizeof(char));
+ ret = malloc (xi+1);
strncpy (ret, s, xi);
ret[xi] = '\0';
parser->start = &s[xi];
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' */
}
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 ] = ' ';
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( ;; )
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);
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);
{
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;
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);
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) ) ) )
{
{
char *psz_perm;
- psz_perm = (char *) malloc(sizeof(char)*10);
+ psz_perm = (char *) malloc(10);
strncpy( psz_perm, "----------", sizeof("----------"));
/* determine permission modes */
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--)
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--)
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 )
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",
/* 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;
}
*psz_d = '\0';
- return (char *)realloc( psz_ret, sizeof(char)*strlen( psz_ret ) + 1 );
+ return (char *)realloc( psz_ret, strlen( psz_ret ) + 1 );
}
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 );
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 );
/* 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;
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];
}
}
- ret = malloc( (xi+1) * sizeof(char) );
+ ret = malloc( xi+1 );
strncpy( ret, s, xi );
ret[xi] = '\0';
parser->start = &s[xi];
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;