From 82d76c4efcae92709aa07ec9e653f73076f43ebf Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Tue, 13 Jan 2009 16:26:42 -0200 Subject: Ansification and compile warning fixes. This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings. --- .gitignore | 4 ++++ Clock.c | 22 +++++++++++----------- Makefile.am | 18 +++++------------- app-defaults/XClock | 1 + app-defaults/XClock-color | 10 ++++++++++ app-defaults/XClock-color.ad | 10 ---------- app-defaults/XClock.ad | 1 - configure.ac | 15 +++++++++++++-- 8 files changed, 44 insertions(+), 37 deletions(-) create mode 100644 app-defaults/XClock create mode 100644 app-defaults/XClock-color delete mode 100644 app-defaults/XClock-color.ad delete mode 100644 app-defaults/XClock.ad diff --git a/.gitignore b/.gitignore index 43fe2e7..8560e15 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,7 @@ stamp-h1 xclock xclock.1 *~ +*.o +xclock-*.tar.* +ChangeLog +tags diff --git a/Clock.c b/Clock.c index ab82db6..8ce3696 100644 --- a/Clock.c +++ b/Clock.c @@ -325,7 +325,7 @@ static void CvtStringToPixmap( #endif #ifdef XRENDER -XtConvertArgRec xftColorConvertArgs[] = { +static XtConvertArgRec xftColorConvertArgs[] = { {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), sizeof(Screen *)}, {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap), @@ -489,7 +489,7 @@ XmuCvtStringToXftFont(Display *dpy, return False; } -XtConvertArgRec xftFontConvertArgs[] = { +static XtConvertArgRec xftFontConvertArgs[] = { {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), sizeof(Screen *)}, }; @@ -752,7 +752,7 @@ Initialize (Widget request, Widget new, ArgList args, Cardinal *num_args) w->clock.can_polygon = False; } w->clock.pixmap = 0; - w->clock.draw = 0; + w->clock.draw = NULL; w->clock.damage.x = 0; w->clock.damage.y = 0; w->clock.damage.height = 0; @@ -798,8 +798,8 @@ RenderClip (ClockWidget w) { Region r; Drawable d; - - RenderPrepare (w, 0); + + RenderPrepare (w, NULL); if (w->clock.buffer) d = w->clock.pixmap; else @@ -1225,7 +1225,7 @@ Resize(Widget gw) if (w->clock.draw) { XftDrawDestroy (w->clock.draw); - w->clock.draw = 0; + w->clock.draw = NULL; } w->clock.picture = 0; } @@ -1436,22 +1436,22 @@ clock_tic(XtPointer client_data, XtIntervalId *id) #endif RenderTextBounds (w, w->clock.prev_time_string, i, prev_len, - &old_tail, 0, 0); + &old_tail, NULL, NULL); RenderUpdateRectBounds (&old_tail, &w->clock.damage); RenderTextBounds (w, time_ptr, i, len, - &new_tail, 0, 0); + &new_tail, NULL, NULL); RenderUpdateRectBounds (&new_tail, &w->clock.damage); while (i) { - RenderTextBounds (w, time_ptr, 0, i, &head, 0, 0); + RenderTextBounds (w, time_ptr, 0, i, &head, NULL, NULL); if (!RenderRectIn (&head, &w->clock.damage)) break; i--; } RenderTextBounds (w, time_ptr, i, len, &new_tail, &x, &y); RenderClip (w); - RenderPrepare (w, 0); + RenderPrepare (w, NULL); #ifndef NO_I18N if (w->clock.utf8) { XftDrawStringUtf8 (w->clock.draw, @@ -2207,7 +2207,7 @@ SetValues(Widget gcurrent, Widget grequest, Widget gnew, if (new->clock.draw) { XftDrawDestroy (new->clock.draw); - new->clock.draw = 0; + new->clock.draw = NULL; } new->clock.picture = 0; } diff --git a/Makefile.am b/Makefile.am index 67faa6e..21c3685 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,24 +35,16 @@ appman_PRE = \ # App default files (*.ad) -appdefaultdir = @appdefaultdir@ +DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults +appdefaultdir = @appdefaultdir@ -APPDEFAULTFILES = \ +dist_appdefault_DATA = \ app-defaults/XClock-color \ app-defaults/XClock -SUFFIXES = .ad - -.ad: - [ -d app-defaults ] || mkdir app-defaults - cp $< $@ - -appdefault_DATA = $(APPDEFAULTFILES) - EXTRA_DIST = \ ChangeLog \ - $(APPDEFAULTFILES:%=%.ad) \ clmask.bit \ clock.bit @@ -70,7 +62,7 @@ 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 @@ -93,7 +85,7 @@ MAN_SUBSTS = \ -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \ -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' -SUFFIXES += .$(APP_MAN_SUFFIX) .man +SUFFIXES = .$(APP_MAN_SUFFIX) .man .man.$(APP_MAN_SUFFIX): sed $(MAN_SUBSTS) < $< > $@ diff --git a/app-defaults/XClock b/app-defaults/XClock new file mode 100644 index 0000000..971ae2d --- /dev/null +++ b/app-defaults/XClock @@ -0,0 +1 @@ +XClock.input: false diff --git a/app-defaults/XClock-color b/app-defaults/XClock-color new file mode 100644 index 0000000..ec857f6 --- /dev/null +++ b/app-defaults/XClock-color @@ -0,0 +1,10 @@ +! $XFree86$ + +#include "XClock" + +XClock.Clock.hourColor: rgba:7f/00/00/c0 +XClock.Clock.minuteColor: rgba:00/7f/7f/c0 +XClock.Clock.secondColor: rgba:00/00/ff/80 +XClock.Clock.majorColor: rgba:7f/00/00/c0 +XClock.Clock.minorColor: rgba:00/7f/7f/c0 + diff --git a/app-defaults/XClock-color.ad b/app-defaults/XClock-color.ad deleted file mode 100644 index ec857f6..0000000 --- a/app-defaults/XClock-color.ad +++ /dev/null @@ -1,10 +0,0 @@ -! $XFree86$ - -#include "XClock" - -XClock.Clock.hourColor: rgba:7f/00/00/c0 -XClock.Clock.minuteColor: rgba:00/7f/7f/c0 -XClock.Clock.secondColor: rgba:00/00/ff/80 -XClock.Clock.majorColor: rgba:7f/00/00/c0 -XClock.Clock.minorColor: rgba:00/7f/7f/c0 - diff --git a/app-defaults/XClock.ad b/app-defaults/XClock.ad deleted file mode 100644 index 971ae2d..0000000 --- a/app-defaults/XClock.ad +++ /dev/null @@ -1 +0,0 @@ -XClock.input: false diff --git a/configure.ac b/configure.ac index 17e9c8e..4b6d07b 100644 --- a/configure.ac +++ b/configure.ac @@ -26,11 +26,17 @@ AC_INIT(xclock,[1.0.3], [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_CHECK_FUNCS([strlcpy getpid]) AC_SEARCH_LIBS([iconv], [iconv], @@ -39,7 +45,7 @@ AC_SEARCH_LIBS([iconv], [iconv], dnl Required dependencies PKG_CHECK_MODULES(XCLOCK_X11, x11) PKG_CHECK_MODULES(XAW, xaw7) -XCLOCK_CFLAGS="$XCLOCK_X11_CFLAGS $XAW_CFLAGS" +XCLOCK_CFLAGS="$CWARNFLAGS $XCLOCK_X11_CFLAGS $XAW_CFLAGS" XCLOCK_LIBS="$XCLOCK_X11_LIBS $XAW_LIBS" dnl Optional dependencies @@ -65,10 +71,15 @@ AC_SUBST(XCLOCK_CFLAGS) AC_SUBST(XCLOCK_LIBS) PKG_CHECK_MODULES(APPDEFS, xt) -appdefaultdir=$(pkg-config --variable=appdefaultdir xt) +xt_appdefaultdir=$(pkg-config --variable=appdefaultdir xt) +AC_ARG_WITH(appdefaultdir, + AC_HELP_STRING([--with-appdefaultdir=], + [specify directory for app-defaults files (default is autodetected)]), + [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"]) AC_SUBST(appdefaultdir) XORG_MANPAGE_SECTIONS XORG_RELEASE_VERSION +XORG_CHANGELOG AC_OUTPUT([Makefile]) -- cgit v1.2.3