changeset 9286:e02f401dde04 libavcodec

mlpdec: Simplify substream length mismatch error.
author ramiro
date Mon, 30 Mar 2009 03:42:40 +0000
parents f2f4f136add4
children b00fc746bdf4
files mlpdec.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mlpdec.c	Mon Mar 30 03:37:19 2009 +0000
+++ b/mlpdec.c	Mon Mar 30 03:42:40 2009 +0000
@@ -1017,8 +1017,10 @@
             if (read_block_data(m, &gb, substr) < 0)
                 return -1;
 
-        } while ((get_bits_count(&gb) < substream_data_len[substr] * 8)
-                 && get_bits1(&gb) == 0);
+            if (get_bits_count(&gb) >= substream_data_len[substr] * 8)
+                goto substream_length_mismatch;
+
+        } while (!get_bits1(&gb));
 
         skip_bits(&gb, (-get_bits_count(&gb)) & 15);
         if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) {
@@ -1049,9 +1051,7 @@
                 av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n"    , substr);
         }
         if (substream_data_len[substr] * 8 != get_bits_count(&gb)) {
-            av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n",
-                   substr);
-            return -1;
+            goto substream_length_mismatch;
         }
 
 next_substr:
@@ -1065,6 +1065,10 @@
 
     return length;
 
+substream_length_mismatch:
+    av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n", substr);
+    return -1;
+
 error:
     m->params_valid = 0;
     return -1;