changeset 9757:8e4d442554b3 libavcodec

Use FFMIN
author reimar
date Sun, 31 May 2009 09:57:42 +0000
parents ed55b61c8e45
children 8ebcc162db3d
files lcldec.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lcldec.c	Sun May 31 09:51:46 2009 +0000
+++ b/lcldec.c	Sun May 31 09:57:42 2009 +0000
@@ -191,8 +191,7 @@
             if (c->flags & FLAG_MULTITHREAD) {
                 mthread_inlen = *(unsigned int*)encoded;
                 mthread_outlen = *(unsigned int*)(encoded+4);
-                if (mthread_outlen > c->decomp_size) // this should not happen
-                    mthread_outlen = c->decomp_size;
+                mthread_outlen = FFMIN(mthread_outlen, c->decomp_size);
                 mszh_dlen = mszh_decomp(encoded + 8, mthread_inlen, c->decomp_buf, c->decomp_size);
                 if (mthread_outlen != mszh_dlen) {
                     av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n",
@@ -238,8 +237,7 @@
             int ret;
             mthread_inlen = *(unsigned int*)encoded;
             mthread_outlen = *(unsigned int*)(encoded+4);
-            if (mthread_outlen > c->decomp_size)
-                mthread_outlen = c->decomp_size;
+            mthread_outlen = FFMIN(mthread_outlen, c->decomp_size);
             ret = zlib_decomp(avctx, encoded + 8, mthread_inlen, 0, mthread_outlen);
             if (ret < 0) return ret;
             ret = zlib_decomp(avctx, encoded + 8 + mthread_inlen, len - mthread_inlen,