From 346bcd7e48459008c2f9937bdc69cf9ad7888e59 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 27 Nov 2014 10:59:47 -0800 Subject: [PATCH] libobs: Fix microsoft compiler issue In older versions of visual studio 2013 microsoft's WORTHLESS C compiler has a bug where it will, almost at random, not be able to handle having variables declared in the middle of a function and give the warning: "illegal use of this type as an expression". It was fixed in recent VS2013 updates, but I'm not about to force everyone to update to it. --- libobs/obs-audio-controls.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libobs/obs-audio-controls.c b/libobs/obs-audio-controls.c index 65ad8d503..08b825938 100644 --- a/libobs/obs-audio-controls.c +++ b/libobs/obs-audio-controls.c @@ -257,6 +257,8 @@ float obs_fader_get_mul(obs_fader_t *fader) bool obs_fader_attach_source(obs_fader_t *fader, obs_source_t *source) { + signal_handler_t *sh; + if (!fader || !source) return false; @@ -264,7 +266,7 @@ bool obs_fader_attach_source(obs_fader_t *fader, obs_source_t *source) pthread_mutex_lock(&fader->mutex); - signal_handler_t *sh = obs_source_get_signal_handler(source); + sh = obs_source_get_signal_handler(source); signal_handler_connect(sh, "volume", fader_source_volume_changed, fader); signal_handler_connect(sh, "destroy", @@ -280,6 +282,8 @@ bool obs_fader_attach_source(obs_fader_t *fader, obs_source_t *source) void obs_fader_detach_source(obs_fader_t *fader) { + signal_handler_t *sh; + if (!fader) return; @@ -288,7 +292,7 @@ void obs_fader_detach_source(obs_fader_t *fader) if (!fader->source) goto exit; - signal_handler_t *sh = obs_source_get_signal_handler(fader->source); + sh = obs_source_get_signal_handler(fader->source); signal_handler_disconnect(sh, "volume", fader_source_volume_changed, fader); signal_handler_disconnect(sh, "destroy",