[FFmpeg-devel] [PATCH] Remove size magic number (15) and use sizeof instead
webmaster at mohammadg.com
webmaster at mohammadg.com
Tue Nov 24 12:55:38 CET 2015
From: Mohammad Ghasembeigi <webmaster at mohammadg.com>
---
libavcodec/dsicinvideo.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavcodec/dsicinvideo.c b/libavcodec/dsicinvideo.c
index f95cbc7..dc9ae7d 100644
--- a/libavcodec/dsicinvideo.c
+++ b/libavcodec/dsicinvideo.c
@@ -100,12 +100,12 @@ static int cin_decode_huffman(const unsigned char *src, int src_size,
unsigned char *dst_end = dst + dst_size;
const unsigned char *src_end = src + src_size;
- memcpy(huff_code_table, src, 15);
- src += 15;
+ memcpy(huff_code_table, src, sizeof(huff_code_table));
+ src += sizeof(huff_code_table);
while (src < src_end) {
huff_code = *src++;
- if ((huff_code >> 4) == 15) {
+ if ((huff_code >> 4) == sizeof(huff_code_table)) {
b = huff_code << 4;
huff_code = *src++;
*dst_cur++ = b | (huff_code >> 4);
@@ -114,8 +114,8 @@ static int cin_decode_huffman(const unsigned char *src, int src_size,
if (dst_cur >= dst_end)
break;
- huff_code &= 15;
- if (huff_code == 15) {
+ huff_code &= sizeof(huff_code_table);
+ if (huff_code == sizeof(huff_code_table)) {
*dst_cur++ = *src++;
} else
*dst_cur++ = huff_code_table[huff_code];
--
1.9.5.msysgit.1
More information about the ffmpeg-devel
mailing list