--- atom4-4.1.orig/Construct +++ atom4-4.1/Construct @@ -80,7 +80,10 @@ # Global configuration $COMPILER = $ARG{COMPILER} || 'g++'; $REALDATADIR = $ARG{REALDATADIR} || abspath(DirPath($DATADIR)); -$CFLAGS = "-pedantic -DDATADIR=\\\"$REALDATADIR\\\""; +## See: https://wiki.debian.org/Hardening +$LDFLAGS = `dpkg-buildflags --get LDFLAGS`; chomp $LDFLAGS; +$CFLAGS = `dpkg-buildflags --get CFLAGS`; chomp $CFLAGS; +$CFLAGS .= " -pedantic -Werror -DDATADIR=\\\"$REALDATADIR\\\""; $CFLAGS .= " -g3" if $ARG{DEBUG}; $CFLAGS .= " -O$OPTIMIZE" if $OPTIMIZE; $CFLAGS .= " -pg -DPROFILE" if $PROFILE; @@ -88,12 +91,13 @@ # Local configuration $INCPATH = "$INCDIR:$PROGLIBPATH/include"; $LIBPATH = "$PROGLIBPATH/lib:$LIBDIR:$X11LIBPATH"; -$LIBS = "$PROGLIB $NCURSESLIB $X11LIB -latom4 -lxatom4"; +$LIBS = "-latom4 -lxatom4 $PROGLIB $NCURSESLIB $X11LIB"; $LIBS .= " -pg" if $PROFILE; $CONS = new cons( CC => $COMPILER, CFLAGS => $CFLAGS, + LDFLAGS => $LDFLAGS, CPPPATH => $INCPATH, LIBS => $LIBS, LIBPATH => $LIBPATH --- atom4-4.1.orig/debian/changelog +++ atom4-4.1/debian/changelog @@ -0,0 +1,107 @@ +atom4 (4.1-6) unstable; urgency=low + + * Fix FTBFS on clang (thanks, Sylvestre Ledru!)(Closes: #710408) + * Fix lintian warnings: + - Upgrade to Standards-Version: 3.9.4 + - Fix description line to match recommended format + - Add recommended build rules to debian/rules + - Use hardening options for build. + + -- Hwei Sheng Teoh Wed, 31 Jul 2013 09:20:27 -0700 + +atom4 (4.1-5.1) unstable; urgency=medium + + * Non-maintainer upload. + - Dont ignore write return value to fix FTBFS. Thanks Tarun kumar mall + for the patch! Closes: #617839 and also LP: #776746 + + -- Bhavani Shankar Fri, 17 Jun 2011 22:46:56 +0200 + +atom4 (4.1-5) unstable; urgency=low + + * Update debhelper compatibility to 8. + - Use dh_prep instead of dh_clean -k + * Fix compiler deprecation warnings. + * Update to debian-policy 3.9.1. + * Fix lintian errors/warnings: + - Fix missing separator in debian/control + - Remove debian/preinst + - Remove debian/prerm + - Fix copyright notice format + * Change order of libraries during linking - thanks, Tarun Kumar Mall! + (Closes: #616039) + + -- Hwei Sheng Teoh Wed, 02 Mar 2011 10:09:04 -0800 + +atom4 (4.1-4) unstable; urgency=low + + * Fix Build-depends: to depend on specific X11 libraries rather than + obsoleted xlibs-dev (Closes: #346674) + + -- Hwei Sheng Teoh Wed, 11 Jan 2006 09:43:13 -0800 + +atom4 (4.1-3) unstable; urgency=low + + * Actually fix missing forward declaration (Closes: #318526) + * Quote values in debian/menu. + + -- Hwei Sheng Teoh Tue, 19 Jul 2005 02:50:43 -0700 + +atom4 (4.1-2) unstable; urgency=low + + * Add missing forward declaration (Closes: #318526) + * Update Standards-Version to 3.6.2.1. + * Fix multi-line Build-Depends. + + -- Hwei Sheng Teoh Sun, 17 Jul 2005 19:02:33 -0700 + +atom4 (4.1-1) unstable; urgency=low + + * New upstream release. + * This is the Just Before A Major Overhaul release. There are very few + cosmetic changes, but a lot of internal improvement especially in + the AI. The following entries are summarized from the (admittedly + less readable) TODO file. + * Visible changes: + - Fixed ncurses interface which fails to render the board background + properly under some terminals. This is a hack; it is likely a + libncurses bug related to the mutt bleeding backgrounds bug. + - AI player now has a real, properly-implemented min-max algorithm + with alpha/beta pruning. The default difficulty level (-d2) is now + quite challenging; -d3 and above are now very tough to beat. + - Some cosmetic improvements in the ncurses interface. + * Internal changes: + - Fixed some bugs in the event loop + - Fixed a major event loop sequencing problem. Man these things are + tricky. + - Event loop now has timers, although they aren't used by anything + in this release. (Not anything linked into the game, that is.) + There are also other significant improvements to the event loop + code. + - Added profiling code to help with AI optimization (game trees that + grow with O(n!) are NOT fun to search at high depths...) + - Preliminary network gaming code. Sorry, this is currently not in a + sufficiently advanced stage for you to actually play a network + game yet. The code is currently not actually linked into the game. + * About version numbers: + - Hindsight is 20-20, as they say. The first Debian release bore a + version number of 4-1, which I now realize was a mistake. The + game's internal version number was 1.1 (as those who played the + ncurses interface might have noticed); the 4 came from an archive + number I use to maintain codebases. I refuse to roll the epoch + just because of this, so to fix this inconsistency, I've bumped + the internal version number to 4.1 and using 4.1-1 for the Debian + version. This is an unfortunate unintentional version bloat. :-( + - Atom-4 will likely reach 4.infinity before 5.0. + * debian/control: grammatical correction; upgrade to Standards-Version + 3.5.9. + + -- Hwei Sheng Teoh Tue, 15 Apr 2003 18:01:33 -0400 + +atom4 (4-1) unstable; urgency=low + + * Initial Debian Release. (Closes: #184628) + * Updated with latest upstream version. + + -- Hwei Sheng Teoh Thu, 13 Mar 2003 09:24:24 -0500 + --- atom4-4.1.orig/debian/compat +++ atom4-4.1/debian/compat @@ -0,0 +1 @@ +8 --- atom4-4.1.orig/debian/control +++ atom4-4.1/debian/control @@ -0,0 +1,19 @@ +Source: atom4 +Section: games +Priority: optional +Maintainer: Hwei Sheng Teoh +Build-Depends: debhelper (>> 8.0.0), cons (>= 2.2.0-2), libx11-dev, libxpm-dev, libxext-dev, libncurses5-dev +Standards-Version: 3.9.4 + +Package: atom4 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Original two-player color puzzle game + Atom-4 is a two-player color manipulation game played with colored + spherical pieces on a board divided into equilateral triangles. The + player who first makes a row of 4 pieces of the right color wins. + However, the players do not directly play pieces of the winning color; + they must construct their winning pieces via color changes that happen + to neighbouring pieces whenever a new piece is placed on the board. + . + Atom-4 supports both a curses-based text interface and an X11 interface. --- atom4-4.1.orig/debian/copyright +++ atom4-4.1/debian/copyright @@ -0,0 +1,12 @@ +This package was debianized by H. S. Teoh on +Thu, 13 Mar 2003 09:24:24 -0500. + +It was adapted from the non-Debian version of the game by the same author. + +Upstream Author: H. S. Teoh + +Copyright 2003-2011 Hwei Sheng Teoh + +License: General Public License version 2 (GPL-2). Please see the file: + /usr/share/common-licenses/GPL-2 + --- atom4-4.1.orig/debian/dirs +++ atom4-4.1/debian/dirs @@ -0,0 +1,3 @@ +usr/games +usr/share/man/man6 +usr/share/games/atom4 --- atom4-4.1.orig/debian/docs +++ atom4-4.1/debian/docs @@ -0,0 +1 @@ +README --- atom4-4.1.orig/debian/menu +++ atom4-4.1/debian/menu @@ -0,0 +1,10 @@ +?package(atom4):\ + needs="X11"\ + section="Games/Board" \ + title="Atom-4 (X11)" \ + command="/usr/games/atom4 -a2 -mx" +?package(atom4):\ + needs="text"\ + section="Games/Board" \ + title="Atom-4 (text)" \ + command="/usr/games/atom4 -a2 -mt" --- atom4-4.1.orig/debian/postinst +++ atom4-4.1/debian/postinst @@ -0,0 +1,48 @@ +#! /bin/sh +# postinst script for atom4 +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +case "$1" in + configure) + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- atom4-4.1.orig/debian/postrm +++ atom4-4.1/debian/postrm @@ -0,0 +1,38 @@ +#! /bin/sh +# postrm script for atom4 +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + + + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 --- atom4-4.1.orig/debian/rules +++ atom4-4.1/debian/rules @@ -0,0 +1,94 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +CONS = cons + + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + touch configure-stamp + +build: build-arch build-indep + +build-arch: build-stamp + +build-indep: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Note: this only build proglib; the actual build is in install + # because cons builds and installs everything directly. (It can be + # split up, but I'm not sure that's necessary.) + cd proglib; $(CONS) . + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + cd proglib; $(CONS) -r . + $(CONS) -r . + + # Clean up .consign files so that they won't end up in the source + # package + find . -name .consign -print | xargs \rm -f + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + # Do actual build here since cons does everything in one go. + $(CONS) . BINDIR=#debian/atom4/usr/games DATADIR=#debian/atom4/usr/share/games/atom4 REALDATADIR=/usr/share/games/atom4 MANDIR=#debian/atom4/usr/share/man PROGLIBPATH=#proglib + + # Clean up .consign files -- these should not be installed into the + # binary package! + find debian/atom4 -name .consign -print | xargs \rm -f + + +# Build architecture-independent files here. +binary-indep: build install + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installmenu + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- atom4-4.1.orig/engine/ai.cc +++ atom4-4.1/engine/ai.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include "ai.h" @@ -224,9 +225,12 @@ #endif //DEBUG_AI // Send move back to parent process - write(fd, &m.x, sizeof(m.x)); - write(fd, &m.y, sizeof(m.y)); - + ssize_t unused_x; + ssize_t unused_y; + unused_x=write(fd, &m.x, sizeof(m.x)); + unused_y=write(fd, &m.y, sizeof(m.y)); + assert (unused_x > 0); + assert (unused_y > 0); #ifdef PROFILE_AI _mcleanup(); #endif //PROFILE_AI @@ -336,4 +340,5 @@ #endif //DEBUG_AI make_move(); // move if it's our turn after reset + return 0; } --- atom4-4.1.orig/ncurses/textui.cc +++ atom4-4.1/ncurses/textui.cc @@ -103,7 +103,7 @@ } } -int ncurses_ui::formatstr(char *fmt, ...) { +int ncurses_ui::formatstr(const char *fmt, ...) { va_list args; int rc; @@ -114,7 +114,7 @@ return rc; } -int ncurses_ui::message(char *fmt, ...) { +int ncurses_ui::message(const char *fmt, ...) { va_list args; int rc; @@ -129,7 +129,7 @@ } void ncurses_ui::draw_tile(WINDOW *w, celltype cell) { - char *glyph; + const char *glyph; int color, bold=0; if (cell>='a' && cell<='h') { @@ -252,7 +252,7 @@ return wgetch(iowin); } -int ncurses_ui::ask_yn(char *question) { +int ncurses_ui::ask_yn(const char *question) { int ch; message("%s (y/n) ", question); --- atom4-4.1.orig/ncurses/textui.h +++ atom4-4.1/ncurses/textui.h @@ -85,8 +85,8 @@ char strbuf[STRBUF_SIZE]; // temp buffer for formatting strings int use_color() { return options&ENABLE_COLOR; } - int formatstr(char *fmt, ...); - int message(char *fmt, ...); + int formatstr(const char *fmt, ...); + int message(const char *fmt, ...); void draw_tile(WINDOW *w, celltype cell); friend void render_cell(int x, int y, celltype cell, void *context); void render_board(); @@ -94,7 +94,7 @@ void render_iowin(); void refresh(); int wait_key(); - int ask_yn(char *msg); + int ask_yn(const char *msg); int init_color(); public: ncurses_ui(atom4 *game, eventloop *loop, int *exitflag, int options=0); --- atom4-4.1.orig/net/net.cc +++ atom4-4.1/net/net.cc @@ -169,7 +169,7 @@ fprintf(stderr, "Client socket (%d) closed\n", sock); } -int netconn::send_packet(char *fmt, ...) { +int netconn::send_packet(const char *fmt, ...) { int rc; va_list args; @@ -179,7 +179,7 @@ return rc; } -int netconn::vsend_packet(char *fmt, va_list args) { +int netconn::vsend_packet(const char *fmt, va_list args) { int i, count; char *sendbuf; --- atom4-4.1.orig/net/net.h +++ atom4-4.1/net/net.h @@ -73,7 +73,7 @@ odlist sendqueue; // outgoing packets waiting for // write-ready condition on socket - int truncate:1; // 1 if in truncate mode, 0 otherwise + unsigned int truncate:1; // 1 if in truncate mode, 0 otherwise void scan_for_packets(); // scan buffer for completed packets void wrap_buffer(int start); // shift buffer contents (start) bytes @@ -91,8 +91,8 @@ virtual ~netconn(); // Queue packet for sending - int send_packet(char *fmt, ...); - int vsend_packet(char *fmt, va_list args); + int send_packet(const char *fmt, ...); + int vsend_packet(const char *fmt, va_list args); // Access functions int sockfd() { return sock; } --- atom4-4.1.orig/net/server.cc +++ atom4-4.1/net/server.cc @@ -147,7 +147,7 @@ serv->send_names(id); // request for name list } -void clientconn::fatal_error(char *fmt, ...) { +void clientconn::fatal_error(const char *fmt, ...) { va_list args; // Transmit error message @@ -440,14 +440,14 @@ } // No more available ID's; send error to client and abort. - char *errormsg = "ERR 903 Server is full\n"; + const char *errormsg = "ERR 903 Server is full\n"; send(csock, errormsg, strlen(errormsg)+1, MSG_NOSIGNAL); close(csock); return 0; } -void server::broadcast(char *fmt, ...) { +void server::broadcast(const char *fmt, ...) { va_list args; int i; --- atom4-4.1.orig/net/server.h +++ atom4-4.1/net/server.h @@ -25,6 +25,7 @@ #define SERVER_BACKLOG 2 // socket backlog limit +class server; // forward decl class clientconn : public netconn { friend class server; @@ -43,7 +44,7 @@ // Protocol dispatch table static struct dispatch { - char *packet_type; + const char *packet_type; void (clientconn::*handler)(); } dispatch_tbl[]; @@ -60,7 +61,7 @@ void p_who(); // Convenience functions - void fatal_error(char *fmt, ...); + void fatal_error(const char *fmt, ...); void not_implemented(); int next_number(); // parse next word in parser as number @@ -130,7 +131,7 @@ int create_servsock(int port, struct sockaddr_in *sockname, int backlog); int new_client(); - void broadcast(char *fmt, ...); // broadcast message to all clients + void broadcast(const char *fmt, ...); // broadcast message to all clients void reset_players(); public: server(atom4 *engine, eventloop *loop, int port, int options); --- atom4-4.1.orig/proglib/c++/exception.cc +++ atom4-4.1/proglib/c++/exception.cc @@ -19,7 +19,7 @@ abort(); // fatal: cannot create exception } -void exception::varinit(char *fmt, va_list args) { +void exception::varinit(const char *fmt, va_list args) { size_t bufsize, msglen; // Initial attempt to format message string @@ -42,9 +42,9 @@ } } -exception::exception(char *error_msg, ...) : is_variable(*error_msg=='@') { +exception::exception(const char *error_msg, ...) : is_variable(*error_msg=='@') { if (!is_variable) { // Static exception - msg = error_msg; + msg = const_cast(error_msg); } else { // Variable exception va_list args; --- atom4-4.1.orig/proglib/c++/exception.h +++ atom4-4.1/proglib/c++/exception.h @@ -41,22 +41,22 @@ char *msg; void out_of_memory(); // does not return - void varinit(char *msg, va_list args); + void varinit(const char *msg, va_list args); protected: // NOTE: the dummy argument is a dirty, cruel hack necessary because the // stdarg in glibc defines va_list as char*, and the bogonous C++ compiler // (g++) does not know how to find a next-better ctor match when this one // is protected. It's not my fault! Derived exception classes will just // have to cope. - exception(int dummy, char *error_msg, va_list args) : + exception(int dummy, const char *error_msg, va_list args) : is_variable(*error_msg=='@') { if (is_variable) varinit(error_msg+1, args); else - msg=error_msg; + msg=const_cast(error_msg); } public: - exception(char *error_msg, ...); + exception(const char *error_msg, ...); exception(const exception &e); virtual ~exception(); --- atom4-4.1.orig/x/xcursor.h +++ atom4-4.1/x/xcursor.h @@ -17,7 +17,7 @@ Drawable d; xflatsprite *cursor; // [R] xsavebuf bckgnd; - int visible:1; + unsigned int visible:1; int x,y; // last known cursor position void draw(); --- atom4-4.1.orig/x/xscoreboard.cc +++ atom4-4.1/x/xscoreboard.cc @@ -39,7 +39,7 @@ #define DATADIR "." // search current dir if undefined #endif -static char *wheelnames[NUM_WHEELS] = { +static const char *wheelnames[NUM_WHEELS] = { DATADIR "/wheel12-1.xpm", DATADIR "/wheel12-2.xpm", DATADIR "/wheel12-3.xpm", @@ -108,7 +108,7 @@ XFreeFont(disp, titlefont); } -void xscoreboard::draw_center(XFontStruct *font, GC gc, char *text, int y) { +void xscoreboard::draw_center(XFontStruct *font, GC gc, const char *text, int y) { XCharStruct result; int dummy, x; int textlen = strlen(text); @@ -145,7 +145,7 @@ XDrawString(disp, buffer, textgc, PL_X, starty+PL_MSG_Y+scorefont->ascent, buf, strlen(buf)); } else if (game->winner()==STALEMATE) { - snprintf(buf, TEXTBUF_MAX, "=== DRAW: no more moves left ===", player); + snprintf(buf, TEXTBUF_MAX, "=== DRAW: no more moves left ==="); XDrawString(disp, buffer, textgc, PL_X, starty+PL_MSG_Y+scorefont->ascent, buf, strlen(buf)); } --- atom4-4.1.orig/x/xscoreboard.h +++ atom4-4.1/x/xscoreboard.h @@ -30,7 +30,7 @@ XFontStruct *scorefont; // regular font GC textgc; - void draw_center(XFontStruct *font, GC gc, char *text, int y); + void draw_center(XFontStruct *font, GC gc, const char *text, int y); void render_score(int player, int y); void render_wheel(int wheel); public: --- atom4-4.1.orig/x/xsprite.cc +++ atom4-4.1/x/xsprite.cc @@ -35,7 +35,8 @@ XFreeGC(disp, drawgc); } -xflatsprite::xflatsprite(xsprite_engine *engine, char *xpmfile) : eng(engine) { +xflatsprite::xflatsprite(xsprite_engine *engine, const char *xpmfile) : + eng(engine) { Display *disp = eng->display(); Drawable d = eng->get_drawable(); XpmAttributes attr; @@ -53,7 +54,7 @@ // (the following is to catch the case when no hotspot is set in the file) attr.x_hotspot = attr.y_hotspot = 0; - if (XpmReadFileToImage(disp, xpmfile, &img, &msk, &attr) + if (XpmReadFileToImage(disp, const_cast(xpmfile), &img, &msk, &attr) != XpmSuccess) { throw exception("@Error while loading pixmap file: %s", xpmfile); } @@ -150,7 +151,7 @@ } -xsprite::xsprite(xsprite_engine *engine, xflatsprite *sprite, char *xpmfile) { +xsprite::xsprite(xsprite_engine *engine, xflatsprite *sprite, const char *xpmfile) { } xsprite::~xsprite() { --- atom4-4.1.orig/x/xsprite.h +++ atom4-4.1/x/xsprite.h @@ -54,7 +54,7 @@ int wd, ht; // width & height int ox, oy; // image origin (==XPM hotspot) public: - xflatsprite(xsprite_engine *engine, char *xpmfile); + xflatsprite(xsprite_engine *engine, const char *xpmfile); ~xflatsprite(); void draw(Drawable d, int x, int y); @@ -91,7 +91,7 @@ // FIXME: need to generalize this class xsprite { public: - xsprite(xsprite_engine *engine, xflatsprite *spr, char *xpmfile); + xsprite(xsprite_engine *engine, xflatsprite *spr, const char *xpmfile); ~xsprite(); void sdraw(Drawable d, int x, int y); --- atom4-4.1.orig/x/xtriboard.cc +++ atom4-4.1/x/xtriboard.cc @@ -19,7 +19,7 @@ #define TILE_XPM DATADIR "/tritile12.xpm" -char *xtriboard::ballnames[NUM_BALLS]={ +const char *xtriboard::ballnames[NUM_BALLS]={ DATADIR "/blackball12.xpm", DATADIR "/redball12.xpm", DATADIR "/greenball12.xpm", --- atom4-4.1.orig/x/xtriboard.h +++ atom4-4.1/x/xtriboard.h @@ -32,7 +32,7 @@ tiled_bckgnd *tritile; // tiled background // FIXME: this should be moved to class XAtom4 - static char *ballnames[NUM_BALLS]; + static const char *ballnames[NUM_BALLS]; xflatsprite *balls[8]; // Auto-positioning cursor --- atom4-4.1.orig/x/xutil.cc +++ atom4-4.1/x/xutil.cc @@ -181,9 +181,9 @@ */ appwindow::appwindow(xconnection *connection, - char *winstr, char *iconstr, + const char *winstr, const char *iconstr, int win_wd, int win_ht, - char *resource_class, char *resource_name) : + const char *resource_class, const char *resource_name) : xwindow(connection, NULL, 0,0, win_wd, win_ht, 0,0,0), disp(connection->display()) { XWMHints *wmhints; @@ -207,8 +207,8 @@ classhints = XAllocClassHint(); if (!classhints) throw exception("Cannot allocate class hints"); - classhints->res_name = resource_class; - classhints->res_class = resource_name; + classhints->res_name = const_cast(resource_class); + classhints->res_class = const_cast(resource_name); sizehints = XAllocSizeHints(); if (!sizehints) throw exception("Cannot allocate size hints"); @@ -217,9 +217,11 @@ sizehints->min_width = sizehints->max_width = wd; sizehints->min_height = sizehints->max_height = ht; - if (!XStringListToTextProperty(&winstr, 1, &win_name)) + char *_winstr = const_cast(winstr); + char *_iconstr = const_cast(iconstr); + if (!XStringListToTextProperty(&_winstr, 1, &win_name)) throw exception("Error while creating TextProperty"); - if (!XStringListToTextProperty(&iconstr, 1, &icon_name)) + if (!XStringListToTextProperty(&_iconstr, 1, &icon_name)) throw exception("Error while creating TextProperty"); // Set these as our WM settings @@ -252,7 +254,7 @@ // FIXME: should use generic image loader tiled_bckgnd::tiled_bckgnd(xconnection *connection, Drawable drawable, - char *xpmfile) + const char *xpmfile) : conn(connection), d(drawable) { Display *disp = conn->display(); XpmAttributes attr; @@ -264,7 +266,7 @@ attr.valuemask = XpmColormap | XpmCloseness; // (Note: NULL is passed for shapemask since we don't care about that) - if (XpmReadFileToPixmap(disp, d, xpmfile, &tile, NULL, &attr) + if (XpmReadFileToPixmap(disp, d, const_cast(xpmfile), &tile, NULL, &attr) != XpmSuccess) { throw exception("@Unable to load tile pixmap from: %s", xpmfile); } --- atom4-4.1.orig/x/xutil.h +++ atom4-4.1/x/xutil.h @@ -125,9 +125,9 @@ Display *disp; // [R] (for convenience only) public: appwindow(xconnection *conn, - char *win_name, char *icon_name, + const char *win_name, const char *icon_name, int width, int height, - char *resource_class, char *resource_name); + const char *resource_class, const char *resource_name); ~appwindow(); }; @@ -141,7 +141,7 @@ GC tilegc; public: // FIXME: should use generic image loader - tiled_bckgnd(xconnection *conn, Drawable d, char *xpmfile); + tiled_bckgnd(xconnection *conn, Drawable d, const char *xpmfile); ~tiled_bckgnd(); void paint(int x, int y, int w, int h);