[vlc-devel] [PATCH 12/12] Workarounds for MSVC bugs.
Felix Abecassis
felix.abecassis at gmail.com
Fri Nov 29 17:43:13 CET 2013
This patch is not meant to be applied.
---
compat/setenv.c | 10 +++++---
include/vlc_charset.h | 9 +++++--
src/audio_output/dec.c | 5 ++-
src/audio_output/filters.c | 15 ++++++++----
src/audio_output/output.c | 3 +-
src/audio_output/volume.c | 6 +++-
src/config/chain.c | 2 +-
src/config/core.c | 3 +-
src/config/help.c | 6 +++-
src/extras/libc.c | 5 ++-
src/input/control.c | 3 +-
src/input/decoder.c | 9 +++++--
src/input/es_out.c | 41 ++++++++++++++++++++++------------
src/input/es_out_timeshift.c | 12 ++++++---
src/input/input.c | 41 +++++++++++++++++++---------------
src/input/meta.c | 3 +-
src/input/resource.c | 3 +-
src/input/stream.c | 5 ++-
src/input/stream_demux.c | 3 +-
src/input/vlm.c | 3 +-
src/input/vlmshell.c | 5 ++-
src/interface/dialog.c | 15 ++++++++----
src/interface/interface.c | 3 +-
src/misc/block.c | 12 ++++++---
src/misc/messages.c | 3 +-
src/misc/picture.c | 9 ++++---
src/misc/subpicture.c | 6 +++-
src/misc/text_style.c | 3 +-
src/misc/variables.c | 3 +-
src/network/httpd.c | 3 +-
src/network/io.c | 2 +-
src/network/tls.c | 3 +-
src/network/udp.c | 2 +-
src/os2/specific.c | 5 ++-
src/playlist/art.c | 3 +-
src/playlist/engine.c | 5 ++-
src/playlist/fetcher.c | 3 +-
src/playlist/item.c | 11 +++++----
src/playlist/loadsave.c | 5 ++-
src/playlist/search.c | 3 +-
src/playlist/services_discovery.c | 5 ++-
src/playlist/tree.c | 3 +-
src/stream_output/sap.c | 3 +-
src/stream_output/stream_output.c | 3 +-
src/text/filesystem.c | 3 +-
src/text/strings.c | 6 +++-
src/text/unicode.c | 8 ++++--
src/video_output/display.c | 21 ++++++++++-------
src/video_output/inhibit.c | 3 +-
src/video_output/snapshot.c | 5 ++-
src/video_output/video_epg.c | 3 +-
src/video_output/video_output.c | 23 ++++++++++++-------
src/video_output/video_text.c | 3 +-
src/video_output/video_widgets.c | 3 +-
src/video_output/vout_subpictures.c | 29 +++++++++++++++---------
src/video_output/window.c | 3 +-
src/win32/dirs.c | 6 +++-
src/win32/filesystem.c | 3 +-
src/win32/plugin.c | 3 +-
src/win32/thread.c | 8 ++++--
60 files changed, 272 insertions(+), 163 deletions(-)
diff --git a/compat/setenv.c b/compat/setenv.c
index e7b4aa5..59f3df5 100644
--- a/compat/setenv.c
+++ b/compat/setenv.c
@@ -28,15 +28,17 @@
int setenv (const char *name, const char *value, int override)
{
#ifdef HAVE_GETENV
- if (override == 0 && getenv (name) != NULL)
- return 0;
+ if (override == 0 && getenv(name) != NULL) {
+ return 0;
+ }
size_t namelen = strlen (name);
size_t valuelen = strlen (value);
char *var = malloc (namelen + valuelen + 2);
- if (var == NULL)
- return -1;
+ if (var == NULL) {
+ return -1;
+ }
sprintf (var, "%s=%s", name, value);
/* This leaks memory. This is unavoidable. */
diff --git a/include/vlc_charset.h b/include/vlc_charset.h
index 4de57ab..5a1eb5b 100644
--- a/include/vlc_charset.h
+++ b/include/vlc_charset.h
@@ -67,8 +67,9 @@ VLC_USED
static inline wchar_t *ToWide (const char *utf8)
{
int len = MultiByteToWideChar (CP_UTF8, 0, utf8, -1, NULL, 0);
- if (len == 0)
+ if (len == 0) {
return NULL;
+ }
wchar_t *out = (wchar_t *)malloc (len * sizeof (wchar_t));
@@ -81,8 +82,9 @@ VLC_USED VLC_MALLOC
static inline char *ToCodePage (unsigned cp, const char *utf8)
{
wchar_t *wide = ToWide (utf8);
- if (wide == NULL)
+ if (wide == NULL) {
return NULL;
+ }
size_t len = WideCharToMultiByte (cp, 0, wide, -1, NULL, 0, NULL, NULL);
if (len == 0)
@@ -99,8 +101,9 @@ VLC_USED VLC_MALLOC
static inline char *FromCodePage (unsigned cp, const char *mb)
{
int len = MultiByteToWideChar (cp, 0, mb, -1, NULL, 0);
- if (len == 0)
+ if (len == 0) {
return NULL;
+ }
wchar_t *wide = (wchar_t *)malloc (len * sizeof (wchar_t));
if (unlikely(wide == NULL))
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index 2dfcff0..1da0272 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -343,8 +343,9 @@ int aout_DecPlay (audio_output_t *aout, block_t *block, int input_rate)
/ owner->input_format.i_rate;
aout_OutputLock (aout);
- if (unlikely(aout_CheckReady (aout)))
- goto drop; /* Pipeline is unrecoverably broken :-( */
+ if (unlikely(aout_CheckReady(aout))) {
+ goto drop; /* Pipeline is unrecoverably broken :-( */
+ }
const mtime_t now = mdate (), advance = block->i_pts - now;
if (advance < -AOUT_MAX_PTS_DELAY)
diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 796da1f..a578c95 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -142,8 +142,9 @@ static int aout_FiltersPipelineCreate(vlc_object_t *obj, filter_t **filters,
/* Encapsulate or decode non-linear formats */
if (!AOUT_FMT_LINEAR(infmt) && infmt->i_format != outfmt->i_format)
{
- if (n == max)
+ if (n == max) {
goto overflow;
+ }
filter_t *f = TryFormat (obj, VLC_CODEC_S32N, &input);
if (f == NULL)
@@ -165,8 +166,9 @@ static int aout_FiltersPipelineCreate(vlc_object_t *obj, filter_t **filters,
{ /* Remixing currently requires FL32... TODO: S16N */
if (input.i_format != VLC_CODEC_FL32)
{
- if (n == max)
+ if (n == max) {
goto overflow;
+ }
filter_t *f = TryFormat (obj, VLC_CODEC_FL32, &input);
if (f == NULL)
@@ -179,8 +181,9 @@ static int aout_FiltersPipelineCreate(vlc_object_t *obj, filter_t **filters,
filters[n++] = f;
}
- if (n == max)
+ if (n == max) {
goto overflow;
+ }
audio_sample_format_t output;
output.i_format = input.i_format;
@@ -204,8 +207,9 @@ static int aout_FiltersPipelineCreate(vlc_object_t *obj, filter_t **filters,
/* Resample */
if (input.i_rate != outfmt->i_rate)
{ /* Resampling works with any linear format, but may be ugly. */
- if (n == max)
+ if (n == max) {
goto overflow;
+ }
audio_sample_format_t output = input;
output.i_rate = outfmt->i_rate;
@@ -225,8 +229,9 @@ static int aout_FiltersPipelineCreate(vlc_object_t *obj, filter_t **filters,
/* Format */
if (input.i_format != outfmt->i_format)
{
- if (max == 0)
+ if (max == 0) {
goto overflow;
+ }
filter_t *f = TryFormat (obj, outfmt->i_format, &input);
if (f == NULL)
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 18fee05..b3d4047 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -163,8 +163,9 @@ audio_output_t *aout_New (vlc_object_t *parent)
audio_output_t *aout = vlc_custom_create (parent, sizeof (aout_instance_t),
"audio output");
- if (unlikely(aout == NULL))
+ if (unlikely(aout == NULL)) {
return NULL;
+ }
aout_owner_t *owner = aout_owner (aout);
diff --git a/src/audio_output/volume.c b/src/audio_output/volume.c
index 57e8f33..8f08add 100644
--- a/src/audio_output/volume.c
+++ b/src/audio_output/volume.c
@@ -79,8 +79,9 @@ aout_volume_t *aout_volume_New(vlc_object_t *parent,
*/
int aout_volume_SetFormat(aout_volume_t *vol, vlc_fourcc_t format)
{
- if (unlikely(vol == NULL))
+ if (unlikely(vol == NULL)) {
return -1;
+ }
audio_volume_t *obj = &vol->object;
if (vol->module != NULL)
@@ -106,8 +107,9 @@ int aout_volume_SetFormat(aout_volume_t *vol, vlc_fourcc_t format)
*/
void aout_volume_Delete(aout_volume_t *vol)
{
- if (vol == NULL)
+ if (vol == NULL) {
return;
+ }
audio_volume_t *obj = &vol->object;
diff --git a/src/config/chain.c b/src/config/chain.c
index 03bbe44..f8116cb 100644
--- a/src/config/chain.c
+++ b/src/config/chain.c
@@ -269,7 +269,7 @@ void config_ChainDestroy( config_chain_t *p_cfg )
void config_ChainParse( vlc_object_t *p_this, const char *psz_prefix,
const char *const *ppsz_options, config_chain_t *cfg )
{
- if( psz_prefix == NULL ) psz_prefix = "";
+ if (psz_prefix == NULL) { psz_prefix = ""; }
size_t plen = 1 + strlen( psz_prefix );
/* First, var_Create all variables */
diff --git a/src/config/core.c b/src/config/core.c
index 9882c52..5d49aa0 100644
--- a/src/config/core.c
+++ b/src/config/core.c
@@ -551,8 +551,9 @@ module_config_t *config_FindConfig (vlc_object_t *p_this, const char *name)
{
VLC_UNUSED(p_this);
- if (unlikely(name == NULL))
+ if (unlikely(name == NULL)) {
return NULL;
+ }
module_config_t *const *p;
p = bsearch (name, config.list, config.count, sizeof (*p), confnamecmp);
diff --git a/src/config/help.c b/src/config/help.c
index 155dc50..09fdfb7 100644
--- a/src/config/help.c
+++ b/src/config/help.c
@@ -261,8 +261,9 @@ static void print_desc(const char *str, unsigned margin, bool color)
{
unsigned width = ConsoleWidth() - margin;
- if (color)
+ if (color) {
fputs(BLUE, stdout);
+ }
const char *word = str;
int wordlen = 0, wordwidth = 0;
@@ -483,8 +484,9 @@ static void print_item(const module_t *m, const module_config_t *item,
static bool module_match(const module_t *m, const char *pattern, bool strict)
{
- if (pattern == NULL)
+ if (pattern == NULL) {
return true;
+ }
const char *objname = module_get_object(m);
diff --git a/src/extras/libc.c b/src/extras/libc.c
index 3389c57..5e8cb3f 100644
--- a/src/extras/libc.c
+++ b/src/extras/libc.c
@@ -234,8 +234,9 @@ static size_t ISO6937toUTF8( const unsigned char **inbuf, size_t *inbytesleft,
{
- if( !inbuf || !(*inbuf) )
- return (size_t)(0); /* Reset state requested */
+ if (!inbuf || !(*inbuf)) {
+ return (size_t)(0); /* Reset state requested */
+ }
const unsigned char *iptr = *inbuf;
const unsigned char *iend = iptr + *inbytesleft;
diff --git a/src/input/control.c b/src/input/control.c
index a4b2842..3ea2934 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -450,8 +450,9 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
case INPUT_GET_AOUT:
{
audio_output_t *p_aout = input_resource_HoldAout( p_input->p->p_resource );
- if( !p_aout )
+ if (!p_aout) {
return VLC_EGENERIC;
+ }
audio_output_t **pp_aout = (audio_output_t**)va_arg( args, audio_output_t** );
*pp_aout = p_aout;
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 8da9777..c66a086 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -206,8 +206,9 @@ void decoder_UnlinkPicture( decoder_t *p_decoder, picture_t *p_picture )
block_t *decoder_NewAudioBuffer( decoder_t *dec, int samples )
{
- if( decoder_UpdateAudioFormat( dec ) )
+ if (decoder_UpdateAudioFormat(dec)) {
return NULL;
+ }
size_t length = samples * dec->fmt_out.audio.i_bytes_per_frame
/ dec->fmt_out.audio.i_frame_length;
@@ -1095,8 +1096,9 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t *pi_ts0, mtime_t *pi_ts1,
const mtime_t i_es_delay = p_owner->i_ts_delay;
- if( !p_clock )
+ if (!p_clock) {
return;
+ }
const bool b_ephemere = pi_ts1 && *pi_ts0 == *pi_ts1;
int i_rate;
@@ -2414,8 +2416,9 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
*/
for( ;; )
{
- if( DecoderIsExitRequested( p_dec ) || p_dec->b_error )
+ if (DecoderIsExitRequested(p_dec) || p_dec->b_error) {
return NULL;
+ }
picture_t *p_picture = vout_GetPicture( p_owner->p_vout );
if( p_picture )
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 97e6b65..e2f73f7 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -224,8 +224,9 @@ static inline bool EsFmtIsTeletext( const es_format_t *p_fmt )
es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
{
es_out_t *out = malloc( sizeof( *out ) );
- if( !out )
+ if (!out) {
return NULL;
+ }
es_out_sys_t *p_sys = calloc( 1, sizeof( *p_sys ) );
if( !p_sys )
@@ -607,12 +608,14 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
&i_stream_start, &i_system_start,
&i_stream_duration, &i_system_duration );
assert( !i_ret || b_forced );
- if( i_ret )
+ if (i_ret) {
return;
+ }
mtime_t i_preroll_duration = 0;
- if( p_sys->i_preroll_end >= 0 )
- i_preroll_duration = __MAX( p_sys->i_preroll_end - i_stream_start, 0 );
+ if (p_sys->i_preroll_end >= 0) {
+ i_preroll_duration = __MAX(p_sys->i_preroll_end - i_stream_start, 0);
+ }
const mtime_t i_buffering_duration = p_sys->i_pts_delay +
i_preroll_duration +
@@ -836,8 +839,9 @@ static mtime_t EsOutGetBuffering( es_out_t *out )
&i_stream_start, &i_system_start,
&i_stream_duration, &i_system_duration );
- if( i_ret )
+ if (i_ret) {
return 0;
+ }
mtime_t i_delay;
@@ -2500,8 +2504,9 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
{
const int i_id = va_arg( args, int );
es_out_id_t *p_es = EsOutGetFromID( out, i_id );
- if( !p_es )
+ if (!p_es) {
return VLC_EGENERIC;
+ }
vlc_object_t **pp_decoder = va_arg( args, vlc_object_t ** );
vout_thread_t **pp_vout = va_arg( args, vout_thread_t ** );
@@ -2644,12 +2649,14 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
case ES_OUT_GET_PCR_SYSTEM:
{
- if( p_sys->b_buffering )
+ if( p_sys->b_buffering ) {
return VLC_EGENERIC;
+ }
es_out_pgrm_t *p_pgrm = p_sys->p_pgrm;
- if( !p_pgrm )
+ if (!p_pgrm) {
return VLC_EGENERIC;
+ }
mtime_t *pi_system = va_arg( args, mtime_t *);
mtime_t *pi_delay = va_arg( args, mtime_t *);
@@ -2659,12 +2666,14 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
case ES_OUT_MODIFY_PCR_SYSTEM:
{
- if( p_sys->b_buffering )
+ if( p_sys->b_buffering ) {
return VLC_EGENERIC;
+ }
es_out_pgrm_t *p_pgrm = p_sys->p_pgrm;
- if( !p_pgrm )
+ if (!p_pgrm) {
return VLC_EGENERIC;
+ }
const bool b_absolute = va_arg( args, int );
const mtime_t i_system = va_arg( args, mtime_t );
@@ -2859,8 +2868,9 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
char psz_cat[128];
snprintf( psz_cat, sizeof(psz_cat),_("Stream %d"), es->i_meta_id );
info_category_t *p_cat = info_category_New( psz_cat );
- if( !p_cat )
- return;
+ if (!p_cat) {
+ return;
+ }
/* Add information */
const char *psz_type;
@@ -2883,9 +2893,10 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
if( psz_type )
info_category_AddInfo( p_cat, _("Type"), "%s", psz_type );
- if( es->i_meta_id != es->i_id )
- info_category_AddInfo( p_cat, _("Original ID"),
- "%d", es->i_id );
+ if (es->i_meta_id != es->i_id) {
+ info_category_AddInfo(p_cat, _("Original ID"),
+ "%d", es->i_id);
+ }
const char *psz_codec_description =
vlc_fourcc_GetDescription( p_fmt_es->i_cat, p_fmt_es->i_codec );
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 0864efb..1c4d856 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -292,8 +292,9 @@ static FILE *GetTmpFile( char **ppsz_file, const char *psz_path );
es_out_t *input_EsOutTimeshiftNew( input_thread_t *p_input, es_out_t *p_next_out, int i_rate )
{
es_out_t *p_out = malloc( sizeof(*p_out) );
- if( !p_out )
+ if (!p_out) {
return NULL;
+ }
es_out_sys_t *p_sys = malloc( sizeof(*p_sys) );
if( !p_sys )
@@ -676,8 +677,9 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
}
case ES_OUT_GET_PCR_SYSTEM:
{
- if( p_sys->b_delayed )
+ if( p_sys->b_delayed ) {
return VLC_EGENERIC;
+ }
mtime_t *pi_system = (mtime_t*)va_arg( args, mtime_t * );
mtime_t *pi_delay = (mtime_t*)va_arg( args, mtime_t * );
@@ -688,8 +690,9 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
const bool b_absolute = va_arg( args, int );
const mtime_t i_system = va_arg( args, mtime_t );
- if( b_absolute && p_sys->b_delayed )
+ if (b_absolute && p_sys->b_delayed) {
return VLC_EGENERIC;
+ }
return es_out_ControlModifyPcrSystem( p_sys->p_out, b_absolute, i_system );
}
@@ -1335,8 +1338,9 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co
case ES_OUT_SET_META: /* arg1=const vlc_meta_t* */
case ES_OUT_SET_GROUP_META: /* arg1=int i_group arg2=const vlc_meta_t* */
{
- if( i_query == ES_OUT_SET_GROUP_META )
+ if( i_query == ES_OUT_SET_GROUP_META ) {
p_cmd->u.control.u.int_meta.i_int = (int)va_arg( args, int );
+ }
const vlc_meta_t *p_meta = va_arg( args, const vlc_meta_t * );
if( b_copy )
diff --git a/src/input/input.c b/src/input/input.c
index e39c1a4..7589120 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -596,8 +596,9 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, bool *pb_d
static int MainLoopTryRepeat( input_thread_t *p_input, mtime_t *pi_start_mdate )
{
int i_repeat = var_GetInteger( p_input, "input-repeat" );
- if( i_repeat == 0 )
+ if( i_repeat == 0 ) {
return VLC_EGENERIC;
+ }
vlc_value_t val;
@@ -1085,24 +1086,26 @@ static void LoadSlaves( input_thread_t *p_input )
free( psz_org );
}
-static void UpdatePtsDelay( input_thread_t *p_input )
+static void UpdatePtsDelay(input_thread_t *p_input)
{
- input_thread_private_t *p_sys = p_input->p;
+ input_thread_private_t *p_sys = p_input->p;
- /* Get max pts delay from input source */
- mtime_t i_pts_delay = p_sys->input.i_pts_delay;
- for( int i = 0; i < p_sys->i_slave; i++ )
- i_pts_delay = __MAX( i_pts_delay, p_sys->slave[i]->i_pts_delay );
+ /* Get max pts delay from input source */
+ mtime_t i_pts_delay = p_sys->input.i_pts_delay;
+ for (int i = 0; i < p_sys->i_slave; i++)
+ i_pts_delay = __MAX(i_pts_delay, p_sys->slave[i]->i_pts_delay);
- if( i_pts_delay < 0 )
- i_pts_delay = 0;
+ if (i_pts_delay < 0) {
+ i_pts_delay = 0;
+ }
- /* Take care of audio/spu delay */
- const mtime_t i_audio_delay = var_GetTime( p_input, "audio-delay" );
- const mtime_t i_spu_delay = var_GetTime( p_input, "spu-delay" );
- const mtime_t i_extra_delay = __MIN( i_audio_delay, i_spu_delay );
- if( i_extra_delay < 0 )
- i_pts_delay -= i_extra_delay;
+ /* Take care of audio/spu delay */
+ const mtime_t i_audio_delay = var_GetTime(p_input, "audio-delay");
+ const mtime_t i_spu_delay = var_GetTime(p_input, "spu-delay");
+ const mtime_t i_extra_delay = __MIN(i_audio_delay, i_spu_delay);
+ if (i_extra_delay < 0) {
+ i_pts_delay -= i_extra_delay;
+ }
/* Update cr_average depending on the caching */
const int i_cr_average = var_GetInteger( p_input, "cr-average" ) * i_pts_delay / DEFAULT_PTS_DELAY;
@@ -2552,8 +2555,9 @@ static void InputSourceMeta( input_thread_t *p_input,
/* If the demux report unsupported meta data, or if we don't have meta data
* try an external "meta reader" */
- if( has_meta && !has_unsupported )
+ if (has_meta && !has_unsupported) {
return;
+ }
demux_meta_t *p_demux_meta =
vlc_custom_create( p_demux, sizeof( *p_demux_meta ), "demux meta" );
@@ -2822,8 +2826,9 @@ static void InputGetExtraFiles( input_thread_t *p_input,
TAB_INIT( *pi_list, *pppsz_list );
- if( ( psz_access && *psz_access && strcmp( psz_access, "file" ) ) || !psz_path )
- return;
+ if ((psz_access && *psz_access && strcmp(psz_access, "file")) || !psz_path) {
+ return;
+ }
const size_t i_path = strlen(psz_path);
diff --git a/src/input/meta.c b/src/input/meta.c
index 6234719..b27c50a 100644
--- a/src/input/meta.c
+++ b/src/input/meta.c
@@ -280,8 +280,9 @@ int input_item_WriteMeta( vlc_object_t *obj, input_item_t *p_item )
if( p_export->psz_file == NULL )
msg_Err( p_export, "cannot write meta to remote media %s", psz_uri );
free( psz_uri );
- if( p_export->psz_file == NULL )
+ if (p_export->psz_file == NULL) {
goto error;
+ }
module_t *p_mod = module_need( p_export, "meta writer", NULL, false );
if( p_mod )
diff --git a/src/input/resource.c b/src/input/resource.c
index f3a82dd..9629105 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -150,8 +150,9 @@ static void DestroyVout( input_resource_t *p_resource )
static void DisplayVoutTitle( input_resource_t *p_resource,
vout_thread_t *p_vout )
{
- if( p_resource->p_input == NULL )
+ if (p_resource->p_input == NULL) {
return;
+ }
/* TODO display the title only one time for the same input ? */
diff --git a/src/input/stream.c b/src/input/stream.c
index d5cbf06..ca28eca 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -1898,7 +1898,7 @@ int stream_Control( stream_t *s, int i_query, ... )
*/
block_t *stream_Block( stream_t *s, int i_size )
{
- if( i_size <= 0 ) return NULL;
+ if (i_size <= 0) { return NULL; }
/* emulate block read */
block_t *p_bk = block_Alloc( i_size );
@@ -1936,8 +1936,9 @@ block_t *stream_BlockRemaining( stream_t *s, int i_max_size )
}
i_allocate = i_size - i_position;
}
- if( i_allocate <= 0 )
+ if (i_allocate <= 0) {
return NULL;
+ }
block_t *p_block = block_Alloc( i_allocate );
int i_index = 0;
diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c
index 3516d79..6b88804 100644
--- a/src/input/stream_demux.c
+++ b/src/input/stream_demux.c
@@ -282,8 +282,9 @@ static int DStreamControl( stream_t *s, int i_query, va_list args )
case STREAM_SET_POSITION:
{
uint64_t i64 = va_arg( args, uint64_t );
- if( i64 < p_sys->i_pos )
+ if( i64 < p_sys->i_pos ) {
return VLC_EGENERIC;
+ }
uint64_t i_skip = i64 - p_sys->i_pos;
while( i_skip > 0 )
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 5c78179..e9972c9 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -635,8 +635,9 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
input_item_AddOption( p_media->vod.p_item,
p_cfg->ppsz_option[i], VLC_INPUT_OPTION_TRUSTED );
- if( asprintf( &psz_header, _("Media: %s"), p_cfg->psz_name ) == -1 )
+ if( asprintf( &psz_header, _("Media: %s"), p_cfg->psz_name ) == -1 ) {
psz_header = NULL;
+ }
sout_description_data_t data;
TAB_INIT(data.i_es, data.es);
diff --git a/src/input/vlmshell.c b/src/input/vlmshell.c
index 97edd90..97952a5 100644
--- a/src/input/vlmshell.c
+++ b/src/input/vlmshell.c
@@ -967,8 +967,9 @@ vlm_media_sys_t *vlm_MediaSearch( vlm_t *vlm, const char *psz_name )
*****************************************************************************/
static vlm_schedule_sys_t *vlm_ScheduleNew( vlm_t *vlm, const char *psz_name )
{
- if( !psz_name )
+ if( !psz_name ) {
return NULL;
+ }
vlm_schedule_sys_t *p_sched = malloc( sizeof( vlm_schedule_sys_t ) );
if( !p_sched )
@@ -1210,7 +1211,7 @@ static int vlm_ScheduleSetup( vlm_schedule_sys_t *schedule, const char *psz_cmd,
*****************************************************************************/
vlm_message_t *vlm_MessageSimpleNew( const char *psz_name )
{
- if( !psz_name ) return NULL;
+ if( !psz_name ) { return NULL; }
vlm_message_t *p_message = malloc( sizeof(*p_message) );
if( !p_message )
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index a1b8d3b..a5ad590 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -107,8 +107,9 @@ void dialog_VFatal (vlc_object_t *obj, bool modal, const char *title,
{
char *text;
- if (obj->i_flags & OBJECT_FLAGS_NOINTERACT)
+ if (obj->i_flags & OBJECT_FLAGS_NOINTERACT) {
return;
+ }
vlc_object_t *provider = dialog_GetProvider (obj);
if (provider == NULL)
@@ -147,8 +148,9 @@ void dialog_Login (vlc_object_t *obj, char **username, char **password,
assert ((username != NULL) && (password != NULL));
*username = *password = NULL;
- if (obj->i_flags & OBJECT_FLAGS_NOINTERACT)
+ if (obj->i_flags & OBJECT_FLAGS_NOINTERACT) {
return;
+ }
vlc_object_t *provider = dialog_GetProvider (obj);
if (provider == NULL)
@@ -184,8 +186,9 @@ void dialog_Login (vlc_object_t *obj, char **username, char **password,
int dialog_Question (vlc_object_t *obj, const char *title, const char *fmt,
const char *yes, const char *no, const char *cancel, ...)
{
- if (obj->i_flags & OBJECT_FLAGS_NOINTERACT)
+ if (obj->i_flags & OBJECT_FLAGS_NOINTERACT) {
return 0;
+ }
vlc_object_t *provider = dialog_GetProvider (obj);
if (provider == NULL)
@@ -215,12 +218,14 @@ dialog_progress_bar_t *
dialog_ProgressCreate (vlc_object_t *obj, const char *title,
const char *message, const char *cancel)
{
- if (obj->i_flags & OBJECT_FLAGS_NOINTERACT)
+ if (obj->i_flags & OBJECT_FLAGS_NOINTERACT) {
return NULL;
+ }
vlc_object_t *provider = dialog_GetProvider (obj);
- if (provider == NULL)
+ if (provider == NULL) {
return NULL;
+ }
dialog_progress_bar_t *dialog = malloc (sizeof (*dialog));
if (dialog != NULL)
diff --git a/src/interface/interface.c b/src/interface/interface.c
index 2350538..05ac990 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -71,8 +71,9 @@ int intf_Create( vlc_object_t *p_this, const char *chain )
/* Allocate structure */
p_intf = vlc_custom_create( p_libvlc, sizeof( *p_intf ), "interface" );
- if( !p_intf )
+ if( !p_intf ) {
return VLC_ENOMEM;
+ }
/* Variable used for interface spawning */
vlc_value_t val, text;
diff --git a/src/misc/block.c b/src/misc/block.c
index a7dfed9..137786c 100644
--- a/src/misc/block.c
+++ b/src/misc/block.c
@@ -133,8 +133,9 @@ block_t *block_Alloc (size_t size)
/* 2 * BLOCK_PADDING: pre + post padding */
const size_t alloc = sizeof (block_t) + BLOCK_ALIGN + (2 * BLOCK_PADDING)
+ size;
- if (unlikely(alloc <= size))
+ if (unlikely(alloc <= size)) {
return NULL;
+ }
block_t *b = malloc (alloc);
if (unlikely(b == NULL))
@@ -201,8 +202,9 @@ block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
}
/* Trim payload end */
- if( p_block->i_buffer > i_body )
+ if (p_block->i_buffer > i_body) {
p_block->i_buffer = i_body;
+ }
uint8_t *p_start = p_block->p_start;
uint8_t *p_end = p_start + p_block->i_size;
@@ -396,8 +398,9 @@ static
ssize_t pread (int fd, void *buf, size_t count, off_t offset)
{
HANDLE handle = (HANDLE)(intptr_t)_get_osfhandle (fd);
- if (handle == INVALID_HANDLE_VALUE)
+ if (handle == INVALID_HANDLE_VALUE) {
return -1;
+ }
OVERLAPPED olap; olap.Offset = offset; olap.OffsetHigh = (offset >> 32);
DWORD written;
@@ -496,8 +499,9 @@ block_t *block_File (int fd)
block_t *block_FilePath (const char *path)
{
int fd = vlc_open (path, O_RDONLY);
- if (fd == -1)
+ if (fd == -1) {
return NULL;
+ }
block_t *block = block_File (fd);
close (fd);
diff --git a/src/misc/messages.c b/src/misc/messages.c
index 1c2a489..5deee3b 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -263,8 +263,9 @@ static void Win32DebugOutputMsg (void* d, int type, const vlc_log_t *p_item,
VLC_UNUSED(p_item);
const signed char *pverbose = d;
- if (pverbose && (*pverbose < 0 || *pverbose < (type - VLC_MSG_ERR)))
+ if (pverbose && (*pverbose < 0 || *pverbose < (type - VLC_MSG_ERR))) {
return;
+ }
va_list dol2;
va_copy (dol2, dol);
diff --git a/src/misc/picture.c b/src/misc/picture.c
index 3e1fb68..19b6d5c 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -203,11 +203,12 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r
video_format_Setup( &fmt, p_fmt->i_chroma,
p_fmt->i_width, p_fmt->i_height,
p_fmt->i_sar_num, p_fmt->i_sar_den );
- if( p_fmt->i_x_offset < p_fmt->i_width &&
+ if (p_fmt->i_x_offset < p_fmt->i_width &&
p_fmt->i_y_offset < p_fmt->i_height &&
- p_fmt->i_visible_width > 0 && p_fmt->i_x_offset + p_fmt->i_visible_width <= p_fmt->i_width &&
- p_fmt->i_visible_height > 0 && p_fmt->i_y_offset + p_fmt->i_visible_height <= p_fmt->i_height )
- video_format_CopyCrop( &fmt, p_fmt );
+ p_fmt->i_visible_width > 0 && p_fmt->i_x_offset + p_fmt->i_visible_width <= p_fmt->i_width &&
+ p_fmt->i_visible_height > 0 && p_fmt->i_y_offset + p_fmt->i_visible_height <= p_fmt->i_height) {
+ video_format_CopyCrop(&fmt, p_fmt);
+ }
/* */
picture_t *p_picture = calloc( 1, sizeof(*p_picture) );
diff --git a/src/misc/subpicture.c b/src/misc/subpicture.c
index 9e2fbb7..ff22433 100644
--- a/src/misc/subpicture.c
+++ b/src/misc/subpicture.c
@@ -105,15 +105,17 @@ subpicture_t *subpicture_NewFromPicture( vlc_object_t *p_obj,
/* */
image_handler_t *p_image = image_HandlerCreate( p_obj );
- if( !p_image )
+ if (!p_image) {
return NULL;
+ }
picture_t *p_pip = image_Convert( p_image, p_picture, &fmt_in, &fmt_out );
image_HandlerDelete( p_image );
- if( !p_pip )
+ if( !p_pip ) {
return NULL;
+ }
subpicture_t *p_subpic = subpicture_New( NULL );
if( !p_subpic )
diff --git a/src/misc/text_style.c b/src/misc/text_style.c
index 2763a25..06184a9 100644
--- a/src/misc/text_style.c
+++ b/src/misc/text_style.c
@@ -76,8 +76,9 @@ text_style_t *text_style_Copy( text_style_t *p_dst, const text_style_t *p_src )
text_style_t *text_style_Duplicate( const text_style_t *p_src )
{
- if( !p_src )
+ if( !p_src ) {
return NULL;
+ }
text_style_t *p_dst = calloc( 1, sizeof(*p_dst) );
if( p_dst )
diff --git a/src/misc/variables.c b/src/misc/variables.c
index e3d56b7..34cfa82 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -1302,8 +1302,9 @@ static int TriggerCallback( vlc_object_t *p_this, variable_t *p_var,
assert( p_this );
int i_entries = p_var->i_entries;
- if( i_entries == 0 )
+ if (i_entries == 0) {
return VLC_SUCCESS;
+ }
callback_entry_t *p_entries = p_var->p_entries;
vlc_object_internals_t *p_priv = vlc_internals( p_this );
diff --git a/src/network/httpd.c b/src/network/httpd.c
index 8f25266..36dbcd2 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -451,8 +451,9 @@ httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
/* We do it ourselves, thanks */
answer->i_status = 0;
- if( httpd_ClientIP( cl, psz_remote_addr, NULL ) == NULL )
+ if( httpd_ClientIP(cl, psz_remote_addr, NULL) == NULL ) {
*psz_remote_addr = '\0';
+ }
uint8_t *psz_args = query->psz_args;
handler->pf_fill( handler->p_sys, handler, query->psz_url, psz_args,
diff --git a/src/network/io.c b/src/network/io.c
index 8a72aea..0114e11 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -163,7 +163,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
}
/* Bind the socket */
-#if defined (_WIN32)
+#if defined (_WIN32) && !defined(_MSC_VER)
/*
* Under Win32 and for multicasting, we bind to INADDR_ANY.
* This is of course a severe bug, since the socket would logically
diff --git a/src/network/tls.c b/src/network/tls.c
index 8874e70..871867d 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -205,8 +205,9 @@ vlc_tls_t *vlc_tls_ClientSessionCreate (vlc_tls_creds_t *crd, int fd,
const char *host, const char *service)
{
vlc_tls_t *session = vlc_tls_SessionCreate (crd, fd, host);
- if (session == NULL)
+ if (session == NULL) {
return NULL;
+ }
mtime_t deadline = mdate ();
deadline += var_InheritInteger (crd, "ipv4-timeout") * 1000;
diff --git a/src/network/udp.c b/src/network/udp.c
index c02da8c..7085708 100644
--- a/src/network/udp.c
+++ b/src/network/udp.c
@@ -96,7 +96,7 @@ static int net_SetupDgramSocket (vlc_object_t *p_obj, int fd,
setsockopt (fd, SOL_SOCKET, SO_REUSEPORT, &(int){ 1 }, sizeof (int));
#endif
-#if defined (_WIN32)
+#if defined (_WIN32) && !defined(_MSC_VER)
if (net_SockAddrIsMulticast (ptr->ai_addr, ptr->ai_addrlen)
&& (sizeof (struct sockaddr_storage) >= ptr->ai_addrlen))
{
diff --git a/src/os2/specific.c b/src/os2/specific.c
index c76f52e..28dd621 100644
--- a/src/os2/specific.c
+++ b/src/os2/specific.c
@@ -224,8 +224,9 @@ void system_Configure( libvlc_int_t *p_this, int i_argc, const char *const ppsz_
else
mrl = vlc_path2uri( ppsz_argv[ i_opt ], NULL );
- if( !mrl )
- mrl = ( char * )ppsz_argv[ i_opt ];
+ if( !mrl ) {
+ mrl = (char *) ppsz_argv[i_opt];
+ }
size_t i_len = strlen( mrl ) + 1;
diff --git a/src/playlist/art.c b/src/playlist/art.c
index b99bdaa..7eca474 100644
--- a/src/playlist/art.c
+++ b/src/playlist/art.c
@@ -163,8 +163,9 @@ int playlist_FindArtInCache( input_item_t *p_item )
{
char *psz_path = ArtCachePath( p_item );
- if( !psz_path )
+ if (!psz_path) {
return VLC_EGENERIC;
+ }
/* Check if file exists */
DIR *p_dir = vlc_opendir( psz_path );
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 8207c79..1602ad3 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -258,7 +258,7 @@ static playlist_t *playlist_Create( vlc_object_t *p_parent )
PL_UNLOCK;
- if( !p_playlist->p_playing ) return NULL;
+ if (!p_playlist->p_playing) { return NULL; }
/* Create media library node */
const bool b_ml = var_InheritBool( p_parent, "media-library");
@@ -298,8 +298,9 @@ static playlist_t *playlist_Create( vlc_object_t *p_parent )
/* Input resources */
p->p_input_resource = input_resource_New( VLC_OBJECT( p_playlist ) );
- if( unlikely(p->p_input_resource == NULL) )
+ if (unlikely(p->p_input_resource == NULL)) {
abort();
+ }
/* Audio output (needed for volume and device controls). */
audio_output_t *aout = input_resource_GetAout( p->p_input_resource );
diff --git a/src/playlist/fetcher.c b/src/playlist/fetcher.c
index f682c8e..0666e13 100644
--- a/src/playlist/fetcher.c
+++ b/src/playlist/fetcher.c
@@ -283,8 +283,9 @@ static int DownloadArt( playlist_fetcher_t *p_fetcher, input_item_t *p_item )
}
stream_t *p_stream = stream_UrlNew( p_fetcher->object, psz_arturl );
- if( !p_stream )
+ if( !p_stream ) {
goto error;
+ }
uint8_t *p_data = NULL;
int i_data = 0;
diff --git a/src/playlist/item.c b/src/playlist/item.c
index e902063..5a77be1 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -635,7 +635,7 @@ int playlist_TreeMove( playlist_t * p_playlist, playlist_item_t *p_item,
{
PL_ASSERT_LOCKED;
- if( p_node->i_children == -1 ) return VLC_EGENERIC;
+ if( p_node->i_children == -1 ) { return VLC_EGENERIC; }
playlist_item_t *p_detach = p_item->p_parent;
int i_index = ItemIndex( p_item );
@@ -710,8 +710,9 @@ void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
PL_ASSERT_LOCKED;
p_sys->b_reset_currently_playing = true;
- if( b_signal )
- vlc_cond_signal( &p_sys->signal );
+ if (b_signal) {
+ vlc_cond_signal(&p_sys->signal);
+ }
playlist_add_t add;
add.i_item = i_item_id;
@@ -877,14 +878,14 @@ static int RecursiveInsertCopy (
PL_ASSERT_LOCKED;
assert( p_parent != NULL && p_item != NULL );
- if( p_item == p_parent ) return i_pos;
+ if (p_item == p_parent) { return i_pos; }
input_item_t *p_input = p_item->p_input;
if( !(p_item->i_children != -1 && b_flat) )
{
input_item_t *p_new_input = input_item_Copy( p_input );
- if( !p_new_input ) return i_pos;
+ if( !p_new_input ) { return i_pos; }
playlist_item_t *p_new_item = NULL;
if( p_item->i_children == -1 )
diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index 1271b30..6d6c1a5 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -40,7 +40,7 @@
int playlist_Export( playlist_t * p_playlist, const char *psz_filename,
playlist_item_t *p_export_root, const char *psz_type )
{
- if( p_export_root == NULL ) return VLC_EGENERIC;
+ if( p_export_root == NULL ) { return VLC_EGENERIC; }
playlist_export_t *p_export =
vlc_custom_create( p_playlist, sizeof( *p_export ), "playlist export" );
@@ -143,8 +143,9 @@ int playlist_MLLoad( playlist_t *p_playlist )
char *psz_uri = vlc_path2uri( psz_file, "file/xspf-open" );
free( psz_file );
- if( psz_uri == NULL )
+ if( psz_uri == NULL ) {
return VLC_ENOMEM;
+ }
const char *const options[1] = { "meta-file", };
/* that option has to be cleaned in input_item_subitem_tree_added() */
diff --git a/src/playlist/search.c b/src/playlist/search.c
index 0c711ca..26eb882 100644
--- a/src/playlist/search.c
+++ b/src/playlist/search.c
@@ -131,8 +131,9 @@ static bool playlist_LiveSearchUpdateInternal( playlist_item_t *p_root,
{
// Use Title or fall back to psz_name
const char *psz_title = vlc_meta_Get( p_item->p_input->p_meta, vlc_meta_Title );
- if( !psz_title )
+ if( !psz_title ) {
psz_title = p_item->p_input->psz_name;
+ }
const char *psz_album = vlc_meta_Get( p_item->p_input->p_meta, vlc_meta_Album );
const char *psz_artist = vlc_meta_Get( p_item->p_input->p_meta, vlc_meta_Artist );
b_enable = ( psz_title && vlc_strcasestr( psz_title, psz_string ) ) ||
diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
index e413f9b..96a96e1 100644
--- a/src/playlist/services_discovery.c
+++ b/src/playlist/services_discovery.c
@@ -324,7 +324,7 @@ static void playlist_sd_item_removeall( const vlc_event_t * p_event, void * user
{
VLC_UNUSED(p_event);
playlist_item_t* p_sd_node = user_data;
- if( p_sd_node == NULL ) return;
+ if( p_sd_node == NULL ) { return; }
playlist_t* p_playlist = p_sd_node->p_playlist;
PL_LOCK;
playlist_NodeEmpty( p_playlist, p_sd_node, true );
@@ -339,8 +339,9 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist,
msg_Dbg( p_playlist, "adding services_discovery %s...", psz_name );
p_sd = vlc_sd_Create( VLC_OBJECT(p_playlist), psz_name );
- if( !p_sd )
+ if( !p_sd ) {
return VLC_ENOMEM;
+ }
/* Free in playlist_ServicesDiscoveryRemove */
vlc_sd_internal_t * p_sds = malloc( sizeof(*p_sds) );
diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index eca12b1..d0f7c10 100644
--- a/src/playlist/tree.c
+++ b/src/playlist/tree.c
@@ -395,8 +395,9 @@ playlist_item_t *GetNextItem( playlist_t *p_playlist,
}
/* Node with children, get the first one */
- if( p_item->i_children > 0 )
+ if( p_item->i_children > 0 ) {
return p_item->pp_children[0];
+ }
playlist_item_t* p_parent = p_item->p_parent;
for( int i = 0 ; i < p_parent->i_children ; i++ )
diff --git a/src/stream_output/sap.c b/src/stream_output/sap.c
index a9eb65b..7226826 100644
--- a/src/stream_output/sap.c
+++ b/src/stream_output/sap.c
@@ -122,8 +122,9 @@ void SAP_Destroy (sap_handler_t *p_sap)
static sap_address_t *AddressCreate (vlc_object_t *obj, const char *group)
{
int fd = net_ConnectUDP (obj, group, IPPORT_SAP, 255);
- if (fd == -1)
+ if( fd == -1 ) {
return NULL;
+ }
sap_address_t *addr = malloc (sizeof (*addr));
if (addr == NULL)
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 3f653f1..f78a330 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -817,8 +817,9 @@ sout_stream_t *sout_StreamChainNew(sout_instance_t *p_sout, char *psz_chain,
}
char *psz_parser = strdup(psz_chain);
- if(!psz_parser)
+ if(!psz_parser) {
return NULL;
+ }
vlc_array_t cfg, name;
vlc_array_init(&cfg);
diff --git a/src/text/filesystem.c b/src/text/filesystem.c
index f3eb1d7..e9873c8 100644
--- a/src/text/filesystem.c
+++ b/src/text/filesystem.c
@@ -91,8 +91,9 @@ FILE *vlc_fopen (const char *filename, const char *mode)
}
int fd = vlc_open (filename, rwflags | oflags, 0666);
- if (fd == -1)
+ if (fd == -1) {
return NULL;
+ }
FILE *stream = fdopen (fd, mode);
if (stream == NULL)
diff --git a/src/text/strings.c b/src/text/strings.c
index 7d5651e..dfc7b69 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -292,8 +292,9 @@ char *convert_xml_special_chars (const char *str)
const size_t len = strlen (str);
char *const buf = malloc (6 * len + 1), *ptr = buf;
- if (unlikely(buf == NULL))
+ if( unlikely(buf == NULL) ) {
return NULL;
+ }
size_t n;
uint32_t cp;
@@ -483,8 +484,9 @@ char *str_format_time( const char *tformat )
for (size_t buflen = strlen (tformat) + 32;; buflen += 32)
{
char *str = malloc (buflen);
- if (str == NULL)
+ if( str == NULL ) {
return NULL;
+ }
size_t len = strftime (str, buflen, tformat, &loctime);
if (len > 0)
diff --git a/src/text/unicode.c b/src/text/unicode.c
index 25215d7..43fb564 100644
--- a/src/text/unicode.c
+++ b/src/text/unicode.c
@@ -56,8 +56,9 @@ int utf8_vfprintf( FILE *stream, const char *fmt, va_list ap )
#else
char *str;
int res = vasprintf (&str, fmt, ap);
- if (unlikely(res == -1))
- return -1;
+ if (unlikely(res == -1)) {
+ return -1;
+ }
#if !VLC_WINSTORE_APP
/* Writing to the console is a lot of fun on Microsoft Windows.
@@ -333,8 +334,9 @@ char *FromCharset(const char *charset, const void *data, size_t data_size)
void *ToCharset(const char *charset, const char *in, size_t *outsize)
{
vlc_iconv_t hd = vlc_iconv_open (charset, "UTF-8");
- if (hd == (vlc_iconv_t)(-1))
+ if (hd == (vlc_iconv_t)(-1)) {
return NULL;
+ }
const size_t inlen = strlen (in);
void *res;
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 33734f1..77ebd6b 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -386,15 +386,17 @@ static void VoutDisplayCreateRender(vout_display_t *vd)
v_dst.i_sar_den = 0;
video_format_t v_dst_cmp = v_dst;
- if ((v_src.i_chroma == VLC_CODEC_J420 && v_dst.i_chroma == VLC_CODEC_I420) ||
- (v_src.i_chroma == VLC_CODEC_J422 && v_dst.i_chroma == VLC_CODEC_I422) ||
- (v_src.i_chroma == VLC_CODEC_J440 && v_dst.i_chroma == VLC_CODEC_I440) ||
- (v_src.i_chroma == VLC_CODEC_J444 && v_dst.i_chroma == VLC_CODEC_I444))
- v_dst_cmp.i_chroma = v_src.i_chroma;
+ if ((v_src.i_chroma == VLC_CODEC_J420 && v_dst.i_chroma == VLC_CODEC_I420) ||
+ (v_src.i_chroma == VLC_CODEC_J422 && v_dst.i_chroma == VLC_CODEC_I422) ||
+ (v_src.i_chroma == VLC_CODEC_J440 && v_dst.i_chroma == VLC_CODEC_I440) ||
+ (v_src.i_chroma == VLC_CODEC_J444 && v_dst.i_chroma == VLC_CODEC_I444)) {
+ v_dst_cmp.i_chroma = v_src.i_chroma;
+ }
const bool convert = memcmp(&v_src, &v_dst_cmp, sizeof(v_src)) != 0;
- if (!convert)
- return;
+ if (!convert) {
+ return;
+ }
msg_Dbg(vd, "A filter to adapt decoder to display is needed");
@@ -1539,8 +1541,9 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
{
video_splitter_t *splitter =
video_splitter_New(VLC_OBJECT(vout), splitter_module, source);
- if (!splitter)
- return NULL;
+ if (!splitter) {
+ return NULL;
+ }
/* */
vout_display_t *wrapper =
diff --git a/src/video_output/inhibit.c b/src/video_output/inhibit.c
index 33d7369..d33b7dc 100644
--- a/src/video_output/inhibit.c
+++ b/src/video_output/inhibit.c
@@ -37,8 +37,9 @@ typedef struct
vlc_inhibit_t *vlc_inhibit_Create (vlc_object_t *parent)
{
inhibit_t *priv = vlc_custom_create (parent, sizeof (*priv), "inhibit" );
- if (priv == NULL)
+ if (priv == NULL) {
return NULL;
+ }
vlc_inhibit_t *ih = &priv->ih;
ih->p_sys = NULL;
diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
index 0519101..14dc4a5 100644
--- a/src/video_output/snapshot.c
+++ b/src/video_output/snapshot.c
@@ -198,8 +198,9 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
path_sanitize(filename);
}
- if (!filename)
- goto error;
+ if (!filename) {
+ goto error;
+ }
/* Save the snapshot */
FILE *file = vlc_fopen(filename, "wb");
diff --git a/src/video_output/video_epg.c b/src/video_output/video_epg.c
index 624caf1..a85a039 100644
--- a/src/video_output/video_epg.c
+++ b/src/video_output/video_epg.c
@@ -284,8 +284,9 @@ int vout_OSDEpg(vout_thread_t *vout, input_item_t *input)
vlc_mutex_unlock(&input->lock);
/* If no EPG event has been found. */
- if (epg == NULL)
+ if( epg == NULL ) {
return VLC_EGENERIC;
+ }
subpicture_updater_sys_t *sys = malloc(sizeof(*sys));
if (!sys) {
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index f9e52cd..54aed10 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -113,8 +113,9 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
const vout_configuration_t *cfg)
{
video_format_t original;
- if (VoutValidateFormat(&original, cfg->fmt))
+ if (VoutValidateFormat(&original, cfg->fmt)) {
return NULL;
+ }
/* Allocate descriptor */
vout_thread_t *vout = vlc_custom_create(object,
@@ -467,8 +468,9 @@ int vout_GetSnapshot(vout_thread_t *vout,
if (image_dst) {
vlc_fourcc_t codec = VLC_CODEC_PNG;
- if (type && image_Type2Fourcc(type))
- codec = image_Type2Fourcc(type);
+ if (type && image_Type2Fourcc(type)) {
+ codec = image_Type2Fourcc(type);
+ }
const int override_width = var_InheritInteger(vout, "snapshot-width");
const int override_height = var_InheritInteger(vout, "snapshot-height");
@@ -760,8 +762,9 @@ static void ThreadChangeFilters(vout_thread_t *vout,
current = next;
}
- if (!is_locked)
- vlc_mutex_lock(&vout->p->filter.lock);
+ if (!is_locked) {
+ vlc_mutex_lock(&vout->p->filter.lock);
+ }
es_format_t fmt_target;
es_format_InitFromVideo(&fmt_target, source ? source : &vout->p->filter.format);
@@ -887,11 +890,13 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
picture_t *filtered = filter_chain_VideoFilter(vout->p->filter.chain_interactive, torender);
vlc_mutex_unlock(&vout->p->filter.lock);
- if (!filtered)
- return VLC_EGENERIC;
+ if (!filtered) {
+ return VLC_EGENERIC;
+ }
- if (filtered->date != vout->p->displayed.current->date)
- msg_Warn(vout, "Unsupported timestamp modifications done by chain_interactive");
+ if (filtered->date != vout->p->displayed.current->date) {
+ msg_Warn(vout, "Unsupported timestamp modifications done by chain_interactive");
+ }
/*
* Get the subpicture to be displayed
diff --git a/src/video_output/video_text.c b/src/video_output/video_text.c
index 4ef8865..cff969c 100644
--- a/src/video_output/video_text.c
+++ b/src/video_output/video_text.c
@@ -106,8 +106,9 @@ void vout_OSDText(vout_thread_t *vout, int channel,
int position, mtime_t duration, const char *text)
{
assert( (position & ~SUBPICTURE_ALIGN_MASK) == 0);
- if (!var_InheritBool(vout, "osd") || duration <= 0)
+ if( !var_InheritBool(vout, "osd") || duration <= 0 ) {
return;
+ }
subpicture_updater_sys_t *sys = malloc(sizeof(*sys));
if (!sys)
diff --git a/src/video_output/video_widgets.c b/src/video_output/video_widgets.c
index 201f907..2a9c22f 100644
--- a/src/video_output/video_widgets.c
+++ b/src/video_output/video_widgets.c
@@ -292,8 +292,9 @@ static void OSDWidget(vout_thread_t *vout, int channel, int type, int position)
{
if (!var_InheritBool(vout, "osd"))
return;
- if (type == OSD_HOR_SLIDER || type == OSD_VERT_SLIDER)
+ if( type == OSD_HOR_SLIDER || type == OSD_VERT_SLIDER ) {
position = VLC_CLIP(position, 0, 100);
+ }
subpicture_updater_sys_t *sys = malloc(sizeof(*sys));
if (!sys)
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 416a04c..988bb43 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -353,7 +353,8 @@ typedef struct {
static spu_area_t spu_area_create(int x, int y, int w, int h, spu_scale_t s)
{
- spu_area_t a = { .x = x, .y = y, .width = w, .height = h, .scale = s };
+ spu_area_t a = { .x = x, .y = y, .width = w, .height = h };
+ a.scale = s;
return a;
}
static spu_area_t spu_area_scaled(spu_area_t a)
@@ -449,8 +450,9 @@ static void SpuAreaFitInside(spu_area_t *area, const spu_area_t *boundary)
const int i_error_x = (a.x + a.width) - boundary->width;
if (i_error_x > 0)
a.x -= i_error_x;
- if (a.x < 0)
- a.x = 0;
+ if (a.x < 0) {
+ a.x = 0;
+ }
const int i_error_y = (a.y + a.height) - boundary->height;
if (i_error_y > 0)
@@ -727,17 +729,19 @@ static void SpuRenderRegion(spu_t *spu,
scale_size);
/* Handle overlapping subtitles when possible */
- if (subpic->b_subtitle && !subpic->b_absolute)
+ if( subpic->b_subtitle && !subpic->b_absolute ) {
SpuAreaFixOverlap(dst_area, subtitle_area, subtitle_area_count,
region->i_align);
+ }
/* we copy the area: for the subtitle overlap support we want
* to only save the area without margin applied */
spu_area_t restrained = *dst_area;
/* apply margin to subtitles and correct if they go over the picture edge */
- if (subpic->b_subtitle)
+ if (subpic->b_subtitle) {
restrained.y -= y_margin;
+ }
spu_area_t display = spu_area_create(0, 0, fmt->i_visible_width,
fmt->i_visible_height,
@@ -985,13 +989,15 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu,
subtitle_region_count += count;
region_count += count;
}
- if (region_count <= 0)
- return NULL;
+ if (region_count <= 0) {
+ return NULL;
+ }
/* Create the output subpicture */
subpicture_t *output = subpicture_New(NULL);
- if (!output)
- return NULL;
+ if (!output) {
+ return NULL;
+ }
output->i_original_picture_width = fmt_dst->i_visible_width;
output->i_original_picture_height = fmt_dst->i_visible_height;
subpicture_region_t **output_last_ptr = &output->p_region;
@@ -1213,8 +1219,9 @@ spu_t *spu_Create(vlc_object_t *object)
spu_t *spu = vlc_custom_create(object,
sizeof(spu_t) + sizeof(spu_private_t),
"subpicture");
- if (!spu)
- return NULL;
+ if (!spu) {
+ return NULL;
+ }
/* Initialize spu fields */
spu_private_t *sys = spu->p = (spu_private_t*)&spu[1];
diff --git a/src/video_output/window.c b/src/video_output/window.c
index bc45bc2..5fb65e6 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -120,8 +120,9 @@ static void vout_window_stop(void *func, va_list ap)
void vout_window_Delete(vout_window_t *window)
{
- if (!window)
+ if (!window) {
return;
+ }
window_t *w = (window_t *)window;
if (w->inhibit)
diff --git a/src/win32/dirs.c b/src/win32/dirs.c
index 7b734c6..0407515 100644
--- a/src/win32/dirs.c
+++ b/src/win32/dirs.c
@@ -51,12 +51,14 @@ char *config_GetLibDir (void)
#else
/* Get our full path */
MEMORY_BASIC_INFORMATION mbi;
- if (!VirtualQuery (config_GetLibDir, &mbi, sizeof(mbi)))
+ if (!VirtualQuery(config_GetLibDir, &mbi, sizeof(mbi))) {
goto error;
+ }
wchar_t wpath[MAX_PATH];
- if (!GetModuleFileName ((HMODULE) mbi.AllocationBase, wpath, MAX_PATH))
+ if (!GetModuleFileName((HMODULE) mbi.AllocationBase, wpath, MAX_PATH)) {
goto error;
+ }
wchar_t *file = wcsrchr (wpath, L'\\');
if (file == NULL)
diff --git a/src/win32/filesystem.c b/src/win32/filesystem.c
index 886a158..7206779 100644
--- a/src/win32/filesystem.c
+++ b/src/win32/filesystem.c
@@ -143,8 +143,9 @@ typedef struct vlc_DIR
DIR *vlc_opendir (const char *dirname)
{
wchar_t *wpath = widen_path (dirname);
- if (wpath == NULL)
+ if (wpath == NULL) {
return NULL;
+ }
vlc_DIR *p_dir = malloc (sizeof (*p_dir));
if (unlikely(p_dir == NULL))
diff --git a/src/win32/plugin.c b/src/win32/plugin.c
index a21d5ec..370a3e3 100644
--- a/src/win32/plugin.c
+++ b/src/win32/plugin.c
@@ -54,8 +54,9 @@ int module_Load( vlc_object_t *p_this, const char *psz_file,
module_handle_t *p_handle, bool lazy )
{
wchar_t *wfile = ToWide (psz_file);
- if (wfile == NULL)
+ if (wfile == NULL) {
return -1;
+ }
module_handle_t handle;
/* FIXME: this is not thread-safe -- Courmisch */
diff --git a/src/win32/thread.c b/src/win32/thread.c
index 4388274..4420c92 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -289,8 +289,9 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
return 0;
}
total = (deadline - total) / 1000;
- if( total < 0 )
+ if (total < 0) {
total = 0;
+ }
DWORD delay = (total > 0x7fffffff) ? 0x7fffffff : total;
vlc_mutex_unlock (p_mutex);
@@ -734,8 +735,9 @@ static mtime_t mdate_perf (void)
{
/* We don't need the real date, just the value of a high precision timer */
LARGE_INTEGER counter;
- if (!QueryPerformanceCounter (&counter))
- abort ();
+ if (!QueryPerformanceCounter(&counter)) {
+ abort();
+ }
/* Convert to from (1/freq) to microsecond resolution */
/* We need to split the division to avoid 63-bits overflow */
--
1.7.9
More information about the vlc-devel
mailing list