[Sound-open-firmware] [PATCH] SRC: Fix use of int and uint types and remove unused function parameters
Seppo Ingalsuo
seppo.ingalsuo at linux.intel.com
Fri Sep 29 13:14:55 CEST 2017
On 29.09.2017 01:05, Liam Girdwood wrote:
> On Wed, 2017-09-27 at 19:02 +0300, Seppo Ingalsuo wrote:
>> On 27.09.2017 18:52, Liam Girdwood wrote:
>>> On Wed, 2017-09-27 at 16:49 +0300, Seppo Ingalsuo wrote:
>>>> This patch fixes the warning messages shown with gcc option -Wextra.
>>>>
>>>> Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo at linux.intel.com>
>>>> ---
>>>> src/audio/src.c | 16 +++++++---------
>>>> 1 file changed, 7 insertions(+), 9 deletions(-)
>>>>
>>>> diff --git a/src/audio/src.c b/src/audio/src.c
>>>> index 3fd9614..3723b4e 100644
>>>> --- a/src/audio/src.c
>>>> +++ b/src/audio/src.c
>>>> @@ -65,8 +65,7 @@ struct comp_data {
>>>> void (*src_func)(struct comp_dev *dev,
>>>> struct comp_buffer *source,
>>>> struct comp_buffer *sink,
>>>> - uint32_t source_frames,
>>>> - uint32_t sink_frames);
>>>> + int source_frames);
>>> Should this be unsigned ?
>> No, it's intentional. The frames count is used for +/- arithmetics ops
>> in the code so it's better to keep it signed integer. With unsigned int
>> type I would need more casts in the code. In this case the lower
>> positive range of int32 is not an issue.
> Ok, so it's better then to also fix the issue in component.h and
> buffer.h on any structure member that will be used in audio processing.
> I dont want to mix types or cast :)
>
> struct comp_buffer {
>
> /* runtime data */
>
> uint32_t size; /* runtime buffer size in bytes (period multiple) */
> uint32_t alloc_size; /* allocated size in bytes */
> uint32_t avail; /* available bytes for reading */
> uint32_t free; /* free bytes for writing */
>
> };
>
> These 4 uints are all used in processing and from struct comp_dev :-
>
> uint32_t frames; /* number of frames we copy to sink */
> uint32_t frame_bytes; /* frames size copied to sink in bytes */
>
> Also some members in sof_ipc_comp_* from ipc.h too.
Thanks, I'll see how large impact this would cause.
Cheers,
Seppo
>
> Liam
>
> ---------------------------------------------------------------------
> Intel Corporation (UK) Limited
> Registered No. 1134945 (England)
> Registered Office: Pipers Way, Swindon SN3 1RJ
> VAT No: 860 2173 47
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> _______________________________________________
> Sound-open-firmware mailing list
> Sound-open-firmware at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
>
More information about the Sound-open-firmware
mailing list