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

Avoid ?: GCC-ism

parent 1aa48d7e
......@@ -414,7 +414,8 @@ static int ScanParametersDvbC( access_t *p_access, scan_parameter_t *p_scan )
/* */
p_scan->frequency.i_min = p_frontend->info.frequency_min;
p_scan->frequency.i_max = p_frontend->info.frequency_max;
p_scan->frequency.i_step = p_frontend->info.frequency_stepsize ?: 166667;
p_scan->frequency.i_step = p_frontend->info.frequency_stepsize
? p_frontend->info.frequency_stepsize : 166667;
p_scan->frequency.i_count = (p_scan->frequency.i_max-p_scan->frequency.i_min)/p_scan->frequency.i_step;
/* */
......@@ -436,7 +437,8 @@ static int ScanParametersDvbT( access_t *p_access, scan_parameter_t *p_scan )
/* */
p_scan->frequency.i_min = p_frontend->info.frequency_min;
p_scan->frequency.i_max = p_frontend->info.frequency_max;
p_scan->frequency.i_step = p_frontend->info.frequency_stepsize ?: 166667;
p_scan->frequency.i_step = p_frontend->info.frequency_stepsize
? p_frontend->info.frequency_stepsize : 166667;
p_scan->frequency.i_count = (p_scan->frequency.i_max-p_scan->frequency.i_min)/p_scan->frequency.i_step;
/* */
......
......@@ -334,12 +334,14 @@ static int InOpen( vlc_object_t *p_this )
goto exit_error;
/* get size */
if( ftp_SendCommand( p_this, p_sys, "SIZE %s", p_sys->url.psz_path ? : "" ) < 0 ||
ftp_ReadCommand( p_this, p_sys, NULL, &psz_arg ) != 2 )
if( ftp_SendCommand( p_this, p_sys, "SIZE %s", p_sys->url.psz_path
? p_sys->url.psz_path : "" ) < 0
|| ftp_ReadCommand( p_this, p_sys, NULL, &psz_arg ) != 2 )
{
msg_Dbg( p_access, "cannot get file size" );
msg_Dbg( p_access, "will try to get directory contents" );
if( ftp_SendCommand( p_this, p_sys, "CWD %s", p_sys->url.psz_path ?: "" ) < 0 ||
if( ftp_SendCommand( p_this, p_sys, "CWD %s", p_sys->url.psz_path
? p_sys->url.psz_path : "" ) < 0 ||
ftp_ReadCommand( p_this, p_sys, NULL, &psz_arg ) != 2 )
{
msg_Err( p_access, "file or directory doesn't exist" );
......@@ -799,8 +801,8 @@ static int ftp_StartStream( vlc_object_t *p_access, access_sys_t *p_sys,
/* "1xx" message */
if( ftp_SendCommand( p_access, p_sys, "%s %s",
p_sys->out ? "STOR" : "RETR",
p_sys->url.psz_path ?: "" ) < 0 ||
ftp_ReadCommand( p_access, p_sys, &i_answer, NULL ) > 2 )
p_sys->url.psz_path ? p_sys->url.psz_path : "" ) < 0
|| ftp_ReadCommand( p_access, p_sys, &i_answer, NULL ) > 2 )
{
msg_Err( p_access, "cannot retrieve file" );
return VLC_EGENERIC;
......
......@@ -248,7 +248,7 @@ static int OpenWithCookies( vlc_object_t *p_this, vlc_array_t *cookies )
char *psz, *p;
/* Only forward an store cookies if the corresponding option is activated */
bool b_forward_cookies = var_CreateGetBool( p_access, "http-forward-cookies" );
vlc_array_t * saved_cookies = b_forward_cookies ? (cookies ?: vlc_array_new()) : NULL;
vlc_array_t * saved_cookies = b_forward_cookies ? (cookies ? cookies : vlc_array_new()) : NULL;
/* Set up p_access */
STANDARD_READ_ACCESS_INIT;
......@@ -1735,8 +1735,8 @@ static char *AuthDigest( access_t *p_access, vlc_url_t *p_url,
http_auth_t *p_auth, const char *psz_method )
{
(void)p_access;
const char *psz_username = p_url->psz_username ?: "";
const char *psz_password = p_url->psz_password ?: "";
const char *psz_username = p_url->psz_username ? p_url->psz_username : "";
const char *psz_password = p_url->psz_password ? p_url->psz_password : "";
char *psz_HA1 = NULL;
char *psz_HA2 = NULL;
......@@ -1843,8 +1843,8 @@ static void AuthReply( access_t *p_access, const char *psz_prefix,
access_sys_t *p_sys = p_access->p_sys;
v_socket_t *pvs = p_sys->p_vs;
const char *psz_username = p_url->psz_username ?: "";
const char *psz_password = p_url->psz_password ?: "";
const char *psz_username = p_url->psz_username ? p_url->psz_username : "";
const char *psz_password = p_url->psz_password ? p_url->psz_password : "";
if( p_auth->psz_nonce )
{
......@@ -1892,20 +1892,20 @@ static void AuthReply( access_t *p_access, const char *psz_prefix,
psz_username,
p_auth->psz_realm,
p_auth->psz_nonce,
p_url->psz_path ?: "/",
p_url->psz_path ? p_url->psz_path : "/",
psz_response,
/* Optional parameters */
p_auth->psz_algorithm ? "algorithm=\"" : "",
p_auth->psz_algorithm ?: "",
p_auth->psz_algorithm ? p_auth->psz_algorithm : "",
p_auth->psz_algorithm ? "\", " : "",
p_auth->psz_cnonce ? "cnonce=\"" : "",
p_auth->psz_cnonce ?: "",
p_auth->psz_cnonce ? p_auth->psz_cnonce : "",
p_auth->psz_cnonce ? "\", " : "",
p_auth->psz_opaque ? "opaque=\"" : "",
p_auth->psz_opaque ?: "",
p_auth->psz_opaque ? p_auth->psz_opaque : "",
p_auth->psz_opaque ? "\", " : "",
p_auth->psz_qop ? "qop=\"" : "",
p_auth->psz_qop ?: "",
p_auth->psz_qop ? p_auth->psz_qop : "",
p_auth->psz_qop ? "\", " : "",
p_auth->i_nonce ? "nc=\"" : "uglyhack=\"", /* Will be parsed as an unhandled extension */
p_auth->i_nonce,
......
......@@ -2958,7 +2958,8 @@ static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd )
if( controls[i].i_cid == queryctrl.id ) break;
name2var( queryctrl.name );
Control( p_obj, p_sys, i_fd,
controls[i].psz_name ? : (const char *)queryctrl.name,
controls[i].psz_name ? controls[i].psz_name
: (const char *)queryctrl.name,
queryctrl.id, queryctrl.default_value );
}
queryctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
......@@ -2988,7 +2989,8 @@ static int ControlReset( vlc_object_t *p_obj, demux_sys_t *p_sys, int i_fd )
if( controls[i].i_cid == queryctrl.id ) break;
name2var( queryctrl.name );
Control( p_obj, p_sys, i_fd,
controls[i].psz_name ? : (const char *)queryctrl.name,
controls[i].psz_name ? controls[i].psz_name
: (const char *)queryctrl.name,
queryctrl.id, queryctrl.default_value );
}
}
......
......@@ -1362,13 +1362,16 @@ static int CdTextParse( vlc_meta_t ***ppp_tracks, int *pi_tracks,
}
break;
case 0x01: /* Performer */
vlc_meta_SetArtist( p_track, psz_value ?: psz_default );
vlc_meta_SetArtist( p_track,
psz_value ? psz_value : psz_default );
break;
case 0x05: /* Messages */
vlc_meta_SetDescription( p_track, psz_value ?: psz_default );
vlc_meta_SetDescription( p_track,
psz_value ? psz_value : psz_default );
break;
case 0x07: /* Genre */
vlc_meta_SetGenre( p_track, psz_value ?: psz_default );
vlc_meta_SetGenre( p_track,
psz_value ? psz_value : psz_default );
break;
/* FIXME unsupported:
* 0x02: songwriter
......
......@@ -175,7 +175,7 @@ static int Open( vlc_object_t *p_this )
if (psz_parser[0] == '[')
psz_parser = strchr (psz_parser, ']');
psz_parser = strchr (psz_parser ?: psz_dst_addr, ':');
psz_parser = strchr (psz_parser ? psz_parser : psz_dst_addr, ':');
if (psz_parser != NULL)
{
*psz_parser++ = '\0';
......
......@@ -269,7 +269,8 @@ static int OpenDecoder( vlc_object_t *p_this )
{
psz_charset = strdup (p_dec->fmt_in.subs.psz_encoding);
msg_Dbg (p_dec, "trying demuxer-specified character encoding: %s",
p_dec->fmt_in.subs.psz_encoding ?: "not specified");
p_dec->fmt_in.subs.psz_encoding ?
p_dec->fmt_in.subs.psz_encoding : "not specified");
}
/* Second, try configured encoding */
......@@ -277,7 +278,7 @@ static int OpenDecoder( vlc_object_t *p_this )
{
psz_charset = var_CreateGetNonEmptyString (p_dec, "subsdec-encoding");
msg_Dbg (p_dec, "trying configured character encoding: %s",
psz_charset ?: "not specified");
psz_charset ? psz_charset : "not specified");
}
/* Third, try "local" encoding with optional UTF-8 autodetection */
......@@ -285,7 +286,7 @@ static int OpenDecoder( vlc_object_t *p_this )
{
psz_charset = strdup (GetFallbackEncoding ());
msg_Dbg (p_dec, "trying default character encoding: %s",
psz_charset ?: "not specified");
psz_charset ? psz_charset : "not specified");
if (var_CreateGetBool (p_dec, "subsdec-autodetect-utf8"))
{
......
......@@ -3217,7 +3217,8 @@ static void PMTSetupEsTeletext( demux_t *p_demux, ts_pid_t *pid,
ts_teletext_page_t *p_dst = &p_page[i_page++];
p_dst->i_type = p_src->i_teletext_type;
p_dst->i_magazine = p_src->i_teletext_magazine_number ? : 8;
p_dst->i_magazine = p_src->i_teletext_magazine_number
? p_src->i_teletext_magazine_number : 8;
p_dst->i_page = p_src->i_teletext_page_number;
memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 );
}
......@@ -3250,7 +3251,8 @@ static void PMTSetupEsTeletext( demux_t *p_demux, ts_pid_t *pid,
break;
}
/* FIXME check if it is the right split */
p_dst->i_magazine = (p_src->i_composition_page_id >> 8) ? : 8;
p_dst->i_magazine = (p_src->i_composition_page_id >> 8)
? (p_src->i_composition_page_id >> 8) : 8;
p_dst->i_page = p_src->i_composition_page_id & 0xff;
memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 );
}
......
......@@ -918,9 +918,11 @@ static const char *FindAttribute (const sdp_t *sdp, unsigned media,
const char *name)
{
/* Look for media attribute, and fallback to session */
return GetAttribute (sdp->mediav[media].pp_attributes,
sdp->mediav[media].i_attributes, name)
?: GetAttribute (sdp->pp_attributes, sdp->i_attributes, name);
const char *attr = GetAttribute (sdp->mediav[media].pp_attributes,
sdp->mediav[media].i_attributes, name);
if (attr == NULL)
attr = GetAttribute (sdp->pp_attributes, sdp->i_attributes, name);
return attr;
}
......
......@@ -1492,11 +1492,15 @@ static int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_t *id )
/* The dimensions will be set properly later on.
* Just put sensible values so we can test an encoder is available. */
id->p_encoder->fmt_in.video.i_width =
id->p_encoder->fmt_out.video.i_width ?:
id->p_decoder->fmt_in.video.i_width ?: 16;
id->p_encoder->fmt_out.video.i_width
? id->p_encoder->fmt_out.video.i_width
: id->p_decoder->fmt_in.video.i_width
? id->p_decoder->fmt_in.video.i_width : 16;
id->p_encoder->fmt_in.video.i_height =
id->p_encoder->fmt_out.video.i_height ?:
id->p_decoder->fmt_in.video.i_height ?: 16;
id->p_encoder->fmt_out.video.i_height
? id->p_encoder->fmt_out.video.i_height
: id->p_decoder->fmt_in.video.i_height
? id->p_decoder->fmt_in.video.i_height : 16;
id->p_encoder->fmt_in.video.i_frame_rate = ENC_FRAMERATE;
id->p_encoder->fmt_in.video.i_frame_rate_base = ENC_FRAMERATE_BASE;
......
......@@ -197,7 +197,8 @@ static int OpenPostproc( vlc_object_t *p_this )
var_AddCallback( p_filter, FILTER_PREFIX "name", PPNameCallback, NULL );
if( val_orig.i_int )
{
p_sys->pp_mode = pp_get_mode_by_name_and_quality( val.psz_string?:
p_sys->pp_mode = pp_get_mode_by_name_and_quality( val.psz_string ?
val.psz_string :
"default",
val_orig.i_int );
......@@ -328,7 +329,8 @@ static void PPChangeMode( filter_t *p_filter, const char *psz_name,
vlc_mutex_lock( &p_sys->lock );
if( i_quality > 0 )
{
pp_mode_t *pp_mode = pp_get_mode_by_name_and_quality( psz_name?:
pp_mode_t *pp_mode = pp_get_mode_by_name_and_quality( psz_name ?
psz_name :
"default",
i_quality );
if( pp_mode )
......
......@@ -1031,7 +1031,8 @@ static int Direct3DVoutCreatePictures( vout_thread_t *p_vout, size_t i_num_pics
HRESULT hr;
size_t c;
// if vout is already running, use current chroma, otherwise choose from upstream
int i_chroma = p_vout->output.i_chroma ? : p_vout->render.i_chroma;
int i_chroma = p_vout->output.i_chroma ? p_vout->output.i_chroma
: p_vout->render.i_chroma;
I_OUTPUTPICTURES = 0;
......
......@@ -344,7 +344,7 @@ static filter_t *filter_chain_AppendFilterInternal( filter_chain_t *p_chain,
vlc_array_append( &p_chain->filters, p_filter );
msg_Dbg( p_chain->p_this, "Filter '%s' (%p) appended to chain",
psz_name?:p_filter->psz_object_name, p_filter );
psz_name ? psz_name : p_filter->psz_object_name, p_filter );
return p_filter;
......
......@@ -68,7 +68,10 @@ static int CmpAddress( vlc_value_t v, vlc_value_t w ) { return v.p_address == w.
* Local duplication functions, and local deallocation functions
*****************************************************************************/
static void DupDummy( vlc_value_t *p_val ) { (void)p_val; /* unused */ }
static void DupString( vlc_value_t *p_val ) { p_val->psz_string = strdup( p_val->psz_string ?: ""); }
static void DupString( vlc_value_t *p_val )
{
p_val->psz_string = strdup( p_val->psz_string ? p_val->psz_string : "" );
}
static void DupList( vlc_value_t *p_val )
{
......@@ -1407,8 +1410,9 @@ static int InheritValue( vlc_object_t *p_this, const char *psz_name,
p_var->ops->pf_dup( p_val );
/*msg_Dbg( p_this, "Inherited value for var %s from object %s",
psz_name ? : "(null)",
p_this->psz_object_name ? : "(Unknown)" );*/
psz_name ? psz_name : "(null)",
p_this->psz_object_name
? p_this->psz_object_name : "(Unknown)" );*/
return VLC_SUCCESS;
}
else if ( p_this->p_parent ) /* We are still not there */
......
......@@ -292,7 +292,7 @@ const char *module_get_name( const module_t *m, bool long_name )
if( long_name && ( m->psz_longname != NULL) )
return m->psz_longname;
return m->psz_shortname ?: m->psz_object_name;
return m->psz_shortname ? m->psz_shortname : m->psz_object_name;
}
/**
......
......@@ -366,7 +366,7 @@ static size_t httpd_HtmlError (char **body, int code, const char *url)
"<a href=\"http://www.videolan.org\">VideoLAN</a>\n"
"</body>\n"
"</html>\n", errname, code, errname,
(url ? " (" : ""), (url ?: ""), (url ? ")" : ""));
(url ? " (" : ""), (url ? url : ""), (url ? ")" : ""));
if (res == -1)
{
......
......@@ -219,8 +219,8 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
net_Close (fd);
#if !defined(WIN32) && !defined(UNDER_CE)
fd = rootwrap_bind (ptr->ai_family, socktype,
protocol ?: ptr->ai_protocol, ptr->ai_addr,
ptr->ai_addrlen);
protocol ? protocol : ptr->ai_protocol,
ptr->ai_addr, ptr->ai_addrlen);
if (fd != -1)
{
msg_Dbg (p_this, "got socket %d from rootwrap", fd);
......
......@@ -153,8 +153,9 @@ int __net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
for( ptr = res; ptr != NULL; ptr = ptr->ai_next )
{
int fd = net_Socket( p_this, ptr->ai_family, type ?: ptr->ai_socktype,
proto ?: ptr->ai_protocol );
int fd = net_Socket( p_this, ptr->ai_family,
type ? type : ptr->ai_socktype,
proto ? proto : ptr->ai_protocol );
if( fd == -1 )
{
msg_Dbg( p_this, "socket error: %m" );
......
......@@ -151,7 +151,8 @@ static int net_ListenSingle (vlc_object_t *obj, const char *host, int port,
if (host && !*host)
host = NULL;
msg_Dbg (obj, "net: opening %s datagram port %d", host ?: "any", port);
msg_Dbg (obj, "net: opening %s datagram port %d",
host ? host : "any", port);
int val = vlc_getaddrinfo (obj, host, port, &hints, &res);
if (val)
......@@ -166,7 +167,7 @@ static int net_ListenSingle (vlc_object_t *obj, const char *host, int port,
for (const struct addrinfo *ptr = res; ptr != NULL; ptr = ptr->ai_next)
{
int fd = net_Socket (obj, ptr->ai_family, ptr->ai_socktype,
protocol ?: ptr->ai_protocol);
protocol ? protocol : ptr->ai_protocol);
if (fd == -1)
{
msg_Dbg (obj, "socket error: %m");
......@@ -662,7 +663,7 @@ int __net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
{
char *str;
int fd = net_Socket (p_this, ptr->ai_family, ptr->ai_socktype,
proto ?: ptr->ai_protocol);
proto ? proto : ptr->ai_protocol);
if (fd == -1)
continue;
......@@ -773,7 +774,7 @@ int __net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
for (struct addrinfo *ptr = loc; ptr != NULL; ptr = ptr->ai_next)
{
int fd = net_Socket (obj, ptr->ai_family, ptr->ai_socktype,
protocol ?: ptr->ai_protocol);
protocol ? protocol : ptr->ai_protocol);
if (fd == -1)
continue; // usually, address family not supported
......
......@@ -1927,7 +1927,8 @@ static int DeinterlaceCallback( vlc_object_t *p_this, char const *psz_cmd,
const deinterlace_mode_t *p_mode;
for( p_mode = &p_deinterlace_mode[0]; p_mode->psz_mode; p_mode++ )
{
if( !strcmp( p_mode->psz_mode, newval.psz_string ?: "" ) )
if( !strcmp( p_mode->psz_mode,
newval.psz_string ? newval.psz_string : "" ) )
break;
}
if( !p_mode->psz_mode )
......@@ -2023,7 +2024,7 @@ static void DeinterlaceEnable( vout_thread_t *p_vout )
else if( DeinterlaceIsPresent( p_vout, false ) )
psz_mode = var_CreateGetNonEmptyString( p_vout, "sout-deinterlace-mode" );
}
var_SetString( p_vout, "deinterlace", psz_mode ?: "" );
var_SetString( p_vout, "deinterlace", psz_mode ? psz_mode : "" );
free( psz_mode );
}
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