From dba2f250a9d1e85a9ec2b6c8dd50a717889dc27f Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Wed, 21 Jan 2009 18:48:33 -0200 Subject: Correct make distchek and sparse warnings. --- .gitignore | 4 ++++ Makefile.am | 4 ++-- configure.ac | 18 ++++++++++++++++++ io.c | 1 + pm.c | 8 ++++---- xfwp.h | 6 +++--- 6 files changed, 32 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index a010c83..475b8a1 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,7 @@ stamp-h1 xfwp xfwp.1 *~ +*.o +xfwp-*.tar.* +ChangeLog +tags diff --git a/Makefile.am b/Makefile.am index a42251a..9ca0998 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,7 +21,7 @@ bin_PROGRAMS = xfwp -xfwp_CFLAGS = $(XFWP_CFLAGS) +AM_CFLAGS = $(XFWP_CFLAGS) xfwp_LDADD = $(XFWP_LIBS) xfwp_SOURCES = \ @@ -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/configure.ac b/configure.ac index 5e668c5..ead8a13 100644 --- a/configure.ac +++ b/configure.ac @@ -26,13 +26,30 @@ AC_INIT(xfwp,[1.0.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], 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 AC_PROG_INSTALL +XORG_CWARNFLAGS + +AC_CANONICAL_HOST +case $host_os in + linux*|gnu*|*-gnu) + OS_CFLAGS="-D_XOPEN_SOURCE -D_BSD_SOURCE" + ;; + *) + OS_CFLAGS= + ;; +esac + # Checks for pkg-config packages PKG_CHECK_MODULES(XFWP, x11 ice xproxymngproto) +XFWP_CFLAGS="$CWARNFLAGS $XFWP_CFLAGS $OS_CFLAGS" AC_SUBST(XFWP_CFLAGS) AC_SUBST(XFWP_LIBS) @@ -42,5 +59,6 @@ XTRANS_TCP_FLAGS XORG_MANPAGE_SECTIONS XORG_RELEASE_VERSION +XORG_CHANGELOG AC_OUTPUT([Makefile]) diff --git a/io.c b/io.c index 5f1e051..8cec51c 100644 --- a/io.c +++ b/io.c @@ -34,6 +34,7 @@ X Window System is a trademark of The Open Group. #include #include #include +#include #include /* Needed here for SunOS */ #include #include diff --git a/pm.c b/pm.c index 5f2297e..4b6691e 100644 --- a/pm.c +++ b/pm.c @@ -228,7 +228,7 @@ void FWPprocessMessages( * */ pm_send_msg_len = STRING_BYTES(config_failure) - + STRING_BYTES(NULL); + + STRING_BYTES(""); IceGetHeaderExtra(iceConn, program_data->major_opcode, PM_GetProxyAddrReply, @@ -238,7 +238,7 @@ void FWPprocessMessages( pReply, pReplyData); pReply->status = PM_Failure; - STORE_STRING(pReplyData, NULL); + STORE_STRING(pReplyData, ""); STORE_STRING(pReplyData, config_failure); IceFlush(iceConn); free(tmp_str); @@ -304,7 +304,7 @@ void FWPprocessMessages( * use IceGetHeaderExtra() and the */ pm_send_msg_len = STRING_BYTES(listen_port_string) - + STRING_BYTES(NULL); + + STRING_BYTES(""); IceGetHeaderExtra(iceConn, program_data->major_opcode, PM_GetProxyAddrReply, @@ -315,7 +315,7 @@ void FWPprocessMessages( pReplyData); pReply->status = PM_Success; STORE_STRING(pReplyData, listen_port_string); - STORE_STRING(pReplyData, NULL); + STORE_STRING(pReplyData, ""); IceFlush(iceConn); /* * before leaving this routine, change the select() timeout diff --git a/xfwp.h b/xfwp.h index fa2f240..a263c76 100644 --- a/xfwp.h +++ b/xfwp.h @@ -233,8 +233,8 @@ extern int SitePolicyPermit; * Compute the number of bytes for a STRING representation */ -#define STRING_BYTES(_str) (2 + (_str ? strlen (_str) : 0) + \ - PAD64 (2 + (_str ? strlen (_str) : 0))) +#define STRING_BYTES(_str) (2 + strlen (_str) + \ + PAD64 (2 + strlen (_str))) @@ -259,7 +259,7 @@ extern int SitePolicyPermit; #define STORE_STRING(_pBuf, _string) \ { \ - int _len = _string ? strlen (_string) : 0; \ + int _len = strlen (_string); \ STORE_CARD16 (_pBuf, _len); \ if (_len) { \ memcpy (_pBuf, _string, _len); \ -- cgit v1.2.3