Mercurial > libavcodec.hg
changeset 9764:dd6bcbec3c24 libavcodec
Use srcptr_end variable to avoid having to update both srcptr and srclen.
author | reimar |
---|---|
date | Sun, 31 May 2009 10:26:58 +0000 |
parents | d359d5ee74b9 |
children | 350826aae685 |
files | lcldec.c |
diffstat | 1 files changed, 2 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lcldec.c Sun May 31 10:23:38 2009 +0000 +++ b/lcldec.c Sun May 31 10:26:58 2009 +0000 @@ -75,22 +75,21 @@ { 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 @@ ofs += cnt * 256; cnt = ((cnt >> 3) & 0x1f) + 1; ofs &= 0x7ff; - srclen -= 2; cnt *= 4; if (destptr_end - destptr < cnt) { cnt = destptr_end - destptr;