From f7e30cc13b4463dab22e203a8ce0021bbc98876e Mon Sep 17 00:00:00 2001 From: Aneesh Dogra Date: Sun, 1 Jan 2012 22:07:54 +0530 Subject: [PATCH] bfi: K&R cosmetics Signed-off-by: Anton Khirnov --- libavcodec/bfi.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c index 3c66226041..cfe7bdc738 100644 --- a/libavcodec/bfi.c +++ b/libavcodec/bfi.c @@ -36,7 +36,7 @@ typedef struct BFIContext { uint8_t *dst; } BFIContext; -static av_cold int bfi_decode_init(AVCodecContext * avctx) +static av_cold int bfi_decode_init(AVCodecContext *avctx) { BFIContext *bfi = avctx->priv_data; avctx->pix_fmt = PIX_FMT_PAL8; @@ -44,7 +44,7 @@ static av_cold int bfi_decode_init(AVCodecContext * avctx) return 0; } -static int bfi_decode_frame(AVCodecContext * avctx, void *data, +static int bfi_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data, *buf_end = avpkt->data + avpkt->size; @@ -71,11 +71,11 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data, bfi->frame.pict_type = AV_PICTURE_TYPE_I; bfi->frame.key_frame = 1; /* Setting the palette */ - if(avctx->extradata_size>768) { + if (avctx->extradata_size > 768) { av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n"); return -1; } - pal = (uint32_t *) bfi->frame.data[1]; + pal = (uint32_t *)bfi->frame.data[1]; for (i = 0; i < avctx->extradata_size / 3; i++) { int shift = 16; *pal = 0; @@ -91,16 +91,17 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data, bfi->frame.key_frame = 0; } - buf += 4; //Unpacked size, not required. + buf += 4; // Unpacked size, not required. while (dst != frame_end) { - static const uint8_t lentab[4]={0,2,0,1}; - unsigned int byte = *buf++, av_uninit(offset); - unsigned int code = byte >> 6; + static const uint8_t lentab[4] = { 0, 2, 0, 1 }; + unsigned int byte = *buf++, av_uninit(offset); + unsigned int code = byte >> 6; unsigned int length = byte & ~0xC0; if (buf >= buf_end) { - av_log(avctx, AV_LOG_ERROR, "Input resolution larger than actual frame.\n"); + av_log(avctx, AV_LOG_ERROR, + "Input resolution larger than actual frame.\n"); return -1; } @@ -120,7 +121,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data, } /* Do boundary check */ - if (dst + (length< frame_end) + if (dst + (length << lentab[code]) > frame_end) break; switch (code) { @@ -167,7 +168,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data, dst += bfi->frame.linesize[0]; } *data_size = sizeof(AVFrame); - *(AVFrame *) data = bfi->frame; + *(AVFrame *)data = bfi->frame; return buf_size; }