GNOME Bugzilla – Bug 52646
Compiler cleanups
Last modified: 2012-01-31 23:24:47 UTC
I recently built gnome-games/1.4.0 for SGI IRIX 6.2, and had to make a few changes to placate the compilers. The most far-reaching was an enum/int confusion. The rest are pretty obvious: --- ./xbill/MCursor.cc Thu Mar 8 08:26:17 2001 +++ ../gnome-games-1.4.0/./xbill/MCursor.cc Thu Mar 22 18:04:12 2001 @@ -2,7 +2,7 @@ #include "objects.h" void MCursor::load(const char *name, int masked) { - static char *dir = NULL; + static char *dir = (char*)NULL; GdkPixmap *pixmap, *bitmap, *mask; int width, height; char file[255]; @@ -11,7 +11,7 @@ sprintf (file, "%s/%s.xpm", dir, name); pixmap = gdk_pixmap_colormap_create_from_xpm(ui.display, ui.colormap, - &bitmap, NULL, file); + &bitmap, (GdkColor*)NULL, file); if (pixmap == NULL) { printf ("cannot open %s\n", file); exit(1); @@ -20,7 +20,7 @@ if (masked == SEP_MASK) { sprintf(file, "%s/%s_mask.xpm", dir, name); pixmap = gdk_pixmap_colormap_create_from_xpm(ui.display, ui.colormap, - &mask, NULL, file); + &mask, (GdkColor*)NULL, file); if (pixmap == NULL) { printf("cannot open %s\n", file); exit(1); --- ./xbill/UI.cc Thu Mar 8 08:26:17 2001 +++ ../gnome-games-1.4.0/./xbill/UI.cc Thu Mar 22 18:24:06 2001 @@ -126,10 +126,10 @@ void UI::popup_dialog (int dialog) { GtkWidget *w; - switch (dialog) { - case game.SCORE: w = scorebox; break; - case game.ENDGAME: w = endgamebox; break; - } + if (dialog == game.SCORE) + w = scorebox; + else if (dialog == game.ENDGAME) + w = endgamebox; popup (NULL, &w); } @@ -138,16 +138,14 @@ /*********************/ void UI::set_cursor(int cursor) { - switch (cursor) { - case game.BUCKETC: - gdk_window_set_cursor(window, bucket.cursor.cursor); break; - case game.DOWNC: - gdk_window_set_cursor(window, downcursor.cursor); break; - case game.DEFAULTC: - gdk_window_set_cursor(window, defaultcursor.cursor); break; - default: - gdk_window_set_cursor(window, OS.cursor[cursor].cursor); - } + if (cursor == game.BUCKETC) + gdk_window_set_cursor(window, bucket.cursor.cursor); + else if (cursor == game.DOWNC) + gdk_window_set_cursor(window, downcursor.cursor); + else if (cursor == game.DEFAULTC) + gdk_window_set_cursor(window, defaultcursor.cursor); + else + gdk_window_set_cursor(window, OS.cursor[cursor].cursor); } void UI::load_cursors() { --- ./xbill/Game.cc Thu Mar 8 08:26:17 2001 +++ ../gnome-games-1.4.0/./xbill/Game.cc Thu Mar 22 18:24:32 2001 @@ -61,10 +61,10 @@ } void Game::update_score (int action) { - switch (action){ - case ENDLEVEL: score+=(level*efficiency/iteration); break; - default: score+=(action*action*BILLPOINTS); - } + if (action == ENDLEVEL) + score+=(level*efficiency/iteration); + else + score+=(action*action*BILLPOINTS); } void Game::warp_to_level (unsigned int lev) {
Are these the same as the ones in our really old patch set from GNOME Games 1.2? Do they superceed those?
They are probably very similar, but may not be exactly the same. I was trying to solve the same problem (make the sources build with strict ANSI compilers), but was using a newer compiler on the local system.
Greg, did these ever get applied? Are they at all relevant for 2.0? Marking high because there is a patch and because portability is important.
I never applied them, so I assume that they're not yet in CVS. I'm pretty sure that I'm not the right person to apply these, but I'll hound some people on IRC and such.
In CVS, thanks for the patch. 2002-04-15 Bastien Nocera <hadess@hadess.net> * Game.cc, MCursor.cc, UI.cc: patch from drk@sgi.com to get gnome-xbill compiled with a strict ansi compiler
*** Bug 16866 has been marked as a duplicate of this bug. ***
This bug is being reassigned to the "general" component so we can close the gnome-xbill bugzilla component. Apologies for the mass email!