mirror of
https://github.com/videolan/vlc.git
synced 2024-11-27 03:47:46 +08:00
charset: rename us_* to vlc_*_c()
This matches the naming convention of vlc_strerror_c(), and avoids clobbering the global namespace.
This commit is contained in:
parent
9791d0cd3e
commit
91646be8e1
@ -363,7 +363,7 @@ static inline char *FromLatin1 (const char *latin)
|
||||
* (or NULL to discard it)
|
||||
* \return the parsed double value (zero if no character could be parsed)
|
||||
*/
|
||||
VLC_API double us_strtod(const char *restrict str, char **restrict end)
|
||||
VLC_API double vlc_strtod_c(const char *restrict str, char **restrict end)
|
||||
VLC_USED;
|
||||
|
||||
/**
|
||||
@ -379,7 +379,7 @@ VLC_USED;
|
||||
* (or NULL to discard it)
|
||||
* \return the parsed double value (zero if no character could be parsed)
|
||||
*/
|
||||
VLC_API float us_strtof(const char *restrict str, char **restrict end)
|
||||
VLC_API float vlc_strtof_c(const char *restrict str, char **restrict end)
|
||||
VLC_USED;
|
||||
|
||||
/**
|
||||
@ -393,9 +393,9 @@ VLC_USED;
|
||||
* \param str nul-terminated string to parse
|
||||
* \return the parsed double value (zero if no character could be parsed)
|
||||
*/
|
||||
VLC_USED static inline double us_atof(const char *str)
|
||||
VLC_USED static inline double vlc_atof_c(const char *str)
|
||||
{
|
||||
return us_strtod(str, NULL);
|
||||
return vlc_strtod_c(str, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -412,7 +412,7 @@ VLC_USED static inline double us_atof(const char *str)
|
||||
* \return number of bytes formatted (excluding the nul terminator)
|
||||
* or -1 on error
|
||||
*/
|
||||
VLC_API int us_vasprintf(char **restrict p, const char *restrict fmt,
|
||||
VLC_API int vlc_vasprintf_c(char **restrict p, const char *restrict fmt,
|
||||
va_list ap) VLC_USED;
|
||||
|
||||
/**
|
||||
@ -428,7 +428,7 @@ VLC_API int us_vasprintf(char **restrict p, const char *restrict fmt,
|
||||
* \return number of bytes formatted (excluding the nul terminator)
|
||||
* or -1 on error
|
||||
*/
|
||||
VLC_API int us_asprintf( char **, const char *, ... ) VLC_USED;
|
||||
VLC_API int vlc_asprintf_c( char **, const char *, ... ) VLC_USED;
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
@ -175,7 +175,7 @@ nop:
|
||||
/* Check for a "vlc://pause:***" command */
|
||||
if( !strncasecmp( psz_name, "pause:", 6 ) )
|
||||
{
|
||||
double f = us_atof( psz_name + 6 );
|
||||
double f = vlc_atof_c( psz_name + 6 );
|
||||
vlc_tick_t length = vlc_tick_from_sec( f );
|
||||
|
||||
msg_Info( p_demux, "command `pause %f'", f );
|
||||
|
@ -729,7 +729,7 @@ static void closeCurrentSegment( sout_access_out_t *p_access, sout_access_out_sy
|
||||
vlc_close( p_sys->i_handle );
|
||||
p_sys->i_handle = -1;
|
||||
|
||||
if( us_asprintf( &segment->psz_duration, "%.2f", secf_from_vlc_tick( p_sys->current_segment_length ) ) == -1 )
|
||||
if( vlc_asprintf_c( &segment->psz_duration, "%.2f", secf_from_vlc_tick( p_sys->current_segment_length ) ) == -1 )
|
||||
{
|
||||
msg_Err( p_access, "Couldn't set duration on closed segment");
|
||||
return;
|
||||
|
@ -547,7 +547,7 @@ static int BandsCallback( vlc_object_t *p_this, char const *psz_cmd,
|
||||
{
|
||||
char *next;
|
||||
/* Read dB -20/20 */
|
||||
float f = us_strtof( p, &next );
|
||||
float f = vlc_strtof_c( p, &next );
|
||||
if( next == p || isnan( f ) )
|
||||
break; /* no conversion */
|
||||
|
||||
|
@ -277,7 +277,7 @@ static bool getRDFFloat(const char *psz_rdf, float *out, const char *psz_var)
|
||||
if (unlikely(p_end == NULL || p_end == p_start + 1))
|
||||
return false;
|
||||
|
||||
*out = us_strtof(p_start, NULL);
|
||||
*out = vlc_strtof_c(p_start, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ static ttml_length_t ttml_read_length( const char *psz )
|
||||
ttml_length_t len = { 0.0, TTML_UNIT_UNKNOWN };
|
||||
|
||||
char* psz_end = NULL;
|
||||
float size = us_strtof( psz, &psz_end );
|
||||
float size = vlc_strtof_c( psz, &psz_end );
|
||||
len.i_value = size;
|
||||
if( psz_end )
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ static tt_time_t tt_ParseTime( const char *s )
|
||||
else /* Offset Time */
|
||||
{
|
||||
char *psz_end = (char *) s;
|
||||
double v = us_strtod( s, &psz_end );
|
||||
double v = vlc_strtod_c( s, &psz_end );
|
||||
if( psz_end != s && *psz_end )
|
||||
{
|
||||
if( *psz_end == 'm' )
|
||||
|
@ -625,7 +625,7 @@ static void ParseVorbisComments( decoder_t *p_dec )
|
||||
audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
|
||||
|
||||
r->pb_gain[AUDIO_REPLAY_GAIN_TRACK] = true;
|
||||
r->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
|
||||
r->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = vlc_atof_c( psz_value );
|
||||
}
|
||||
else if( !strcasecmp( psz_name, "REPLAYGAIN_TRACK_PEAK" ) ||
|
||||
!strcasecmp( psz_name, "RG_PEAK" ) )
|
||||
@ -633,7 +633,7 @@ static void ParseVorbisComments( decoder_t *p_dec )
|
||||
audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
|
||||
|
||||
r->pb_peak[AUDIO_REPLAY_GAIN_TRACK] = true;
|
||||
r->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
|
||||
r->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = vlc_atof_c( psz_value );
|
||||
}
|
||||
else if( !strcasecmp( psz_name, "REPLAYGAIN_ALBUM_GAIN" ) ||
|
||||
!strcasecmp( psz_name, "RG_AUDIOPHILE" ) )
|
||||
@ -641,14 +641,14 @@ static void ParseVorbisComments( decoder_t *p_dec )
|
||||
audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
|
||||
|
||||
r->pb_gain[AUDIO_REPLAY_GAIN_ALBUM] = true;
|
||||
r->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
|
||||
r->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = vlc_atof_c( psz_value );
|
||||
}
|
||||
else if( !strcasecmp( psz_name, "REPLAYGAIN_ALBUM_PEAK" ) )
|
||||
{
|
||||
audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
|
||||
|
||||
r->pb_peak[AUDIO_REPLAY_GAIN_ALBUM] = true;
|
||||
r->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
|
||||
r->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = vlc_atof_c( psz_value );
|
||||
}
|
||||
else if( !strcasecmp( psz_name, "METADATA_BLOCK_PICTURE" ) )
|
||||
{ /* Do nothing, for now */ }
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "css_parser.h"
|
||||
#include "CSSGrammar.h"
|
||||
#define VAL(a, b) { yylval->term.val = (a); yylval->term.type = TYPE_ ## b; }
|
||||
#define us_strtof strtof
|
||||
#define vlc_strtof_c strtof
|
||||
char *d;
|
||||
%}
|
||||
|
||||
@ -79,24 +79,24 @@ range \?{1,6}|{h}(\?{0,5}|{h}(\?{0,4}|{h}(\?{0,3}|{h}(\?{0,2}|{h}(\??|{h})))))
|
||||
|
||||
"!{w}important" {return IMPORTANT_SYM;}
|
||||
|
||||
{num}em { VAL( us_strtof(yytext, &d), EMS ); return LENGTH;}
|
||||
{num}em { VAL( vlc_strtof_c(yytext, &d), EMS ); return LENGTH;}
|
||||
{num}ex { VAL( atoi(yytext), EXS ); return LENGTH;}
|
||||
{num}px { VAL( atoi(yytext), PIXELS ); return LENGTH;}
|
||||
{num}cm { VAL( us_strtof(yytext, &d) * 10, MILLIMETERS ); return LENGTH;}
|
||||
{num}cm { VAL( vlc_strtof_c(yytext, &d) * 10, MILLIMETERS ); return LENGTH;}
|
||||
{num}mm { VAL( atoi(yytext), MILLIMETERS ); return LENGTH;}
|
||||
{num}in { VAL( us_strtof(yytext, &d) * 25.4, MILLIMETERS ); return LENGTH;}
|
||||
{num}pt { VAL( us_strtof(yytext, &d), POINTS ); return LENGTH;}
|
||||
{num}pc { VAL( us_strtof(yytext, &d), POINTS ); return LENGTH;}
|
||||
{num}deg { VAL( us_strtof(yytext, &d), DEGREES ); return ANGLE;}
|
||||
{num}rad { VAL( us_strtof(yytext, &d) * 0.0174533, DEGREES ); return ANGLE;}
|
||||
{num}grad { VAL( us_strtof(yytext, &d) * 1.1111111, DEGREES ); return ANGLE;}
|
||||
{num}in { VAL( vlc_strtof_c(yytext, &d) * 25.4, MILLIMETERS ); return LENGTH;}
|
||||
{num}pt { VAL( vlc_strtof_c(yytext, &d), POINTS ); return LENGTH;}
|
||||
{num}pc { VAL( vlc_strtof_c(yytext, &d), POINTS ); return LENGTH;}
|
||||
{num}deg { VAL( vlc_strtof_c(yytext, &d), DEGREES ); return ANGLE;}
|
||||
{num}rad { VAL( vlc_strtof_c(yytext, &d) * 0.0174533, DEGREES ); return ANGLE;}
|
||||
{num}grad { VAL( vlc_strtof_c(yytext, &d) * 1.1111111, DEGREES ); return ANGLE;}
|
||||
{num}ms { VAL( atoi(yytext), MILLISECONDS ); return TIME;}
|
||||
{num}s { VAL( atoi(yytext) * 1000, MILLISECONDS ); return TIME;}
|
||||
{num}Hz { VAL( atoi(yytext), HERTZ ); return FREQ;}
|
||||
{num}kHz { VAL( atoi(yytext) * 1000, HERTZ ); return FREQ;}
|
||||
{num}{ident} { VAL( 0, DIMENSION ); return DIMEN;}
|
||||
{num}% { VAL( atoi(yytext), PERCENT ); return PERCENTAGE;}
|
||||
{num} { VAL( us_strtof(yytext, &d), NONE ); return NUMBER;}
|
||||
{num} { VAL( vlc_strtof_c(yytext, &d), NONE ); return NUMBER;}
|
||||
|
||||
"url("{w}{string}{w}")" { yylval->string = vlc_css_unquotedunescaped(yytext); return URI;}
|
||||
"url("{w}{url}{w}")" { yylval->string = vlc_css_unquotedunescaped(yytext); return URI;}
|
||||
|
@ -183,7 +183,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
|
||||
if( bo_size( &box ) != i_start + 8 )
|
||||
bo_add_8( &box, ' ' );
|
||||
char *psz;
|
||||
int i_printed = us_asprintf( &psz, "line:%2.2f%%", offset );
|
||||
int i_printed = vlc_asprintf_c( &psz, "line:%2.2f%%", offset );
|
||||
if( i_printed >= 0 )
|
||||
{
|
||||
if( i_printed > 0 )
|
||||
|
@ -174,7 +174,7 @@ typedef struct
|
||||
static bool parse_percent( const char *psz, float *value )
|
||||
{
|
||||
char *psz_end;
|
||||
float d = us_strtof( psz, &psz_end );
|
||||
float d = vlc_strtof_c( psz, &psz_end );
|
||||
if( d >= 0.0 && d <= 100.0 && *psz_end == '%' )
|
||||
*value = d / 100.0;
|
||||
return psz_end != psz;
|
||||
@ -183,14 +183,14 @@ static bool parse_percent( const char *psz, float *value )
|
||||
static bool parse_percent_tuple( const char *psz, float *x, float *y )
|
||||
{
|
||||
char *psz_end;
|
||||
float a = us_strtof( psz, &psz_end );
|
||||
float a = vlc_strtof_c( psz, &psz_end );
|
||||
if( psz_end != psz &&
|
||||
a >= 0.0 && a <= 100.0 && psz_end && *psz_end == '%' )
|
||||
{
|
||||
psz = strchr( psz_end, ',' );
|
||||
if( psz )
|
||||
{
|
||||
float b = us_strtof( ++psz, &psz_end );
|
||||
float b = vlc_strtof_c( ++psz, &psz_end );
|
||||
if( psz_end != psz &&
|
||||
b >= 0.0 && b <= 100.0 && psz_end && *psz_end == '%' )
|
||||
{
|
||||
@ -307,7 +307,7 @@ static void webvtt_cue_settings_ParseTuple( webvtt_cue_settings_t *p_settings,
|
||||
p_settings->b_snap_to_lines = false;
|
||||
}
|
||||
else
|
||||
p_settings->line.value = us_strtof( psz_value, NULL );
|
||||
p_settings->line.value = vlc_strtof_c( psz_value, NULL );
|
||||
/* else auto */
|
||||
|
||||
const char *psz_align = strchr( psz_value, ',' );
|
||||
|
@ -1008,11 +1008,11 @@ static int Open ( vlc_object_t *p_this )
|
||||
psz_val = var_GetString( p_enc, SOUT_CFG_PREFIX "psy-rd" );
|
||||
if( psz_val )
|
||||
{
|
||||
if( us_atof( psz_val ) != 1.0 )
|
||||
if( vlc_atof_c( psz_val ) != 1.0 )
|
||||
{
|
||||
char *p = strchr( psz_val, ':' );
|
||||
p_sys->param.analyse.f_psy_rd = us_atof( psz_val );
|
||||
p_sys->param.analyse.f_psy_trellis = p ? us_atof( p+1 ) : 0;
|
||||
p_sys->param.analyse.f_psy_rd = vlc_atof_c( psz_val );
|
||||
p_sys->param.analyse.f_psy_trellis = p ? vlc_atof_c( p+1 ) : 0;
|
||||
}
|
||||
free( psz_val );
|
||||
}
|
||||
@ -1023,8 +1023,8 @@ static int Open ( vlc_object_t *p_this )
|
||||
psz_val = var_GetString( p_enc, SOUT_CFG_PREFIX "level" );
|
||||
if( psz_val )
|
||||
{
|
||||
if( us_atof (psz_val) < 6 && us_atof (psz_val) > 0 )
|
||||
p_sys->param.i_level_idc = (int) (10 * us_atof (psz_val)
|
||||
if( vlc_atof_c(psz_val) < 6 && vlc_atof_c(psz_val) > 0 )
|
||||
p_sys->param.i_level_idc = (int) (10 * vlc_atof_c(psz_val)
|
||||
+ .5);
|
||||
else if( atoi(psz_val) >= 10 && atoi(psz_val) <= 51 )
|
||||
p_sys->param.i_level_idc = atoi (psz_val);
|
||||
|
@ -47,7 +47,7 @@ static vlc_tick_t str_duration( const char *psz_duration )
|
||||
return -1;
|
||||
do
|
||||
{
|
||||
double number = us_strtod( psz_duration, &end_ptr );
|
||||
double number = vlc_strtod_c( psz_duration, &end_ptr );
|
||||
double mul = 0;
|
||||
if ( psz_duration != end_ptr )
|
||||
psz_duration = end_ptr;
|
||||
|
@ -3040,14 +3040,14 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
|
||||
const char *psz_meta = vlc_meta_GetExtra( p_sys->p_meta, "replaygain_track_gain" );
|
||||
if( psz_meta )
|
||||
{
|
||||
double f_gain = us_atof( psz_meta );
|
||||
double f_gain = vlc_atof_c( psz_meta );
|
||||
p_arg->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = f_gain;
|
||||
p_arg->pb_gain[AUDIO_REPLAY_GAIN_TRACK] = f_gain != 0;
|
||||
}
|
||||
psz_meta = vlc_meta_GetExtra( p_sys->p_meta, "replaygain_track_peak" );
|
||||
if( psz_meta )
|
||||
{
|
||||
double f_gain = us_atof( psz_meta );
|
||||
double f_gain = vlc_atof_c( psz_meta );
|
||||
p_arg->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = f_gain;
|
||||
p_arg->pb_peak[AUDIO_REPLAY_GAIN_TRACK] = f_gain > 0;
|
||||
}
|
||||
|
@ -1095,7 +1095,7 @@ static int ID3TAG_Parse_Handler( uint32_t i_tag, const uint8_t *p_payload, size_
|
||||
{
|
||||
const char *psz_val = vlc_meta_GetExtra( p_meta, ppsz_keys[i] );
|
||||
if( psz_val )
|
||||
*pf = us_atof( psz_val );
|
||||
*pf = vlc_atof_c( psz_val );
|
||||
}
|
||||
free( ppsz_keys[i] );
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ static void parseEXTINF( char *psz_string,
|
||||
|
||||
/* Parse duration */
|
||||
char *psz_end = NULL;
|
||||
float i_parsed_duration = us_strtof( psz_string, &psz_end );
|
||||
float i_parsed_duration = vlc_strtof_c( psz_string, &psz_end );
|
||||
if( i_parsed_duration > 0 )
|
||||
meta->i_duration = vlc_tick_from_sec( (double)i_parsed_duration );
|
||||
|
||||
|
@ -1013,7 +1013,7 @@ static int ParseMicroDvd( vlc_object_t *p_obj, subs_properties_t *p_props,
|
||||
|
||||
/* We found a possible setting of the framerate "{1}{1}23.976" */
|
||||
/* Check if it's usable, and if the sub-original-fps is not set */
|
||||
float f_fps = us_strtof( psz_text, NULL );
|
||||
float f_fps = vlc_strtof_c( psz_text, NULL );
|
||||
if( f_fps > 0.f && var_GetFloat( p_obj, "sub-original-fps" ) <= 0.f )
|
||||
p_props->i_microsecperframe = llroundf((float)CLOCK_FREQ / f_fps);
|
||||
}
|
||||
@ -1740,7 +1740,7 @@ static int ParseMPSub( vlc_object_t *p_obj, subs_properties_t *p_props,
|
||||
|
||||
if( sscanf( s, "FORMAT=%[^\r\n]", psz_temp ) )
|
||||
{
|
||||
float f_fps = us_strtof( psz_temp, NULL );
|
||||
float f_fps = vlc_strtof_c( psz_temp, NULL );
|
||||
|
||||
if( f_fps > 0.f && var_GetFloat( p_obj, "sub-original-fps" ) <= 0.f )
|
||||
var_SetFloat( p_obj, "sub-original-fps", f_fps );
|
||||
@ -1753,10 +1753,10 @@ static int ParseMPSub( vlc_object_t *p_obj, subs_properties_t *p_props,
|
||||
}
|
||||
|
||||
/* Data Lines */
|
||||
float f1 = us_strtof( s, &psz_temp );
|
||||
float f1 = vlc_strtof_c( s, &psz_temp );
|
||||
if( *psz_temp )
|
||||
{
|
||||
float f2 = us_strtof( psz_temp, NULL );
|
||||
float f2 = vlc_strtof_c( psz_temp, NULL );
|
||||
p_props->mpsub.f_total += f1 * p_props->mpsub.i_factor;
|
||||
p_subtitle->i_start = llroundf(10000.f * p_props->mpsub.f_total);
|
||||
p_props->mpsub.f_total += f2 * p_props->mpsub.i_factor;
|
||||
|
@ -494,19 +494,19 @@ void vorbis_ParseComment( es_format_t *p_fmt, vlc_meta_t **pp_meta,
|
||||
if (!p) goto next_comment;
|
||||
if ( !strncasecmp(psz_comment, "REPLAYGAIN_TRACK_GAIN=", 22) )
|
||||
{
|
||||
(*ppf_replay_gain)[AUDIO_REPLAY_GAIN_TRACK] = us_atof( ++p );
|
||||
(*ppf_replay_gain)[AUDIO_REPLAY_GAIN_TRACK] = vlc_atof_c( ++p );
|
||||
}
|
||||
else if ( !strncasecmp(psz_comment, "REPLAYGAIN_ALBUM_GAIN=", 22) )
|
||||
{
|
||||
(*ppf_replay_gain)[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( ++p );
|
||||
(*ppf_replay_gain)[AUDIO_REPLAY_GAIN_ALBUM] = vlc_atof_c( ++p );
|
||||
}
|
||||
else if ( !strncasecmp(psz_comment, "REPLAYGAIN_ALBUM_PEAK=", 22) )
|
||||
{
|
||||
(*ppf_replay_peak)[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( ++p );
|
||||
(*ppf_replay_peak)[AUDIO_REPLAY_GAIN_ALBUM] = vlc_atof_c( ++p );
|
||||
}
|
||||
else if ( !strncasecmp(psz_comment, "REPLAYGAIN_TRACK_PEAK=", 22) )
|
||||
{
|
||||
(*ppf_replay_peak)[AUDIO_REPLAY_GAIN_TRACK] = us_atof( ++p );
|
||||
(*ppf_replay_peak)[AUDIO_REPLAY_GAIN_TRACK] = vlc_atof_c( ++p );
|
||||
}
|
||||
}
|
||||
else if( !strncasecmp(psz_comment, "CHAPTER", 7) )
|
||||
|
@ -396,7 +396,7 @@ void config_ChainParse( vlc_object_t *p_this, const char *psz_prefix,
|
||||
NULL, 0 );
|
||||
break;
|
||||
case CONFIG_ITEM_FLOAT:
|
||||
val.f_float = us_atof( cfg->psz_value ? cfg->psz_value : "0" );
|
||||
val.f_float = vlc_atof_c( cfg->psz_value ? cfg->psz_value : "0" );
|
||||
break;
|
||||
case CONFIG_ITEM_STRING:
|
||||
val.psz_string = cfg->psz_value;
|
||||
|
@ -311,7 +311,7 @@ int config_LoadCmdLine( vlc_object_t *p_this, int i_argc,
|
||||
var_Change( p_this, psz_name, VLC_VAR_SETMINMAX,
|
||||
(vlc_value_t){ .f_float = p_conf->min.f },
|
||||
(vlc_value_t){ .f_float = p_conf->max.f } );
|
||||
var_SetFloat( p_this, psz_name, us_atof(state.arg) );
|
||||
var_SetFloat( p_this, psz_name, vlc_atof_c(state.arg) );
|
||||
break;
|
||||
case CONFIG_ITEM_BOOL:
|
||||
var_Create( p_this, psz_name, VLC_VAR_BOOL );
|
||||
@ -347,7 +347,7 @@ int config_LoadCmdLine( vlc_object_t *p_this, int i_argc,
|
||||
break;
|
||||
case CONFIG_ITEM_FLOAT:
|
||||
var_Create( p_this, name, VLC_VAR_FLOAT );
|
||||
var_SetFloat( p_this, name, us_atof(state.arg) );
|
||||
var_SetFloat( p_this, name, vlc_atof_c(state.arg) );
|
||||
break;
|
||||
case CONFIG_ITEM_BOOL:
|
||||
var_Create( p_this, name, VLC_VAR_BOOL );
|
||||
|
@ -290,26 +290,26 @@ void vlc_audio_replay_gain_MergeFromMeta( audio_replay_gain_t *p_dst,
|
||||
(psz_value = vlc_meta_GetExtra(p_meta, "RG_RADIO")) )
|
||||
{
|
||||
p_dst->pb_gain[AUDIO_REPLAY_GAIN_TRACK] = true;
|
||||
p_dst->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
|
||||
p_dst->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = vlc_atof_c( psz_value );
|
||||
}
|
||||
|
||||
if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_TRACK_PEAK" )) ||
|
||||
(psz_value = vlc_meta_GetExtra(p_meta, "RG_PEAK" )) )
|
||||
{
|
||||
p_dst->pb_peak[AUDIO_REPLAY_GAIN_TRACK] = true;
|
||||
p_dst->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
|
||||
p_dst->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = vlc_atof_c( psz_value );
|
||||
}
|
||||
|
||||
if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_ALBUM_GAIN" )) ||
|
||||
(psz_value = vlc_meta_GetExtra(p_meta, "RG_AUDIOPHILE" )) )
|
||||
{
|
||||
p_dst->pb_gain[AUDIO_REPLAY_GAIN_ALBUM] = true;
|
||||
p_dst->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
|
||||
p_dst->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = vlc_atof_c( psz_value );
|
||||
}
|
||||
|
||||
if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_ALBUM_PEAK" )) )
|
||||
{
|
||||
p_dst->pb_peak[AUDIO_REPLAY_GAIN_ALBUM] = true;
|
||||
p_dst->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
|
||||
p_dst->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = vlc_atof_c( psz_value );
|
||||
}
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ static int ExecuteControl( vlm_t *p_vlm, const char *psz_name, const int i_arg,
|
||||
else
|
||||
{
|
||||
/* Percent */
|
||||
double d_new_position = us_atof( psz_argument ) / 100.0;
|
||||
double d_new_position = vlc_atof_c( psz_argument ) / 100.0;
|
||||
|
||||
if( b_relative )
|
||||
{
|
||||
|
@ -430,10 +430,10 @@ update_Download
|
||||
update_GetRelease
|
||||
update_NeedUpgrade
|
||||
update_New
|
||||
us_asprintf
|
||||
us_strtod
|
||||
us_strtof
|
||||
us_vasprintf
|
||||
vlc_asprintf_c
|
||||
vlc_strtod_c
|
||||
vlc_strtof_c
|
||||
vlc_vasprintf_c
|
||||
vlc_close
|
||||
vlc_fopen
|
||||
utf8_fprintf
|
||||
|
@ -990,7 +990,7 @@ void var_OptionParse( vlc_object_t *p_obj, const char *psz_option,
|
||||
break;
|
||||
|
||||
case VLC_VAR_FLOAT:
|
||||
val.f_float = us_atof( psz_value );
|
||||
val.f_float = vlc_atof_c( psz_value );
|
||||
break;
|
||||
|
||||
case VLC_VAR_STRING:
|
||||
|
@ -1193,7 +1193,7 @@ void httpd_MsgAdd(httpd_message_t *msg, const char *name, const char *psz_value,
|
||||
|
||||
va_list args;
|
||||
va_start(args, psz_value);
|
||||
int ret = us_vasprintf(&h->value, psz_value, args);
|
||||
int ret = vlc_vasprintf_c(&h->value, psz_value, args);
|
||||
va_end(args);
|
||||
|
||||
if (ret == -1) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* i18n_atof.c: Test for us_atof
|
||||
* i18n_atof.c: Test for vlc_atof_c()
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2006 Rémi Denis-Courmont
|
||||
*
|
||||
@ -35,22 +35,19 @@ int main (void)
|
||||
const char sharp9[] = "999999#999999";
|
||||
char *end;
|
||||
|
||||
assert (us_atof("0") == 0.);
|
||||
assert (us_atof("1") == 1.);
|
||||
assert (us_atof("1.") == 1.);
|
||||
assert (us_atof("1,") == 1.);
|
||||
assert (us_atof("1#") == 1.);
|
||||
assert (us_atof(dot9) == 999999.999999);
|
||||
assert (us_atof(comma9) == 999999.);
|
||||
assert (us_atof(sharp9) == 999999.);
|
||||
assert (us_atof("invalid") == 0.);
|
||||
assert(vlc_atof_c("0") == 0.);
|
||||
assert(vlc_atof_c("1") == 1.);
|
||||
assert(vlc_atof_c("1.") == 1.);
|
||||
assert(vlc_atof_c("1,") == 1.);
|
||||
assert(vlc_atof_c("1#") == 1.);
|
||||
assert(vlc_atof_c(dot9) == 999999.999999);
|
||||
assert(vlc_atof_c(comma9) == 999999.);
|
||||
assert(vlc_atof_c(sharp9) == 999999.);
|
||||
assert(vlc_atof_c("invalid") == 0.);
|
||||
|
||||
assert ((us_strtod(dot9, &end ) == 999999.999999)
|
||||
&& (*end == '\0'));
|
||||
assert ((us_strtod(comma9, &end ) == 999999.)
|
||||
&& (*end == ','));
|
||||
assert ((us_strtod(sharp9, &end ) == 999999.)
|
||||
&& (*end == '#'));
|
||||
assert((vlc_strtod_c(dot9, &end ) == 999999.999999) && (*end == '\0'));
|
||||
assert((vlc_strtod_c(comma9, &end ) == 999999.) && (*end == ','));
|
||||
assert((vlc_strtod_c(sharp9, &end ) == 999999.) && (*end == '#'));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "libvlc.h"
|
||||
#include <vlc_charset.h>
|
||||
|
||||
double us_strtod( const char *str, char **end )
|
||||
double vlc_strtod_c(const char *restrict str, char **restrict end)
|
||||
{
|
||||
locale_t loc = newlocale (LC_NUMERIC_MASK, "C", NULL);
|
||||
locale_t oldloc = uselocale (loc);
|
||||
@ -57,7 +57,7 @@ double us_strtod( const char *str, char **end )
|
||||
return res;
|
||||
}
|
||||
|
||||
float us_strtof( const char *str, char **end )
|
||||
float vlc_strtof_c(const char *restrict str, char **restrict end)
|
||||
{
|
||||
locale_t loc = newlocale (LC_NUMERIC_MASK, "C", NULL);
|
||||
locale_t oldloc = uselocale (loc);
|
||||
@ -71,7 +71,8 @@ float us_strtof( const char *str, char **end )
|
||||
return res;
|
||||
}
|
||||
|
||||
int us_vasprintf( char **ret, const char *format, va_list ap )
|
||||
int vlc_vasprintf_c(char **restrict ret, const char *restrict format,
|
||||
va_list ap)
|
||||
{
|
||||
locale_t loc = newlocale( LC_NUMERIC_MASK, "C", NULL );
|
||||
locale_t oldloc = uselocale( loc );
|
||||
@ -87,13 +88,13 @@ int us_vasprintf( char **ret, const char *format, va_list ap )
|
||||
return i_rc;
|
||||
}
|
||||
|
||||
int us_asprintf( char **ret, const char *format, ... )
|
||||
int vlc_asprintf_c(char **restrict ret, const char *restrict format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int i_rc;
|
||||
|
||||
va_start( ap, format );
|
||||
i_rc = us_vasprintf( ret, format, ap );
|
||||
i_rc = vlc_vasprintf_c(ret, format, ap);
|
||||
va_end( ap );
|
||||
|
||||
return i_rc;
|
||||
|
Loading…
Reference in New Issue
Block a user