From 6697e31fbb616656b7f34515a79454af394b500a Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Fri, 30 Jan 2009 15:45:20 -0200 Subject: Janitor: ansification, make distcheck, .gitignore The ansification code is minor edit of the patch (by me) at https://bugs.freedesktop.org/show_bug.cgi?id=14727 as it would not apply cleanly anymore. --- .gitignore | 12 ++ Makefile.am | 2 +- configure.ac | 17 +-- cxpm/.gitignore | 5 - cxpm/cxpm.c | 13 +- src/.gitignore | 6 - src/Attrib.c | 42 +++--- src/CrBufFrI.c | 73 +++++----- src/CrBufFrP.c | 13 +- src/CrDatFrI.c | 72 +++++----- src/CrDatFrP.c | 12 +- src/CrIFrBuf.c | 27 ++-- src/CrIFrDat.c | 27 ++-- src/CrIFrP.c | 12 +- src/CrPFrBuf.c | 15 +- src/CrPFrDat.c | 15 +- src/CrPFrI.c | 10 +- src/Image.c | 6 +- src/Info.c | 18 ++- src/RdFToBuf.c | 6 +- src/RdFToDat.c | 6 +- src/RdFToI.c | 45 +++--- src/RdFToP.c | 15 +- src/WrFFrBuf.c | 6 +- src/WrFFrDat.c | 6 +- src/WrFFrI.c | 69 +++++----- src/WrFFrP.c | 12 +- src/create.c | 417 +++++++++++++++++++++++++++----------------------------- src/data.c | 34 +++-- src/hashtab.c | 29 ++-- src/misc.c | 19 ++- src/parse.c | 62 +++++---- src/rgb.c | 58 ++++---- src/scan.c | 134 +++++++++--------- sxpm/.gitignore | 5 - sxpm/sxpm.c | 55 ++++---- 36 files changed, 665 insertions(+), 710 deletions(-) delete mode 100644 cxpm/.gitignore delete mode 100644 src/.gitignore delete mode 100644 sxpm/.gitignore diff --git a/.gitignore b/.gitignore index a150dfb..e806a7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.deps +.libs aclocal.m4 autom4te.cache compile @@ -8,6 +10,7 @@ config.log config.status config.sub configure +cxpm depcomp install-sh libtool @@ -18,5 +21,14 @@ MakeOut missing mkinstalldirs stamp-h1 +sxpm xpm.pc *~ +*.1 +*.o +*.la +*.lo +*.po +libXpm-*.tar.* +ChangeLog +tags diff --git a/Makefile.am b/Makefile.am index a3890f7..d6e7b29 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,6 +22,6 @@ MAINTAINERCLEANFILES = ChangeLog .PHONY: ChangeLog ChangeLog: - (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2) + $(CHANGELOG_CMD) dist-hook: ChangeLog diff --git a/configure.ac b/configure.ac index 3174b30..34e3ea1 100644 --- a/configure.ac +++ b/configure.ac @@ -5,15 +5,20 @@ AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE +# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG +m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])]) +XORG_MACROS_VERSION(1.2) AM_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_LIBTOOL AC_PROG_CC LT_AC_PROG_SED +XORG_CWARNFLAGS # Checks for pkg-config packages PKG_CHECK_MODULES(XPM, xproto x11) +XPM_CFLAGS="$CWARNFLAGS $XPM_CFLAGS" AC_SUBST(XPM_CFLAGS) AC_SUBST(XPM_LIBS) @@ -23,15 +28,6 @@ AC_HEADER_STDC # Checks for functions AC_CHECK_FUNCS([strlcat]) -# Checks for typedefs, structures, and compiler characteristics. - -if test "x$GCC" = "xyes"; then - GCC_WARNINGS="-Wall -Wpointer-arith -Wstrict-prototypes \ - -Wmissing-prototypes -Wmissing-declarations \ - -Wnested-externs -fno-strict-aliasing" - CFLAGS="$GCC_WARNINGS $CFLAGS" -fi - # Internationalization & localization support AC_SEARCH_LIBS([gettext], [intl], [USE_GETTEXT="yes"], [USE_GETTEXT="no"]) AC_MSG_CHECKING([where to install localized messages]) @@ -63,11 +59,12 @@ if test x$STAT_ZFILE = xyes ; then fi PKG_CHECK_MODULES(SXPM, xt xext xextproto, build_sxpm=true, build_sxpm=false) - +SXPM_CFLAGS="$CWARNFLAGS $SXPM_CFLAGS" AM_CONDITIONAL(BUILD_SXPM, test x$build_sxpm = xtrue) XORG_MANPAGE_SECTIONS XORG_RELEASE_VERSION +XORG_CHANGELOG AC_OUTPUT([Makefile src/Makefile diff --git a/cxpm/.gitignore b/cxpm/.gitignore deleted file mode 100644 index 4c621a5..0000000 --- a/cxpm/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -cxpm -.deps -.libs -Makefile -Makefile.in diff --git a/cxpm/cxpm.c b/cxpm/cxpm.c index ed0c7c8..c5cf289 100644 --- a/cxpm/cxpm.c +++ b/cxpm/cxpm.c @@ -56,9 +56,7 @@ * note that 's' could stand both for "special" and "slow" ;-) */ static int -sGetc(data, file) - xpmData *data; - FILE *file; +sGetc(xpmData *data, FILE *file) { int c = getc(data->stream.file); if (c == '\n') { @@ -71,10 +69,7 @@ sGetc(data, file) } static void -sUngetc(data, c, file) - xpmData *data; - int c; - FILE *file; +sUngetc(xpmData *data, int c, FILE *file) { ungetc(c, data->stream.file); if (c == '\n') { @@ -143,9 +138,7 @@ ErrorMessage( } int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { XpmImage image; char *filename; diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 666c770..0000000 --- a/src/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -libXpm.la -*.lo -Makefile -Makefile.in diff --git a/src/Attrib.c b/src/Attrib.c index a6feb52..cb304df 100644 --- a/src/Attrib.c +++ b/src/Attrib.c @@ -49,10 +49,10 @@ LFUNC(FreeOldColorTable, void, (XpmColor **colorTable, unsigned int ncolors)); * Create a colortable compatible with the old style colortable */ static int -CreateOldColorTable(ct, ncolors, oldct) - XpmColor *ct; - unsigned int ncolors; - XpmColor ***oldct; +CreateOldColorTable( + XpmColor *ct, + unsigned int ncolors, + XpmColor ***oldct) { XpmColor **colorTable, **color; unsigned int a; @@ -72,9 +72,9 @@ CreateOldColorTable(ct, ncolors, oldct) } static void -FreeOldColorTable(colorTable, ncolors) - XpmColor **colorTable; - unsigned int ncolors; +FreeOldColorTable( + XpmColor **colorTable, + unsigned int ncolors) { unsigned int a, b; XpmColor **color; @@ -97,9 +97,9 @@ FreeOldColorTable(colorTable, ncolors) * Free the computed color table */ void -xpmFreeColorTable(colorTable, ncolors) - XpmColor *colorTable; - int ncolors; +xpmFreeColorTable( + XpmColor *colorTable, + int ncolors) { int a, b; XpmColor *color; @@ -119,9 +119,9 @@ xpmFreeColorTable(colorTable, ncolors) * Free array of extensions */ void -XpmFreeExtensions(extensions, nextensions) - XpmExtension *extensions; - int nextensions; +XpmFreeExtensions( + XpmExtension *extensions, + int nextensions) { unsigned int i, j, nlines; XpmExtension *ext; @@ -147,7 +147,7 @@ XpmFreeExtensions(extensions, nextensions) */ int -XpmAttributesSize() +XpmAttributesSize(void) { return sizeof(XpmAttributes); } @@ -156,8 +156,7 @@ XpmAttributesSize() * Init returned data to free safely later on */ void -xpmInitAttributes(attributes) - XpmAttributes *attributes; +xpmInitAttributes(XpmAttributes *attributes) { if (attributes) { attributes->pixels = NULL; @@ -184,10 +183,10 @@ xpmInitAttributes(attributes) * Fill in the XpmAttributes with the XpmImage and the XpmInfo */ void -xpmSetAttributes(attributes, image, info) - XpmAttributes *attributes; - XpmImage *image; - XpmInfo *info; +xpmSetAttributes( + XpmAttributes *attributes, + XpmImage *image, + XpmInfo *info) { if (attributes->valuemask & XpmReturnColorTable) { attributes->colorTable = image->colorTable; @@ -254,8 +253,7 @@ xpmSetAttributes(attributes, image, info) * but the structure itself */ void -XpmFreeAttributes(attributes) - XpmAttributes *attributes; +XpmFreeAttributes(XpmAttributes *attributes) { if (attributes->valuemask & XpmReturnPixels && attributes->npixels) { XpmFree(attributes->pixels); diff --git a/src/CrBufFrI.c b/src/CrBufFrI.c index b879715..a53b117 100644 --- a/src/CrBufFrI.c +++ b/src/CrBufFrI.c @@ -59,12 +59,12 @@ LFUNC(ExtensionsSize, unsigned int, (XpmExtension *ext, unsigned int num)); LFUNC(CommentsSize, int, (XpmInfo *info)); int -XpmCreateBufferFromImage(display, buffer_return, image, shapeimage, attributes) - Display *display; - char **buffer_return; - XImage *image; - XImage *shapeimage; - XpmAttributes *attributes; +XpmCreateBufferFromImage( + Display *display, + char **buffer_return, + XImage *image, + XImage *shapeimage, + XpmAttributes *attributes) { XpmImage xpmimage; XpmInfo info; @@ -105,10 +105,10 @@ do \ }while(0) int -XpmCreateBufferFromXpmImage(buffer_return, image, info) - char **buffer_return; - XpmImage *image; - XpmInfo *info; +XpmCreateBufferFromXpmImage( + char **buffer_return, + XpmImage *image, + XpmInfo *info) { /* calculation variables */ int ErrorStatus; @@ -271,13 +271,13 @@ error: static int -WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp) - char **dataptr; - unsigned int *data_size; - unsigned int *used_size; - XpmColor *colors; - unsigned int ncolors; - unsigned int cpp; +WriteColors( + char **dataptr, + unsigned int *data_size, + unsigned int *used_size, + XpmColor *colors, + unsigned int ncolors, + unsigned int cpp) { char buf[BUFSIZ] = {0}; unsigned int a, key, l; @@ -329,15 +329,15 @@ WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp) } static void -WritePixels(dataptr, data_size, used_size, width, height, cpp, pixels, colors) - char *dataptr; - unsigned int data_size; - unsigned int *used_size; - unsigned int width; - unsigned int height; - unsigned int cpp; - unsigned int *pixels; - XpmColor *colors; +WritePixels( + char *dataptr, + unsigned int data_size, + unsigned int *used_size, + unsigned int width, + unsigned int height, + unsigned int cpp, + unsigned int *pixels, + XpmColor *colors) { char *s = dataptr; unsigned int x, y, h; @@ -372,9 +372,9 @@ WritePixels(dataptr, data_size, used_size, width, height, cpp, pixels, colors) } static unsigned int -ExtensionsSize(ext, num) - XpmExtension *ext; - unsigned int num; +ExtensionsSize( + XpmExtension *ext, + unsigned int num) { unsigned int x, y, a, size; char **line; @@ -397,12 +397,12 @@ ExtensionsSize(ext, num) } static void -WriteExtensions(dataptr, data_size, used_size, ext, num) - char *dataptr; - unsigned int data_size; - unsigned int *used_size; - XpmExtension *ext; - unsigned int num; +WriteExtensions( + char *dataptr, + unsigned int data_size, + unsigned int *used_size, + XpmExtension *ext, + unsigned int num) { unsigned int x, y, a; char **line; @@ -432,8 +432,7 @@ WriteExtensions(dataptr, data_size, used_size, ext, num) } static int -CommentsSize(info) - XpmInfo *info; +CommentsSize(XpmInfo *info) { int size = 0; diff --git a/src/CrBufFrP.c b/src/CrBufFrP.c index 44eb56d..de3e776 100644 --- a/src/CrBufFrP.c +++ b/src/CrBufFrP.c @@ -38,13 +38,12 @@ #include "XpmI.h" int -XpmCreateBufferFromPixmap(display, buffer_return, pixmap, shapemask, - attributes) - Display *display; - char **buffer_return; - Pixmap pixmap; - Pixmap shapemask; - XpmAttributes *attributes; +XpmCreateBufferFromPixmap( + Display *display, + char **buffer_return, + Pixmap pixmap, + Pixmap shapemask, + XpmAttributes *attributes) { XImage *ximage = NULL; XImage *shapeimage = NULL; diff --git a/src/CrDatFrI.c b/src/CrDatFrI.c index 9099966..aa1d893 100644 --- a/src/CrDatFrI.c +++ b/src/CrDatFrI.c @@ -59,12 +59,12 @@ LFUNC(CreateExtensions, void, (char **dataptr, unsigned int data_size, unsigned int ext_nlines)); int -XpmCreateDataFromImage(display, data_return, image, shapeimage, attributes) - Display *display; - char ***data_return; - XImage *image; - XImage *shapeimage; - XpmAttributes *attributes; +XpmCreateDataFromImage( + Display *display, + char ***data_return, + XImage *image, + XImage *shapeimage, + XpmAttributes *attributes) { XpmImage xpmimage; XpmInfo info; @@ -102,10 +102,10 @@ do \ } while(0) int -XpmCreateDataFromXpmImage(data_return, image, info) - char ***data_return; - XpmImage *image; - XpmInfo *info; +XpmCreateDataFromXpmImage( + char ***data_return, + XpmImage *image, + XpmInfo *info) { /* calculation variables */ int ErrorStatus; @@ -244,12 +244,12 @@ exit: } static int -CreateColors(dataptr, data_size, colors, ncolors, cpp) - char **dataptr; - unsigned int *data_size; - XpmColor *colors; - unsigned int ncolors; - unsigned int cpp; +CreateColors( + char **dataptr, + unsigned int *data_size, + XpmColor *colors, + unsigned int ncolors, + unsigned int cpp) { char buf[BUFSIZ]; unsigned int a, key, l; @@ -295,14 +295,14 @@ CreateColors(dataptr, data_size, colors, ncolors, cpp) } static void -CreatePixels(dataptr, data_size, width, height, cpp, pixels, colors) - char **dataptr; - unsigned int data_size; - unsigned int width; - unsigned int height; - unsigned int cpp; - unsigned int *pixels; - XpmColor *colors; +CreatePixels( + char **dataptr, + unsigned int data_size, + unsigned int width, + unsigned int height, + unsigned int cpp, + unsigned int *pixels, + XpmColor *colors) { char *s; unsigned int x, y, h, offset; @@ -345,11 +345,11 @@ CreatePixels(dataptr, data_size, width, height, cpp, pixels, colors) } static void -CountExtensions(ext, num, ext_size, ext_nlines) - XpmExtension *ext; - unsigned int num; - unsigned int *ext_size; - unsigned int *ext_nlines; +CountExtensions( + XpmExtension *ext, + unsigned int num, + unsigned int *ext_size, + unsigned int *ext_nlines) { unsigned int x, y, a, size, nlines; char **line; @@ -371,13 +371,13 @@ CountExtensions(ext, num, ext_size, ext_nlines) } static void -CreateExtensions(dataptr, data_size, offset, ext, num, ext_nlines) - char **dataptr; - unsigned int data_size; - unsigned int offset; - XpmExtension *ext; - unsigned int num; - unsigned int ext_nlines; +CreateExtensions( + char **dataptr, + unsigned int data_size, + unsigned int offset, + XpmExtension *ext, + unsigned int num, + unsigned int ext_nlines) { unsigned int x, y, a, b; char **line; diff --git a/src/CrDatFrP.c b/src/CrDatFrP.c index 20981b7..0e17fee 100644 --- a/src/CrDatFrP.c +++ b/src/CrDatFrP.c @@ -38,12 +38,12 @@ #include "XpmI.h" int -XpmCreateDataFromPixmap(display, data_return, pixmap, shapemask, attributes) - Display *display; - char ***data_return; - Pixmap pixmap; - Pixmap shapemask; - XpmAttributes *attributes; +XpmCreateDataFromPixmap( + Display *display, + char ***data_return, + Pixmap pixmap, + Pixmap shapemask, + XpmAttributes *attributes) { XImage *ximage = NULL; XImage *shapeimage = NULL; diff --git a/src/CrIFrBuf.c b/src/CrIFrBuf.c index d98e658..b6b12ca 100644 --- a/src/CrIFrBuf.c +++ b/src/CrIFrBuf.c @@ -40,13 +40,12 @@ LFUNC(OpenBuffer, void, (char *buffer, xpmData *mdata)); int -XpmCreateImageFromBuffer(display, buffer, image_return, - shapeimage_return, attributes) - Display *display; - char *buffer; - XImage **image_return; - XImage **shapeimage_return; - XpmAttributes *attributes; +XpmCreateImageFromBuffer( + Display *display, + char *buffer, + XImage **image_return, + XImage **shapeimage_return, + XpmAttributes *attributes) { XpmImage image; XpmInfo info; @@ -83,10 +82,10 @@ XpmCreateImageFromBuffer(display, buffer, image_return, } int -XpmCreateXpmImageFromBuffer(buffer, image, info) - char *buffer; - XpmImage *image; - XpmInfo *info; +XpmCreateXpmImageFromBuffer( + char *buffer, + XpmImage *image, + XpmInfo *info) { xpmData mdata; int ErrorStatus; @@ -108,9 +107,9 @@ XpmCreateXpmImageFromBuffer(buffer, image, info) * open the given buffer to be read or written as an xpmData which is returned */ static void -OpenBuffer(buffer, mdata) - char *buffer; - xpmData *mdata; +OpenBuffer( + char *buffer, + xpmData *mdata) { mdata->type = XPMBUFFER; mdata->cptr = buffer; diff --git a/src/CrIFrDat.c b/src/CrIFrDat.c index ab93a49..9ef1557 100644 --- a/src/CrIFrDat.c +++ b/src/CrIFrDat.c @@ -40,13 +40,12 @@ LFUNC(OpenArray, void, (char **data, xpmData *mdata)); int -XpmCreateImageFromData(display, data, image_return, - shapeimage_return, attributes) - Display *display; - char **data; - XImage **image_return; - XImage **shapeimage_return; - XpmAttributes *attributes; +XpmCreateImageFromData( + Display *display, + char **data, + XImage **image_return, + XImage **shapeimage_return, + XpmAttributes *attributes) { XpmImage image; XpmInfo info; @@ -83,10 +82,10 @@ XpmCreateImageFromData(display, data, image_return, } int -XpmCreateXpmImageFromData(data, image, info) - char **data; - XpmImage *image; - XpmInfo *info; +XpmCreateXpmImageFromData( + char **data, + XpmImage *image, + XpmInfo *info) { xpmData mdata; int ErrorStatus; @@ -108,9 +107,9 @@ XpmCreateXpmImageFromData(data, image, info) * open the given array to be read or written as an xpmData which is returned */ static void -OpenArray(data, mdata) - char **data; - xpmData *mdata; +OpenArray( + char **data, + xpmData *mdata) { mdata->type = XPMARRAY; mdata->stream.data = data; diff --git a/src/CrIFrP.c b/src/CrIFrP.c index 144acc4..79c4c49 100644 --- a/src/CrIFrP.c +++ b/src/CrIFrP.c @@ -38,12 +38,12 @@ #include "XpmI.h" void -xpmCreateImageFromPixmap(display, pixmap, ximage_return, width, height) - Display *display; - Pixmap pixmap; - XImage **ximage_return; - unsigned int *width; - unsigned int *height; +xpmCreateImageFromPixmap( + Display *display, + Pixmap pixmap, + XImage **ximage_return, + unsigned int *width, + unsigned int *height) { unsigned int dum; int dummy; diff --git a/src/CrPFrBuf.c b/src/CrPFrBuf.c index f3f9030..2c28a41 100644 --- a/src/CrPFrBuf.c +++ b/src/CrPFrBuf.c @@ -38,14 +38,13 @@ #include "XpmI.h" int -XpmCreatePixmapFromBuffer(display, d, buffer, pixmap_return, - shapemask_return, attributes) - Display *display; - Drawable d; - char *buffer; - Pixmap *pixmap_return; - Pixmap *shapemask_return; - XpmAttributes *attributes; +XpmCreatePixmapFromBuffer( + Display *display, + Drawable d, + char *buffer, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes) { XImage *ximage, *shapeimage; int ErrorStatus; diff --git a/src/CrPFrDat.c b/src/CrPFrDat.c index 483b3af..b65771d 100644 --- a/src/CrPFrDat.c +++ b/src/CrPFrDat.c @@ -38,14 +38,13 @@ #include "XpmI.h" int -XpmCreatePixmapFromData(display, d, data, pixmap_return, - shapemask_return, attributes) - Display *display; - Drawable d; - char **data; - Pixmap *pixmap_return; - Pixmap *shapemask_return; - XpmAttributes *attributes; +XpmCreatePixmapFromData( + Display *display, + Drawable d, + char **data, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes) { XImage *ximage, *shapeimage; int ErrorStatus; diff --git a/src/CrPFrI.c b/src/CrPFrI.c index 2f555dd..8f6f4aa 100644 --- a/src/CrPFrI.c +++ b/src/CrPFrI.c @@ -38,11 +38,11 @@ #include "XpmI.h" void -xpmCreatePixmapFromImage(display, d, ximage, pixmap_return) - Display *display; - Drawable d; - XImage *ximage; - Pixmap *pixmap_return; +xpmCreatePixmapFromImage( + Display *display, + Drawable d, + XImage *ximage, + Pixmap *pixmap_return) { GC gc; XGCValues values; diff --git a/src/Image.c b/src/Image.c index 2179d4e..e0223cc 100644 --- a/src/Image.c +++ b/src/Image.c @@ -41,8 +41,7 @@ * Init returned data to free safely later on */ void -xpmInitXpmImage(image) - XpmImage *image; +xpmInitXpmImage(XpmImage *image) { image->ncolors = 0; image->colorTable = NULL; @@ -53,8 +52,7 @@ xpmInitXpmImage(image) * Free the XpmImage data which have been allocated */ void -XpmFreeXpmImage(image) - XpmImage *image; +XpmFreeXpmImage(XpmImage *image) { if (image->colorTable) xpmFreeColorTable(image->colorTable, image->ncolors); diff --git a/src/Info.c b/src/Info.c index f35abd9..e975a6d 100644 --- a/src/Info.c +++ b/src/Info.c @@ -41,8 +41,7 @@ * Init returned data to free safely later on */ void -xpmInitXpmInfo(info) - XpmInfo *info; +xpmInitXpmInfo(XpmInfo *info) { if (info) { info->hints_cmt = NULL; @@ -57,8 +56,7 @@ xpmInitXpmInfo(info) * Free the XpmInfo data which have been allocated */ void -XpmFreeXpmInfo(info) - XpmInfo *info; +XpmFreeXpmInfo(XpmInfo *info) { if (info) { if (info->valuemask & XpmComments) { @@ -88,9 +86,9 @@ XpmFreeXpmInfo(info) * Set the XpmInfo valuemask to retrieve required info */ void -xpmSetInfoMask(info, attributes) - XpmInfo *info; - XpmAttributes *attributes; +xpmSetInfoMask( + XpmInfo *info, + XpmAttributes *attributes) { info->valuemask = 0; if (attributes->valuemask & XpmReturnInfos) @@ -103,9 +101,9 @@ xpmSetInfoMask(info, attributes) * Fill in the XpmInfo with the XpmAttributes */ void -xpmSetInfo(info, attributes) - XpmInfo *info; - XpmAttributes *attributes; +xpmSetInfo( + XpmInfo *info, + XpmAttributes *attributes) { info->valuemask = 0; if (attributes->valuemask & XpmInfos) { diff --git a/src/RdFToBuf.c b/src/RdFToBuf.c index 222bf18..b719960 100644 --- a/src/RdFToBuf.c +++ b/src/RdFToBuf.c @@ -59,9 +59,9 @@ #endif int -XpmReadFileToBuffer(filename, buffer_return) - char *filename; - char **buffer_return; +XpmReadFileToBuffer( + char *filename, + char **buffer_return) { int fd, fcheck; off_t len; diff --git a/src/RdFToDat.c b/src/RdFToDat.c index 11f753b..87f7f1e 100644 --- a/src/RdFToDat.c +++ b/src/RdFToDat.c @@ -38,9 +38,9 @@ #include "XpmI.h" int -XpmReadFileToData(filename, data_return) - char *filename; - char ***data_return; +XpmReadFileToData( + char *filename, + char ***data_return) { XpmImage image; XpmInfo info; diff --git a/src/RdFToI.c b/src/RdFToI.c index 60db54a..bc05fe6 100644 --- a/src/RdFToI.c +++ b/src/RdFToI.c @@ -53,15 +53,19 @@ LFUNC(OpenReadFile, int, (char *filename, xpmData *mdata)); LFUNC(xpmDataClose, void, (xpmData *mdata)); +FUNC(xpmPipeThrough, FILE*, (int fd, + const char *cmd, + const char *arg1, + const char *mode)); + #ifndef CXPMPROG int -XpmReadFileToImage(display, filename, - image_return, shapeimage_return, attributes) - Display *display; - char *filename; - XImage **image_return; - XImage **shapeimage_return; - XpmAttributes *attributes; +XpmReadFileToImage( + Display *display, + char *filename, + XImage **image_return, + XImage **shapeimage_return, + XpmAttributes *attributes) { XpmImage image; XpmInfo info; @@ -100,10 +104,10 @@ XpmReadFileToImage(display, filename, } int -XpmReadFileToXpmImage(filename, image, info) - char *filename; - XpmImage *image; - XpmInfo *info; +XpmReadFileToXpmImage( + char *filename, + XpmImage *image, + XpmInfo *info) { xpmData mdata; int ErrorStatus; @@ -128,11 +132,11 @@ XpmReadFileToXpmImage(filename, image, info) #ifndef NO_ZPIPE /* Do not depend on errno after read_through */ FILE* -xpmPipeThrough(fd, cmd, arg1, mode) - int fd; - const char* cmd; - const char* arg1; - const char* mode; +xpmPipeThrough( + int fd, + const char *cmd, + const char *arg1, + const char *mode) { FILE* fp; int status, fds[2], in = 0, out = 1; @@ -190,9 +194,9 @@ fail2: * open the given file to be read as an xpmData which is returned. */ static int -OpenReadFile(filename, mdata) - char *filename; - xpmData *mdata; +OpenReadFile( + char *filename, + xpmData *mdata) { if (!filename) { mdata->stream.file = (stdin); @@ -263,8 +267,7 @@ OpenReadFile(filename, mdata) * close the file related to the xpmData if any */ static void -xpmDataClose(mdata) - xpmData *mdata; +xpmDataClose(xpmData *mdata) { if (mdata->stream.file != (stdin)) fclose(mdata->stream.file); diff --git a/src/RdFToP.c b/src/RdFToP.c index 993824e..bacedda 100644 --- a/src/RdFToP.c +++ b/src/RdFToP.c @@ -38,14 +38,13 @@ #include "XpmI.h" int -XpmReadFileToPixmap(display, d, filename, pixmap_return, - shapemask_return, attributes) - Display *display; - Drawable d; - char *filename; - Pixmap *pixmap_return; - Pixmap *shapemask_return; - XpmAttributes *attributes; +XpmReadFileToPixmap( + Display *display, + Drawable d, + char *filename, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes) { XImage *ximage, *shapeimage; int ErrorStatus; diff --git a/src/WrFFrBuf.c b/src/WrFFrBuf.c index 9e0497a..bd1c45b 100644 --- a/src/WrFFrBuf.c +++ b/src/WrFFrBuf.c @@ -40,9 +40,9 @@ #include "XpmI.h" int -XpmWriteFileFromBuffer(filename, buffer) - char *filename; - char *buffer; +XpmWriteFileFromBuffer( + char *filename, + char *buffer) { int fcheck, len; FILE *fp = fopen(filename, "w"); diff --git a/src/WrFFrDat.c b/src/WrFFrDat.c index bc0a944..dc738b9 100644 --- a/src/WrFFrDat.c +++ b/src/WrFFrDat.c @@ -38,9 +38,9 @@ #include "XpmI.h" int -XpmWriteFileFromData(filename, data) - char *filename; - char **data; +XpmWriteFileFromData( + char *filename, + char **data) { XpmImage image; XpmInfo info; diff --git a/src/WrFFrI.c b/src/WrFFrI.c index 15043e8..3eeaf2a 100644 --- a/src/WrFFrI.c +++ b/src/WrFFrI.c @@ -68,12 +68,12 @@ LFUNC(OpenWriteFile, int, (char *filename, xpmData *mdata)); LFUNC(xpmDataClose, void, (xpmData *mdata)); int -XpmWriteFileFromImage(display, filename, image, shapeimage, attributes) - Display *display; - char *filename; - XImage *image; - XImage *shapeimage; - XpmAttributes *attributes; +XpmWriteFileFromImage( + Display *display, + char *filename, + XImage *image, + XImage *shapeimage, + XpmAttributes *attributes) { XpmImage xpmimage; XpmInfo info; @@ -99,10 +99,10 @@ XpmWriteFileFromImage(display, filename, image, shapeimage, attributes) } int -XpmWriteFileFromXpmImage(filename, image, info) - char *filename; - XpmImage *image; - XpmInfo *info; +XpmWriteFileFromXpmImage( + char *filename, + XpmImage *image, + XpmInfo *info) { xpmData mdata; char *name, *dot, *s, new_name[BUFSIZ] = {0}; @@ -163,11 +163,11 @@ XpmWriteFileFromXpmImage(filename, image, info) } static int -xpmWriteFile(file, image, name, info) - FILE *file; - XpmImage *image; - char *name; - XpmInfo *info; +xpmWriteFile( + FILE *file, + XpmImage *image, + char *name, + XpmInfo *info) { /* calculation variables */ unsigned int cmts, extensions; @@ -221,10 +221,10 @@ xpmWriteFile(file, image, name, info) } static void -WriteColors(file, colors, ncolors) - FILE *file; - XpmColor *colors; - unsigned int ncolors; +WriteColors( + FILE *file, + XpmColor *colors, + unsigned int ncolors) { unsigned int a, key; char *s; @@ -245,13 +245,13 @@ WriteColors(file, colors, ncolors) static int -WritePixels(file, width, height, cpp, pixels, colors) - FILE *file; - unsigned int width; - unsigned int height; - unsigned int cpp; - unsigned int *pixels; - XpmColor *colors; +WritePixels( + FILE *file, + unsigned int width, + unsigned int height, + unsigned int cpp, + unsigned int *pixels, + XpmColor *colors) { char *s, *p, *buf; unsigned int x, y, h; @@ -289,10 +289,10 @@ WritePixels(file, width, height, cpp, pixels, colors) } static void -WriteExtensions(file, ext, num) - FILE *file; - XpmExtension *ext; - unsigned int num; +WriteExtensions( + FILE *file, + XpmExtension *ext, + unsigned int num) { unsigned int x, y, n; char **line; @@ -318,9 +318,9 @@ FUNC(xpmPipeThrough, FILE*, (int fd, * open the given file to be written as an xpmData which is returned */ static int -OpenWriteFile(filename, mdata) - char *filename; - xpmData *mdata; +OpenWriteFile( + char *filename, + xpmData *mdata) { if (!filename) { mdata->stream.file = (stdout); @@ -356,8 +356,7 @@ OpenWriteFile(filename, mdata) * close the file related to the xpmData if any */ static void -xpmDataClose(mdata) - xpmData *mdata; +xpmDataClose(xpmData *mdata) { if (mdata->stream.file != (stdout)) fclose(mdata->stream.file); diff --git a/src/WrFFrP.c b/src/WrFFrP.c index 87ceb88..497ba56 100644 --- a/src/WrFFrP.c +++ b/src/WrFFrP.c @@ -38,12 +38,12 @@ #include "XpmI.h" int -XpmWriteFileFromPixmap(display, filename, pixmap, shapemask, attributes) - Display *display; - char *filename; - Pixmap pixmap; - Pixmap shapemask; - XpmAttributes *attributes; +XpmWriteFileFromPixmap( + Display *display, + char *filename, + Pixmap pixmap, + Pixmap shapemask, + XpmAttributes *attributes) { XImage *ximage = NULL; XImage *shapeimage = NULL; diff --git a/src/create.c b/src/create.c index e3179f7..acae321 100644 --- a/src/create.c +++ b/src/create.c @@ -163,8 +163,9 @@ FUNC(xpmstrcasecmp, int, (char *s1, char *s2)); * which does the trick */ int -xpmstrcasecmp(s1, s2) - register char *s1, *s2; +xpmstrcasecmp( + register char *s1, + register char *s2) { register int c1, c2; @@ -185,8 +186,7 @@ xpmstrcasecmp(s1, s2) * return the default color key related to the given visual */ static int -xpmVisualType(visual) - Visual *visual; +xpmVisualType(Visual *visual) { #ifndef FOR_MSW # ifndef AMIGA @@ -235,12 +235,12 @@ closeness_cmp(Const void *a, Const void *b) * call XAllocColor and return 0 if failure, positive otherwise */ static int -AllocColor(display, colormap, colorname, xcolor, closure) - Display *display; - Colormap colormap; - char *colorname; - XColor *xcolor; - void *closure; /* not used */ +AllocColor( + Display *display, + Colormap colormap, + char *colorname, + XColor *xcolor, + void *closure) /* not used */ { int status; if (colorname) @@ -258,21 +258,20 @@ AllocColor(display, colormap, colorname, xcolor, closure) */ static int -SetCloseColor(display, colormap, visual, col, image_pixel, mask_pixel, - alloc_pixels, nalloc_pixels, attributes, cols, ncols, - allocColor, closure) - Display *display; - Colormap colormap; - Visual *visual; - XColor *col; - Pixel *image_pixel, *mask_pixel; - Pixel *alloc_pixels; - unsigned int *nalloc_pixels; - XpmAttributes *attributes; - XColor *cols; - int ncols; - XpmAllocColorFunc allocColor; - void *closure; +SetCloseColor( + Display *display, + Colormap colormap, + Visual *visual, + XColor *col, + Pixel *image_pixel, + Pixel *mask_pixel, + Pixel *alloc_pixels, + unsigned int *nalloc_pixels, + XpmAttributes *attributes, + XColor *cols, + int ncols, + XpmAllocColorFunc allocColor, + void *closure) { /* @@ -443,26 +442,24 @@ SetCloseColor(display, colormap, visual, col, image_pixel, mask_pixel, */ static int -SetColor(display, colormap, visual, colorname, color_index, - image_pixel, mask_pixel, mask_pixel_index, - alloc_pixels, nalloc_pixels, used_pixels, nused_pixels, - attributes, cols, ncols, allocColor, closure) - Display *display; - Colormap colormap; - Visual *visual; - char *colorname; - unsigned int color_index; - Pixel *image_pixel, *mask_pixel; - unsigned int *mask_pixel_index; - Pixel *alloc_pixels; - unsigned int *nalloc_pixels; - Pixel *used_pixels; - unsigned int *nused_pixels; - XpmAttributes *attributes; - XColor *cols; - int ncols; - XpmAllocColorFunc allocColor; - void *closure; +SetColor( + Display *display, + Colormap colormap, + Visual *visual, + char *colorname, + unsigned int color_index, + Pixel *image_pixel, + Pixel *mask_pixel, + unsigned int *mask_pixel_index, + Pixel *alloc_pixels, + unsigned int *nalloc_pixels, + Pixel *used_pixels, + unsigned int *nused_pixels, + XpmAttributes *attributes, + XColor *cols, + int ncols, + XpmAllocColorFunc allocColor, + void *closure) { XColor xcolor; int status; @@ -507,20 +504,18 @@ SetColor(display, colormap, visual, colorname, color_index, static int -CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels, - mask_pixel_index, alloc_pixels, nalloc_pixels, - used_pixels, nused_pixels) - Display *display; - XpmAttributes *attributes; - XpmColor *colors; - unsigned int ncolors; - Pixel *image_pixels; - Pixel *mask_pixels; - unsigned int *mask_pixel_index; - Pixel *alloc_pixels; - unsigned int *nalloc_pixels; - Pixel *used_pixels; - unsigned int *nused_pixels; +CreateColors( + Display *display, + XpmAttributes *attributes, + XpmColor *colors, + unsigned int ncolors, + Pixel *image_pixels, + Pixel *mask_pixels, + unsigned int *mask_pixel_index, + Pixel *alloc_pixels, + unsigned int *nalloc_pixels, + Pixel *used_pixels, + unsigned int *nused_pixels) { /* variables stored in the XpmAttributes structure */ Visual *visual; @@ -739,12 +734,12 @@ CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels, /* default FreeColors function, simply call XFreeColors */ static int -FreeColors(display, colormap, pixels, n, closure) - Display *display; - Colormap colormap; - Pixel *pixels; - int n; - void *closure; /* not used */ +FreeColors( + Display *display, + Colormap colormap, + Pixel *pixels, + int n, + void *closure) /* not used */ { return XFreeColors(display, colormap, pixels, n, 0); } @@ -761,13 +756,12 @@ do \ } while(0) int -XpmCreateImageFromXpmImage(display, image, - image_return, shapeimage_return, attributes) - Display *display; - XpmImage *image; - XImage **image_return; - XImage **shapeimage_return; - XpmAttributes *attributes; +XpmCreateImageFromXpmImage( + Display *display, + XpmImage *image, + XImage **image_return, + XImage **shapeimage_return, + XpmAttributes *attributes) { /* variables stored in the XpmAttributes structure */ Visual *visual; @@ -973,14 +967,14 @@ error: * Create an XImage with its data */ static int -CreateXImage(display, visual, depth, format, width, height, image_return) - Display *display; - Visual *visual; - unsigned int depth; - int format; - unsigned int width; - unsigned int height; - XImage **image_return; +CreateXImage( + Display *display, + Visual *visual, + unsigned int depth, + int format, + unsigned int width, + unsigned int height, + XImage **image_return) { int bitmap_pad; @@ -1072,9 +1066,9 @@ static unsigned char Const _reverse_byte[0x100] = { }; static int -_XReverse_Bytes(bpt, nb) - register unsigned char *bpt; - register unsigned int nb; +_XReverse_Bytes( + register unsigned char *bpt, + register unsigned int nb) { do { *bpt = _reverse_byte[*bpt]; @@ -1085,9 +1079,9 @@ _XReverse_Bytes(bpt, nb) void -xpm_xynormalizeimagebits(bp, img) - register unsigned char *bp; - register XImage *img; +xpm_xynormalizeimagebits( + register unsigned char *bp, + register XImage *img) { register unsigned char c; @@ -1115,9 +1109,9 @@ xpm_xynormalizeimagebits(bp, img) } void -xpm_znormalizeimagebits(bp, img) - register unsigned char *bp; - register XImage *img; +xpm_znormalizeimagebits( + register unsigned char *bp, + register XImage *img) { register unsigned char c; @@ -1160,13 +1154,13 @@ static unsigned char Const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00}; static void -_putbits(src, dstoffset, numbits, dst) - register char *src; /* address of source bit string */ - int dstoffset; /* bit offset into destination; +_putbits( + register char *src, /* address of source bit string */ + int dstoffset, /* bit offset into destination; * range is 0-31 */ - register int numbits; /* number of bits to copy to + register int numbits, /* number of bits to copy to * destination */ - register char *dst; /* address of destination bit string */ + register char *dst) /* address of destination bit string */ { register unsigned char chlo, chhi; int hibits; @@ -1208,12 +1202,12 @@ _putbits(src, dstoffset, numbits, dst) */ static void -PutImagePixels(image, width, height, pixelindex, pixels) - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +PutImagePixels( + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { register char *src; register char *dst; @@ -1295,12 +1289,12 @@ static unsigned long byteorderpixel = MSBFirst << 24; */ static void -PutImagePixels32(image, width, height, pixelindex, pixels) - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +PutImagePixels32( + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { unsigned char *data; unsigned int *iptr; @@ -1405,12 +1399,12 @@ PutImagePixels32(image, width, height, pixelindex, pixels) */ static void -PutImagePixels16(image, width, height, pixelindex, pixels) - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +PutImagePixels16( + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { unsigned char *data; unsigned int *iptr; @@ -1486,12 +1480,12 @@ PutImagePixels16(image, width, height, pixelindex, pixels) */ static void -PutImagePixels8(image, width, height, pixelindex, pixels) - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +PutImagePixels8( + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { char *data; unsigned int *iptr; @@ -1533,12 +1527,12 @@ PutImagePixels8(image, width, height, pixelindex, pixels) */ static void -PutImagePixels1(image, width, height, pixelindex, pixels) - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +PutImagePixels1( + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { if (image->byte_order != image->bitmap_bit_order) PutImagePixels(image, width, height, pixelindex, pixels); @@ -1647,14 +1641,13 @@ PutImagePixels1(image, width, height, pixelindex, pixels) } int -XpmCreatePixmapFromXpmImage(display, d, image, - pixmap_return, shapemask_return, attributes) - Display *display; - Drawable d; - XpmImage *image; - Pixmap *pixmap_return; - Pixmap *shapemask_return; - XpmAttributes *attributes; +XpmCreatePixmapFromXpmImage( + Display *display, + Drawable d, + XpmImage *image, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes) { XImage *ximage, *shapeimage; int ErrorStatus; @@ -1732,13 +1725,13 @@ APutImagePixels ( # endif/* AMIGA */ #else /* FOR_MSW part follows */ static void -MSWPutImagePixels(dc, image, width, height, pixelindex, pixels) - Display *dc; - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +MSWPutImagePixels( + Display *dc, + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { unsigned int *data = pixelindex; unsigned int x, y; @@ -1760,11 +1753,11 @@ MSWPutImagePixels(dc, image, width, height, pixelindex, pixels) #if !defined(FOR_MSW) && !defined(AMIGA) static int -PutPixel1(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel1( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { register char *src; register char *dst; @@ -1795,11 +1788,11 @@ PutPixel1(ximage, x, y, pixel) } static int -PutPixel(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { register char *src; register char *dst; @@ -1834,11 +1827,11 @@ PutPixel(ximage, x, y, pixel) #if !defined(WORD64) && !defined(LONG64) static int -PutPixel32(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel32( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -1852,11 +1845,11 @@ PutPixel32(ximage, x, y, pixel) #endif static int -PutPixel32MSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel32MSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -1872,11 +1865,11 @@ PutPixel32MSB(ximage, x, y, pixel) } static int -PutPixel32LSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel32LSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -1892,11 +1885,11 @@ PutPixel32LSB(ximage, x, y, pixel) } static int -PutPixel16MSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel16MSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -1910,11 +1903,11 @@ PutPixel16MSB(ximage, x, y, pixel) } static int -PutPixel16LSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel16LSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -1928,11 +1921,11 @@ PutPixel16LSB(ximage, x, y, pixel) } static int -PutPixel8(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel8( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { if(x < 0 || y < 0) return 0; @@ -1942,11 +1935,11 @@ PutPixel8(ximage, x, y, pixel) } static int -PutPixel1MSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel1MSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { if(x < 0 || y < 0) return 0; @@ -1959,11 +1952,11 @@ PutPixel1MSB(ximage, x, y, pixel) } static int -PutPixel1LSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel1LSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { if(x < 0 || y < 0) return 0; @@ -1981,15 +1974,14 @@ PutPixel1LSB(ximage, x, y, pixel) * This function parses an Xpm file or data and directly create an XImage */ int -xpmParseDataAndCreate(display, data, image_return, shapeimage_return, - image, info, attributes) - Display *display; - xpmData *data; - XImage **image_return; - XImage **shapeimage_return; - XpmImage *image; - XpmInfo *info; - XpmAttributes *attributes; +xpmParseDataAndCreate( + Display *display, + xpmData *data, + XImage **image_return, + XImage **shapeimage_return, + XpmImage *image, + XpmInfo *info, + XpmAttributes *attributes) { /* variables stored in the XpmAttributes structure */ Visual *visual; @@ -2320,24 +2312,19 @@ error: static int ParseAndPutPixels( #ifdef FOR_MSW - dc, -#endif - data, width, height, ncolors, cpp, colorTable, hashtable, - image, image_pixels, shapeimage, shape_pixels) -#ifdef FOR_MSW - Display *dc; + Display *dc, #endif - xpmData *data; - unsigned int width; - unsigned int height; - unsigned int ncolors; - unsigned int cpp; - XpmColor *colorTable; - xpmHashTable *hashtable; - XImage *image; - Pixel *image_pixels; - XImage *shapeimage; - Pixel *shape_pixels; + xpmData *data, + unsigned int width, + unsigned int height, + unsigned int ncolors, + unsigned int cpp, + XpmColor *colorTable, + xpmHashTable *hashtable, + XImage *image, + Pixel *image_pixels, + XImage *shapeimage, + Pixel *shape_pixels) { unsigned int a, x, y; diff --git a/src/data.c b/src/data.c index 87f4b3f..94caa61 100644 --- a/src/data.c +++ b/src/data.c @@ -182,8 +182,7 @@ ParseComment(xpmData *data) * skip to the end of the current string and the beginning of the next one */ int -xpmNextString(data) - xpmData *data; +xpmNextString(xpmData *data) { if (!data->type) data->cptr = (data->stream.data)[++data->line]; @@ -238,10 +237,10 @@ xpmNextString(data) * skip whitespace and return the following word */ unsigned int -xpmNextWord(data, buf, buflen) - xpmData *data; - char *buf; - unsigned int buflen; +xpmNextWord( + xpmData *data, + char *buf, + unsigned int buflen) { register unsigned int n = 0; int c; @@ -275,9 +274,9 @@ xpmNextWord(data, buf, buflen) * returns 1 if one is found and 0 if not */ int -xpmNextUI(data, ui_return) - xpmData *data; - unsigned int *ui_return; +xpmNextUI( + xpmData *data, + unsigned int *ui_return) { char buf[BUFSIZ]; int l; @@ -290,10 +289,10 @@ xpmNextUI(data, ui_return) * return end of string - WARNING: malloc! */ int -xpmGetString(data, sptr, l) - xpmData *data; - char **sptr; - unsigned int *l; +xpmGetString( + xpmData *data, + char **sptr, + unsigned int *l) { unsigned int i, n = 0; int c; @@ -374,9 +373,9 @@ xpmGetString(data, sptr, l) * get the current comment line */ int -xpmGetCmt(data, cmt) - xpmData *data; - char **cmt; +xpmGetCmt( + xpmData *data, + char **cmt) { if (!data->type) *cmt = NULL; @@ -403,8 +402,7 @@ xpmDataType xpmDataTypes[] = * parse xpm header */ int -xpmParseHeader(data) - xpmData *data; +xpmParseHeader(xpmData *data) { char buf[BUFSIZ+1] = {0}; int l, n = 0; diff --git a/src/hashtab.c b/src/hashtab.c index 84f5e25..49e6e48 100644 --- a/src/hashtab.c +++ b/src/hashtab.c @@ -42,9 +42,9 @@ LFUNC(AtomMake, xpmHashAtom, (char *name, void *data)); LFUNC(HashTableGrows, int, (xpmHashTable * table)); static xpmHashAtom -AtomMake(name, data) /* makes an atom */ - char *name; /* WARNING: is just pointed to */ - void *data; +AtomMake( /* makes an atom */ + char *name, /* WARNING: is just pointed to */ + void *data) { xpmHashAtom object = (xpmHashAtom) XpmMalloc(sizeof(struct _xpmHashAtom)); @@ -107,9 +107,9 @@ AtomMake(name, data) /* makes an atom */ */ xpmHashAtom * -xpmHashSlot(table, s) - xpmHashTable *table; - char *s; +xpmHashSlot( + xpmHashTable *table, + char *s) { xpmHashAtom *atomTable = table->atomTable; unsigned int hash; @@ -134,8 +134,7 @@ xpmHashSlot(table, s) } static int -HashTableGrows(table) - xpmHashTable *table; +HashTableGrows(xpmHashTable *table) { xpmHashAtom *atomTable = table->atomTable; unsigned int size = table->size; @@ -171,10 +170,10 @@ HashTableGrows(table) */ int -xpmHashIntern(table, tag, data) - xpmHashTable *table; - char *tag; - void *data; +xpmHashIntern( + xpmHashTable *table, + char *tag, + void *data) { xpmHashAtom *slot; @@ -200,8 +199,7 @@ xpmHashIntern(table, tag, data) */ int -xpmHashTableInit(table) - xpmHashTable *table; +xpmHashTableInit(xpmHashTable *table) { xpmHashAtom *p; xpmHashAtom *atomTable; @@ -226,8 +224,7 @@ xpmHashTableInit(table) */ void -xpmHashTableFree(table) - xpmHashTable *table; +xpmHashTableFree(xpmHashTable *table) { xpmHashAtom *p; xpmHashAtom *atomTable = table->atomTable; diff --git a/src/misc.c b/src/misc.c index d842e0e..e5bc0f6 100644 --- a/src/misc.c +++ b/src/misc.c @@ -43,8 +43,7 @@ * which does the trick */ char * -xpmstrdup(s1) - char *s1; +xpmstrdup(char *s1) { char *s2; size_t l = strlen(s1) + 1; @@ -57,10 +56,10 @@ xpmstrdup(s1) #endif unsigned int -xpmatoui(p, l, ui_return) - register char *p; - unsigned int l; - unsigned int *ui_return; +xpmatoui( + register char *p, + unsigned int l, + unsigned int *ui_return) { register unsigned int n, i; @@ -82,8 +81,7 @@ xpmatoui(p, l, ui_return) * Function returning a character string related to an error code. */ char * -XpmGetErrorString(errcode) - int errcode; +XpmGetErrorString(int errcode) { switch (errcode) { case XpmColorError: @@ -108,7 +106,7 @@ XpmGetErrorString(errcode) * newer or older than the one with which a program has been first compiled. */ int -XpmLibraryVersion() +XpmLibraryVersion(void) { return XpmIncludeVersion; } @@ -120,8 +118,7 @@ XpmLibraryVersion() #endif void -XpmFree(ptr) - void *ptr; +XpmFree(void *ptr) { free(ptr); } diff --git a/src/parse.c b/src/parse.c index bd5b52c..b183866 100644 --- a/src/parse.c +++ b/src/parse.c @@ -82,12 +82,16 @@ char *xpmColorKeys[] = { }; int -xpmParseValues(data, width, height, ncolors, cpp, - x_hotspot, y_hotspot, hotspot, extensions) - xpmData *data; - unsigned int *width, *height, *ncolors, *cpp; - unsigned int *x_hotspot, *y_hotspot, *hotspot; - unsigned int *extensions; +xpmParseValues( + xpmData *data, + unsigned int *width, + unsigned int *height, + unsigned int *ncolors, + unsigned int *cpp, + unsigned int *x_hotspot, + unsigned int *y_hotspot, + unsigned int *hotspot, + unsigned int *extensions) { unsigned int l; char buf[BUFSIZ + 1]; @@ -192,12 +196,12 @@ xpmParseValues(data, width, height, ncolors, cpp, } int -xpmParseColors(data, ncolors, cpp, colorTablePtr, hashtable) - xpmData *data; - unsigned int ncolors; - unsigned int cpp; - XpmColor **colorTablePtr; - xpmHashTable *hashtable; +xpmParseColors( + xpmData *data, + unsigned int ncolors, + unsigned int cpp, + XpmColor **colorTablePtr, + xpmHashTable *hashtable) { unsigned int key = 0, l, a, b, len; unsigned int curkey; /* current color key */ @@ -365,15 +369,15 @@ xpmParseColors(data, ncolors, cpp, colorTablePtr, hashtable) } static int -ParsePixels(data, width, height, ncolors, cpp, colorTable, hashtable, pixels) - xpmData *data; - unsigned int width; - unsigned int height; - unsigned int ncolors; - unsigned int cpp; - XpmColor *colorTable; - xpmHashTable *hashtable; - unsigned int **pixels; +ParsePixels( + xpmData *data, + unsigned int width, + unsigned int height, + unsigned int ncolors, + unsigned int cpp, + XpmColor *colorTable, + xpmHashTable *hashtable, + unsigned int **pixels) { unsigned int *iptr, *iptr2 = NULL; /* found by Egbert Eich */ unsigned int a, x, y; @@ -538,10 +542,10 @@ do \ } int -xpmParseExtensions(data, extensions, nextensions) - xpmData *data; - XpmExtension **extensions; - unsigned int *nextensions; +xpmParseExtensions( + xpmData *data, + XpmExtension **extensions, + unsigned int *nextensions) { XpmExtension *exts = NULL, *ext; unsigned int num = 0; @@ -659,10 +663,10 @@ do { \ * in an an XpmImage structure which is returned. */ int -xpmParseData(data, image, info) - xpmData *data; - XpmImage *image; - XpmInfo *info; +xpmParseData( + xpmData *data, + XpmImage *image, + XpmInfo *info) { /* variables to return */ unsigned int width, height, ncolors, cpp; diff --git a/src/rgb.c b/src/rgb.c index 0a5af8b..848ae1f 100644 --- a/src/rgb.c +++ b/src/rgb.c @@ -56,10 +56,9 @@ * number of entries stored. */ int -xpmReadRgbNames(rgb_fname, rgbn) - char *rgb_fname; - xpmRgbName rgbn[]; - +xpmReadRgbNames( + char *rgb_fname, + xpmRgbName rgbn[]) { FILE *rgbf; int n, items, red, green, blue; @@ -118,11 +117,12 @@ xpmReadRgbNames(rgb_fname, rgbn) * Return the color name corresponding to the given rgb values */ char * -xpmGetRgbName(rgbn, rgbn_max, red, green, blue) - xpmRgbName rgbn[]; /* rgb mnemonics from rgb text file */ - int rgbn_max; /* number of rgb mnemonics in table */ - int red, green, blue; /* rgb values */ - +xpmGetRgbName( + xpmRgbName rgbn[], /* rgb mnemonics from rgb text file */ + int rgbn_max, /* number of rgb mnemonics in table */ + int red, /* rgb values */ + int green, + int blue) { int i; xpmRgbName *rgb; @@ -144,10 +144,9 @@ xpmGetRgbName(rgbn, rgbn_max, red, green, blue) * Free the strings which have been malloc'ed in xpmReadRgbNames */ void -xpmFreeRgbNames(rgbn, rgbn_max) - xpmRgbName rgbn[]; - int rgbn_max; - +xpmFreeRgbNames( + xpmRgbName rgbn[], + int rgbn_max) { int i; xpmRgbName *rgb; @@ -162,9 +161,9 @@ xpmFreeRgbNames(rgbn, rgbn_max) #include "rgbtab.h" /* hard coded rgb.txt table */ int -xpmReadRgbNames(rgb_fname, rgbn) - char *rgb_fname; - xpmRgbName rgbn[]; +xpmReadRgbNames( + char *rgb_fname, + xpmRgbName rgbn[]) { /* * check for consistency??? @@ -178,11 +177,13 @@ xpmReadRgbNames(rgb_fname, rgbn) * which has something like #0303 for one color */ char * -xpmGetRgbName(rgbn, rgbn_max, red, green, blue) - xpmRgbName rgbn[]; /* rgb mnemonics from rgb text file - * not used */ - int rgbn_max; /* not used */ - int red, green, blue; /* rgb values */ +xpmGetRgbName( + xpmRgbName rgbn[], /* rgb mnemonics from rgb text file + * not used */ + int rgbn_max, /* not used */ + int red, /* rgb values */ + int green, + int blue) { int i; @@ -202,9 +203,11 @@ xpmGetRgbName(rgbn, rgbn_max, red, green, blue) /* used in XParseColor in simx.c */ int -xpmGetRGBfromName(inname, r, g, b) - char *inname; - int *r, *g, *b; +xpmGetRGBfromName( + char *inname, + int *r, + int *g, + int *b) { int left, right, middle; int cmp; @@ -274,10 +277,9 @@ xpmGetRGBfromName(inname, r, g, b) } void -xpmFreeRgbNames(rgbn, rgbn_max) - xpmRgbName rgbn[]; - int rgbn_max; - +xpmFreeRgbNames( + xpmRgbName rgbn[], + int rgbn_max) { /* nothing to do */ } diff --git a/src/scan.c b/src/scan.c index e8e4c27..eab1c43 100644 --- a/src/scan.c +++ b/src/scan.c @@ -122,10 +122,10 @@ LFUNC(ScanOtherColors, int, (Display *display, XpmColor *colors, * if not large enough. */ static int -storePixel(pixel, pmap, index_return) - Pixel pixel; - PixelsMap *pmap; - unsigned int *index_return; +storePixel( + Pixel pixel, + PixelsMap *pmap, + unsigned int *index_return) { unsigned int i; Pixel *p; @@ -157,10 +157,10 @@ storePixel(pixel, pmap, index_return) } static int -storeMaskPixel(pixel, pmap, index_return) - Pixel pixel; - PixelsMap *pmap; - unsigned int *index_return; +storeMaskPixel( + Pixel pixel, + PixelsMap *pmap, + unsigned int *index_return) { if (!pixel) { if (!pmap->ncolors) { @@ -187,13 +187,12 @@ do { \ * the given XpmImage structure. */ int -XpmCreateXpmImageFromImage(display, image, shapeimage, - xpmimage, attributes) - Display *display; - XImage *image; - XImage *shapeimage; - XpmImage *xpmimage; - XpmAttributes *attributes; +XpmCreateXpmImageFromImage( + Display *display, + XImage *image, + XImage *shapeimage, + XpmImage *xpmimage, + XpmAttributes *attributes) { /* variables stored in the XpmAttributes structure */ unsigned int cpp; @@ -363,10 +362,10 @@ error: } static int -ScanTransparentColor(color, cpp, attributes) - XpmColor *color; - unsigned int cpp; - XpmAttributes *attributes; +ScanTransparentColor( + XpmColor *color, + unsigned int cpp, + XpmAttributes *attributes) { char *s; unsigned int a, b, c; @@ -419,14 +418,14 @@ ScanTransparentColor(color, cpp, attributes) } static int -ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes) - Display *display; - XpmColor *colors; - unsigned int ncolors; - Pixel *pixels; - unsigned int mask; - unsigned int cpp; - XpmAttributes *attributes; +ScanOtherColors( + Display *display, + XpmColor *colors, + unsigned int ncolors, + Pixel *pixels, + unsigned int mask, + unsigned int cpp, + XpmAttributes *attributes) { /* variables stored in the XpmAttributes structure */ Colormap colormap; @@ -614,11 +613,11 @@ static unsigned long Const low_bits_table[] = { */ static int -GetImagePixels(image, width, height, pmap) - XImage *image; - unsigned int width; - unsigned int height; - PixelsMap *pmap; +GetImagePixels( + XImage *image, + unsigned int width, + unsigned int height, + PixelsMap *pmap) { char *src; char *dst; @@ -720,11 +719,11 @@ static unsigned long byteorderpixel = MSBFirst << 24; #endif static int -GetImagePixels32(image, width, height, pmap) - XImage *image; - unsigned int width; - unsigned int height; - PixelsMap *pmap; +GetImagePixels32( + XImage *image, + unsigned int width, + unsigned int height, + PixelsMap *pmap) { unsigned char *addr; unsigned char *data; @@ -785,11 +784,11 @@ GetImagePixels32(image, width, height, pmap) */ static int -GetImagePixels16(image, width, height, pmap) - XImage *image; - unsigned int width; - unsigned int height; - PixelsMap *pmap; +GetImagePixels16( + XImage *image, + unsigned int width, + unsigned int height, + PixelsMap *pmap) { unsigned char *addr; unsigned char *data; @@ -831,11 +830,11 @@ GetImagePixels16(image, width, height, pmap) */ static int -GetImagePixels8(image, width, height, pmap) - XImage *image; - unsigned int width; - unsigned int height; - PixelsMap *pmap; +GetImagePixels8( + XImage *image, + unsigned int width, + unsigned int height, + PixelsMap *pmap) { unsigned int *iptr; unsigned char *data; @@ -864,12 +863,12 @@ GetImagePixels8(image, width, height, pmap) */ static int -GetImagePixels1(image, width, height, pmap, storeFunc) - XImage *image; - unsigned int width; - unsigned int height; - PixelsMap *pmap; - storeFuncPtr storeFunc; +GetImagePixels1( + XImage *image, + unsigned int width, + unsigned int height, + PixelsMap *pmap, + storeFuncPtr storeFunc) { unsigned int *iptr; unsigned int x, y; @@ -920,7 +919,7 @@ AGetImagePixels ( unsigned int width, unsigned int height, PixelsMap *pmap, - int (*storeFunc) ()) + int (*storeFunc) (Pixel, PixelsMap *, unsigned int *)) { unsigned int *iptr; unsigned int x, y; @@ -954,13 +953,13 @@ AGetImagePixels ( # endif/* AMIGA */ #else /* ndef FOR_MSW */ static int -MSWGetImagePixels(display, image, width, height, pmap, storeFunc) - Display *display; - XImage *image; - unsigned int width; - unsigned int height; - PixelsMap *pmap; - int (*storeFunc) (); +MSWGetImagePixels( + Display *display, + XImage *image, + unsigned int width, + unsigned int height, + PixelsMap *pmap, + int (*storeFunc) (Pixel, PixelsMap*, unsigned int *)) { unsigned int *iptr; unsigned int x, y; @@ -984,13 +983,12 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc) #ifndef FOR_MSW # ifndef AMIGA int -XpmCreateXpmImageFromPixmap(display, pixmap, shapemask, - xpmimage, attributes) - Display *display; - Pixmap pixmap; - Pixmap shapemask; - XpmImage *xpmimage; - XpmAttributes *attributes; +XpmCreateXpmImageFromPixmap( + Display *display, + Pixmap pixmap, + Pixmap shapemask, + XpmImage *xpmimage, + XpmAttributes *attributes) { XImage *ximage = NULL; XImage *shapeimage = NULL; diff --git a/sxpm/.gitignore b/sxpm/.gitignore deleted file mode 100644 index 89c4575..0000000 --- a/sxpm/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -sxpm diff --git a/sxpm/sxpm.c b/sxpm/sxpm.c index a43d441..1b80d53 100644 --- a/sxpm/sxpm.c +++ b/sxpm/sxpm.c @@ -110,16 +110,14 @@ static char *plaid[] = { #define xrdb XtDatabase(dpy) static Colormap colormap; -void Usage(); -void ErrorMessage(); -void Punt(); -void VersionInfo(); - -#ifdef __STDC__ +void Usage(void); +void ErrorMessage(int ErrorStatus, char *tag); +void Punt(int i); +void VersionInfo(void); void kinput(Widget widget, char *tag, XEvent *xe, Boolean *b); -#else -void kinput(); -#endif +void GetNumbers(int num, int *format_return, + int *libmajor_return, + char *libminor_return); #define IWIDTH 50 #define IHEIGHT 50 @@ -139,9 +137,9 @@ static XrmOptionDescRec options[] = { }; int -main(argc, argv) - int argc; - char **argv; +main( + int argc, + char **argv) { int ErrorStatus; unsigned int verbose = 0; /* performs verbose output */ @@ -578,7 +576,7 @@ main(argc, argv) } void -Usage() +Usage(void) { /* L10N_Comments : Usage message (sxpm -h) in two parts. In the first part %s is replaced by the command name. */ @@ -616,9 +614,9 @@ if no input is specified sxpm reads from standard input.\n\ void -ErrorMessage(ErrorStatus, tag) - int ErrorStatus; - char *tag; +ErrorMessage( + int ErrorStatus, + char *tag) { char *error = NULL; char *warning = NULL; @@ -674,8 +672,7 @@ ErrorMessage(ErrorStatus, tag) } void -Punt(i) - int i; +Punt(int i) { if (icon.pixmap) { XFreePixmap(dpy, icon.pixmap); @@ -703,11 +700,11 @@ Punt(i) } void -kinput(widget, tag, xe, b) - Widget widget; - char *tag; - XEvent *xe; - Boolean *b; +kinput( + Widget widget, + char *tag, + XEvent *xe, + Boolean *b) { char c = '\0'; @@ -721,11 +718,11 @@ kinput(widget, tag, xe, b) * number (following the rule described in xpm.h). */ void -GetNumbers(num, format_return, libmajor_return, libminor_return) - int num; - int *format_return; - int *libmajor_return; - char *libminor_return; +GetNumbers( + int num, + int *format_return, + int *libmajor_return, + char *libminor_return) { *format_return = num / 10000; *libmajor_return = (num % 10000) / 100; @@ -733,7 +730,7 @@ GetNumbers(num, format_return, libmajor_return, libminor_return) } void -VersionInfo() +VersionInfo(void) { int format, libmajor; char libminor; -- cgit v1.2.3