Commit b4c9cb16 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Make vlc_value_t.i_int 64-bits

The memory usage is already there anyway. However, this increases the
code size a little, especially on 32-bits platforms.

N.B.: helper getter functions are still 32-bits until further change.
So are configuration items.
parent 2a6fdbb4
......@@ -409,7 +409,7 @@ struct stat;
*/
typedef union
{
int i_int;
int64_t i_int;
bool b_bool;
float f_float;
char * psz_string;
......
......@@ -188,7 +188,8 @@ VLC_EXPORT( int, var_TriggerCallback, ( vlc_object_t *, const char * ) );
* \param psz_name The name of the variable
* \param i The new integer value of this variable
*/
static inline int var_SetInteger( vlc_object_t *p_obj, const char *psz_name, int i )
static inline int var_SetInteger( vlc_object_t *p_obj, const char *psz_name,
int64_t i )
{
vlc_value_t val;
val.i_int = i;
......
......@@ -438,7 +438,8 @@ static int Open( vlc_object_t *p_this )
else if( val.i_int != AOUT_VAR_SPDIF )
{
/* This should not happen ! */
msg_Err( p_aout, "internal: can't find audio-device (%i)", val.i_int );
msg_Err( p_aout, "internal: can't find audio-device (%"PRId64")",
val.i_int );
free( p_sys );
free( psz_device );
return VLC_EGENERIC;
......
......@@ -1492,7 +1492,7 @@ static int AudioDeviceCallback( vlc_object_t *p_this, const char *psz_variable,
{
aout_instance_t *p_aout = (aout_instance_t *)p_this;
var_Set( p_aout->p_libvlc, "macosx-audio-device", new_val );
msg_Dbg( p_aout, "Set Device: %#x", new_val.i_int );
msg_Dbg( p_aout, "Set Device: %#"PRIx64, new_val.i_int );
return aout_ChannelsRestart( p_this, psz_variable, old_val, new_val, param );
}
......@@ -353,7 +353,8 @@ static int Open( vlc_object_t *p_this )
else
{
/* This should not happen ! */
msg_Err( p_aout, "internal: can't find audio-device (%i)", val.i_int );
msg_Err( p_aout, "internal: can't find audio-device (%"PRId64")",
val.i_int );
close( p_sys->i_fd );
free( p_sys );
return VLC_EGENERIC;
......
......@@ -418,7 +418,7 @@ mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name,
for( i = 0; i < val_list.p_list->i_count; i++ )
{
char psz_int[16];
char psz_int[21];
mvar_t *itm;
switch( i_type & VLC_VAR_TYPE )
......@@ -438,7 +438,7 @@ mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name,
case VLC_VAR_INTEGER:
itm = mvar_New( name, "set" );
mvar_AppendNewVar( itm, "name", text_list.p_list->p_values[i].psz_string );
snprintf( psz_int, sizeof(psz_int), "%d",
snprintf( psz_int, sizeof(psz_int), "%"PRId64,
val_list.p_list->p_values[i].i_int );
mvar_AppendNewVar( itm, "id", psz_int );
snprintf( psz_int, sizeof(psz_int), "%d",
......
......@@ -1184,10 +1184,12 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
for ( i = 0; i < val.p_list->i_count; i++ )
{
if ( i_value == val.p_list->p_values[i].i_int )
msg_rc( "| %i - %s *", val.p_list->p_values[i].i_int,
msg_rc( "| %"PRId64" - %s *",
val.p_list->p_values[i].i_int,
text.p_list->p_values[i].psz_string );
else
msg_rc( "| %i - %s", val.p_list->p_values[i].i_int,
msg_rc( "| %"PRId64" - %s",
val.p_list->p_values[i].i_int,
text.p_list->p_values[i].psz_string );
}
var_FreeList( &val, &text );
......@@ -1761,10 +1763,10 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
for ( i = 0; i < val.p_list->i_count; i++ )
{
if ( i_value == val.p_list->p_values[i].i_int )
msg_rc( "| %i - %s *", val.p_list->p_values[i].i_int,
msg_rc( "| %"PRId64" - %s *", val.p_list->p_values[i].i_int,
text.p_list->p_values[i].psz_string );
else
msg_rc( "| %i - %s", val.p_list->p_values[i].i_int,
msg_rc( "| %"PRId64" - %s", val.p_list->p_values[i].i_int,
text.p_list->p_values[i].psz_string );
}
var_FreeList( &val, &text );
......
......@@ -623,7 +623,7 @@ static int CreateChoicesMenu( intf_thread_t *p_intf, GtkMenu *submenu, const cha
case VLC_VAR_INTEGER:
var_Get( p_object, psz_var, &val );
if( CURTEXT ) menutext = CURTEXT;
else snprintf( menutext, sizeof(string)-1, "%d", CURVAL.i_int );
else snprintf( menutext, sizeof(string)-1, "%"PRId64, CURVAL.i_int );
CreateAndConnect( p_intf, submenu, psz_var, menutext, "",
ITEM_RADIO, p_object, CURVAL, i_type,
( CURVAL.i_int == val.i_int )
......
......@@ -857,7 +857,7 @@
o_title = text_list.p_list->p_values[i].psz_string ?
[[VLCMain sharedInstance] localizedString: text_list.p_list->p_values[i].psz_string] :
[NSString stringWithFormat: @"%d",
[NSString stringWithFormat: @"%"PRId64,
val_list.p_list->p_values[i].i_int];
o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""];
......
......@@ -62,7 +62,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t val;
vout_thread_t *p_vout = (vout_thread_t *)p_this;
msg_Dbg( p_vout, "set %d", new_val.i_int );
msg_Dbg( p_vout, "set %"PRId64, new_val.i_int );
var_Create( p_vout->p_libvlc, "video-device", VLC_VAR_INTEGER );
var_Set( p_vout->p_libvlc, "video-device", new_val );
......
......@@ -1536,7 +1536,8 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
{
int i_title_count = var_CountChoices( p_input, "title" );
if( i_title_count > 0 )
mvnprintw( y++, 0, COLS, _(" Title : %d/%d"), val.i_int, i_title_count );
mvnprintw( y++, 0, COLS, _(" Title : %"PRId64"/%d"),
val.i_int, i_title_count );
}
/* Chapter */
......@@ -1544,7 +1545,8 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
{
int i_chapter_count = var_CountChoices( p_input, "chapter" );
if( i_chapter_count > 0 )
mvnprintw( y++, 0, COLS, _(" Chapter : %d/%d"), val.i_int, i_chapter_count );
mvnprintw( y++, 0, COLS, _(" Chapter : %"PRId64"/%d"),
val.i_int, i_chapter_count );
}
}
else
......
......@@ -480,7 +480,7 @@ void ExtVideo::setWidgetValue( QObject *widget )
else if( lineedit )
{
char str[30];
snprintf( str, sizeof(str), "%06X", val.i_int );
snprintf( str, sizeof(str), "%06"PRIX64, val.i_int );
lineedit->setText( str );
}
else if( combobox ) combobox->setCurrentIndex(
......@@ -685,7 +685,7 @@ void ExtV4l2::Refresh( void )
const char *psz_var = text.p_list->p_values[i].psz_string;
var_Change( p_obj, psz_var, VLC_VAR_GETTEXT, &name, NULL );
const char *psz_label = name.psz_string;
msg_Dbg( p_intf, "v4l2 control \"%x\": %s (%s)",
msg_Dbg( p_intf, "v4l2 control \"%"PRIx64"\": %s (%s)",
val.p_list->p_values[i].i_int, psz_var, name.psz_string );
int i_type = var_Type( p_obj, psz_var );
......
......@@ -417,11 +417,11 @@ void InputManager::UpdateNavigation()
if( val.i_int > 0 )
{
emit titleChanged( true );
msg_Dbg( p_intf, "Title %i", val.i_int );
msg_Dbg( p_intf, "Title %"PRId64, val.i_int );
/* p_input != NULL since val.i_int != 0 */
var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val2, NULL );
emit chapterChanged( (val2.i_int > 1) || ( val2.i_int > 0 && val.i_int > 1 ) );
msg_Dbg( p_intf, "Chapter: %i", val2.i_int );
msg_Dbg( p_intf, "Chapter: %"PRId64, val2.i_int );
}
else
emit titleChanged( false );
......
......@@ -830,7 +830,8 @@ static int Open( vlc_object_t *p_this )
var_Get( p_mux, SOUT_CFG_PREFIX "csa-pkt", &pkt_val );
if( pkt_val.i_int < 12 || pkt_val.i_int > 188 )
{
msg_Err( p_mux, "wrong packet size %d specified.", pkt_val.i_int );
msg_Err( p_mux, "wrong packet size %"PRId64" specified.",
pkt_val.i_int );
msg_Warn( p_mux, "using default packet size of 188 bytes" );
p_sys->i_csa_pkt_size = 188;
}
......
......@@ -2562,7 +2562,7 @@ static int AtmoSettingsCallback( vlc_object_t *p_this, char const *psz_var,
if(p_atmo_config)
{
msg_Dbg(p_filter, "apply AtmoSettingsCallback %s (int: %d -> %d)",
msg_Dbg(p_filter, "apply AtmoSettingsCallback %s (int: %"PRId64" -> %"PRId64")",
psz_var,
oldval.i_int,
newval.i_int
......
......@@ -749,7 +749,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
{
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing alpha from %d/255 to %d/255",
p_sys->i_alpha, newval.i_int);
p_sys->i_alpha, (int)newval.i_int);
p_sys->i_alpha = __MIN( __MAX( newval.i_int, 0 ), 255 );
vlc_mutex_unlock( &p_sys->lock );
}
......@@ -757,7 +757,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
{
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing height from %dpx to %dpx",
p_sys->i_height, newval.i_int );
p_sys->i_height, (int)newval.i_int );
p_sys->i_height = __MAX( newval.i_int, 0 );
vlc_mutex_unlock( &p_sys->lock );
}
......@@ -765,15 +765,15 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
{
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing width from %dpx to %dpx",
p_sys->i_width, newval.i_int );
p_sys->i_width, (int)newval.i_int );
p_sys->i_width = __MAX( newval.i_int, 0 );
vlc_mutex_unlock( &p_sys->lock );
}
else if( VAR_IS( "xoffset" ) )
{
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing x offset from %dpx to %dpx",
p_sys->i_xoffset, newval.i_int );
msg_Dbg( p_this, "changing x offset from %dpx to %px",
p_sys->i_xoffset, (int)newval.i_int );
p_sys->i_xoffset = __MAX( newval.i_int, 0 );
vlc_mutex_unlock( &p_sys->lock );
}
......@@ -781,7 +781,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
{
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing y offset from %dpx to %dpx",
p_sys->i_yoffset, newval.i_int );
p_sys->i_yoffset, (int)newval.i_int );
p_sys->i_yoffset = __MAX( newval.i_int, 0 );
vlc_mutex_unlock( &p_sys->lock );
}
......@@ -796,7 +796,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
while( pi_align_values[i_new] != newval.i_int ) i_new++;
msg_Dbg( p_this, "changing alignment from %d (%s) to %d (%s)",
p_sys->i_align, ppsz_align_descriptions[i_old],
newval.i_int, ppsz_align_descriptions[i_new] );
(int)newval.i_int, ppsz_align_descriptions[i_new] );
p_sys->i_align = newval.i_int;
vlc_mutex_unlock( &p_sys->lock );
}
......@@ -804,7 +804,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
{
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing border width from %dpx to %dpx",
p_sys->i_borderw, newval.i_int );
p_sys->i_borderw, (int)newval.i_int );
p_sys->i_borderw = __MAX( newval.i_int, 0 );
vlc_mutex_unlock( &p_sys->lock );
}
......@@ -812,7 +812,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
{
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing border height from %dpx to %dpx",
p_sys->i_borderh, newval.i_int );
p_sys->i_borderh, (int)newval.i_int );
p_sys->i_borderh = __MAX( newval.i_int, 0 );
vlc_mutex_unlock( &p_sys->lock );
}
......@@ -831,7 +831,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing position method from %d (%s) to %d (%s)",
p_sys->i_position, ppsz_pos_descriptions[p_sys->i_position],
newval.i_int, ppsz_pos_descriptions[newval.i_int]);
(int)newval.i_int, ppsz_pos_descriptions[newval.i_int]);
p_sys->i_position = newval.i_int;
vlc_mutex_unlock( &p_sys->lock );
}
......@@ -840,7 +840,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
{
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing number of rows from %d to %d",
p_sys->i_rows, newval.i_int );
p_sys->i_rows, (int)newval.i_int );
p_sys->i_rows = __MAX( newval.i_int, 1 );
vlc_mutex_unlock( &p_sys->lock );
}
......@@ -848,7 +848,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
{
vlc_mutex_lock( &p_sys->lock );
msg_Dbg( p_this, "changing number of columns from %d to %d",
p_sys->i_cols, newval.i_int );
p_sys->i_cols, (int)newval.i_int );
p_sys->i_cols = __MAX( newval.i_int, 1 );
vlc_mutex_unlock( &p_sys->lock );
}
......
......@@ -603,7 +603,7 @@ static int OSDMenuCallback( vlc_object_t *p_this, char const *psz_var,
}
}
else if( !strncmp( psz_var, OSD_CFG"update", 14) )
p_sys->i_update = (mtime_t)(newval.i_int * 1000);
p_sys->i_update = newval.i_int * INT64_C(1000);
else if( !strncmp( psz_var, OSD_CFG"timeout", 15) )
p_sys->i_update = newval.i_int % 1000;
else if( !strncmp( psz_var, OSD_CFG"alpha", 13) )
......
......@@ -1385,11 +1385,11 @@ static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
if( !p_sys->b_vnc_key_events )
return VLC_SUCCESS;
msg_Dbg( p_this, "key pressed (%d) ", newval.i_int );
msg_Dbg( p_this, "key pressed (%"PRId64") ", newval.i_int );
if ( !newval.i_int )
{
msg_Err( p_this, "Received invalid key event %d", newval.i_int );
msg_Err( p_this, "Received invalid key event 0" );
return VLC_EGENERIC;
}
......
......@@ -951,12 +951,12 @@ static void EsOutESVarUpdateGeneric( es_out_t *out, int i_id,
{
if( psz_language && *psz_language )
{
if( asprintf( &text.psz_string, "%s %i - [%s]", _( "Track" ), val.i_int, psz_language ) == -1 )
if( asprintf( &text.psz_string, "%s %"PRId64" - [%s]", _( "Track" ), val.i_int, psz_language ) == -1 )
text.psz_string = NULL;
}
else
{
if( asprintf( &text.psz_string, "%s %i", _( "Track" ), val.i_int ) == -1 )
if( asprintf( &text.psz_string, "%s %"PRId64, _( "Track" ), val.i_int ) == -1 )
text.psz_string = NULL;
}
}
......
......@@ -2135,7 +2135,7 @@ static bool Control( input_thread_t *p_input,
if( bookmark.i_time_offset < 0 && bookmark.i_byte_offset < 0 )
{
msg_Err( p_input, "invalid bookmark %d", val.i_int );
msg_Err( p_input, "invalid bookmark %"PRId64, val.i_int );
break;
}
......
......@@ -719,7 +719,7 @@ static void DumpVariable (const void *data, const VISIT which, const int depth)
printf( ": %s", p_var->val.b_bool ? "true" : "false" );
break;
case VLC_VAR_INTEGER:
printf( ": %d", p_var->val.i_int );
printf( ": %"PRId64, p_var->val.i_int );
break;
case VLC_VAR_STRING:
printf( ": \"%s\"", p_var->val.psz_string );
......
......@@ -550,7 +550,7 @@ void osd_MenuUp( vlc_object_t *p_this )
osd_SetKeyPressed( VLC_OBJECT(p_osd->p_libvlc),
var_InheritInteger(p_osd, p_button->psz_action) );
#if defined(OSD_MENU_DEBUG)
msg_Dbg( p_osd, "select (%d, %s)", val.i_int, p_button->psz_action );
msg_Dbg( p_osd, "select (%"PRId64", %s)", val.i_int, p_button->psz_action );
#endif
}
}
......@@ -617,7 +617,7 @@ void osd_MenuDown( vlc_object_t *p_this )
osd_SetKeyPressed( VLC_OBJECT(p_osd->p_libvlc),
var_InheritInteger(p_osd, p_button->psz_action_down) );
#if defined(OSD_MENU_DEBUG)
msg_Dbg( p_osd, "select (%d, %s)", val.i_int, p_button->psz_action_down );
msg_Dbg( p_osd, "select (%"PRId64", %s)", val.i_int, p_button->psz_action_down );
#endif
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment