File magicpoint-1.13a-gcc15-fix.patch of Package mgp
---
contrib/xwintoppm/dsimple.c | 92 ++++++++++++++---------------------
contrib/xwintoppm/dsimple.h | 32 +++++++-----
contrib/xwintoppm/list.h | 2
contrib/xwintoppm/multiVis.c | 16 +-----
contrib/xwintoppm/multiVis.h | 2
contrib/xwintoppm/xwintoppm.c | 38 ++++++--------
ctlwords.c | 3 -
draw.c | 8 ++-
grammar.y | 4 +
image/bright.c | 15 ++---
image/clip.c | 10 ++-
image/cmuwmraster.c | 7 --
image/compress.c | 4 -
image/copyright.h | 2
image/dither.c | 23 ++------
image/faces.c | 6 --
image/fbm.c | 7 --
image/g3.c | 7 --
image/gif.c | 8 ---
image/halftone.c | 4 -
image/image.h | 92 +++++++++++++++++++----------------
image/imagetypes.c | 15 +----
image/imagetypes.h | 72 ++++++++++++++--------------
image/img.c | 9 ---
image/imlib_loader.c | 22 ++------
image/jpeg.c | 9 +--
image/mac.c | 7 --
image/mcidas.c | 9 +--
image/misc.c | 3 -
image/new.c | 37 ++++----------
image/path.c | 2
image/pbm.c | 7 --
image/pcx.c | 7 --
image/png.c | 6 --
image/reduce.c | 39 ++++++++-------
image/rle.c | 12 ++--
image/rle.h | 28 +---------
image/rlelib.c | 108 +++++++++++++++---------------------------
image/rotate.c | 4 -
image/send.c | 2
image/smooth.c | 4 -
image/sunraster.c | 7 --
image/window.c | 8 +--
image/xbitmap.c | 7 --
image/xloadimage.h | 58 ++++++++++++++++------
image/xpixmap.c | 7 --
image/xwd.c | 7 --
image/zio.c | 27 +++-------
image/zoom.c | 4 -
mgp.c | 9 +--
parse.c | 2
51 files changed, 393 insertions(+), 527 deletions(-)
--- a/contrib/xwintoppm/dsimple.c
+++ b/contrib/xwintoppm/dsimple.c
@@ -35,6 +35,7 @@ from the X Consortium.
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <stdio.h>
+#include <stdarg.h>
/*
* Other_stuff.h: Definitions of routines in other_stuff.
*
@@ -48,13 +49,16 @@ char *malloc(), realloc();
#endif
extern Bool silent;
-unsigned long Resolve_Color();
-Pixmap Bitmap_To_Pixmap();
-Window Select_Window();
+unsigned long Resolve_Color(Window w, char *name);
+Pixmap Bitmap_To_Pixmap(Display *dpy, Drawable d, GC gc, Pixmap bitmap,
+ int width, int height);
+Window Select_Window(Display *dpy);
void out();
void blip();
-Window Window_With_Name();
-void Fatal_Error();
+Window Window_With_Name(Display *dpy, Window top, char *name);
+void Fatal_Error(char *msg, ...);
+void usage(void);
+int outl(char *msg, ...);
/*
* Just_display: A group of routines designed to make the writting of simple
@@ -76,8 +80,7 @@ extern int screen;
/*
* Malloc: like malloc but handles out of memory using Fatal_Error.
*/
-char *Malloc(size)
- unsigned size;
+char *Malloc(unsigned size)
{
char *data;
@@ -91,9 +94,7 @@ char *Malloc(size)
/*
* Realloc: like Malloc except for realloc, handles NULL using Malloc.
*/
-char *Realloc(ptr, size)
- char *ptr;
- int size;
+char *Realloc(char *ptr, int size)
{
char *new_ptr;
@@ -111,9 +112,7 @@ char *Realloc(ptr, size)
* Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obselete)
* If found, remove it from command line. Don't go past a lone -.
*/
-char *Get_Display_Name(pargc, argv)
- int *pargc; /* MODIFIED */
- char **argv; /* MODIFIED */
+char *Get_Display_Name(int *pargc, char **argv)
{
int argc = *pargc;
char **pargv = argv+1;
@@ -147,8 +146,7 @@ char *Get_Display_Name(pargc, argv)
* Open_Display: Routine to open a display with correct error handling.
* Does not require dpy or screen defined on entry.
*/
-Display *Open_Display(display_name)
-char *display_name;
+Display *Open_Display(char *display_name)
{
Display *d;
@@ -171,9 +169,7 @@ char *display_name;
* for this display is then stored in screen.
* Does not require dpy or screen defined.
*/
-void Setup_Display_And_Screen(argc, argv)
-int *argc; /* MODIFIED */
-char **argv; /* MODIFIED */
+void Setup_Display_And_Screen(int *argc, char **argv)
{
dpy = Open_Display (Get_Display_Name(argc, argv));
screen = DefaultScreen(dpy);
@@ -183,8 +179,7 @@ char **argv; /* MODIFIED */
/*
* Open_Font: This routine opens a font with error handling.
*/
-XFontStruct *Open_Font(name)
-char *name;
+XFontStruct *Open_Font(char *name)
{
XFontStruct *font;
@@ -211,10 +206,8 @@ static void _bitmap_error(status, filena
Fatal_Error("Out of memory!");
}
-Pixmap ReadBitmapFile(d, filename, width, height, x_hot, y_hot)
- Drawable d;
- char *filename;
- int *width, *height, *x_hot, *y_hot;
+Pixmap ReadBitmapFile(Drawable d, char *filename, int *width, int *height,
+ int *x_hot, int *y_hot)
{
Pixmap bitmap;
int status;
@@ -233,10 +226,8 @@ Pixmap ReadBitmapFile(d, filename, width
* WriteBitmapFile: same as XWriteBitmapFile except it handles errors
* using Fatal_Error.
*/
-void WriteBitmapFile(filename, bitmap, width, height, x_hot, y_hot)
- char *filename;
- Pixmap bitmap;
- int width, height, x_hot, y_hot;
+void WriteBitmapFile(char *filename, Pixmap bitmap, int width, int height,
+ int x_hot, int y_hot)
{
int status;
@@ -269,9 +260,7 @@ void WriteBitmapFile(filename, bitmap, w
* all command line arguments, and other setup is done.
* For examples of usage, see xwininfo, xwd, or xprop.
*/
-Window Select_Window_Args(rargc, argv)
- int *rargc;
- char **argv;
+Window Select_Window_Args(int *rargc, char **argv)
#define ARGC (*rargc)
{
int nargc=1;
@@ -339,9 +328,7 @@ extern int screen;
* on the display. This routine does not require wind to
* be defined.
*/
-unsigned long Resolve_Color(w, name)
- Window w;
- char *name;
+unsigned long Resolve_Color(Window w, char *name)
{
XColor c;
Colormap colormap;
@@ -375,12 +362,8 @@ unsigned long Resolve_Color(w, name)
* Width and height are required solely for efficiency.
* If needed, they can be obtained via. XGetGeometry.
*/
-Pixmap Bitmap_To_Pixmap(dpy, d, gc, bitmap, width, height)
- Display *dpy;
- Drawable d;
- GC gc;
- Pixmap bitmap;
- int width, height;
+Pixmap Bitmap_To_Pixmap(Display *dpy, Drawable d, GC gc, Pixmap bitmap,
+ int width, int height)
{
Pixmap pix;
int x;
@@ -411,8 +394,7 @@ void blip()
* Routine to let user select a window using the mouse
*/
-Window Select_Window(dpy)
- Display *dpy;
+Window Select_Window(Display *dpy)
{
int status;
Cursor cursor;
@@ -462,10 +444,7 @@ Window Select_Window(dpy)
* one found will be returned. Only top and its subwindows
* are looked at. Normally, top should be the RootWindow.
*/
-Window Window_With_Name(dpy, top, name)
- Display *dpy;
- Window top;
- char *name;
+Window Window_With_Name(Display *dpy, Window top, char *name)
{
Window *children, dummy;
unsigned int nchildren;
@@ -494,15 +473,16 @@ Window Window_With_Name(dpy, top, name)
* in code so we can tell where we are. Outl may be invoked like
* printf with up to 7 arguments.
*/
-/* VARARGS1 */
-outl(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6)
- char *msg;
- char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
+int outl(char *msg, ...)
{
+ va_list ap;
+
+ va_start(ap, msg);
fflush(stdout);
- fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ vfprintf(stderr, msg, ap);
fprintf(stderr, "\n");
fflush(stderr);
+ va_end(ap);
return 0;
}
@@ -512,14 +492,16 @@ outl(msg, arg0,arg1,arg2,arg3,arg4,arg5,
* Does not require dpy or screen defined.
*/
/* VARARGS1 */
-void Fatal_Error(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6)
-char *msg;
-char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
+void Fatal_Error(char *msg, ...)
{
+ va_list ap;
+
+ va_start(ap, msg);
fflush(stdout);
fflush(stderr);
fprintf(stderr, "%s: error: ", program_name);
- fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ vfprintf(stderr, msg, ap);
fprintf(stderr, "\n");
+ va_end(ap);
exit(1);
}
--- a/contrib/xwintoppm/dsimple.h
+++ b/contrib/xwintoppm/dsimple.h
@@ -50,16 +50,18 @@ int screen;
/* Declaritions for functions in just_display.c */
-void Fatal_Error();
-char *Malloc();
-char *Realloc();
-char *Get_Display_Name();
-Display *Open_Display();
-void Setup_Display_And_Screen();
-XFontStruct *Open_Font();
-Pixmap ReadBitmapFile();
-void WriteBitmapFile();
-Window Select_Window_Args();
+void Fatal_Error(char *msg, ...);
+char *Malloc(unsigned size);
+char *Realloc(char *ptr, int size);
+char *Get_Display_Name(int *pargc, char **argv);
+Display *Open_Display(char *display_name);
+void Setup_Display_And_Screen(int *argc, char **argv);
+XFontStruct *Open_Font(char *name);
+Pixmap ReadBitmapFile(Drawable d, char *filename, int *width, int *height,
+ int *x_hot, int *y_hot);
+void WriteBitmapFile(char *filename, Pixmap bitmap, int width, int height,
+ int x_hot, int y_hot);
+Window Select_Window_Args(int *rargc, char **argv);
#define X_USAGE "[host:display]" /* X arguments handled by
Get_Display_Name */
@@ -73,9 +75,11 @@ Window Select_Window_Args();
* Send bugs, etc. to chariot@athena.mit.edu.
*/
-unsigned long Resolve_Color();
-Pixmap Bitmap_To_Pixmap();
-Window Select_Window();
+unsigned long Resolve_Color(Window w, char *name);
+Pixmap Bitmap_To_Pixmap(Display *dpy, Drawable d, GC gc, Pixmap bitmap,
+ int width, int height);
+Window Select_Window(Display *dpy);
void out();
void blip();
-Window Window_With_Name();
+int outl(char *msg, ...);
+Window Window_With_Name(Display *dpy, Window top, char *name);
--- a/contrib/xwintoppm/list.h
+++ b/contrib/xwintoppm/list.h
@@ -46,6 +46,8 @@ from the X Consortium.
#define DUP_WHOLE_LIST 0
#define START_AT_CURR 1
+#define NeedFunctionPrototypes 1
+
typedef struct _list_item {
struct _list_item *next;
union {
--- a/contrib/xwintoppm/multiVis.c
+++ b/contrib/xwintoppm/multiVis.c
@@ -972,19 +972,9 @@ static int src_in_region_list( src, imag
/** ------------------------------------------------------------------------
Makes a new entry in image_wins with the given fields filled in.
------------------------------------------------------------------------ **/
-static void add_window_to_list( image_wins, w, xrr, yrr, x_vis, y_vis,
- width, height, border_width,vis, cmap, parent)
- list_ptr image_wins;
- Window w;
- int xrr;
- int yrr;
- int x_vis;
- int y_vis;
- int width;
- int height;
- Visual *vis;
- Colormap cmap;
- Window parent;
+static void add_window_to_list(list_ptr image_wins, Window w, int xrr, int yrr, int x_vis, int y_vis,
+ int width, int height, int border_width,
+ Visual *vis, Colormap cmap, Window parent)
{
image_win_type *new_src;
--- a/contrib/xwintoppm/multiVis.h
+++ b/contrib/xwintoppm/multiVis.h
@@ -37,6 +37,8 @@ from the X Consortium.
------------------------------------------------------------------------ **/
+#define NeedFunctionPrototypes 1
+
extern int GetMultiVisualRegions(
#if NeedFunctionPrototypes
Display *, Window, int, int, unsigned int,
--- a/contrib/xwintoppm/xwintoppm.c
+++ b/contrib/xwintoppm/xwintoppm.c
@@ -139,6 +139,14 @@ long add_pixel_value = 0;
extern int (*_XErrorFunction)();
extern int _XDefaultError();
+void usage(void);
+void Error(char *string);
+int Window_Dump(Window window, FILE *out);
+int Image_Size(XImage *image);
+int Get_XColors(XWindowAttributes *win_info, XColor **colors);
+int _swapshort (char *bp, unsigned n);
+int _swaplong (char *bp, unsigned n);
+
static long parse_long (s)
char *s;
{
@@ -155,11 +163,9 @@ static long parse_long (s)
return (thesign * retval);
}
-main(argc, argv)
- int argc;
- char **argv;
+int main(int argc, char **argv)
{
- register i;
+ register int i;
Window target_win;
FILE *out_file = stdout;
Bool frame_only = False;
@@ -281,9 +287,7 @@ XColor **colors ;
* writting.
*/
-Window_Dump(window, out)
- Window window;
- FILE *out;
+int Window_Dump(Window window, FILE *out)
{
unsigned long swaptest = 1;
XColor *colors;
@@ -610,7 +614,7 @@ Window_Dump(window, out)
/*
* Report the syntax for calling xwd.
*/
-usage()
+void usage(void)
{
fprintf (stderr,
"usage: %s [-display host:dpy] [-debug] [-help] %s [-nobdrs] [-out <file>]",
@@ -624,8 +628,7 @@ usage()
* Error - Fatal xwd error.
*/
-Error(string)
- char *string; /* Error description string. */
+void Error(char *string)
{
outl("\nxwd: Error => %s\n", string);
if (errno != 0) {
@@ -641,8 +644,7 @@ Error(string)
* Determine the pixmap size.
*/
-int Image_Size(image)
- XImage *image;
+int Image_Size(XImage *image)
{
if (image->format != ZPixmap)
return(image->bytes_per_line * image->height * image->depth);
@@ -701,9 +703,7 @@ XColor **colors ;
/*
* Get the XColors of all pixels in image - returns # of colors
*/
-int Get_XColors(win_info, colors)
- XWindowAttributes *win_info;
- XColor **colors;
+int Get_XColors(XWindowAttributes *win_info, XColor **colors)
{
int i, ncolors;
Colormap cmap = win_info->colormap;
@@ -717,9 +717,7 @@ int Get_XColors(win_info, colors)
return ncolors ;
}
-_swapshort (bp, n)
- register char *bp;
- register unsigned n;
+int _swapshort (char *bp, unsigned n)
{
register char c;
register char *ep = bp + n;
@@ -733,9 +731,7 @@ _swapshort (bp, n)
return 0;
}
-_swaplong (bp, n)
- register char *bp;
- register unsigned n;
+int _swaplong (char *bp, unsigned n)
{
register char c;
register char *ep = bp + n;
--- a/ctlwords.c
+++ b/ctlwords.c
@@ -25,8 +25,9 @@ BEGIN {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
-main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
char buf[1024];
char *p, *q;
--- a/draw.c
+++ b/draw.c
@@ -179,6 +179,10 @@ static int zheight[ZIMAGENUM];
#endif
extern int zoomin;
+/* imlib_loader.c */
+extern void manage_pixmap(Pixmap pixmap, int add, int page);
+extern Pixmap pixmap_fromimimage(Imlib_Image *imimage, int width, int height);
+
static int
ispsfilename(p0)
char *p0;
@@ -4361,7 +4365,7 @@ epstoimage(state, epsfile, x, y, width,
struct stat stbuf;
char geom[32], device[64], scalebuf[32];
static char imagefile[MAXPATHLEN];
- void (*sigpipe_handler)();
+ void (*sigpipe_handler)(int);
fd = -1;
for (i = 0; i < 3; i++) {
@@ -5277,7 +5281,7 @@ xft_draw_fragment(state, p, len, registr
static char prefix[3][20] = { "\033$B", "\033$A", "\033$(C"};
char buf16[1024], *p16;
char out16[1024], *o16;
- int ileft, oleft;
+ size_t ileft, oleft;
#ifdef HAVE_ICONV
static iconv_t icv[3];
#endif
--- a/grammar.y
+++ b/grammar.y
@@ -75,6 +75,8 @@ struct ctrl *root;
char *yyfilename;
extern int yylineno;
+int yylex();
+
#ifdef HAVE_STDARG_H
/* GCC complains if we declare this function in traditional style */
void
@@ -178,6 +180,7 @@ gen_int(op, v)
return ct;
}
+#if 0
static struct ctrl *
gen_int2(op, v1, v2)
int op;
@@ -194,6 +197,7 @@ gen_int2(op, v1, v2)
ct->cti2_value2 = v2;
return ct;
}
+#endif
static struct ctrl *
gen_int3(op, v1, v2, v3)
--- a/image/bright.c
+++ b/image/bright.c
@@ -16,10 +16,9 @@ extern void make_gamma(double gamma, int
/* alter an image's brightness by a given percentage
*/
-void brighten(image, percent, verbose)
- Image *image;
- unsigned int percent;
- unsigned int verbose;
+void brighten(Image *image,
+ unsigned int percent,
+ unsigned int verbose)
{ int a;
unsigned int newrgb;
float fperc;
@@ -138,9 +137,8 @@ static void setupNormalizationArray(min,
/* normalize an image.
*/
-Image *normalize(image, verbose)
- Image *image;
- unsigned int verbose;
+Image *normalize(Image *image,
+ unsigned int verbose)
{ unsigned int a, x, y;
unsigned int min, max;
Pixel pixval;
@@ -246,8 +244,7 @@ Image *normalize(image, verbose)
/* convert to grayscale
*/
-void gray(image, verbose)
- Image *image;
+void gray(Image *image, int verbose)
{ int a;
unsigned int size;
Intensity intensity, red, green, blue;
--- a/image/clip.c
+++ b/image/clip.c
@@ -11,10 +11,12 @@
#include "copyright.h"
#include "image.h"
-Image *clip(simage, clipx, clipy, clipw, cliph, verbose)
- Image *simage;
- unsigned int clipx, clipy, clipw, cliph;
- unsigned int verbose;
+Image *clip(Image *simage,
+ unsigned int clipx,
+ unsigned int clipy,
+ unsigned int clipw,
+ unsigned int cliph,
+ unsigned int verbose)
{ Image *image=NULL;
unsigned int x, y;
unsigned int slinelen, dlinelen;
--- a/image/cmuwmraster.c
+++ b/image/cmuwmraster.c
@@ -27,8 +27,7 @@ struct cmuwm_header *headerp;
(int) memToVal(headerp->depth, sizeof(short)));
}
-int cmuwmIdent(fullname, name)
-char *fullname, *name;
+int cmuwmIdent(char *fullname, char *name)
{
ZFILE *zf;
struct cmuwm_header header;
@@ -67,9 +66,7 @@ char *fullname, *name;
return r;
}
-Image* cmuwmLoad(fullname, name, verbose)
-char *fullname, *name;
-unsigned int verbose;
+Image* cmuwmLoad(char *fullname, char *name, unsigned int verbose)
{
ZFILE *zf;
struct cmuwm_header header;
--- a/image/compress.c
+++ b/image/compress.c
@@ -30,9 +30,7 @@
#define NIL_PIXEL 0xffffffff
-void compress_colormap(image, verbose)
- Image *image;
- unsigned int verbose;
+void compress_colormap(Image *image, unsigned int verbose)
{ Pixel hash_table[32768];
Pixel *pixel_table;
Pixel *pixel_map;
--- a/image/copyright.h
+++ b/image/copyright.h
@@ -20,7 +20,7 @@
*/
#ifndef __SABER__
-static const char *Copyright = "Copyright 1989, 1990, 1991, 1992 Jim Frost";
+#define Copyright "Copyright 1989, 1990, 1991, 1992 Jim Frost"
#endif
#define _JIM_COPYRIGHT_
#endif
--- a/image/dither.c
+++ b/image/dither.c
@@ -28,18 +28,16 @@
#define Threshold 16384 /* in the dithering process */
#define MinGrey 0
-static unsigned int tone_scale_adjust();
-static void LeftToRight();
-static void RightToLeft();
+static unsigned int tone_scale_adjust(unsigned int val);
+static void LeftToRight(int *curr, int *next, int width);
+static void RightToLeft(int *curr, int *next, int width);
/*
* simple floyd-steinberg dither with serpentine raster processing
*/
-Image *dither(cimage, verbose)
- Image *cimage;
- unsigned int verbose;
+Image *dither(Image *cimage, unsigned int verbose)
{
Image *image; /* destination image */
unsigned int *grey; /* grey map for source image */
@@ -189,8 +187,7 @@ Image *dither(cimage, verbose)
*
* this should help things look a bit better on most displays.
*/
-static unsigned int tone_scale_adjust(val)
- unsigned int val;
+static unsigned int tone_scale_adjust(unsigned int val)
{
unsigned int rslt;
@@ -207,10 +204,7 @@ static unsigned int tone_scale_adjust(va
/*
* dither a line from left to right
*/
-static void LeftToRight(curr, next, width)
- int *curr;
- int *next;
- int width;
+static void LeftToRight(int *curr, int *next, int width)
{
int idx;
int error;
@@ -232,10 +226,7 @@ static void LeftToRight(curr, next, widt
/*
* dither a line from right to left
*/
-static void RightToLeft(curr, next, width)
- int *curr;
- int *next;
- int width;
+static void RightToLeft(int *curr, int *next, int width)
{
int idx;
int error;
--- a/image/faces.c
+++ b/image/faces.c
@@ -84,8 +84,7 @@ static int nextInt(zf, len)
return(value);
}
-Image *facesLoad(fullname, name, verbose)
- char *fullname, *name;
+Image *facesLoad(char *fullname, char *name, unsigned int verbose)
{ ZFILE *zf;
Image *image;
char fname[BUFSIZ];
@@ -170,8 +169,7 @@ Image *facesLoad(fullname, name, verbose
return(image);
}
-int facesIdent(fullname, name)
- char *fullname, *name;
+int facesIdent(char *fullname, char *name)
{ Image *image;
if ((image = facesLoad(fullname, name, 1))) {
--- a/image/fbm.c
+++ b/image/fbm.c
@@ -192,9 +192,7 @@ static void tellAboutImage(name)
fbmin_img_width, fbmin_img_height, fbmin_img_clrlen / 3);
}
-Image *fbmLoad(fullname, name, verbose)
- char *fullname, *name;
- unsigned int verbose;
+Image *fbmLoad(char *fullname, char *name, unsigned int verbose)
{
ZFILE *zf;
Image *image;
@@ -263,8 +261,7 @@ Image *fbmLoad(fullname, name, verbose)
return(image);
}
-int fbmIdent(fullname, name)
-char *fullname, *name;
+int fbmIdent(char *fullname, char *name)
{
ZFILE *zf;
unsigned int ret;
--- a/image/g3.c
+++ b/image/g3.c
@@ -384,9 +384,7 @@ tryagain:
return(ret);
}
-Image *g3Load(fullname, name, verbose)
- char *fullname, *name;
- unsigned int verbose;
+Image *g3Load(char *fullname, char *name, unsigned int verbose)
{
ZFILE *fd;
@@ -470,8 +468,7 @@ Image *g3Load(fullname, name, verbose)
* it was always getting false positives so now it loads the whole image in
* to see if it's reasonable.
*/
-int g3Ident(fullname, name)
- char *fullname, *name;
+int g3Ident(char *fullname, char *name)
{
Image *image;
--- a/image/gif.c
+++ b/image/gif.c
@@ -32,10 +32,7 @@ static int InterlacedOffset[] = { 0, 4,
/* be read - offsets and jumps... */
static int InterlacedJumps[] = { 8, 8, 4, 2 };
-Image *
-gifLoad(fullname, name, verbose)
- char *fullname, *name;
- unsigned int verbose;
+Image *gifLoad(char *fullname, char *name, unsigned int verbose)
{
byte *pixline;
unsigned char *Buffer, *BufferP;
@@ -190,8 +187,7 @@ gifLoad(fullname, name, verbose)
}
int
-gifIdent(fullname, name)
- char *fullname, *name;
+gifIdent(char *fullname, char *name)
{
GifFileType *gifp;
int ret;
--- a/image/halftone.c
+++ b/image/halftone.c
@@ -152,9 +152,7 @@ static byte DitherBits[GRAYS][4] = {
/* simple dithering algorithm, really optimized for the 4x4 array
*/
-Image *halftone(cimage, verbose)
- Image *cimage;
- unsigned int verbose;
+Image *halftone(Image *cimage, unsigned int verbose)
{ Image *image;
unsigned char *sp, *dp, *dp2; /* data pointers */
unsigned int dindex; /* index into dither array */
--- a/image/image.h
+++ b/image/image.h
@@ -127,78 +127,86 @@ typedef struct {
/* function declarations
*/
-Image *clip(); /* clip.c */
+Image *clip(Image *simage,
+ unsigned int clipx,
+ unsigned int clipy,
+ unsigned int clipw,
+ unsigned int cliph,
+ unsigned int verbose); /* clip.c */
+
+void brighten(Image *image,
+ unsigned int percent,
+ unsigned int verbose); /* bright.c */
+
+void gray(Image *image, int verbose);
+Image *normalize(Image *image,
+ unsigned int verbose);
-void brighten(); /* bright.c */
-void equalize();
-void gray();
-Image *normalize();
+void compress_colormap(Image *image, unsigned int verbose); /* compress.c */
-void compress_colormap(); /* compress.c */
-
-Image *dither(); /* dither.c */
+Image *dither(Image *cimage, unsigned int verbose); /* dither.c */
void fill(); /* fill.c */
void fold(); /* fold.c */
-Image *halftone(); /* halftone.c */
+Image *halftone(Image *cimage, unsigned int verbose); /* halftone.c */
-Image *loadImage(); /* imagetypes.c */
-void identifyImage();
-void goodImage();
+Image *loadImage(char *name, unsigned int verbose); /* imagetypes.c */
+void identifyImage(char *name);
+void goodImage(Image *image, char *func);
Image *merge(); /* merge.c */
extern unsigned long DepthToColorsTable[]; /* new.c */
-unsigned long colorsToDepth();
-char *dupString();
-Image *newBitImage();
-Image *newRGBImage();
-Image *newTrueImage();
-void freeImage();
-void freeImageData();
-void newRGBMapData();
-void freeRGBMapData();
-byte *lcalloc();
-byte *lmalloc();
-void lfree();
+unsigned long colorsToDepth(unsigned long ncolors);
+char *dupString(char *s);
+Image *newBitImage(unsigned int width, unsigned int height);
+Image *newRGBImage(unsigned int width, unsigned int height, unsigned int depth);
+Image *newTrueImage(unsigned int width, unsigned int height);
+void freeImage(Image *image);
+void freeImageData(Image *image);
+void newRGBMapData(RGBMap *rgb, unsigned int size);
+void freeRGBMapData(RGBMap *rgb);
+byte *lcalloc(unsigned int size);
+byte *lmalloc(unsigned int size);
+void lfree(void *area);
#define depthToColors(n) DepthToColorsTable[((n) < 32 ? (n) : 32)]
-Image *reduce(); /* reduce.c */
-Image *expand();
+Image *reduce(Image *image, unsigned int n, unsigned int verbose); /* reduce.c */
+Image *expand(Image *image);
-Image *rotate(); /* rotate.c */
+Image *rotate(Image *simage, int degrees, int verbose); /* rotate.c */
-Image *smooth(); /* smooth.c */
+Image *smooth(Image *image, int iterations, int verbose); /* smooth.c */
/* doMemToVal and doMemToValLSB used to be void type but some compilers
* (particularly the 4.1.1 SunOS compiler) couldn't handle the
* (void)(thing= value) conversion used in the macros.
*/
-unsigned long doMemToVal(); /* value.c */
-unsigned long doValToMem();
-unsigned long doMemToValLSB();
-unsigned long doValToMemLSB();
-void flipBits();
+unsigned long doMemToVal(byte *p, unsigned int len); /* value.c */
+unsigned long doValToMem(unsigned long val, byte *p, unsigned int len);
+unsigned long doMemToValLSB(byte *p, unsigned int len);
+unsigned long doValToMemLSB(unsigned long val, byte *p, unsigned int len);
+void flipBits(byte *p, unsigned int len);
#ifdef __APPLE__
/* darwin has zopen() */
-ZFILE *zzopen(); /* zio.c */
+ZFILE *zzopen(char *name); /* zio.c */
#define zopen zzopen
#else
-ZFILE *zopen(); /* zio.c */
+ZFILE *zopen(char *name); /* zio.c */
#endif
-int zread();
-int zgetc();
-char *zgets();
-void zclose();
-void znocache();
-void zreset();
+int zread(ZFILE *zf, byte *buf, unsigned int len);
+int zgetc(ZFILE *zf);
+char *zgets(byte *buf, unsigned int size, ZFILE *zf);
+void zclose(ZFILE *zf);
+void znocache(ZFILE *zf);
+void zreset(char *filename);
-Image *zoom(); /* zoom.c */
+Image *zoom(Image *oimage, float xzoom, float yzoom, int verbose); /* zoom.c */
/* this returns the (approximate) intensity of an RGB triple
*/
--- a/image/imagetypes.c
+++ b/image/imagetypes.c
@@ -17,8 +17,8 @@
*/
static struct imagetypes {
- int (*identifier)(); /* print out image info if this kind of image */
- Image *(*loader)(); /* load image if this kind of image */
+ int (*identifier)(char *, char *); /* print out image info if this kind of image */
+ Image *(*loader)(char *, char *, unsigned int); /* load image if this kind of image */
char *name; /* name of this image format */
} ImageTypes[] = {
#ifdef USE_IMLIB
@@ -56,9 +56,7 @@ extern int findImage(char *, char *);
/* load a named image
*/
-Image *loadImage(name, verbose)
- char *name;
- unsigned int verbose;
+Image *loadImage(char *name, unsigned int verbose)
{ char fullname[BUFSIZ];
Image *image;
int a;
@@ -83,8 +81,7 @@ Image *loadImage(name, verbose)
/* identify what kind of image a named image is
*/
-void identifyImage(name)
- char *name;
+void identifyImage(char *name)
{ char fullname[BUFSIZ];
int a;
@@ -116,9 +113,7 @@ void supportedImageTypes()
fprintf(stderr, " %s\n", ImageTypes[a].name);
}
-void goodImage(image, func)
- Image *image;
- char *func;
+void goodImage(Image *image, char *func)
{
if (!image) {
fprintf(stderr, "%s: nil image\n", func);
--- a/image/imagetypes.h
+++ b/image/imagetypes.h
@@ -7,42 +7,42 @@
* jim frost 10.15.89
*/
-Image *facesLoad();
-Image *pbmLoad();
-Image *sunRasterLoad();
-Image *gifLoad();
-Image *rleLoad();
-Image *xwdLoad();
-Image *xbitmapLoad();
-Image *xpixmapLoad();
-Image *g3Load();
-Image *fbmLoad();
-Image *pcxLoad();
-Image *imgLoad();
-Image *macLoad();
-Image *cmuwmLoad();
-Image *mcidasLoad();
-Image *jpegLoad();
-Image *imLoad();
+Image *facesLoad(char *fullname, char *name, unsigned int verbose);
+Image *pbmLoad(char *fullname, char *name, unsigned int verbose);
+Image *sunRasterLoad(char *fullname, char *name, unsigned int verbose);
+Image *gifLoad(char *fullname, char *name, unsigned int verbose);
+Image *rleLoad(char *fullname, char *name, unsigned int verbose);
+Image *xwdLoad(char *fullname, char *name, unsigned int verbose);
+Image *xbitmapLoad(char *fullname, char *name, unsigned int verbose);
+Image *xpixmapLoad(char *fullname, char *name, unsigned int verbose);
+Image *g3Load(char *fullname, char *name, unsigned int verbose);
+Image *fbmLoad(char *fullname, char *name, unsigned int verbose);
+Image *pcxLoad(char *fullname, char *name, unsigned int verbose);
+Image *imgLoad(char *fullname, char *name, unsigned int verbose);
+Image *macLoad(char *fullname, char *name, unsigned int verbose);
+Image* cmuwmLoad(char *fullname, char *name, unsigned int verbose);
+Image *mcidasLoad(char *fullname, char *name, unsigned int verbose);
+Image *jpegLoad(char *fullname, char *name, unsigned int verbose);
+Image *imLoad(char *fullname, char *name, unsigned int verbose);
-int facesIdent();
-int pbmIdent();
-int sunRasterIdent();
-int gifIdent();
-int rleIdent();
-int xwdIdent();
-int xbitmapIdent();
-int xpixmapIdent();
-int g3Ident();
-int fbmIdent();
-int pcxIdent();
-int imgIdent();
-int macIdent();
-int cmuwmIdent();
-int mcidasIdent();
-int jpegIdent();
-int imIdent();
+int facesIdent(char *fullname, char *name);
+int pbmIdent(char *fullname, char *name);
+int sunRasterIdent(char *fullname, char *name);
+int gifIdent(char *fullname, char *name);
+int rleIdent(char *fullname, char *name);
+int xwdIdent(char *fullname, char *name);
+int xbitmapIdent(char *fullname, char *ename);
+int xpixmapIdent(char *fullname, char *name);
+int g3Ident(char *fullname, char *name);
+int fbmIdent(char *fullname, char *name);
+int pcxIdent(char *fullname, char *name);
+int imgIdent(char *fullname, char *name);
+int macIdent(char *fullname, char *name);
+int cmuwmIdent(char *fullname, char *name);
+int mcidasIdent(char *fullname, char *name);
+int jpegIdent(char *fullname, char *name);
+int imIdent(char *fullname, char *name);
#ifdef USE_PNG
-int pngIdent();
-Image *pngLoad();
+int pngIdent(char *fullname, char *name);
+Image *pngLoad(char *fullname, char *name, unsigned int verbose);
#endif
--- a/image/img.c
+++ b/image/img.c
@@ -32,9 +32,7 @@ static void IMG_WriteByte(); /* Write
** Returns 1 if file is a GEM Image, 0 otherwise
*/
-unsigned int imgIdent (fullname,name)
-
- char *fullname, *name;
+int imgIdent(char *fullname, char *name)
{
ZFILE *zf; /* Input file */
IMG_Header header; /* GEM Image header info */
@@ -62,10 +60,7 @@ unsigned int imgIdent (fullname,name)
** Returns pointer to allocated struct if successful, NULL otherwise
*/
-Image *imgLoad (fullname,name,verbose)
-
- char *fullname, *name;
- unsigned int verbose;
+Image *imgLoad(char *fullname, char *name, unsigned int verbose)
{
register int i; /* Random index */
ZFILE *zf; /* Input file */
--- a/image/imlib_loader.c
+++ b/image/imlib_loader.c
@@ -21,6 +21,9 @@ int imIdent(char *fullname, char *name)
return 1;
}
+Imlib_Image *search_imdata(char *fullname, Image *image);
+void regist_imdata(char *fullname, Imlib_Image *im, Image *image);
+
Image *imLoad(char *fullname, char *name, unsigned int verbose)
{
static Display *disp = NULL;
@@ -29,8 +32,6 @@ Image *imLoad(char *fullname, char *name
unsigned int w,h, size, i;
DATA32 * argb_data;
byte * rgb_ptr;
- Imlib_Image *search_imdata();
- void regist_imdata();
if (disp == NULL) {
disp=XOpenDisplay(NULL);
@@ -45,7 +46,7 @@ Image *imLoad(char *fullname, char *name
imlib_context_set_colormap(DefaultColormap(disp, DefaultScreen(disp)));
imlib_context_set_drawable(DefaultRootWindow(disp));
}
- if ((im = search_imdata(fullname), image) == NULL) {
+ if ((im = search_imdata(fullname, image)) == NULL) {
/* im = Imlib_load_image(id, fullname); */
im = imlib_load_image(fullname);
}
@@ -123,10 +124,7 @@ Imlib_Image *search_imdata(char *fullnam
return NULL;
}
-void regist_imdata(fullname, im, image)
- char *fullname;
- Imlib_Image *im;
- Image *image;
+void regist_imdata(char *fullname, Imlib_Image *im, Image *image)
{
if (imnum >= IMFILENUM)
return;
@@ -137,9 +135,7 @@ void regist_imdata(fullname, im, image)
imnum ++;
}
-Pixmap pixmap_fromimimage(imimage, width, height)
- Imlib_Image *imimage;
- int width, height;
+Pixmap pixmap_fromimimage(Imlib_Image *imimage, int width, int height)
{
Pixmap pixmap;
#if 0
@@ -154,11 +150,7 @@ Pixmap pixmap_fromimimage(imimage, width
}
#define MAXPMAP 100
-void
-manage_pixmap(pixmap, add, page)
- Pixmap pixmap;
- int add;
- int page;
+void manage_pixmap(Pixmap pixmap, int add, int page)
{
static Pixmap pmap[MAXPMAP];
static int ppage[MAXPMAP];
--- a/image/jpeg.c
+++ b/image/jpeg.c
@@ -54,10 +54,9 @@
#include "image.h"
#include "jpeg.h"
-METHODDEF int read_jpeg_data ();
+METHODDEF int read_jpeg_data (decompress_info_ptr cinfo);
-int jpegIdent(fullname, name)
- char *fullname, *name;
+int jpegIdent(char *fullname, char *name)
{
struct decompress_info_struct cinfo;
struct decompress_methods_struct dc_methods;
@@ -111,9 +110,7 @@ int jpegIdent(fullname, name)
return retv;
}
-Image *jpegLoad(fullname,name,verbose)
- char *fullname,*name;
- unsigned int verbose;
+Image *jpegLoad(char *fullname, char *name, unsigned int verbose)
{
struct decompress_info_struct cinfo;
struct decompress_methods_struct dc_methods;
--- a/image/mac.c
+++ b/image/mac.c
@@ -148,9 +148,7 @@ char *name;
name, macin_img_width, macin_img_height);
}
-Image *macLoad(fullname, name, verbose)
- char *fullname, *name;
- unsigned int verbose;
+Image *macLoad(char *fullname, char *name, unsigned int verbose)
{
ZFILE *zf;
Image *image;
@@ -215,8 +213,7 @@ Image *macLoad(fullname, name, verbose)
return(image);
}
-int macIdent(fullname, name)
-char *fullname, *name;
+int macIdent(char *fullname, char *name)
{
ZFILE *zf;
unsigned int ret;
--- a/image/mcidas.c
+++ b/image/mcidas.c
@@ -7,7 +7,7 @@
#include "xloadimage.h"
#include "mcidas.h"
-char *mc_sensor();
+char *mc_sensor(int);
/*
* convert from little endian to big endian four byte object
@@ -32,8 +32,7 @@ unsigned long lend ;
/* ARGSUSED */
-int mcidasIdent(fullname, name)
- char *fullname, *name;
+int mcidasIdent(char *fullname, char *name)
{ ZFILE *zf;
struct area_dir dir ;
int r;
@@ -65,9 +64,7 @@ int mcidasIdent(fullname, name)
}
-Image *mcidasLoad(fullname, name, verbose)
- char *fullname, *name;
- unsigned int verbose;
+Image *mcidasLoad(char *fullname, char *name, unsigned int verbose)
{ ZFILE *zf;
struct area_dir dir;
struct navigation nav;
--- a/image/misc.c
+++ b/image/misc.c
@@ -120,6 +120,8 @@ char *tail(path)
return(t);
}
+extern void gammacorrect(Image *image, float disp_gam, unsigned int verbose);
+
Image *processImage(disp, scrn, image, options, verbose)
Display *disp;
int scrn;
@@ -129,7 +131,6 @@ Image *processImage(disp, scrn, image, o
{ Image *tmpimage;
XColor xcolor;
unsigned int compressed= 0;
- void gammacorrect();
goodImage(image, "processImage");
--- a/image/new.c
+++ b/image/new.c
@@ -60,8 +60,7 @@ unsigned long DepthToColorsTable[] = {
/* 32 */ 2147483648UL /* bigger than unsigned int; this is good enough */
};
-unsigned long colorsToDepth(ncolors)
- unsigned long ncolors;
+unsigned long colorsToDepth(unsigned long ncolors)
{ unsigned long a;
for (a= 0; (a < 32) && (DepthToColorsTable[a] < ncolors); a++)
@@ -70,8 +69,7 @@ unsigned long colorsToDepth(ncolors)
return(a);
}
-char *dupString(s)
- char *s;
+char *dupString(char *s)
{ char *d;
if (!s)
@@ -81,9 +79,7 @@ char *dupString(s)
return(d);
}
-void newRGBMapData(rgb, size)
- RGBMap *rgb;
- unsigned int size;
+void newRGBMapData(RGBMap *rgb, unsigned int size)
{
rgb->used= 0;
rgb->size= size;
@@ -93,16 +89,14 @@ void newRGBMapData(rgb, size)
rgb->blue= (Intensity *)lmalloc(sizeof(Intensity) * size);
}
-void freeRGBMapData(rgb)
- RGBMap *rgb;
+void freeRGBMapData(RGBMap *rgb)
{
lfree((byte *)rgb->red);
lfree((byte *)rgb->green);
lfree((byte *)rgb->blue);
}
-Image *newBitImage(width, height)
- unsigned int width, height;
+Image *newBitImage(unsigned int width, unsigned int height)
{ Image *image;
unsigned int linelen;
@@ -123,8 +117,7 @@ Image *newBitImage(width, height)
return(image);
}
-Image *newRGBImage(width, height, depth)
- unsigned int width, height, depth;
+Image *newRGBImage(unsigned int width, unsigned int height, unsigned int depth)
{ Image *image;
unsigned int pixlen, numcolors;
@@ -146,8 +139,7 @@ Image *newRGBImage(width, height, depth)
return(image);
}
-Image *newTrueImage(width, height)
- unsigned int width, height;
+Image *newTrueImage(unsigned int width, unsigned int height)
{ Image *image;
image= (Image *)lmalloc(sizeof(Image));
@@ -164,8 +156,7 @@ Image *newTrueImage(width, height)
return(image);
}
-void freeImageData(image)
- Image *image;
+void freeImageData(Image *image)
{
if (image->title) {
lfree((byte *)image->title);
@@ -177,15 +168,13 @@ void freeImageData(image)
lfree(image->alpha);
}
-void freeImage(image)
- Image *image;
+void freeImage(Image *image)
{
freeImageData(image);
lfree((byte *)image);
}
-byte *lmalloc(size)
- unsigned int size;
+byte *lmalloc(unsigned int size)
{ byte *area;
if (size == 0) {
@@ -200,8 +189,7 @@ byte *lmalloc(size)
return(area);
}
-byte *lcalloc(size)
- unsigned int size;
+byte *lcalloc(unsigned int size)
{ byte *area;
if (size == 0) {
@@ -216,8 +204,7 @@ byte *lcalloc(size)
return(area);
}
-void lfree(area)
- byte *area;
+void lfree(void *area)
{
free(area);
}
--- a/image/path.c
+++ b/image/path.c
@@ -258,7 +258,7 @@ char *expandPath(p)
int b1, b2, var;
char *ptr;
- char *getenv();
+ /* char *getenv(); */
buf1[0] = '\0';
buf2[0] = '\0';
--- a/image/pbm.c
+++ b/image/pbm.c
@@ -171,8 +171,7 @@ static int isPBM(zf, name, width, height
return(NOTPBM);
}
-int pbmIdent(fullname, name)
- char *fullname, *name;
+int pbmIdent(char *fullname, char *name)
{ ZFILE *zf;
unsigned int width, height, maxval, ret;
@@ -184,9 +183,7 @@ int pbmIdent(fullname, name)
return(ret != NOTPBM);
}
-Image *pbmLoad(fullname, name, verbose)
- char *fullname, *name;
- unsigned int verbose;
+Image *pbmLoad(char *fullname, char *name, unsigned int verbose)
{ ZFILE *zf;
Image *image=NULL;
int pbm_type;
--- a/image/pcx.c
+++ b/image/pcx.c
@@ -40,8 +40,7 @@
*/
-unsigned int pcxIdent ( fullname, name )
- char *fullname, *name;
+int pcxIdent(char *fullname, char *name)
{
ZFILE *zf;
unsigned int ret;
@@ -292,9 +291,7 @@ static void PCX_LoadImage ( zf ,image )
** Returns pointer to allocated struct if successful, NULL otherwise
*/
-Image *pcxLoad ( fullname, name, verbose )
- char *fullname, *name;
- unsigned int verbose;
+Image *pcxLoad(char *fullname, char *name, unsigned int verbose)
{
ZFILE *zf;
unsigned int i;
--- a/image/png.c
+++ b/image/png.c
@@ -44,12 +44,10 @@
#define PNG_CHECK_BYTES 4
int
-pngIdent(char *fullname, char *name) {}
+pngIdent(char *fullname, char *name) { return 0; }
Image *
-pngLoad(fullname, name, verbose)
- char *fullname, *name;
- unsigned int verbose;
+pngLoad(char *fullname, char *name, unsigned int verbose)
{
FILE *fp;
png_structp png_ptr;
--- a/image/reduce.c
+++ b/image/reduce.c
@@ -81,7 +81,7 @@ unsigned long colorDistance(rgb, a, b)
struct color_area {
unsigned short *pixels; /* array of pixel values in this area */
unsigned short num_pixels; /* size of above array */
- int (*sort_func)(); /* predicate func to sort with before
+ int (*sort_func)(const void *, const void *); /* predicate func to sort with before
* splitting */
unsigned long pixel_count; /* # of image pixels we represent */
struct color_area *prev, *next;
@@ -90,9 +90,10 @@ struct color_area {
/* predicate functions for qsort
*/
-static int sortRGB(p1, p2)
- unsigned short *p1, *p2;
+static int sortRGB(const void *_p1, const void *_p2)
{ unsigned int red1, green1, blue1, red2, green2, blue2;
+ unsigned short *p1 = (unsigned short *)_p1;
+ unsigned short *p2 = (unsigned short *)_p2;
red1= RED_INTENSITY(*p1);
green1= GREEN_INTENSITY(*p1);
@@ -117,9 +118,10 @@ static int sortRGB(p1, p2)
return(1);
}
-static int sortRBG(p1, p2)
- unsigned short *p1, *p2;
+static int sortRBG(const void *_p1, const void *_p2)
{ unsigned int red1, green1, blue1, red2, green2, blue2;
+ const unsigned short *p1 = (unsigned short *)_p1;
+ const unsigned short *p2 = (unsigned short *)_p2;
red1= RED_INTENSITY(*p1);
green1= GREEN_INTENSITY(*p1);
@@ -144,9 +146,10 @@ static int sortRBG(p1, p2)
return(1);
}
-static int sortGRB(p1, p2)
- unsigned short *p1, *p2;
+static int sortGRB(const void *_p1, const void *_p2)
{ unsigned int red1, green1, blue1, red2, green2, blue2;
+ const unsigned short *p1 = (unsigned short *)_p1;
+ const unsigned short *p2 = (unsigned short *)_p2;
red1= RED_INTENSITY(*p1);
green1= GREEN_INTENSITY(*p1);
@@ -171,9 +174,10 @@ static int sortGRB(p1, p2)
return(1);
}
-static int sortGBR(p1, p2)
- unsigned short *p1, *p2;
+static int sortGBR(const void *_p1, const void *_p2)
{ unsigned int red1, green1, blue1, red2, green2, blue2;
+ const unsigned short *p1 = (unsigned short *)_p1;
+ const unsigned short *p2 = (unsigned short *)_p2;
red1= RED_INTENSITY(*p1);
green1= GREEN_INTENSITY(*p1);
@@ -198,9 +202,10 @@ static int sortGBR(p1, p2)
return(1);
}
-static int sortBRG(p1, p2)
- unsigned short *p1, *p2;
+static int sortBRG(const void *_p1, const void *_p2)
{ unsigned int red1, green1, blue1, red2, green2, blue2;
+ const unsigned short *p1 = (unsigned short *)_p1;
+ const unsigned short *p2 = (unsigned short *)_p2;
red1= RED_INTENSITY(*p1);
green1= GREEN_INTENSITY(*p1);
@@ -225,9 +230,10 @@ static int sortBRG(p1, p2)
return(1);
}
-static int sortBGR(p1, p2)
- unsigned short *p1, *p2;
+static int sortBGR(const void *_p1, const void *_p2)
{ unsigned int red1, green1, blue1, red2, green2, blue2;
+ const unsigned short *p1 = (unsigned short *)_p1;
+ const unsigned short *p2 = (unsigned short *)_p2;
red1= RED_INTENSITY(*p1);
green1= GREEN_INTENSITY(*p1);
@@ -364,9 +370,7 @@ static void insertColorArea(pixel_counts
*rsmallest= smallest;
}
-Image *reduce(image, n, verbose)
- Image *image;
- unsigned int n, verbose;
+Image *reduce(Image *image, unsigned int n, unsigned int verbose)
{ unsigned long pixel_counts[32768]; /* pixel occurrance histogram */
unsigned short pixel_array[32768];
unsigned long count, midpoint;
@@ -577,8 +581,7 @@ Image *reduce(image, n, verbose)
/* expand an image into a true color image
*/
-Image *expand(image)
- Image *image;
+Image *expand(Image *image)
{
Image *new_image;
int x, y;
--- a/image/rle.c
+++ b/image/rle.c
@@ -25,7 +25,10 @@
#include "image.h"
#include "rle.h"
-void dithermap();
+void dithermap(int levels, double gamma, int rgbmap[][3],
+ int divN[256],
+ int modN[256],
+ int magic[16][16]);
/* input file stuff */
static int ptype; /* picture type : */
@@ -100,8 +103,7 @@ static void c_m_line(dp,number,line)
}
}
-int rleIdent(fullname, name)
- char *fullname, *name;
+int rleIdent(char *fullname, char *name)
{
ZFILE *rlefile;
int x_len,y_len;
@@ -184,9 +186,7 @@ int rleIdent(fullname, name)
}
}
-Image *rleLoad(fullname,name,verbose)
- char *fullname,*name;
- unsigned int verbose;
+Image *rleLoad(char *fullname, char *name, unsigned int verbose)
{
int x_len, y_len;
int i,j;
--- a/image/rle.h
+++ b/image/rle.h
@@ -148,42 +148,22 @@ extern struct sv_globals {
* buildmap - build a more usable colormap from data in globals struct.
*/
extern rle_pixel **
-buildmap();
-/* ( globals, minmap, gamma )
- * struct sv_globals * globals;
- * int minmap;
- * double gamma;
- */
+buildmap(struct sv_globals *globals, int minmap, double gamma);
/*
* rle_getcom - get a specific comment from the image comments.
*/
-extern char *
-rle_getcom();
-/* ( name, globals )
- * char * name;
- * struct sv_globals * globals;
- */
+extern char *rle_getcom(char *name, struct sv_globals *globals);
/*
* rle_putcom - put (or replace) a comment into the image comments.
*/
-extern char *
-rle_putcom();
-/* ( value, globals )
- * char * value;
- * struct sv_globals * globals;
- */
+extern char *rle_putcom(char * value, struct sv_globals *globals);
/*
* rle_delcom - delete a specific comment from the image comments.
*/
-extern char *
-rle_delcom();
-/* ( name, globals )
- * char * name;
- * struct sv_globals * globals;
- */
+extern char *rle_delcom(char * name, struct sv_globals *globals);
/*
* dither globals
--- a/image/rlelib.c
+++ b/image/rlelib.c
@@ -127,19 +127,18 @@ struct XtndRsetup
/* ****************************************************************
* Dispatch table for different output types.
*/
-typedef void sv_fn();
struct sv_dispatch_tab {
char *magic; /* magic type flags */
- sv_fn *setup, /* startup function */
- *skipBlankLines,
- *setColor,
- *skipPixels,
- *newScanLine,
- *putdat, /* put a set of differing pixels */
- *putrn, /* put a run all the same */
- *blockHook, /* hook called at start of new */
+ void (*setup)(struct sv_globals * globals); /* startup function */
+ void (*skipBlankLines)(int nblank, struct sv_globals * globals);
+ void (*setColor)(int c, struct sv_globals * globals);
+ void (*skipPixels)(int nskip, int last, int wasrun, struct sv_globals * globals);
+ void (*newScanLine)(int flag, struct sv_globals * globals);
+ void (*putdat)(rle_pixel *buf, int n, struct sv_globals * globals); /* put a set of differing pixels */
+ void (*putrn)(int color, int n, int last, struct sv_globals * globals); /* put a run all the same */
+ void (*blockHook)(struct sv_globals * globals); /* hook called at start of new */
/* output block */
- *putEof; /* write EOF marker (if possible) */
+ void (*putEof)(struct sv_globals *globals); /* write EOF marker (if possible) */
};
struct sv_dispatch_tab sv_DTable[];
@@ -202,17 +201,17 @@ struct sv_dispatch_tab sv_DTable[];
*/
-void RunSetup(),
- RunSkipBlankLines(),
- RunSetColor(),
- RunSkipPixels(),
- RunNewScanLine(),
- Runputdata(),
- Runputrun(),
- RunputEof();
+void RunSetup(struct sv_globals * globals);
+void RunSkipBlankLines(int nblank, struct sv_globals * globals);
+void RunSetColor(int c, struct sv_globals * globals);
+void RunSkipPixels(int nskip, int last, int wasrun, struct sv_globals * globals);
+void RunNewScanLine(int flag, struct sv_globals * globals);
+void Runputdata(rle_pixel *buf, int n, struct sv_globals * globals);
+void Runputrun(int color, int n, int last, struct sv_globals * globals);
+void RunputEof(struct sv_globals * globals);
-void DefaultBlockHook();
-void NullputEof();
+void DefaultBlockHook(struct sv_globals * globals);
+void NullputEof(struct sv_globals *globals);
struct sv_dispatch_tab sv_DTable[] = {
{
@@ -417,8 +416,7 @@ union { short s; char c[2]; } arg;
* Put out initial setup data for RLE svfb files.
*/
void
-RunSetup(globals)
-register struct sv_globals * globals;
+RunSetup(struct sv_globals * globals)
{
}
@@ -427,8 +425,7 @@ register struct sv_globals * globals;
* Skip one or more blank lines in the RLE file.
*/
void
-RunSkipBlankLines(nblank, globals)
-register struct sv_globals * globals;
+RunSkipBlankLines(int nblank, struct sv_globals * globals)
{
}
@@ -438,8 +435,7 @@ register struct sv_globals * globals;
* color: 0 = Red, 1 = Green, 2 = Blue.
*/
void
-RunSetColor(c, globals)
-register struct sv_globals * globals;
+RunSetColor(int c, struct sv_globals * globals)
{
}
@@ -450,8 +446,7 @@ register struct sv_globals * globals;
/* ARGSUSED */
void
-RunSkipPixels(nskip, last, wasrun, globals)
-register struct sv_globals * globals;
+RunSkipPixels(int nskip, int last, int wasrun, struct sv_globals * globals)
{
}
@@ -461,8 +456,7 @@ register struct sv_globals * globals;
* operation, only generate code if the newline flag is true.
*/
void
-RunNewScanLine(flag, globals)
-register struct sv_globals * globals;
+RunNewScanLine(int flag, struct sv_globals * globals)
{
}
@@ -471,9 +465,7 @@ register struct sv_globals * globals;
* Put one or more pixels of byte data into the output file.
*/
void
-Runputdata(buf, n, globals)
-rle_pixel * buf;
-register struct sv_globals * globals;
+Runputdata(rle_pixel * buf, int n, struct sv_globals * globals)
{
}
@@ -484,8 +476,7 @@ register struct sv_globals * globals;
/* ARGSUSED */
void
-Runputrun(color, n, last, globals)
-register struct sv_globals * globals;
+Runputrun(int color, int n, int last, struct sv_globals * globals)
{
}
@@ -495,15 +486,13 @@ register struct sv_globals * globals;
* Output an EOF opcode
*/
void
-RunputEof(globals)
-register struct sv_globals * globals;
+RunputEof(struct sv_globals * globals)
{
}
/*ARGSUSED*/
void
-DefaultBlockHook(globals)
-struct sv_globals * globals;
+DefaultBlockHook(struct sv_globals * globals)
{
}
@@ -804,7 +793,7 @@ struct inst {
#define DATUM(inst) (0x00ff & inst.datum)
static int debug_f; /* if non-zero, print debug info */
-static void bfill();
+static void bfill(char *s, int n, int c);
/*****************************************************************
* TAG(rle_get_setup)
@@ -1297,9 +1286,7 @@ rle_pixel *scanline[];
/* Fill buffer at s with n copies of character c. N must be <= 65535*/
/* ARGSUSED */
-static void bfill(s, n, c)
-char *s;
-int n, c;
+static void bfill(char *s, int n, int c)
{
#ifdef vax
asm(" movc5 $0,*4(ap),12(ap),8(ap),*4(ap)");
@@ -1351,7 +1338,7 @@ int n, c;
* Copyright (c) 1987, University of Utah
*/
-void make_square();
+void make_square(double N, int divN[256], int modN[256], int magic[16][16]);
/* dither globals */
int dith_levels = 128;
@@ -1390,12 +1377,8 @@ int dith_size = 16;
* if you don't want function call overhead.
*/
void
-dithermap(levels, gamma, rgbmap, divN, modN, magic)
-double gamma;
-int rgbmap[][3];
-int divN[256];
-int modN[256];
-int magic[16][16];
+dithermap(int levels, double gamma, int rgbmap[][3],
+ int divN[256], int modN[256], int magic[16][16])
{
double N;
register int i;
@@ -1450,12 +1433,8 @@ int magic[16][16];
* divN[val] > magic[col][row] ? 1 : 0
*/
void
-bwdithermap(levels, gamma, bwmap, divN, modN, magic)
-double gamma;
-int bwmap[];
-int divN[256];
-int modN[256];
-int magic[16][16];
+bwdithermap(int levels, double gamma, int bwmap[],
+ int divN[256], int modN[256], int magic[16][16])
{
double N;
register int i;
@@ -1565,11 +1544,7 @@ int magic[16][16];
* its sublevel, and is used in the dithering computation.
*/
void
-make_square(N, divN, modN, magic)
-double N;
-int divN[256];
-int modN[256];
-int magic[16][16] ;
+make_square(double N, int divN[256], int modN[256], int magic[16][16])
{
register int i, j, k, l;
double magicfact;
@@ -1676,10 +1651,8 @@ int gammamap[256];
* see "Note:" in dithermap comment.
*/
int
-dithergb(x, y, r, g, b, levels, divN, modN, magic)
-int divN[256];
-int modN[256];
-int magic[16][16];
+dithergb(int x, int y, int r, int g, int b, int levels,
+ int divN[256], int modN[256], int magic[16][16])
{
int col = x % 16, row = y % 16;
@@ -1707,10 +1680,7 @@ int magic[16][16];
* see "Note:" in bwdithermap comment.
*/
int
-ditherbw(x, y, val, divN, modN, magic)
-int divN[256];
-int modN[256];
-int magic[16][16];
+ditherbw(int x, int y, int val, int divN[256], int modN[256], int magic[16][16])
{
int col = x % 16, row = y % 16;
--- a/image/rotate.c
+++ b/image/rotate.c
@@ -37,9 +37,7 @@ int *new_pos; /* Destination bit posi
/* rotate()
* rotates an image
*/
-Image *rotate(simage, degrees, verbose)
-Image *simage; /* Image to rotate */
-int degrees; /* Number of degrees to rotate */
+Image *rotate(Image *simage, int degrees, int verbose)
{
char buf[BUFSIZ]; /* New title */
Image *image1; /* Source image */
--- a/image/send.c
+++ b/image/send.c
@@ -37,7 +37,7 @@ Pixmap ximageToPixmap(disp, parent, xima
Window parent;
XImageInfo *ximageinfo;
{
- int (*old_handler)();
+ int (*old_handler)(Display *, XErrorEvent *);
Pixmap pixmap;
GotError = 0;
--- a/image/smooth.c
+++ b/image/smooth.c
@@ -72,9 +72,7 @@ static Image *doSmooth(image)
return(new);
}
-Image *smooth(image, iterations, verbose)
- Image *image;
- int verbose;
+Image *smooth(Image *image, int iterations, int verbose)
{ int a;
Image *old, *new;
--- a/image/sunraster.c
+++ b/image/sunraster.c
@@ -67,8 +67,7 @@ static void babble(name, header)
fprintf(stderr, " Sun rasterfile\n");
}
-int sunRasterIdent(fullname, name)
- char *fullname, *name;
+int sunRasterIdent(char *fullname, char *name)
{ ZFILE *zf;
struct rheader header;
int r;
@@ -155,9 +154,7 @@ static void sunread(zf, buf, len, enc)
}
}
-Image *sunRasterLoad(fullname, name, verbose)
- char *fullname, *name;
- unsigned int verbose;
+Image *sunRasterLoad(char *fullname, char *name, unsigned int verbose)
{ ZFILE *zf;
struct rheader header;
unsigned int mapsize;
--- a/image/window.c
+++ b/image/window.c
@@ -16,9 +16,7 @@
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
-#ifdef SYSV
#include <unistd.h>
-#endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
@@ -44,7 +42,7 @@ static Colormap ImageColormap;
static int AlarmWentOff = 0;
-static RETSIGTYPE delayAlarmHandler()
+static void delayAlarmHandler(int sig)
{
AlarmWentOff = 1;
}
@@ -224,7 +222,7 @@ void setViewportColormap(disp, scrn, vis
int scrn;
Visual *visual;
{ XSetWindowAttributes swa;
- static cmap_atom= None;
+ static Atom cmap_atom= None;
Window cmap_windows[2];
if (cmap_atom == None)
@@ -661,7 +659,7 @@ char imageInWindow(disp, scrn, image, us
}
if (! (ximageinfo= imageToXImage(disp, scrn, visual, depth, image,
- private_cmap, fit, verbose))) {
+ private_cmap, fit, 0, verbose))) {
fprintf(stderr, "Cannot convert Image to XImage\n");
cleanup(-1);
}
--- a/image/xbitmap.c
+++ b/image/xbitmap.c
@@ -128,9 +128,7 @@ static void badFile(name)
cleanup(-1);
}
-Image *xbitmapLoad(fullname, name, verbose)
- char *fullname, *name;
- unsigned int verbose;
+Image *xbitmapLoad(char *fullname, char *name, unsigned int verbose)
{ ZFILE *zf;
Image *image;
char line[MAX_SIZE];
@@ -248,8 +246,7 @@ Image *xbitmapLoad(fullname, name, verbo
* x bitmaps anyway given their size
*/
-int xbitmapIdent(fullname, name)
- char *fullname, *name;
+int xbitmapIdent(char *fullname, char *ename)
{ Image *image;
if ((image = xbitmapLoad(fullname, name, (unsigned int)1))) {
--- a/image/xloadimage.h
+++ b/image/xloadimage.h
@@ -67,31 +67,57 @@ typedef struct {
void supportedImageTypes(); /* imagetypes.c */
-char *tail(); /* misc.c */
+char *tail(char *path); /* misc.c */
void memoryExhausted();
-void internalError();
+void internalError(int sig);
void version();
-void usage();
-void goodImage();
-Image *processImage();
-int errorHandler();
+void usage(char *name);
+void goodImage(Image *image, char *func);
+Image *processImage(Display *disp, int scrn, Image *image, ImageOptions *options, unsigned int verbose);
+int errorHandler(Display *disp, XErrorEvent *error);
-char *expandPath(); /* path.c */
-int findImage();
+char *expandPath(char *p); /* path.c */
+int findImage(char *name, char *fullname);
void listImages();
void loadPathsAndExts();
void showPath();
void imageOnRoot(); /* root.c */
-void sendXImage(); /* send.c */
-XImageInfo *imageToXImage();
-Pixmap ximageToPixmap();
-void freeXImage();
+void sendXImage(XImageInfo *ximageinfo,
+ int src_x, int src_y, int dst_x, int dst_y,
+ unsigned int w, unsigned int h); /* send.c */
+XImageInfo *imageToXImage(Display *disp,
+ int scrn,
+ Visual *visual,
+ unsigned int ddepth,
+ Image *image,
+ unsigned int private_cmap,
+ unsigned int fit,
+ unsigned int back,
+ unsigned int verbose);
+Pixmap ximageToPixmap(Display *disp,
+ Window parent,
+ XImageInfo *ximageinfo);
+void freeXImage(Image *image,
+ XImageInfo *ximageinfo);
Visual *getBestVisual(); /* visual.c */
-int visualClassFromName(); /* window.c */
-char *nameOfVisualClass();
-void cleanUpWindow();
-char imageInWindow();
+int visualClassFromName(char *name); /* window.c */
+char *nameOfVisualClass(int class);
+void cleanUpWindow(Display *disp);
+char imageInWindow(Display *disp,
+ int scrn,
+ Image *image,
+ char *user_geometry,
+ unsigned int fullscreen,
+ unsigned int install,
+ unsigned int private_cmap,
+ unsigned int fit,
+ unsigned int use_pixmap,
+ unsigned int delay,
+ int visual_class,
+ int argc,
+ char *argv[],
+ unsigned int verbose);
--- a/image/xpixmap.c
+++ b/image/xpixmap.c
@@ -40,9 +40,7 @@ static void corrupted(fullname, zf)
cleanup(-1);
}
-Image *xpixmapLoad(fullname, name, verbose)
- char *fullname, *name;
- unsigned int verbose;
+Image *xpixmapLoad(char *fullname, char *name, unsigned int verbose)
{ ZFILE *zf;
char buf[BUFSIZ];
char what[BUFSIZ];
@@ -237,8 +235,7 @@ Image *xpixmapLoad(fullname, name, verbo
return(image);
}
-int xpixmapIdent(fullname, name)
- char *fullname, *name;
+int xpixmapIdent(char *fullname, char *name)
{ Image *image;
if ((image = xpixmapLoad(fullname, name, (unsigned int)1))) {
--- a/image/xwd.c
+++ b/image/xwd.c
@@ -132,8 +132,7 @@ static int isXWD(name, zf, header, verbo
return(1);
}
-int xwdIdent(fullname, name)
- char *fullname, *name;
+int xwdIdent(char *fullname, char *name)
{ ZFILE *zf;
XWDHeader header;
int ret;
@@ -404,9 +403,7 @@ static Image *loadZPixmap(fullname, zf,
return(image);
}
-Image *xwdLoad(fullname, name, verbose)
- char *fullname, *name;
- int verbose;
+Image *xwdLoad(char *fullname, char *name, unsigned int verbose)
{ ZFILE *zf;
XWDHeader header;
int cmaplen;
--- a/image/zio.c
+++ b/image/zio.c
@@ -81,8 +81,7 @@ static int doRead(zf, buf, len)
/* reset a read cache
*/
-void zreset(filename)
- char *filename;
+void zreset(char *filename)
{ int a;
struct cache *old;
@@ -135,11 +134,10 @@ void zreset(filename)
}
#ifdef __APPLE__
-ZFILE *zzopen(name)
+ZFILE *zzopen(char *name)
#else
-ZFILE *zopen(name)
+ZFILE *zopen(char *name)
#endif
- char *name;
{ int a;
ZFILE *zf;
char buf[BUFSIZ];
@@ -233,16 +231,12 @@ ZFILE *zopen(name)
return(zf);
}
-int zread(zf, buf, len)
- ZFILE *zf;
- byte *buf;
- unsigned int len;
+int zread(ZFILE *zf, byte *buf, unsigned int len)
{
return(doRead(zf, buf, len));
}
-int zgetc(zf)
- ZFILE *zf;
+int zgetc(ZFILE *zf)
{ unsigned char c;
if (doRead(zf, &c, 1) > 0)
@@ -251,10 +245,7 @@ int zgetc(zf)
return(EOF);
}
-char *zgets(buf, size, zf)
- byte *buf;
- unsigned int size;
- ZFILE *zf;
+char *zgets(byte *buf, unsigned int size, ZFILE *zf)
{ int p= 0;
while (doRead(zf, buf + p, 1) > 0) {
@@ -273,8 +264,7 @@ char *zgets(buf, size, zf)
* need to re-open it
*/
-void znocache(zf)
- ZFILE *zf;
+void znocache(ZFILE *zf)
{
zf->nocache= 1;
}
@@ -283,8 +273,7 @@ void znocache(zf)
* zreset() is called with the filename.
*/
-void zclose(zf)
- ZFILE *zf;
+void zclose(ZFILE *zf)
{
zf->dataptr= zf->data;
zf->bufptr= 0;
--- a/image/zoom.c
+++ b/image/zoom.c
@@ -237,9 +237,7 @@ static Image *reduced_image(oimage, widt
return dest;
}
-Image *zoom(oimage, xzoom, yzoom, verbose)
- Image *oimage;
- float xzoom, yzoom;
+Image *zoom(Image *oimage, float xzoom, float yzoom, int verbose)
{ char buf[BUFSIZ];
Image *image=NULL;
unsigned int *xindex, *yindex;
--- a/mgp.c
+++ b/mgp.c
@@ -113,6 +113,10 @@ static int wantreload __P((void));
/*image*/
extern char *expandPath __P((char *));
+extern void zoomout_zimage(int id);
+extern void zoomin_zimage(int id);
+extern int search_zimage(int x, int y, int page);
+
extern int smooth_scaling; /* in image/zoom.c */
#ifdef TTY_KEYINPUT
@@ -199,10 +203,7 @@ cleanup(int sig)
exit(-sig);
}
-int
-main(argc, argv)
- int argc;
- char **argv;
+int main(int argc, char **argv)
{
int i, j; /* counters */
int tmp_argc; /* number of current arguments */
--- a/parse.c
+++ b/parse.c
@@ -384,7 +384,7 @@ read_file(fp, filename, page, line, prea
int filterfd = -1;
char filtername[MAXPATHLEN];
pid_t filterpid = -1;
- void (*filtersig)() = (void (*)())NULL;
+ void (*filtersig)(int) = (void (*)(int))NULL;
int lineno;
static char *searchpath[] = {
"", /*mgp_fname*/