From 400a51a7521a51d4876f25916cce13bf8df8b169 Mon Sep 17 00:00:00 2001
From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org>
Date: Sat, 28 Feb 1998 00:36:50 +0100
Subject: [PATCH] bugfix in P4

Rev: src/modules/Image/encodings/Makefile.in:1.12
Rev: src/modules/Image/encodings/gif.c:1.35
Rev: src/modules/Image/encodings/pnm.c:1.13
---
 src/modules/Image/encodings/Makefile.in | 16 ++--------------
 src/modules/Image/encodings/gif.c       | 18 +++++++++---------
 src/modules/Image/encodings/pnm.c       | 13 +++++++------
 3 files changed, 18 insertions(+), 29 deletions(-)

diff --git a/src/modules/Image/encodings/Makefile.in b/src/modules/Image/encodings/Makefile.in
index 50528e782f..f2468c0eac 100644
--- a/src/modules/Image/encodings/Makefile.in
+++ b/src/modules/Image/encodings/Makefile.in
@@ -1,11 +1,9 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../../..:../../..
-GIF_OBJS = gif.o gif_lzw.o png.o
-JPEG_OBJS = jpeg.o
-PNG_OBJS = png.o
+GIF_OBJS = gif.o gif_lzw.o 
 PNM_OBJS = pnm.o 
 X_OBJS = x.o
-OBJS=gif.a pnm.a png.a x.a
+OBJS=gif.a pnm.a x.a
 
 @SET_MAKE@
 
@@ -29,16 +27,6 @@ x.a : $(X_OBJS)
 	$(AR) cq x.a $(X_OBJS)
 	$(RANLIB) x.a
 
-png.a : $(PNG_OBJS)
-	rm -f png.a
-	$(AR) cq png.a $(PNG_OBJS)
-	$(RANLIB) png.a
-
-jpeg.a : $(JPEG_OBJS)
-	rm -f jpeg.a
-	$(AR) cq jpeg.a $(JPEG_OBJS)
-	$(RANLIB) jpeg.a
-
 pnm.a : $(PNM_OBJS)
 	rm -f pnm.a
 	$(AR) cq pnm.a $(PNM_OBJS)
diff --git a/src/modules/Image/encodings/gif.c b/src/modules/Image/encodings/gif.c
index 66a2201d60..dc20a39523 100644
--- a/src/modules/Image/encodings/gif.c
+++ b/src/modules/Image/encodings/gif.c
@@ -1,9 +1,9 @@
-/* $Id: gif.c,v 1.34 1998/02/19 01:46:01 per Exp $ */
+/* $Id: gif.c,v 1.35 1998/02/27 23:36:49 mirar Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: gif.c,v 1.34 1998/02/19 01:46:01 per Exp $
+**!	$Id: gif.c,v 1.35 1998/02/27 23:36:49 mirar Exp $
 **! submodule GIF
 **!
 **!	This submodule keep the GIF encode/decode capabilities
@@ -31,7 +31,7 @@
 
 #include "stralloc.h"
 #include "global.h"
-RCSID("$Id: gif.c,v 1.34 1998/02/19 01:46:01 per Exp $");
+RCSID("$Id: gif.c,v 1.35 1998/02/27 23:36:49 mirar Exp $");
 #include "pike_macros.h"
 #include "object.h"
 #include "constants.h"
@@ -2279,7 +2279,7 @@ void image_gif__encode(INT32 args)
 
 /** module *******************************************/
 
-struct program *image_gif_module_program=NULL;
+struct program *image_encoding_gif_program=NULL;
 
 void init_image_gif(void)
 {
@@ -2333,8 +2333,8 @@ void init_image_gif(void)
 
    /** done **/
 
-   image_gif_module_program=end_program();
-   push_object(clone_object(image_gif_module_program,0));
+   image_encoding_gif_program=end_program();
+   push_object(clone_object(image_encoding_gif_program,0));
    {
      struct pike_string *s=make_shared_string("GIF");
      add_constant(s,sp-1,0);
@@ -2345,9 +2345,9 @@ void init_image_gif(void)
 
 void exit_image_gif(void)
 {
-  if(image_gif_module_program)
+  if(image_encoding_gif_program)
   {
-    free_program(image_gif_module_program);
-    image_gif_module_program=0;
+    free_program(image_encoding_gif_program);
+    image_encoding_gif_program=0;
   }
 }
diff --git a/src/modules/Image/encodings/pnm.c b/src/modules/Image/encodings/pnm.c
index 5ee0c43e11..8b19f6f353 100644
--- a/src/modules/Image/encodings/pnm.c
+++ b/src/modules/Image/encodings/pnm.c
@@ -1,9 +1,9 @@
-/* $Id: pnm.c,v 1.12 1998/01/25 08:27:15 hubbe Exp $ */
+/* $Id: pnm.c,v 1.13 1998/02/27 23:36:50 mirar Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: pnm.c,v 1.12 1998/01/25 08:27:15 hubbe Exp $
+**!	$Id: pnm.c,v 1.13 1998/02/27 23:36:50 mirar Exp $
 **! submodule PNM
 **!
 **!	This submodule keeps the PNM encode/decode capabilities
@@ -49,7 +49,7 @@
 
 #include "stralloc.h"
 #include "global.h"
-RCSID("$Id: pnm.c,v 1.12 1998/01/25 08:27:15 hubbe Exp $");
+RCSID("$Id: pnm.c,v 1.13 1998/02/27 23:36:50 mirar Exp $");
 #include "pike_macros.h"
 #include "object.h"
 #include "constants.h"
@@ -409,6 +409,7 @@ void img_pnm_encode_P4(INT32 args) /* binary PBM */
 
    y=img->ysize;
    s=img->img;
+
    c=(unsigned char*)((b=begin_shared_string(((img->xsize+7)>>3)*
 					     img->ysize))->str);
    if (img->xsize)
@@ -423,7 +424,7 @@ void img_pnm_encode_P4(INT32 args) /* binary PBM */
 	 if (!(bit>>=1)) { *(++c)=0; bit=128; }
 	 s++;
       }
-      if (y && bit>1) *(++c)=0; 
+      if (bit!=128) ++c;
    }
    b=end_shared_string(b);
 
@@ -518,9 +519,9 @@ void img_pnm_encode_ascii(INT32 args)
    if (args<1 ||
        sp[-args].type!=T_OBJECT ||
        !(img=(struct image*)get_storage(sp[-args].u.object,image_program)))
-      error("Image.PNM.encode_binary(): Illegal arguments\n");
+      error("Image.PNM.encode_ascii(): Illegal arguments\n");
    if (!img->img)
-      error("Image.PNM.encode_binary(): Given image is empty\n");
+      error("Image.PNM.encode_ascii(): Given image is empty\n");
 
    func=img_pnm_encode_P1; /* PBM */
    n=img->xsize*img->ysize;
-- 
GitLab