summaryrefslogtreecommitdiff
path: root/libavcodec/lcldec.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-05-31 10:26:58 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-05-31 10:26:58 +0000
commit5e5fe7dab556caa354363cd5135ac405eb25f891 (patch)
tree2ffe56b49fa4d1461e7bd264da8342e76c66665a /libavcodec/lcldec.c
parentdbc53ffc7c398f90ae1cf59e513d3882bc0dc188 (diff)
Use srcptr_end variable to avoid having to update both srcptr and srclen.
Originally committed as revision 19048 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/lcldec.c')
-rw-r--r--libavcodec/lcldec.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 9ad731e56a..1a695dc4a4 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -75,22 +75,21 @@ static unsigned int mszh_decomp(unsigned char * srcptr, int srclen, unsigned cha
{
unsigned char *destptr_bak = destptr;
unsigned char *destptr_end = destptr + destsize;
+ unsigned char *srcptr_end = srcptr + srclen;
unsigned char mask = 0;
unsigned char maskbit = 0;
unsigned int ofs, cnt;
- while (srclen > 0 && destptr < destptr_end) {
+ while (srcptr < srcptr_end && destptr < destptr_end) {
if (maskbit == 0) {
mask = *srcptr++;
maskbit = 8;
- srclen--;
continue;
}
if ((mask & (1 << (--maskbit))) == 0) {
if (destptr_end - destptr < 4)
break;
memcpy(destptr, srcptr, 4);
- srclen -= 4;
destptr += 4;
srcptr += 4;
} else {
@@ -99,7 +98,6 @@ static unsigned int mszh_decomp(unsigned char * srcptr, int srclen, unsigned cha
ofs += cnt * 256;
cnt = ((cnt >> 3) & 0x1f) + 1;
ofs &= 0x7ff;
- srclen -= 2;
cnt *= 4;
if (destptr_end - destptr < cnt) {
cnt = destptr_end - destptr;