From 77ca528eece3f948a897a85d7dabce5dea6bdb7a Mon Sep 17 00:00:00 2001
From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org>
Date: Sun, 20 Oct 1996 04:03:54 +0200
Subject: [PATCH] ...and some optimizations. The 'fromgif' might not work with
 other then 8bpp images (untested yet)

Rev: src/modules/image/image.h:1.5
Rev: src/modules/image/lzw.c:1.6
Rev: src/modules/image/lzw.h:1.2
---
 src/modules/image/image.h |  2 ++
 src/modules/image/lzw.c   |  2 +-
 src/modules/image/lzw.h   | 17 +++++++++++++----
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/modules/image/image.h b/src/modules/image/image.h
index fa3359b8d9..64450704b0 100644
--- a/src/modules/image/image.h
+++ b/src/modules/image/image.h
@@ -63,3 +63,5 @@ void image_floyd_steinberg(rgb_group *rgb,int xsize,
 			   int way,int *res,
 			   struct colortable *ct);
 
+int image_decode_gif(struct image *dest,struct image *dest_alpha,
+		     unsigned char *src,unsigned long len);
diff --git a/src/modules/image/lzw.c b/src/modules/image/lzw.c
index a2960e8abe..cb6a0e0091 100644
--- a/src/modules/image/lzw.c
+++ b/src/modules/image/lzw.c
@@ -90,7 +90,7 @@ static void lzw_recurse_find_code(struct lzw *lzw,lzwcode_t codeno)
 }
 #endif
 
-static void lzw_output(struct lzw *lzw,lzwcode_t codeno)
+static INLINE void lzw_output(struct lzw *lzw,lzwcode_t codeno)
 {
    int bits,bitp;
    unsigned char c;
diff --git a/src/modules/image/lzw.h b/src/modules/image/lzw.h
index 8ccd273459..9c5235b091 100644
--- a/src/modules/image/lzw.h
+++ b/src/modules/image/lzw.h
@@ -15,15 +15,24 @@ struct lzw
    unsigned char *out,lastout;
    struct lzwc 
    {
-      lzwcode_t no;
       unsigned char c;
-      struct lzwc *firstchild;
-      struct lzwc *next;
-   } *code,*current;
+      lzwcode_t firstchild;
+      lzwcode_t next;
+   } *code;
+   lzwcode_t current,firstfree;
+#ifndef GIF_LZW
+   unsigned long alloced;
+#endif
 };
 
+#define LZWCNULL ((lzwcode_t)(~0))
+
 void lzw_add(struct lzw *lzw,int c);
 void lzw_quit(struct lzw *lzw);
 void lzw_init(struct lzw *lzw,int bits);
+unsigned long lzw_unpack(unsigned char *dest,unsigned long destlen,
+			 unsigned char *src,unsigned long srclen,
+			 int bits);
+
 
 
-- 
GitLab