diff mbox

[FFmpeg-devel] lavc/alac: Make a variable unsigned

Message ID CAB0OVGp5NPPZhMcGzjp7qE-MLJzGy4AFoVfXEj0TboOKtMBDfw@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos April 18, 2019, 11:53 a.m. UTC
Hi!

Attached patch silences a warning that is shown with some gcc versions.

Please comment, Carl Eugen

Comments

Lauri Kasanen April 18, 2019, 12:54 p.m. UTC | #1
On Thu, 18 Apr 2019 13:53:37 +0200
Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:

> Hi!
>
> Attached patch silences a warning that is shown with some gcc versions.

It pokes my style sense to have different things in the sizeof() and
the var. How about uint32_t in both?

- Lauri
Hendrik Leppkes April 18, 2019, 1:07 p.m. UTC | #2
On Thu, Apr 18, 2019 at 2:54 PM Lauri Kasanen <cand@gmx.com> wrote:
>
> On Thu, 18 Apr 2019 13:53:37 +0200
> Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
> > Hi!
> >
> > Attached patch silences a warning that is shown with some gcc versions.
>
> It pokes my style sense to have different things in the sizeof() and
> the var. How about uint32_t in both?
>

Those two things are entirely unrelated types, though.

- Hendrik
Carl Eugen Hoyos April 18, 2019, 1:25 p.m. UTC | #3
2019-04-18 14:54 GMT+02:00, Lauri Kasanen <cand@gmx.com>:
> On Thu, 18 Apr 2019 13:53:37 +0200
> Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
>> Hi!
>>
>> Attached patch silences a warning that is shown with some gcc versions.
>
> It pokes my style sense to have different things in the sizeof() and
> the var. How about uint32_t in both?

I believe the sizeof() is an unrelated issue, I don't need 32 bit for the
size, just a variable size the system likes in the 64k range.

I wonder if the sizeof() isn't wrong, it looks wrong because
it uses a type instead of a variable.

Carl Eugen
Lauri Kasanen April 18, 2019, 2:17 p.m. UTC | #4
On Thu, 18 Apr 2019 15:07:03 +0200
Hendrik Leppkes <h.leppkes@gmail.com> wrote:

> On Thu, Apr 18, 2019 at 2:54 PM Lauri Kasanen <cand@gmx.com> wrote:
> >
> > On Thu, 18 Apr 2019 13:53:37 +0200
> > Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> >
> > > Hi!
> > >
> > > Attached patch silences a warning that is shown with some gcc versions.
> >
> > It pokes my style sense to have different things in the sizeof() and
> > the var. How about uint32_t in both?
> >
>
> Those two things are entirely unrelated types, though.

Indeed, my bad. Please ignore.

- Lauri
Carl Eugen Hoyos April 19, 2019, 12:02 p.m. UTC | #5
2019-04-18 13:53 GMT+02:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:

> Attached patch silences a warning that is shown with some gcc versions.

Patch applied.

Carl Eugen
diff mbox

Patch

From 6ed77b4c191028f47f48396a782619f2ba47b716 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Thu, 18 Apr 2019 13:51:07 +0200
Subject: [PATCH] lavc/alac: Make a variable unsigned.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes a bogus compiler warning (max_samples_per_frame is checked):
libavcodec/alac.c: In function ‘allocate_buffers’:
./libavutil/internal.h:142:9: warning: argument 1 value ‘18446744073709551552’ exceeds maximum object size 9223372036854775807
---
 libavcodec/alac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index d6b87db..2f44340 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -486,7 +486,7 @@  static av_cold int alac_decode_close(AVCodecContext *avctx)
 static int allocate_buffers(ALACContext *alac)
 {
     int ch;
-    int buf_size = alac->max_samples_per_frame * sizeof(int32_t);
+    unsigned buf_size = alac->max_samples_per_frame * sizeof(int32_t);
 
     for (ch = 0; ch < 2; ch++) {
         alac->predict_error_buffer[ch]  = NULL;
-- 
1.7.10.4