Commit 1187a57b authored by JP Dinger's avatar JP Dinger

Remove unneeded casts and intermediaries in va_arg()-using boilerplate.

parent 8f556b71
...@@ -263,8 +263,6 @@ static void DemuxClose( vlc_object_t *p_this ) ...@@ -263,8 +263,6 @@ static void DemuxClose( vlc_object_t *p_this )
static int DemuxControl( demux_t *p_demux, int i_query, va_list args ) static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
{ {
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
bool *pb;
int64_t *pi64;
switch( i_query ) switch( i_query )
{ {
...@@ -273,22 +271,19 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args ) ...@@ -273,22 +271,19 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
case DEMUX_CAN_SEEK: case DEMUX_CAN_SEEK:
case DEMUX_SET_PAUSE_STATE: case DEMUX_SET_PAUSE_STATE:
case DEMUX_CAN_CONTROL_PACE: case DEMUX_CAN_CONTROL_PACE:
pb = (bool*)va_arg( args, bool * ); *va_arg( args, bool * ) = true;
*pb = false;
return VLC_SUCCESS; return VLC_SUCCESS;
case DEMUX_GET_PTS_DELAY: case DEMUX_GET_PTS_DELAY:
pi64 = (int64_t*)va_arg( args, int64_t * ); *va_arg( args, int64_t * ) = (int64_t)p_sys->i_cache * 1000;
*pi64 = (int64_t)p_sys->i_cache * 1000;
return VLC_SUCCESS; return VLC_SUCCESS;
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
pi64 = (int64_t*)va_arg( args, int64_t * ); *va_arg( args, int64_t * ) = mdate();
*pi64 = mdate();
return VLC_SUCCESS; return VLC_SUCCESS;
case DEMUX_SET_NEXT_DEMUX_TIME: case DEMUX_SET_NEXT_DEMUX_TIME:
p_sys->i_next_demux_date = (int64_t)va_arg( args, int64_t ); p_sys->i_next_demux_date = va_arg( args, int64_t );
return VLC_SUCCESS; return VLC_SUCCESS;
/* TODO implement others */ /* TODO implement others */
......
...@@ -338,22 +338,18 @@ static int Seek( access_t *p_access, int64_t i_pos ) ...@@ -338,22 +338,18 @@ static int Seek( access_t *p_access, int64_t i_pos )
*****************************************************************************/ *****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args ) static int Control( access_t *p_access, int i_query, va_list args )
{ {
bool *pb_bool;
int64_t *pi_64;
switch( i_query ) switch( i_query )
{ {
case ACCESS_CAN_SEEK: case ACCESS_CAN_SEEK:
case ACCESS_CAN_FASTSEEK: case ACCESS_CAN_FASTSEEK:
case ACCESS_CAN_PAUSE: case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE: case ACCESS_CAN_CONTROL_PACE:
pb_bool = (bool*)va_arg( args, bool* ); *va_arg( args, bool* ) = true;
*pb_bool = true;
break; break;
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); *va_arg( args, int64_t * ) =
*pi_64 = var_GetInteger( p_access, "cdda-caching" ) * INT64_C(1000); var_GetInteger( p_access, "cdda-caching" ) * INT64_C(1000);
break; break;
case ACCESS_SET_PAUSE_STATE: case ACCESS_SET_PAUSE_STATE:
......
...@@ -799,9 +799,6 @@ static int Demux( demux_t *p_demux ) ...@@ -799,9 +799,6 @@ static int Demux( demux_t *p_demux )
*****************************************************************************/ *****************************************************************************/
static int Control( demux_t *p_demux, int i_query, va_list args ) static int Control( demux_t *p_demux, int i_query, va_list args )
{ {
bool *pb;
int64_t *pi64;
switch( i_query ) switch( i_query )
{ {
/* Special for access_demux */ /* Special for access_demux */
...@@ -809,18 +806,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -809,18 +806,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_CAN_SEEK: case DEMUX_CAN_SEEK:
case DEMUX_SET_PAUSE_STATE: case DEMUX_SET_PAUSE_STATE:
case DEMUX_CAN_CONTROL_PACE: case DEMUX_CAN_CONTROL_PACE:
pb = (bool*)va_arg( args, bool * ); *va_arg( args, bool * ) = false;
*pb = false;
return VLC_SUCCESS; return VLC_SUCCESS;
case DEMUX_GET_PTS_DELAY: case DEMUX_GET_PTS_DELAY:
pi64 = (int64_t*)va_arg( args, int64_t * ); *va_arg( args, int64_t * ) = (int64_t)DEFAULT_PTS_DELAY;
*pi64 = (int64_t)DEFAULT_PTS_DELAY;
return VLC_SUCCESS; return VLC_SUCCESS;
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
pi64 = (int64_t*)va_arg( args, int64_t * ); *va_arg( args, int64_t * ) = mdate();
*pi64 = mdate();
return VLC_SUCCESS; return VLC_SUCCESS;
/* TODO implement others */ /* TODO implement others */
......
...@@ -467,28 +467,22 @@ fatal: ...@@ -467,28 +467,22 @@ fatal:
*****************************************************************************/ *****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args ) static int Control( access_t *p_access, int i_query, va_list args )
{ {
bool *pb_bool;
int64_t *pi_64;
switch( i_query ) switch( i_query )
{ {
/* */ /* */
case ACCESS_CAN_SEEK: case ACCESS_CAN_SEEK:
case ACCESS_CAN_FASTSEEK: case ACCESS_CAN_FASTSEEK:
pb_bool = (bool*)va_arg( args, bool* ); *va_arg( args, bool* ) = false;
*pb_bool = false;
break; break;
case ACCESS_CAN_PAUSE: case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE: case ACCESS_CAN_CONTROL_PACE:
pb_bool = (bool*)va_arg( args, bool* ); *va_arg( args, bool* ) = true;
*pb_bool = true;
break; break;
/* */ /* */
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); *va_arg( args, int64_t * ) = DEFAULT_PTS_DELAY * 1000;
*pi_64 = DEFAULT_PTS_DELAY * 1000;
break; break;
/* */ /* */
......
...@@ -286,13 +286,13 @@ static int Control (access_t *p_access, int query, va_list args) ...@@ -286,13 +286,13 @@ static int Control (access_t *p_access, int query, va_list args)
case ACCESS_CAN_FASTSEEK: case ACCESS_CAN_FASTSEEK:
case ACCESS_CAN_PAUSE: case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE: case ACCESS_CAN_CONTROL_PACE:
*((bool *)va_arg (args, bool *)) = true; *va_arg(args, bool *) = true;
return VLC_SUCCESS; return VLC_SUCCESS;
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
{ {
int delay_ms = var_CreateGetInteger (p_access, "file-caching"); int delay_ms = var_CreateGetInteger (p_access, "file-caching");
*((int64_t *)va_arg (args, int64_t *)) = delay_ms * INT64_C (1000); *va_arg(args, int64_t *) = delay_ms * INT64_C (1000);
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -312,22 +312,18 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -312,22 +312,18 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
*****************************************************************************/ *****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args ) static int Control( access_t *p_access, int i_query, va_list args )
{ {
bool *pb_bool;
int64_t *pi_64;
switch( i_query ) switch( i_query )
{ {
case ACCESS_CAN_SEEK: case ACCESS_CAN_SEEK:
case ACCESS_CAN_FASTSEEK: case ACCESS_CAN_FASTSEEK:
case ACCESS_CAN_PAUSE: case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE: case ACCESS_CAN_CONTROL_PACE:
pb_bool = (bool*)va_arg( args, bool* ); *va_arg( args, bool* ) = true;
*pb_bool = true;
break; break;
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); *va_arg( args, int64_t * )
*pi_64 = (int64_t)var_GetInteger( p_access, "smb-caching" ) * 1000; = (int64_t)var_GetInteger( p_access, "smb-caching" ) * 1000;
break; break;
case ACCESS_SET_PAUSE_STATE: case ACCESS_SET_PAUSE_STATE:
......
...@@ -1087,10 +1087,6 @@ static int AccessOpen( vlc_object_t * p_this ) ...@@ -1087,10 +1087,6 @@ static int AccessOpen( vlc_object_t * p_this )
*****************************************************************************/ *****************************************************************************/
static int DemuxControl( demux_t *p_demux, int i_query, va_list args ) static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
{ {
demux_sys_t *p_sys = p_demux->p_sys;
bool *pb;
int64_t *pi64;
switch( i_query ) switch( i_query )
{ {
/* Special for access_demux */ /* Special for access_demux */
...@@ -1098,18 +1094,15 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args ) ...@@ -1098,18 +1094,15 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
case DEMUX_CAN_SEEK: case DEMUX_CAN_SEEK:
case DEMUX_SET_PAUSE_STATE: case DEMUX_SET_PAUSE_STATE:
case DEMUX_CAN_CONTROL_PACE: case DEMUX_CAN_CONTROL_PACE:
pb = (bool*)va_arg( args, bool * ); *va_arg( args, bool * ) = false;
*pb = false;
return VLC_SUCCESS; return VLC_SUCCESS;
case DEMUX_GET_PTS_DELAY: case DEMUX_GET_PTS_DELAY:
pi64 = (int64_t*)va_arg( args, int64_t * ); *va_arg(args,int64_t *) = (int64_t)p_demux->p_sys->i_cache*1000;
*pi64 = (int64_t)p_sys->i_cache * 1000;
return VLC_SUCCESS; return VLC_SUCCESS;
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
pi64 = (int64_t*)va_arg( args, int64_t * ); *va_arg( args, int64_t * ) = mdate();
*pi64 = mdate();
return VLC_SUCCESS; return VLC_SUCCESS;
/* TODO implement others */ /* TODO implement others */
...@@ -1125,8 +1118,6 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args ) ...@@ -1125,8 +1118,6 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
*****************************************************************************/ *****************************************************************************/
static int AccessControl( access_t *p_access, int i_query, va_list args ) static int AccessControl( access_t *p_access, int i_query, va_list args )
{ {
bool *pb_bool;
int64_t *pi_64;
demux_sys_t *p_sys = (demux_sys_t *) p_access->p_sys; demux_sys_t *p_sys = (demux_sys_t *) p_access->p_sys;
switch( i_query ) switch( i_query )
...@@ -1134,22 +1125,14 @@ static int AccessControl( access_t *p_access, int i_query, va_list args ) ...@@ -1134,22 +1125,14 @@ static int AccessControl( access_t *p_access, int i_query, va_list args )
/* */ /* */
case ACCESS_CAN_SEEK: case ACCESS_CAN_SEEK:
case ACCESS_CAN_FASTSEEK: case ACCESS_CAN_FASTSEEK:
pb_bool = (bool*)va_arg( args, bool* );
*pb_bool = false;
break;
case ACCESS_CAN_PAUSE: case ACCESS_CAN_PAUSE:
pb_bool = (bool*)va_arg( args, bool* );
*pb_bool = false;
break;
case ACCESS_CAN_CONTROL_PACE: case ACCESS_CAN_CONTROL_PACE:
pb_bool = (bool*)va_arg( args, bool* ); *va_arg( args, bool* ) = false;
*pb_bool = false;
break; break;
/* */ /* */
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); *va_arg(args,int64_t *) = (int64_t)p_sys->i_cache*1000;
*pi_64 = (int64_t) p_sys->i_cache * 1000;
break; break;
/* */ /* */
......
...@@ -241,9 +241,6 @@ static void Close( vlc_object_t *p_this ) ...@@ -241,9 +241,6 @@ static void Close( vlc_object_t *p_this )
static int Control( access_t *p_access, int i_query, va_list args ) static int Control( access_t *p_access, int i_query, va_list args )
{ {
access_sys_t *p_sys = p_access->p_sys; access_sys_t *p_sys = p_access->p_sys;
bool *pb_bool;
int *pi_int;
int64_t *pi_64;
input_title_t ***ppp_title; input_title_t ***ppp_title;
int i; int i;
...@@ -254,14 +251,13 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -254,14 +251,13 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_CAN_FASTSEEK: case ACCESS_CAN_FASTSEEK:
case ACCESS_CAN_PAUSE: case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE: case ACCESS_CAN_CONTROL_PACE:
pb_bool = (bool*)va_arg( args, bool* ); *va_arg( args, bool* ) = true;
*pb_bool = true;
break; break;
/* */ /* */
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); *va_arg( args, int64_t * )
*pi_64 = (int64_t)var_GetInteger(p_access,"vcd-caching") * 1000; = (int64_t)var_GetInteger(p_access,"vcd-caching") * 1000;
break; break;
/* */ /* */
...@@ -269,11 +265,10 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -269,11 +265,10 @@ static int Control( access_t *p_access, int i_query, va_list args )
break; break;
case ACCESS_GET_TITLE_INFO: case ACCESS_GET_TITLE_INFO:
ppp_title = (input_title_t***)va_arg( args, input_title_t*** ); ppp_title = va_arg( args, input_title_t*** );
pi_int = (int*)va_arg( args, int* ); *va_arg( args, int* ) = p_sys->i_titles;
/* Duplicate title infos */ /* Duplicate title infos */
*pi_int = p_sys->i_titles;
*ppp_title = malloc( sizeof(input_title_t **) * p_sys->i_titles ); *ppp_title = malloc( sizeof(input_title_t **) * p_sys->i_titles );
for( i = 0; i < p_sys->i_titles; i++ ) for( i = 0; i < p_sys->i_titles; i++ )
{ {
...@@ -282,7 +277,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -282,7 +277,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
break; break;
case ACCESS_SET_TITLE: case ACCESS_SET_TITLE:
i = (int)va_arg( args, int ); i = va_arg( args, int );
if( i != p_access->info.i_title ) if( i != p_access->info.i_title )
{ {
/* Update info */ /* Update info */
...@@ -301,7 +296,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -301,7 +296,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_SET_SEEKPOINT: case ACCESS_SET_SEEKPOINT:
{ {
input_title_t *t = p_sys->title[p_access->info.i_title]; input_title_t *t = p_sys->title[p_access->info.i_title];
i = (int)va_arg( args, int ); i = va_arg( args, int );
if( t->i_seekpoint > 0 ) if( t->i_seekpoint > 0 )
{ {
p_access->info.i_update |= INPUT_UPDATE_SEEKPOINT; p_access->info.i_update |= INPUT_UPDATE_SEEKPOINT;
......
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