Signed-off-by: Michael Stefaniuc mstefani@winehq.org --- dlls/dsound/primary.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 9f41a2b47f..852ec51b7f 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -576,7 +576,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(IDirectSoundBuffer8 *iface, LO
for (i = 0; i < DS_MAX_CHANNELS; i++) { if (device->pwfx->nChannels > i){ - fvol = (float)((DWORD)(device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); + fvol = (float)((device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); hr = IAudioStreamVolume_SetChannelVolume(device->volume, i, fvol); if (FAILED(hr)){ LeaveCriticalSection(&device->mixlock); @@ -932,7 +932,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(IDirectSoundBuffer8 *iface, LONG
for (i = 0; i < DS_MAX_CHANNELS; i++) { if (device->pwfx->nChannels > i) { - fvol = (float)((DWORD)(device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); + fvol = (float)((device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); hr = IAudioStreamVolume_SetChannelVolume(device->volume, i, fvol); if (FAILED(hr)){ LeaveCriticalSection(&device->mixlock);
On Thu, Feb 28, 2019 at 12:50:29AM +0100, Michael Stefaniuc wrote:
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 9f41a2b47f..852ec51b7f 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -576,7 +576,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(IDirectSoundBuffer8 *iface, LO
for (i = 0; i < DS_MAX_CHANNELS; i++) { if (device->pwfx->nChannels > i){
fvol = (float)((DWORD)(device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF);
fvol = (float)((device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); hr = IAudioStreamVolume_SetChannelVolume(device->volume, i, fvol); if (FAILED(hr)){ LeaveCriticalSection(&device->mixlock);
I guess I'm not opposed to these patches, but I don't really see the benefit either.
Andrew
On 3/1/19 3:53 PM, Andrew Eikum wrote:
On Thu, Feb 28, 2019 at 12:50:29AM +0100, Michael Stefaniuc wrote:
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 9f41a2b47f..852ec51b7f 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -576,7 +576,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(IDirectSoundBuffer8 *iface, LO
for (i = 0; i < DS_MAX_CHANNELS; i++) { if (device->pwfx->nChannels > i){
fvol = (float)((DWORD)(device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF);
fvol = (float)((device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); hr = IAudioStreamVolume_SetChannelVolume(device->volume, i, fvol); if (FAILED(hr)){ LeaveCriticalSection(&device->mixlock);
I guess I'm not opposed to these patches, but I don't really see the benefit either.
Andrew
Sorry if I intrude, but this has me wondering now. Should pointless casts not be removed, in general? Obviously there's no benefit other than cleaning the code. (I'm talking in general wine policy, not this specific code).
On 3/1/19 3:00 PM, Gabriel Ivăncescu wrote:
On 3/1/19 3:53 PM, Andrew Eikum wrote:
On Thu, Feb 28, 2019 at 12:50:29AM +0100, Michael Stefaniuc wrote:
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 9f41a2b47f..852ec51b7f 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -576,7 +576,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(IDirectSoundBuffer8 *iface, LO for (i = 0; i < DS_MAX_CHANNELS; i++) { if (device->pwfx->nChannels > i){ - fvol = (float)((DWORD)(device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); + fvol = (float)((device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); hr = IAudioStreamVolume_SetChannelVolume(device->volume, i, fvol); if (FAILED(hr)){ LeaveCriticalSection(&device->mixlock);
I guess I'm not opposed to these patches, but I don't really see the benefit either.
Andrew
Sorry if I intrude, but this has me wondering now. Should pointless casts not be removed, in general? Obviously there's no benefit other than cleaning the code. (I'm talking in general wine policy, not this specific code).
I do that on and off since 2007. I removed a few thousands of those :)
bye michael
On 3/1/19 2:53 PM, Andrew Eikum wrote:
On Thu, Feb 28, 2019 at 12:50:29AM +0100, Michael Stefaniuc wrote:
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 9f41a2b47f..852ec51b7f 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -576,7 +576,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(IDirectSoundBuffer8 *iface, LO
for (i = 0; i < DS_MAX_CHANNELS; i++) { if (device->pwfx->nChannels > i){
fvol = (float)((DWORD)(device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF);
fvol = (float)((device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); hr = IAudioStreamVolume_SetChannelVolume(device->volume, i, fvol); if (FAILED(hr)){ LeaveCriticalSection(&device->mixlock);
I guess I'm not opposed to these patches, but I don't really see the benefit either.
Less code is the first visible change. But more importantly casts function a little bit like a comment /* WARNING THERE MIGHT BE DRAGONS!! */ Superfluous casts just drag the attention to code were no extra attention is needed.
bye michael
On 3/1/19 8:53 PM, Michael Stefaniuc wrote:
On 3/1/19 2:53 PM, Andrew Eikum wrote:
On Thu, Feb 28, 2019 at 12:50:29AM +0100, Michael Stefaniuc wrote:
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 9f41a2b47f..852ec51b7f 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -576,7 +576,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(IDirectSoundBuffer8 *iface, LO
for (i = 0; i < DS_MAX_CHANNELS; i++) { if (device->pwfx->nChannels > i){
fvol = (float)((DWORD)(device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF);
fvol = (float)((device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); hr = IAudioStreamVolume_SetChannelVolume(device->volume, i, fvol); if (FAILED(hr)){ LeaveCriticalSection(&device->mixlock);
I guess I'm not opposed to these patches, but I don't really see the benefit either.
Less code is the first visible change. But more importantly casts function a little bit like a comment /* WARNING THERE MIGHT BE DRAGONS!! */ Superfluous casts just drag the attention to code were no extra attention is needed.
Oh, and for pointer casts there is the real danger of silencing the compiler and masking errors. Common ones I've run into and even did that mistake myself was casting the wrong indirection level, e.g. (foo *)ptr instead of (foo *)&ptr. But I've run into a few bugs where it was casting the completely wrong thing.
bye michael
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Thu, Feb 28, 2019 at 12:50:29AM +0100, Michael Stefaniuc wrote:
Signed-off-by: Michael Stefaniuc mstefani@winehq.org
dlls/dsound/primary.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 9f41a2b47f..852ec51b7f 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -576,7 +576,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(IDirectSoundBuffer8 *iface, LO
for (i = 0; i < DS_MAX_CHANNELS; i++) { if (device->pwfx->nChannels > i){
fvol = (float)((DWORD)(device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF);
fvol = (float)((device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); hr = IAudioStreamVolume_SetChannelVolume(device->volume, i, fvol); if (FAILED(hr)){ LeaveCriticalSection(&device->mixlock);
@@ -932,7 +932,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(IDirectSoundBuffer8 *iface, LONG
for (i = 0; i < DS_MAX_CHANNELS; i++) { if (device->pwfx->nChannels > i) {
fvol = (float)((DWORD)(device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF);
fvol = (float)((device->volpan.dwTotalAmpFactor[i] & 0xFFFF) / (float)0xFFFF); hr = IAudioStreamVolume_SetChannelVolume(device->volume, i, fvol); if (FAILED(hr)){ LeaveCriticalSection(&device->mixlock);
-- 2.20.1