diff mbox

[FFmpeg-devel] lavc/pcm-bluray: Do not use incompatible pointers on big-endian.

Message ID CAB0OVGpbNrR3d+N2V3GvutZwRoa-yUY2a0vemAK7enrg1FE87A@mail.gmail.com
State Superseded
Headers show

Commit Message

Carl Eugen Hoyos Nov. 1, 2017, 4:16 p.m. UTC
Hi!

Attached patch silences two gcc warnings, no sample for odd channel count found.

Please comment, Carl Eugen

Comments

Hendrik Leppkes Nov. 1, 2017, 5:16 p.m. UTC | #1
On Wed, Nov 1, 2017 at 5:16 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> Hi!
>
> Attached patch silences two gcc warnings, no sample for odd channel count found.
>
>  #if HAVE_BIGENDIAN
> -                    bytestream2_get_buffer(&gb, dst16, avctx->channels * 2);
> -                    dst16 += avctx->channels;
> +                    uint8_t *dst = frame->data[0];
> +                    bytestream2_get_buffer(&gb, frame->data[0], avctx->channels * 2);
> +                    dst += avctx->channels * 2;
>  #else
>                      channel = avctx->channels;
>                      do {

This hunk seems fishy. dst is only ever set, never read, and this code
is executed in a loop but always writes to the same position.

- Hendrik
diff mbox

Patch

From 991b0d62b7ac005765dfe83ef6ffa63a2b7b6fae Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Wed, 1 Nov 2017 17:14:04 +0100
Subject: [PATCH] lavc/pcm-bluray: Do not use incompatible pointers on
 big-endian.

Fixes the following gcc warnings:
libavcodec/pcm-bluray.c:172:45: warning: passing argument 2 of 'bytestream2_get_buffer' from incompatible pointer type
libavcodec/pcm-bluray.c:192:49: warning: passing argument 2 of 'bytestream2_get_buffer' from incompatible pointer type
---
 libavcodec/pcm-bluray.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/pcm-bluray.c b/libavcodec/pcm-bluray.c
index 517d7b5..d723881 100644
--- a/libavcodec/pcm-bluray.c
+++ b/libavcodec/pcm-bluray.c
@@ -169,7 +169,7 @@  static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
             samples *= num_source_channels;
             if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
 #if HAVE_BIGENDIAN
-                bytestream2_get_buffer(&gb, dst16, buf_size);
+                bytestream2_get_buffer(&gb, frame->data[0], buf_size);
 #else
                 do {
                     *dst16++ = bytestream2_get_be16u(&gb);
@@ -189,8 +189,9 @@  static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
             if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
                 do {
 #if HAVE_BIGENDIAN
-                    bytestream2_get_buffer(&gb, dst16, avctx->channels * 2);
-                    dst16 += avctx->channels;
+                    uint8_t *dst = frame->data[0];
+                    bytestream2_get_buffer(&gb, frame->data[0], avctx->channels * 2);
+                    dst += avctx->channels * 2;
 #else
                     channel = avctx->channels;
                     do {
-- 
1.7.10.4