summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-15 15:43:08 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-15 15:43:08 -0200
commit5d82f32cac19af013c48d01b66aa9f14add30f42 (patch)
tree7805731f25966892f4d23e395e8b99345bd60577
parenta27df6ee496a1b2df678242cf514490924f44027 (diff)
Ansification and compile warning fixes.
This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and most gcc 4.3 and sparse warnings.
-rw-r--r--.gitignore4
-rw-r--r--Makefile.am2
-rw-r--r--clientwin.c6
-rw-r--r--configure.ac8
-rw-r--r--list.c2
-rw-r--r--multiVis.c243
-rw-r--r--xwd.c52
7 files changed, 127 insertions, 190 deletions
diff --git a/.gitignore b/.gitignore
index 36b7cfe..ec5775d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,3 +18,7 @@ stamp-h1
xwd
xwd.1
*~
+*.o
+xwd-*.tar.*
+ChangeLog
+tags
diff --git a/Makefile.am b/Makefile.am
index 8e193a9..a5ac242 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -77,6 +77,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/clientwin.c b/clientwin.c
index 808adec..cce35ad 100644
--- a/clientwin.c
+++ b/clientwin.c
@@ -22,6 +22,8 @@
#include <X11/Xatom.h>
#include <X11/Xlib.h>
+#include "clientwin.h"
+
static Atom atom_wm_state = None;
/*
@@ -68,7 +70,7 @@ Window_Is_Viewable(Display * dpy, Window win)
* Children are searched in top-down stacking order.
* The first matching window is returned, None if no match is found.
*/
-Window
+static Window
Find_Client_In_Children(Display * dpy, Window win)
{
Window root, parent;
@@ -114,7 +116,7 @@ Find_Client_In_Children(Display * dpy, Window win)
/*
* Find virtual roots (_NET_VIRTUAL_ROOTS)
*/
-unsigned long *
+static unsigned long *
Find_Roots(Display * dpy, Window root, unsigned int *num)
{
Atom type_ret;
diff --git a/configure.ac b/configure.ac
index c80a8e5..68a033e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,18 +26,26 @@ AC_INIT(xwd,[1.0.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],x
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)
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
+XORG_CWARNFLAGS
+
# Checks for pkg-config packages
PKG_CHECK_MODULES(XWD, x11)
+XWD_CFLAGS="$CWARNFLAGS $XWD_CFLAGS"
AC_SUBST(XWD_CFLAGS)
AC_SUBST(XWD_LIBS)
XORG_MANPAGE_SECTIONS
XORG_RELEASE_VERSION
+XORG_CHANGELOG
AC_OUTPUT([Makefile])
diff --git a/list.c b/list.c
index c5ea6c8..85472a2 100644
--- a/list.c
+++ b/list.c
@@ -79,7 +79,7 @@ int add_to_list(list_ptr lp, void *item)
Creates a new list and sets its pointers to NULL.
Returns a pointer to the new list.
-------------------------------------------------------------------- **/
-list_ptr new_list ()
+list_ptr new_list (void)
{
list_ptr lp;
diff --git a/multiVis.c b/multiVis.c
index e5ed2c7..23d83b4 100644
--- a/multiVis.c
+++ b/multiVis.c
@@ -170,8 +170,7 @@ static void destroy_image_region(
/* End of Prototype Declarations */
-void initFakeVisual(Vis)
-Visual *Vis ;
+void initFakeVisual(Visual *Vis)
{
Vis->ext_data=NULL;
Vis->class = DirectColor ;
@@ -183,12 +182,8 @@ Visual *Vis ;
}
static int
-QueryColorMap(disp,src_cmap,src_vis,src_colors,rShift,gShift,bShift)
-Display *disp ;
-Visual *src_vis ;
-Colormap src_cmap ;
-XColor **src_colors ;
-int *rShift, *gShift, *bShift;
+QueryColorMap(Display *disp, Colormap src_cmap, Visual *src_vis,
+ XColor **src_colors, int *rShift, int *gShift, int *bShift)
{
int ncolors,i ;
unsigned long redMask, greenMask, blueMask;
@@ -246,25 +241,20 @@ int *rShift, *gShift, *bShift;
}
int
-GetMultiVisualRegions(disp,srcRootWinid, x, y, width, height,
- transparentOverlays,numVisuals, pVisuals,numOverlayVisuals, pOverlayVisuals,
- numImageVisuals, pImageVisuals,vis_regions,vis_image_regions,allImage)
- Display *disp;
- Window srcRootWinid; /* root win on which grab was done */
- int x; /* root rel UL corner of bounding box of grab */
- int y;
- unsigned int width; /* size of bounding box of grab */
- unsigned int height;
- int *transparentOverlays ;
- int *numVisuals;
- XVisualInfo **pVisuals;
- int *numOverlayVisuals;
- OverlayInfo **pOverlayVisuals;
- int *numImageVisuals;
- XVisualInfo ***pImageVisuals;
- list_ptr *vis_regions; /* list of regions to read from */
- list_ptr *vis_image_regions ;
- int *allImage ;
+GetMultiVisualRegions(Display *disp,
+ /* root win on which grab was done */
+ Window srcRootWinid,
+ /* root rel UL corner of bounding box of grab */
+ int x, int y,
+ /* size of bounding box of grab */
+ unsigned int width, unsigned int height,
+ int *transparentOverlays, int *numVisuals,
+ XVisualInfo **pVisuals, int *numOverlayVisuals,
+ OverlayInfo **pOverlayVisuals,
+ int *numImageVisuals, XVisualInfo ***pImageVisuals,
+ /* list of regions to read from */
+ list_ptr *vis_regions,
+ list_ptr *vis_image_regions, int *allImage)
{
int hasNonDefault;
XRectangle bbox; /* bounding box of grabbed area */
@@ -304,12 +294,10 @@ GetMultiVisualRegions(disp,srcRootWinid, x, y, width, height,
}
-static void TransferImage(disp,reg_image,srcw,srch,reg,
- target_image,dst_x,dst_y)
-Display *disp;
-XImage *reg_image,*target_image ;
-image_region_type *reg;
-int srcw,srch,dst_x , dst_y ;
+static void TransferImage(Display *disp, XImage *reg_image,
+ int srcw, int srch,
+ image_region_type *reg, XImage *target_image,
+ int dst_x, int dst_y)
{
int i,j,old_pixel,new_pixel,red_ind,green_ind,blue_ind ;
XColor *colors;
@@ -388,13 +376,10 @@ int srcw,srch,dst_x , dst_y ;
}
static XImage *
-ReadRegionsInList(disp,fakeVis,depth,format,width,height,bbox,regions)
-Display *disp ;
-Visual *fakeVis ;
-int depth , width , height ;
-int format ;
-XRectangle bbox; /* bounding box of grabbed area */
-list_ptr regions;/* list of regions to read from */
+ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format,
+ int width,int height,
+ XRectangle bbox, /* bounding box of grabbed area */
+ list_ptr regions) /* list of regions to read from */
{
image_region_type *reg;
int dst_x, dst_y; /* where in pixmap to write (UL) */
@@ -471,26 +456,21 @@ list_ptr regions;/* list of regions to read from */
/** ------------------------------------------------------------------------
------------------------------------------------------------------------ **/
-XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height,
- numVisuals,pVisuals,numOverlayVisuals,pOverlayVisuals,numImageVisuals,
- pImageVisuals,vis_regions,vis_image_regions,format,allImage)
- Display *disp;
- Window srcRootWinid; /* root win on which grab was done */
- int x; /* root rel UL corner of bounding box of grab */
- int y;
- unsigned int width; /* size of bounding box of grab */
- unsigned int height;
- /** int transparentOverlays; ***/
- int numVisuals;
- XVisualInfo *pVisuals;
- int numOverlayVisuals;
- OverlayInfo *pOverlayVisuals;
- int numImageVisuals;
- XVisualInfo **pImageVisuals;
- list_ptr vis_regions; /* list of regions to read from */
- list_ptr vis_image_regions ;/* list of regions to read from */
- int format;
- int allImage ;
+XImage *ReadAreaToImage(Display *disp,
+ /* root win on which grab was done */
+ Window srcRootWinid,
+ /* root rel UL corner of bounding box of grab */
+ int x, int y,
+ /* size of bounding box of grab */
+ unsigned int width, unsigned int height,
+ int numVisuals, XVisualInfo *pVisuals,
+ int numOverlayVisuals, OverlayInfo *pOverlayVisuals,
+ int numImageVisuals, XVisualInfo **pImageVisuals,
+ /* list of regions to read from */
+ list_ptr vis_regions,
+ /* list of regions to read from */
+ list_ptr vis_image_regions,
+ int format, int allImage)
{
image_region_type *reg;
XRectangle bbox; /* bounding box of grabbed area */
@@ -664,17 +644,15 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height,
image_wins must point to an existing list struct that's already
been zeroed (zero_list()).
------------------------------------------------------------------------ **/
-static void make_src_list( disp, image_wins, bbox, curr, x_rootrel, y_rootrel,
- curr_attrs, pclip)
- Display *disp;
- list_ptr image_wins;
- XRectangle *bbox; /* bnding box of area we want */
- Window curr;
- int x_rootrel; /* pos of curr WRT root */
- int y_rootrel;
- XWindowAttributes *curr_attrs;
- XRectangle *pclip; /* visible part of curr, not */
- /* obscurred by ancestors */
+static void make_src_list(Display *disp, list_ptr image_wins,
+ /* bnding box of area we want */
+ XRectangle *bbox,
+ Window curr,
+ /* pos of curr WRT root */
+ int x_rootrel, int y_rootrel,
+ XWindowAttributes *curr_attrs,
+ /* visible part of curr, not obscurred by ancestors */
+ XRectangle *pclip)
{
XWindowAttributes child_attrs;
Window root, parent, *child; /* variables for XQueryTree() */
@@ -760,15 +738,9 @@ static void make_src_list( disp, image_wins, bbox, curr, x_rootrel, y_rootrel,
there will be two regions in the list.
Returns a pointer to the list.
------------------------------------------------------------------------ **/
-static list_ptr make_region_list( disp, win, bbox, hasNonDefault,
- numImageVisuals, pImageVisuals, allImage)
- Display *disp;
- Window win;
- XRectangle *bbox;
- int *hasNonDefault;
- int numImageVisuals;
- XVisualInfo **pImageVisuals;
- int *allImage;
+static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox,
+ int *hasNonDefault, int numImageVisuals,
+ XVisualInfo **pImageVisuals, int *allImage)
{
XWindowAttributes win_attrs;
list image_wins;
@@ -863,8 +835,7 @@ static list_ptr make_region_list( disp, win, bbox, hasNonDefault,
/** ------------------------------------------------------------------------
Destructor called from destroy_region_list().
------------------------------------------------------------------------ **/
-static void destroy_image_region(image_region)
- image_region_type *image_region;
+static void destroy_image_region(image_region_type *image_region)
{
XDestroyRegion( image_region->visible_region);
free( (void *) image_region);
@@ -873,8 +844,7 @@ static void destroy_image_region(image_region)
/** ------------------------------------------------------------------------
Destroys the region list, destroying all the regions contained in it.
------------------------------------------------------------------------ **/
-static void destroy_region_list( rlist)
- list_ptr rlist;
+static void destroy_region_list(list_ptr rlist)
{
delete_list_destroying( rlist, (DESTRUCT_FUNC_PTR)destroy_image_region);
}
@@ -886,12 +856,8 @@ static void destroy_region_list( rlist)
only provides a way to subtract one region from another, not a
rectangle from a region.
------------------------------------------------------------------------ **/
-static void subtr_rect_from_image_region( image_region, x, y, width, height)
- image_region_type *image_region;
- int x;
- int y;
- int width;
- int height;
+static void subtr_rect_from_image_region(image_region_type *image_region,
+ int x, int y, int width, int height)
{
XRectangle rect;
Region rect_region;
@@ -911,12 +877,8 @@ static void subtr_rect_from_image_region( image_region, x, y, width, height)
/** ------------------------------------------------------------------------
Adds the specified rectangle to the region in image_region.
------------------------------------------------------------------------ **/
-static void add_rect_to_image_region( image_region, x, y, width, height)
- image_region_type *image_region;
- int x;
- int y;
- int width;
- int height;
+static void add_rect_to_image_region(image_region_type *image_region,
+ int x, int y, int width, int height)
{
XRectangle rect;
@@ -933,9 +895,7 @@ static void add_rect_to_image_region( image_region, x, y, width, height)
Returns TRUE if the given src's visual is already represented in
the image_regions list, FALSE otherwise.
------------------------------------------------------------------------ **/
-static int src_in_region_list( src, image_regions)
- image_win_type *src;
- list_ptr image_regions;
+static int src_in_region_list(image_win_type *src, list_ptr image_regions)
{
image_region_type *ir;
@@ -954,20 +914,10 @@ static int src_in_region_list( src, image_regions)
/** ------------------------------------------------------------------------
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;
- int border_width;
- 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;
@@ -993,10 +943,8 @@ static void add_window_to_list( image_wins, w, xrr, yrr, x_vis, y_vis,
Returns TRUE if the given src's visual is in the image planes,
FALSE otherwise.
------------------------------------------------------------------------ **/
-static int src_in_image( src, numImageVisuals, pImageVisuals)
- image_win_type *src;
- int numImageVisuals;
- XVisualInfo **pImageVisuals;
+static int src_in_image(image_win_type *src, int numImageVisuals,
+ XVisualInfo **pImageVisuals)
{
int i;
@@ -1013,13 +961,9 @@ static int src_in_image( src, numImageVisuals, pImageVisuals)
Returns TRUE if the given src's visual is in the overlay planes
and transparency is possible, FALSE otherwise.
------------------------------------------------------------------------ **/
-static int src_in_overlay( src, numOverlayVisuals, pOverlayVisuals,
- transparentColor, transparentType)
- image_region_type *src;
- int numOverlayVisuals;
- OverlayInfo *pOverlayVisuals;
- int *transparentColor;
- int *transparentType;
+static int src_in_overlay(image_region_type *src, int numOverlayVisuals,
+ OverlayInfo *pOverlayVisuals,
+ int *transparentColor, int *transparentType)
{
int i;
@@ -1087,29 +1031,27 @@ static int weCreateServerOverlayVisualsProperty = False;
*
******************************************************************************/
-int GetXVisualInfo(display, screen, transparentOverlays,
- numVisuals, pVisuals,
- numOverlayVisuals, pOverlayVisuals,
- numImageVisuals, pImageVisuals)
-
- Display *display; /* Which X server (aka "display"). */
- int screen; /* Which screen of the "display". */
- int *transparentOverlays; /* Non-zero if there's at least one
- * overlay visual and if at least one
- * of those supports a transparent
- * pixel. */
- int *numVisuals; /* Number of XVisualInfo struct's
- * pointed to to by pVisuals. */
- XVisualInfo **pVisuals; /* All of the device's visuals. */
- int *numOverlayVisuals; /* Number of OverlayInfo's pointed
- * to by pOverlayVisuals. If this
- * number is zero, the device does
- * not have overlay planes. */
- OverlayInfo **pOverlayVisuals; /* The device's overlay plane visual
- * information. */
- int *numImageVisuals; /* Number of XVisualInfo's pointed
- * to by pImageVisuals. */
- XVisualInfo ***pImageVisuals; /* The device's image visuals. */
+int GetXVisualInfo(/* Which X server (aka "display"). */
+ Display *display,
+ /* Which screen of the "display". */
+ int screen,
+ /* Non-zero if there's at least one overlay visual and
+ * if at least one of those supports a transparent pixel. */
+ int *transparentOverlays,
+ /* Number of XVisualInfo struct's pointed to by pVisuals. */
+ int *numVisuals,
+ /* All of the device's visuals. */
+ XVisualInfo **pVisuals,
+ /* Number of OverlayInfo's pointed to by pOverlayVisuals.
+ * If this number is zero, the device does not have
+ * overlay planes. */
+ int *numOverlayVisuals,
+ /* The device's overlay plane visual information. */
+ OverlayInfo **pOverlayVisuals,
+ /* Number of XVisualInfo's pointed to by pImageVisuals. */
+ int *numImageVisuals,
+ /* The device's image visuals. */
+ XVisualInfo ***pImageVisuals)
{
XVisualInfo getVisInfo; /* Paramters of XGetVisualInfo */
int mask;
@@ -1221,11 +1163,8 @@ int GetXVisualInfo(display, screen, transparentOverlays,
*
******************************************************************************/
-void FreeXVisualInfo(pVisuals, pOverlayVisuals, pImageVisuals)
-
- XVisualInfo *pVisuals;
- OverlayInfo *pOverlayVisuals;
- XVisualInfo **pImageVisuals;
+void FreeXVisualInfo(XVisualInfo *pVisuals, OverlayInfo *pOverlayVisuals,
+ XVisualInfo **pImageVisuals)
{
XFree(pVisuals);
if (weCreateServerOverlayVisualsProperty)
diff --git a/xwd.c b/xwd.c
index 944faab..65c1f3b 100644
--- a/xwd.c
+++ b/xwd.c
@@ -91,14 +91,14 @@ typedef unsigned long Pixel;
/* Setable Options */
-int format = ZPixmap;
-Bool nobdrs = False;
-Bool on_root = False;
-Bool standard_out = True;
-Bool debug = False;
-Bool silent = False;
-Bool use_installed = False;
-long add_pixel_value = 0;
+static int format = ZPixmap;
+static Bool nobdrs = False;
+static Bool on_root = False;
+static Bool standard_out = True;
+static Bool debug = False;
+static Bool silent = False;
+static Bool use_installed = False;
+static long add_pixel_value = 0;
extern int main(int, char **);
@@ -112,8 +112,7 @@ static int Get24bitDirectColors(XColor **);
static int ReadColors(Visual *, Colormap, XColor **);
-static long parse_long (s)
- char *s;
+static long parse_long (char *s)
{
char *fmt = "%lu";
long retval = 0L;
@@ -129,9 +128,7 @@ static long parse_long (s)
}
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
register int i;
Window target_win;
@@ -215,8 +212,7 @@ main(argc, argv)
}
static int
-Get24bitDirectColors(colors)
-XColor **colors ;
+Get24bitDirectColors(XColor **colors)
{
int i , ncolors = 256 ;
XColor *tcol ;
@@ -239,9 +235,7 @@ XColor **colors ;
*/
void
-Window_Dump(window, out)
- Window window;
- FILE *out;
+Window_Dump(Window window, FILE *out)
{
unsigned long swaptest = 1;
XColor *colors;
@@ -515,7 +509,7 @@ Window_Dump(window, out)
* Report the syntax for calling xwd.
*/
void
-usage()
+usage(void)
{
fprintf (stderr,
"usage: %s [-display host:dpy] [-debug] [-help] %s [-nobdrs] [-out <file>]",
@@ -529,8 +523,7 @@ usage()
* 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);
@@ -541,10 +534,7 @@ int Image_Size(image)
#define lowbit(x) ((x) & (~(x) + 1))
static int
-ReadColors(vis,cmap,colors)
-Visual *vis ;
-Colormap cmap ;
-XColor **colors ;
+ReadColors(Visual *vis, Colormap cmap, XColor **colors)
{
int i,ncolors ;
@@ -589,9 +579,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;
@@ -606,9 +594,7 @@ int Get_XColors(win_info, colors)
}
void
-_swapshort (bp, n)
- register char *bp;
- register unsigned n;
+_swapshort (register char *bp, register unsigned n)
{
register char c;
register char *ep = bp + n;
@@ -622,9 +608,7 @@ _swapshort (bp, n)
}
void
-_swaplong (bp, n)
- register char *bp;
- register unsigned n;
+_swaplong (register char *bp, register unsigned n)
{
register char c;
register char *ep = bp + n;