All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	qemu-devel@nongnu.org
Cc: devel@daynix.com, Akihiko Odaki <akihiko.odaki@daynix.com>
Subject: Re: [PATCH v7 1/6] coreaudio: Remove unnecessary explicit casts
Date: Sat, 25 Jan 2025 11:41:00 +0100	[thread overview]
Message-ID: <2917255.Mg30ljiku8@silver> (raw)
In-Reply-To: <b9116fa5-aafd-4dc8-8b31-86b079f1ad9c@daynix.com>

On Saturday, January 25, 2025 6:58:30 AM CET Akihiko Odaki wrote:
> On 2025/01/24 18:39, Christian Schoenebeck wrote:
> > On Friday, January 24, 2025 6:12:04 AM CET Akihiko Odaki wrote:
> >> coreaudio had unnecessary explicit casts and they had extra whitespaces
> >> around them so remove them.
> >>
> >> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> >> ---
> >>   audio/coreaudio.m | 6 +++---
> >>   1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/audio/coreaudio.m b/audio/coreaudio.m
> >> index cadd729d50537850d81718b9284efed5877d9185..0b67347ad7e8c43a77af308a1a3a654dd7084083 100644
> >> --- a/audio/coreaudio.m
> >> +++ b/audio/coreaudio.m
> >> @@ -309,7 +309,7 @@ static OSStatus audioDeviceIOProc(
> >>       UInt32 frameCount, pending_frames;
> >>       void *out = outOutputData->mBuffers[0].mData;
> >>       HWVoiceOut *hw = hwptr;
> >> -    coreaudioVoiceOut *core = (coreaudioVoiceOut *) hwptr;
> >> +    coreaudioVoiceOut *core = hwptr;
> > 
> > Well, hwptr is void*, so both versions are fine.
> > 
> > struct name 'coreaudioVoiceOut' should start with upper case BTW.
> > 
> >>       size_t len;
> >>   
> >>       if (coreaudio_buf_lock (core, "audioDeviceIOProc")) {
> >> @@ -392,10 +392,10 @@ static OSStatus init_out_device(coreaudioVoiceOut *core)
> >>       }
> >>   
> >>       if (frameRange.mMinimum > core->frameSizeSetting) {
> >> -        core->audioDevicePropertyBufferFrameSize = (UInt32) frameRange.mMinimum;
> >> +        core->audioDevicePropertyBufferFrameSize = frameRange.mMinimum;
> >>           dolog ("warning: Upsizing Buffer Frames to %f\n", frameRange.mMinimum);
> >>       } else if (frameRange.mMaximum < core->frameSizeSetting) {
> >> -        core->audioDevicePropertyBufferFrameSize = (UInt32) frameRange.mMaximum;
> >> +        core->audioDevicePropertyBufferFrameSize = frameRange.mMaximum;
> >>           dolog ("warning: Downsizing Buffer Frames to %f\n", frameRange.mMaximum);
> >>       } else {
> >>           core->audioDevicePropertyBufferFrameSize = core->frameSizeSetting;
> > 
> > Those casts are actually necessary, as AudioValueRange's members are Float64
> > (a.k.a. double) types.
> 
> Explicit casts are unnecessary. Implicit casts still happen at every 
> line changed with this patch.

Wooo, I wasn't aware that QEMU doesn't use -Wconversion. I am not used to 
that. To me it makes sense to warn especially for things like implicit casts
from floating point to integer, as it would be the case here.

/Christian




  reply	other threads:[~2025-01-25 10:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24  5:12 [PATCH v7 0/6] coreaudio fixes Akihiko Odaki
2025-01-24  5:12 ` [PATCH v7 1/6] coreaudio: Remove unnecessary explicit casts Akihiko Odaki
2025-01-24  9:39   ` Christian Schoenebeck
2025-01-25  5:58     ` Akihiko Odaki
2025-01-25 10:41       ` Christian Schoenebeck [this message]
2025-01-26  4:00         ` Akihiko Odaki
2025-01-24  5:12 ` [PATCH v7 2/6] coreaudio: Remove extra whitespaces Akihiko Odaki
2025-01-24  9:44   ` Christian Schoenebeck
2025-01-24  5:12 ` [PATCH v7 3/6] coreaudio: Improve naming Akihiko Odaki
2025-01-24 10:01   ` Christian Schoenebeck
2025-01-25  6:05     ` Akihiko Odaki
2025-01-24  5:12 ` [PATCH v7 4/6] coreaudio: Commit the result of init in the end Akihiko Odaki
2025-01-24  5:12 ` [PATCH v7 5/6] audio: Add functions to initialize buffers Akihiko Odaki
2025-01-24  5:12 ` [PATCH v7 6/6] coreaudio: Initialize the buffer for device change Akihiko Odaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2917255.Mg30ljiku8@silver \
    --to=qemu_oss@crudebyte.com \
    --cc=akihiko.odaki@daynix.com \
    --cc=balaton@eik.bme.hu \
    --cc=devel@daynix.com \
    --cc=kraxel@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.