changeset 4726:ecb663d00b6b libavcodec

factorize
author michael
date Sun, 25 Mar 2007 14:02:54 +0000
parents 74caca70e2b3
children 23f8f6efc870
files lzw.c
diffstat 1 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lzw.c	Sun Mar 25 13:41:14 2007 +0000
+++ b/lzw.c	Sun Mar 25 14:02:54 2007 +0000
@@ -192,13 +192,12 @@
     oc = s->oc;
     fc = s->fc;
 
-    while (sp > s->stack) {
-        *buf++ = *(--sp);
-        if ((--l) == 0)
-            goto the_end;
-    }
-
     for (;;) {
+        while (sp > s->stack) {
+            *buf++ = *(--sp);
+            if ((--l) == 0)
+                goto the_end;
+        }
         c = lzw_get_code(s);
         if (c == s->end_code) {
             s->end_code = -1;
@@ -242,11 +241,6 @@
                     s->curmask = mask[++s->cursize];
                 }
             }
-            while (sp > s->stack) {
-                *buf++ = *(--sp);
-                if ((--l) == 0)
-                    goto the_end;
-            }
         }
     }
   the_end: