diff --git a/.gitattributes b/.gitattributes index 5f2a7caf91f19560955dbaa7f200bb6326ddd90f..33005a29fee21980790a0fdf33e8064209a67149 100644 --- a/.gitattributes +++ b/.gitattributes @@ -246,6 +246,7 @@ testfont binary /src/modules/Image/encodings/avs.c foreign_ident /src/modules/Image/encodings/bmp.c foreign_ident /src/modules/Image/encodings/configure.in foreign_ident +/src/modules/Image/encodings/encodings.h foreign_ident /src/modules/Image/encodings/gd.c foreign_ident /src/modules/Image/encodings/gif.c foreign_ident /src/modules/Image/encodings/gif_lzw.c foreign_ident diff --git a/src/modules/Image/encodings/any.c b/src/modules/Image/encodings/any.c index 3b3f2fcaaad53393196ae8d3fb555c887a04c842..811e307088260136aaaa08d410216a2a2a196cb4 100644 --- a/src/modules/Image/encodings/any.c +++ b/src/modules/Image/encodings/any.c @@ -1,9 +1,9 @@ -/* $Id: any.c,v 1.16 2000/03/22 18:12:19 peter Exp $ */ +/* $Id: any.c,v 1.17 2000/07/03 13:30:32 grubba Exp $ */ /* **! module Image **! note -**! $Id: any.c,v 1.16 2000/03/22 18:12:19 peter Exp $ +**! $Id: any.c,v 1.17 2000/07/03 13:30:32 grubba Exp $ **! submodule ANY **! **! This method calls the other decoding methods @@ -23,7 +23,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: any.c,v 1.16 2000/03/22 18:12:19 peter Exp $"); +RCSID("$Id: any.c,v 1.17 2000/07/03 13:30:32 grubba Exp $"); #include "pike_macros.h" #include "operators.h" #include "builtin_functions.h" @@ -38,13 +38,7 @@ RCSID("$Id: any.c,v 1.16 2000/03/22 18:12:19 peter Exp $"); #include "image.h" -void image_gif__decode(INT32 args); -void image_pnm_decode(INT32 args); -void image_xwd__decode(INT32 args); -void image_ilbm_decode(INT32 args); -void image_ras_decode(INT32 args); -void image_pvr_f_decode_header(INT32 args); -void image_tim_f_decode_header(INT32 args); +#include "encodings.h" /* **! method mapping _decode(string data) diff --git a/src/modules/Image/encodings/bmp.c b/src/modules/Image/encodings/bmp.c index 26eda2794ffa0aa92222d707bb6e5fe0ead8a162..cf54daa064c70f360373dd2da10bf00f9a747cae 100644 --- a/src/modules/Image/encodings/bmp.c +++ b/src/modules/Image/encodings/bmp.c @@ -1,9 +1,9 @@ -/* $Id: bmp.c,v 1.20 2000/02/03 12:25:18 grubba Exp $ */ +/* $Id: bmp.c,v 1.21 2000/07/03 13:30:32 grubba Exp $ */ /* **! module Image **! note -**! $Id: bmp.c,v 1.20 2000/02/03 12:25:18 grubba Exp $ +**! $Id: bmp.c,v 1.21 2000/07/03 13:30:32 grubba Exp $ **! submodule BMP **! **! This submodule keeps the BMP (Windows Bitmap) @@ -22,7 +22,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: bmp.c,v 1.20 2000/02/03 12:25:18 grubba Exp $"); +RCSID("$Id: bmp.c,v 1.21 2000/07/03 13:30:32 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -40,6 +40,8 @@ RCSID("$Id: bmp.c,v 1.20 2000/02/03 12:25:18 grubba Exp $"); #include "builtin_functions.h" +#include "encodings.h" + extern void f_add(INT32 args); extern struct program *image_colortable_program; @@ -189,7 +191,7 @@ void img_bmp_encode(INT32 args) else SIMPLE_BAD_ARG_ERROR("Image.BMP.encode",2,"mapping|object|int\n"); - if (bpp==0) + if (bpp==0) { if (!nct) bpp=24; else if (image_colortable_size(nct)<=2 && !rle) @@ -198,6 +200,7 @@ void img_bmp_encode(INT32 args) bpp=4; else bpp=8; + } switch (bpp) { @@ -499,7 +502,7 @@ void i_img_bmp__decode(INT32 args,int header_only) if (sp[-args].u.string->size_shift) SIMPLE_BAD_ARG_ERROR("Image.BMP.decode",1,"8 bit string"); - if (args>1) + if (args>1) { if (sp[1-args].type!=T_MAPPING) SIMPLE_BAD_ARG_ERROR("Image.BMP.decode",2,"mapping"); else @@ -508,6 +511,7 @@ void i_img_bmp__decode(INT32 args,int header_only) MAKE_CONSTANT_SHARED_STRING(qs,"quality"); parameter_int(sp+1-args,qs,&quality); } + } os=s=(p_wchar0*)sp[-args].u.string->str; len=sp[-args].u.string->len; diff --git a/src/modules/Image/encodings/encodings.h b/src/modules/Image/encodings/encodings.h new file mode 100644 index 0000000000000000000000000000000000000000..d8c1240bbca8499f6e59135e99e912f24ec96b16 --- /dev/null +++ b/src/modules/Image/encodings/encodings.h @@ -0,0 +1,22 @@ +/* + * $Id: encodings.h,v 1.1 2000/07/03 13:30:32 grubba Exp $ + */ + +#ifndef IMAGE_ENCODINGS_ENCODINGS_H +#define IMAGE_ENCODINGS_ENCODINGS_H + +void image_gif__decode(INT32 args); +void image_gif_decode_map(INT32 args); +void image_pvr_f__decode(INT32 args); +void image_pvr_f_decode_header(INT32 args); +void image_tim_f__decode(INT32 args); +void image_tim_f_decode_header(INT32 args); +void image_xwd__decode(INT32 args); +void image_xwd_decode_header(INT32 args); +void img_bmp__decode(INT32 args); +void img_bmp_decode_header(INT32 args); +void img_ilbm_decode(INT32 args); +void img_pnm_decode(INT32 args); +void img_ras_decode(INT32 args); + +#endif /* !IMAGE_ENCODINGS_ENCODINGS_H */ diff --git a/src/modules/Image/encodings/gif.c b/src/modules/Image/encodings/gif.c index d8b52361f2c80d6377c25530b038c5da5a0b650a..f9da94420bda1d814a7d18aa02e8f37af72dad43 100644 --- a/src/modules/Image/encodings/gif.c +++ b/src/modules/Image/encodings/gif.c @@ -1,9 +1,9 @@ -/* $Id: gif.c,v 1.50 1999/11/14 22:16:08 mast Exp $ */ +/* $Id: gif.c,v 1.51 2000/07/03 13:30:32 grubba Exp $ */ /* **! module Image **! note -**! $Id: gif.c,v 1.50 1999/11/14 22:16:08 mast Exp $ +**! $Id: gif.c,v 1.51 2000/07/03 13:30:32 grubba Exp $ **! submodule GIF **! **! This submodule keep the GIF encode/decode capabilities @@ -31,7 +31,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: gif.c,v 1.50 1999/11/14 22:16:08 mast Exp $"); +RCSID("$Id: gif.c,v 1.51 2000/07/03 13:30:32 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -49,6 +49,8 @@ RCSID("$Id: gif.c,v 1.50 1999/11/14 22:16:08 mast Exp $"); #include "gif_lzw.h" +#include "encodings.h" + extern struct program *image_colortable_program; extern struct program *image_program; extern struct program *image_layer_program; @@ -2638,7 +2640,7 @@ static void image_gif_lzw_decode(INT32 args) last=n; m++; - if (m>=maxcode - earlychange) + if (m>=maxcode - earlychange) { if (m==MAX_GIF_CODE - earlychange) { #ifdef GIF_DEBUG @@ -2660,6 +2662,7 @@ static void image_gif_lzw_decode(INT32 args) break; /* error! too much codes */ } } + } } if (reversebits) diff --git a/src/modules/Image/encodings/ilbm.c b/src/modules/Image/encodings/ilbm.c index 0663a2d0d8660b26d92fa43e56f8563ade5a253e..d52513fb0df4aabb816b248a74a4c3f7e316eaa3 100644 --- a/src/modules/Image/encodings/ilbm.c +++ b/src/modules/Image/encodings/ilbm.c @@ -1,9 +1,9 @@ -/* $Id: ilbm.c,v 1.13 2000/02/03 19:01:29 grubba Exp $ */ +/* $Id: ilbm.c,v 1.14 2000/07/03 13:30:32 grubba Exp $ */ /* **! module Image **! note -**! $Id: ilbm.c,v 1.13 2000/02/03 19:01:29 grubba Exp $ +**! $Id: ilbm.c,v 1.14 2000/07/03 13:30:32 grubba Exp $ **! submodule ILBM **! **! This submodule keep the ILBM encode/decode capabilities @@ -14,7 +14,7 @@ #include "global.h" #include "stralloc.h" -RCSID("$Id: ilbm.c,v 1.13 2000/02/03 19:01:29 grubba Exp $"); +RCSID("$Id: ilbm.c,v 1.14 2000/07/03 13:30:32 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -30,6 +30,8 @@ RCSID("$Id: ilbm.c,v 1.13 2000/02/03 19:01:29 grubba Exp $"); #include "image.h" #include "colortable.h" +#include "encodings.h" + extern struct program *image_colortable_program; extern struct program *image_program; diff --git a/src/modules/Image/encodings/png.c b/src/modules/Image/encodings/png.c index 7ddfa2f1887cfc87df14267a7b99cce4031e8bf2..c2d234bff5475fdd6da93f12cf569ab80d5318be 100644 --- a/src/modules/Image/encodings/png.c +++ b/src/modules/Image/encodings/png.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: png.c,v 1.31 2000/05/07 00:04:58 per Exp $"); +RCSID("$Id: png.c,v 1.32 2000/07/03 13:30:32 grubba Exp $"); #include "image_machine.h" @@ -375,7 +375,7 @@ static void image_png___decode(INT32 args) */ static struct pike_string *_png_unfilter(unsigned char *data, - INT32 len, + size_t len, int xsize,int ysize, int filter,int type, int bpp, @@ -416,7 +416,7 @@ static struct pike_string *_png_unfilter(unsigned char *data, #if 0 fprintf(stderr, "%05d 0x%08lx %02x %02x %02x > %02x < %02x %02x %02x " - "len=%d xsize=%d sbb=%d next=0x%08lx d=0x%lx nd=0x%lx\n", + "len=%ld xsize=%d sbb=%d next=0x%08lx d=0x%lx nd=0x%lx\n", ysize+1,(unsigned long)s, s[-3],s[-2],s[-1],s[0],s[1],s[2],s[3], len,xsize,sbb, diff --git a/src/modules/Image/encodings/pnm.c b/src/modules/Image/encodings/pnm.c index 4841b772c04ee74511dfbabc5cea6fdd25bcd7bf..5633cea402b48060f77e23490bcde5b334c3c418 100644 --- a/src/modules/Image/encodings/pnm.c +++ b/src/modules/Image/encodings/pnm.c @@ -1,9 +1,9 @@ -/* $Id: pnm.c,v 1.20 1999/06/19 11:08:00 mirar Exp $ */ +/* $Id: pnm.c,v 1.21 2000/07/03 13:30:32 grubba Exp $ */ /* **! module Image **! note -**! $Id: pnm.c,v 1.20 1999/06/19 11:08:00 mirar Exp $ +**! $Id: pnm.c,v 1.21 2000/07/03 13:30:32 grubba Exp $ **! submodule PNM **! **! This submodule keeps the PNM encode/decode capabilities @@ -49,7 +49,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: pnm.c,v 1.20 1999/06/19 11:08:00 mirar Exp $"); +RCSID("$Id: pnm.c,v 1.21 2000/07/03 13:30:32 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -63,6 +63,8 @@ RCSID("$Id: pnm.c,v 1.20 1999/06/19 11:08:00 mirar Exp $"); #include "image.h" #include "builtin_functions.h" +#include "encodings.h" + extern struct program *image_colortable_program; extern struct program *image_program; diff --git a/src/modules/Image/encodings/pvr.c b/src/modules/Image/encodings/pvr.c index b9693cce8178ebc444752a55fcff586b149649cc..0d20d93348d54837c591fdc8434b80ef40d6c0e2 100644 --- a/src/modules/Image/encodings/pvr.c +++ b/src/modules/Image/encodings/pvr.c @@ -4,7 +4,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: pvr.c,v 1.7 2000/03/05 19:24:17 marcus Exp $"); +RCSID("$Id: pvr.c,v 1.8 2000/07/03 13:30:32 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -22,6 +22,8 @@ RCSID("$Id: pvr.c,v 1.7 2000/03/05 19:24:17 marcus Exp $"); #include "image.h" +#include "encodings.h" + extern struct program *image_program; /* @@ -227,7 +229,7 @@ void image_pvr_f_encode(INT32 args) struct object *imgo; struct mapping *optm = NULL; struct image *alpha = NULL, *img; - INT32 gbix, sz, attr; + INT32 gbix=0, sz, attr=0; int has_gbix=0, twiddle=0; struct pike_string *res; unsigned char *dst; @@ -245,13 +247,14 @@ void image_pvr_f_encode(INT32 args) (alpha=(struct image*)get_storage(s->u.object, image_program))==NULL) error("Image.PVR.encode: option (arg 2) \"alpha\" has illegal type\n"); if((s = simple_mapping_string_lookup(optm, "global_index"))!=NULL && - !IS_UNDEFINED(s)) + !IS_UNDEFINED(s)) { if(s->type == T_INT) { gbix = s->u.integer; has_gbix=1; } else error("Image.PVR.encode: option (arg 2) \"global_index\" has illegal type\n"); + } } if (!img->img) diff --git a/src/modules/Image/encodings/ras.c b/src/modules/Image/encodings/ras.c index e22059cc33caadb61d91887f96025bc07beabd10..6a34e78876ff3e3a97ce6d8125393a42656d4533 100644 --- a/src/modules/Image/encodings/ras.c +++ b/src/modules/Image/encodings/ras.c @@ -1,9 +1,9 @@ -/* $Id: ras.c,v 1.5 2000/02/03 19:01:29 grubba Exp $ */ +/* $Id: ras.c,v 1.6 2000/07/03 13:30:32 grubba Exp $ */ /* **! module Image **! note -**! $Id: ras.c,v 1.5 2000/02/03 19:01:29 grubba Exp $ +**! $Id: ras.c,v 1.6 2000/07/03 13:30:32 grubba Exp $ **! submodule RAS **! **! This submodule keep the RAS encode/decode capabilities @@ -14,7 +14,7 @@ #include "global.h" #include "stralloc.h" -RCSID("$Id: ras.c,v 1.5 2000/02/03 19:01:29 grubba Exp $"); +RCSID("$Id: ras.c,v 1.6 2000/07/03 13:30:32 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -32,6 +32,8 @@ RCSID("$Id: ras.c,v 1.5 2000/02/03 19:01:29 grubba Exp $"); #include "image.h" #include "colortable.h" +#include "encodings.h" + extern struct program *image_colortable_program; extern struct program *image_program; @@ -117,7 +119,7 @@ void img_ras_decode(INT32 args) unsigned char *src, *tmpdata=NULL; INT32 len, x, y; unsigned int numcolors = 0; - struct nct_flat_entry *entries; + struct nct_flat_entry *entries = NULL; get_all_args("Image.RAS.decode", args, "%S", &str); @@ -191,7 +193,7 @@ void img_ras_decode(INT32 args) } - if(rs.ras_length) + if(rs.ras_length) { if(rs.ras_length > len) { /* Better to proceed and make a partly black image? */ if(ctab != NULL) @@ -199,9 +201,10 @@ void img_ras_decode(INT32 args) error("Image.RAS.decode: image data truncated\n"); } else len = rs.ras_length; + } if(rs.ras_type == RT_BYTE_ENCODED) { - INT32 img_sz; + INT32 img_sz = 0; switch(rs.ras_depth) { case 1: img_sz = ((rs.ras_width+15)>>4)*2*rs.ras_height; @@ -282,7 +285,7 @@ void img_ras_decode(INT32 args) break; case 1: { - int bits = 0, data; + int bits = 0, data = 0; for(x=0; x<rs.ras_width; x++) { if(!bits) { if(len<2) { @@ -405,7 +408,7 @@ static void image_ras_encode(INT32 args) struct rasterfile rs; struct nct_dither dith; rgb_group *rgb; - INT32 x, y, llen; + INT32 x, y, llen = 0; unsigned char *dst; void (*ctfunc)(rgb_group *, unsigned char *, int, struct neo_colortable *, struct nct_dither *, int) = NULL; diff --git a/src/modules/Image/encodings/tim.c b/src/modules/Image/encodings/tim.c index a0a2b4a97550447b4c65dd64fae31a42ad6a705b..c81798496fcc8ccef844968657123e790977e15c 100644 --- a/src/modules/Image/encodings/tim.c +++ b/src/modules/Image/encodings/tim.c @@ -4,7 +4,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: tim.c,v 1.5 2000/04/09 03:19:44 peter Exp $"); +RCSID("$Id: tim.c,v 1.6 2000/07/03 13:30:32 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -22,6 +22,8 @@ RCSID("$Id: tim.c,v 1.5 2000/04/09 03:19:44 peter Exp $"); #include "image.h" +#include "encodings.h" + extern struct program *image_program; /* diff --git a/src/modules/Image/encodings/xwd.c b/src/modules/Image/encodings/xwd.c index ebad87d110c0e7d62489da66013f91865fcaac07..9363fdf29620361fcb7dab379ac383c269cafe41 100644 --- a/src/modules/Image/encodings/xwd.c +++ b/src/modules/Image/encodings/xwd.c @@ -1,9 +1,9 @@ -/* $Id: xwd.c,v 1.13 2000/01/11 01:42:36 mast Exp $ */ +/* $Id: xwd.c,v 1.14 2000/07/03 13:30:32 grubba Exp $ */ /* **! module Image **! note -**! $Id: xwd.c,v 1.13 2000/01/11 01:42:36 mast Exp $ +**! $Id: xwd.c,v 1.14 2000/07/03 13:30:32 grubba Exp $ **! submodule XWD **! **! This submodule keeps the XWD (X Windows Dump) @@ -25,7 +25,7 @@ #include <ctype.h> #include "stralloc.h" -RCSID("$Id: xwd.c,v 1.13 2000/01/11 01:42:36 mast Exp $"); +RCSID("$Id: xwd.c,v 1.14 2000/07/03 13:30:32 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -39,6 +39,8 @@ RCSID("$Id: xwd.c,v 1.13 2000/01/11 01:42:36 mast Exp $"); #include "image.h" #include "builtin_functions.h" +#include "encodings.h" + extern struct program *image_colortable_program; extern struct program *image_program;