From: RĂ©mi Denis-Courmont Date: Fri, 2 Jul 2010 17:54:50 +0000 (+0300) Subject: Make vlc_value_t.i_int 64-bits X-Git-Tag: 1.2.0-pre1~5975 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=b4c9cb160e24388a8c6092717f5257cdf46f146a;p=vlc 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. --- diff --git a/include/vlc_common.h b/include/vlc_common.h index 38ad6fce21..38b63645dc 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -409,7 +409,7 @@ struct stat; */ typedef union { - int i_int; + int64_t i_int; bool b_bool; float f_float; char * psz_string; diff --git a/include/vlc_variables.h b/include/vlc_variables.h index 0a9d7057b2..b1c2b394e8 100644 --- a/include/vlc_variables.h +++ b/include/vlc_variables.h @@ -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; diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c index b5168d2f1f..4aa70fd0e6 100644 --- a/modules/audio_output/alsa.c +++ b/modules/audio_output/alsa.c @@ -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; diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c index d3f22a7242..216e930b77 100644 --- a/modules/audio_output/auhal.c +++ b/modules/audio_output/auhal.c @@ -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 ); } diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c index 14d91ca1c0..a05fcf16b6 100644 --- a/modules/audio_output/oss.c +++ b/modules/audio_output/oss.c @@ -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; diff --git a/modules/control/http/mvar.c b/modules/control/http/mvar.c index 0e723e0182..946501985f 100644 --- a/modules/control/http/mvar.c +++ b/modules/control/http/mvar.c @@ -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", diff --git a/modules/control/rc.c b/modules/control/rc.c index 2fbc628fdf..93da8472a8 100644 --- a/modules/control/rc.c +++ b/modules/control/rc.c @@ -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 ); diff --git a/modules/gui/hildon/maemo_menus.c b/modules/gui/hildon/maemo_menus.c index 77d2b323bd..71f17fcb14 100644 --- a/modules/gui/hildon/maemo_menus.c +++ b/modules/gui/hildon/maemo_menus.c @@ -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 ) diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m index d25288d779..cad72406ec 100644 --- a/modules/gui/macosx/controls.m +++ b/modules/gui/macosx/controls.m @@ -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: @""]; diff --git a/modules/gui/macosx/vout.m b/modules/gui/macosx/vout.m index d68c415e3b..7ba72647b5 100644 --- a/modules/gui/macosx/vout.m +++ b/modules/gui/macosx/vout.m @@ -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 ); diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c index 25967a9442..70d8f0f15c 100644 --- a/modules/gui/ncurses.c +++ b/modules/gui/ncurses.c @@ -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 diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp index da4d3403be..eca75df894 100644 --- a/modules/gui/qt4/components/extended_panels.cpp +++ b/modules/gui/qt4/components/extended_panels.cpp @@ -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 ); diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp index 7717cd2185..d92d7e26f9 100644 --- a/modules/gui/qt4/input_manager.cpp +++ b/modules/gui/qt4/input_manager.cpp @@ -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 ); diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index 1c0961f9ce..eb0ce1243a 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -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; } diff --git a/modules/video_filter/atmo/atmo.cpp b/modules/video_filter/atmo/atmo.cpp index 5f48ca4832..3a1bb955b2 100644 --- a/modules/video_filter/atmo/atmo.cpp +++ b/modules/video_filter/atmo/atmo.cpp @@ -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 diff --git a/modules/video_filter/mosaic.c b/modules/video_filter/mosaic.c index 41b3a645f4..82fda8290a 100644 --- a/modules/video_filter/mosaic.c +++ b/modules/video_filter/mosaic.c @@ -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 ); } diff --git a/modules/video_filter/osdmenu.c b/modules/video_filter/osdmenu.c index bb88cf069e..01560d9b25 100644 --- a/modules/video_filter/osdmenu.c +++ b/modules/video_filter/osdmenu.c @@ -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) ) diff --git a/modules/video_filter/remoteosd.c b/modules/video_filter/remoteosd.c index f11ec0798a..817eb495e8 100644 --- a/modules/video_filter/remoteosd.c +++ b/modules/video_filter/remoteosd.c @@ -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; } diff --git a/src/input/es_out.c b/src/input/es_out.c index 37c6304d92..0fc7176070 100644 --- a/src/input/es_out.c +++ b/src/input/es_out.c @@ -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; } } diff --git a/src/input/input.c b/src/input/input.c index 6e4ad9ba36..af7137fa23 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -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; } diff --git a/src/misc/objects.c b/src/misc/objects.c index 352acb3b8e..65802c77c7 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -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 ); diff --git a/src/osd/osd.c b/src/osd/osd.c index 7c1f74934e..7c5046de11 100644 --- a/src/osd/osd.c +++ b/src/osd/osd.c @@ -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 } }