From fac4b31c8c4269461b8a59e87a3544a854b7d686 Mon Sep 17 00:00:00 2001 From: Oldes Date: Mon, 8 Jul 2019 21:23:25 +0200 Subject: [PATCH] FIX: warning: jump to label 'error' crosses initialization of 'REFERENCE_TIME dur' Fixes this warning: In file included from sokol-samples\libs\sokol\sokol.c:12:0: sokol/sokol_audio.h: In function 'bool _saudio_backend_init()': sokol/sokol_audio.h:1201:1: warning: jump to label 'error' [-fpermissive] error: ^~~~~ sokol/sokol_audio.h:1127:14: note: from here goto error; ^~~~~ sokol/sokol_audio.h:1160:20: note: crosses initialization of 'REFERENCE_TIME dur' REFERENCE_TIME dur = (REFERENCE_TIME) --- sokol_audio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sokol_audio.h b/sokol_audio.h index 5d199423c..aff174f1a 100644 --- a/sokol_audio.h +++ b/sokol_audio.h @@ -1117,6 +1117,7 @@ _SOKOL_PRIVATE void _saudio_wasapi_release(void) { } _SOKOL_PRIVATE bool _saudio_backend_init(void) { + REFERENCE_TIME dur; if (FAILED(CoInitializeEx(0, COINIT_MULTITHREADED))) { SOKOL_LOG("sokol_audio wasapi: CoInitializeEx failed"); return false; @@ -1157,7 +1158,7 @@ _SOKOL_PRIVATE bool _saudio_backend_init(void) { fmt.wBitsPerSample = 16; fmt.nBlockAlign = (fmt.nChannels * fmt.wBitsPerSample) / 8; fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign; - REFERENCE_TIME dur = (REFERENCE_TIME) + dur = (REFERENCE_TIME) (((double)_saudio.buffer_frames) / (((double)_saudio.sample_rate) * (1.0/10000000.0))); if (FAILED(IAudioClient_Initialize(_saudio.backend.audio_client, AUDCLNT_SHAREMODE_SHARED,