Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Sep 2015 20:04:53 +0000 (UTC)
From:      Christian Weisgerber <naddy@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r397338 - in head/games/xpipeman: . files
Message-ID:  <201509192004.t8JK4r7b073476@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: naddy
Date: Sat Sep 19 20:04:52 2015
New Revision: 397338
URL: https://svnweb.freebsd.org/changeset/ports/397338

Log:
  Properly fix the LP64 issue in the application resource handling rather
  than praying that globals end up in the lower 32-bit address space.
  
  Add a number of missing includes, missing prototypes, etc.

Added:
  head/games/xpipeman/files/patch-game.c   (contents, props changed)
  head/games/xpipeman/files/patch-graphics.c   (contents, props changed)
  head/games/xpipeman/files/patch-xpipeman.h   (contents, props changed)
Modified:
  head/games/xpipeman/Makefile
  head/games/xpipeman/files/patch-Imakefile
  head/games/xpipeman/files/patch-main.c
  head/games/xpipeman/files/patch-score.c

Modified: head/games/xpipeman/Makefile
==============================================================================
--- head/games/xpipeman/Makefile	Sat Sep 19 20:00:54 2015	(r397337)
+++ head/games/xpipeman/Makefile	Sat Sep 19 20:04:52 2015	(r397338)
@@ -3,7 +3,7 @@
 
 PORTNAME=	xpipeman
 PORTVERSION=	1.0
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	games
 MASTER_SITES=	SUNSITE/games/strategy
 DISTNAME=	${PORTNAME}
@@ -11,9 +11,6 @@ DISTNAME=	${PORTNAME}
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	Connect the pipes to stop the leaks
 
-# LP64 issues
-ONLY_FOR_ARCHS=	i386 amd64
-
 USES=		imake tar:Z
 USE_XORG=	x11 xaw xext xmu xt sm ice
 CFLAGS+=	-Wno-error=return-type

Modified: head/games/xpipeman/files/patch-Imakefile
==============================================================================
--- head/games/xpipeman/files/patch-Imakefile	Sat Sep 19 20:00:54 2015	(r397337)
+++ head/games/xpipeman/files/patch-Imakefile	Sat Sep 19 20:04:52 2015	(r397338)
@@ -1,5 +1,5 @@
---- ./Imakefile.orig	1992-07-28 23:56:27.000000000 +0000
-+++ ./Imakefile	2013-05-31 12:26:22.000000000 +0000
+--- Imakefile.orig	1992-07-28 23:56:27 UTC
++++ Imakefile
 @@ -1,7 +1,7 @@
  
 -     SCORE_FILE = -DSCORE_FILE=\"/usr/games/lib/xpipescores\"
@@ -20,7 +20,7 @@
  all:: xpipeman
  
  ComplexProgramTarget(xpipeman)
-@@ -19,4 +22,3 @@
+@@ -19,4 +22,3 @@ ComplexProgramTarget(xpipeman)
   *  InstallManPage(xpipeman,$(MANDIR))
   *  InstallProgram(xpipeman,$(BINDIR))
   */

Added: head/games/xpipeman/files/patch-game.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpipeman/files/patch-game.c	Sat Sep 19 20:04:52 2015	(r397338)
@@ -0,0 +1,62 @@
+--- game.c.orig	1991-09-13 20:32:11 UTC
++++ game.c
+@@ -35,6 +35,7 @@
+  */
+ 
+ #include <X11/Intrinsic.h>
++#include <stdlib.h>
+ #include "xpipeman.h"
+ 
+ /* some of these are global */
+@@ -442,7 +443,7 @@ new_level()
+       blkrstart=0;
+       blkfull = STARTFULL;
+ 
+-      if (current_callback != NULL)
++      if (current_callback != 0)
+ 	XtRemoveTimeOut(current_callback);
+       current_callback = XtAddTimeOut(flow_time_start,show_when_flow,NULL);
+       
+@@ -458,7 +459,7 @@ new_level()
+ void
+ speed_up_flow()
+ { int i;
+- if (current_callback != NULL)
++ if (current_callback != 0)
+    XtRemoveTimeOut(current_callback);
+  flow_time = FASTFLOW;
+  current_callback= XtAddTimeOut(flow_time,draw_flow,NULL);
+@@ -515,13 +516,13 @@ XtIntervalId *id;
+     }
+    if (start_flowing)
+      {
+-      if (current_callback != NULL)
++      if (current_callback != 0)
+ 	XtRemoveTimeOut(current_callback);
+       current_callback = XtAddTimeOut(flow_time_start,draw_flow,NULL);
+     }
+   else
+     {
+-      if (current_callback != NULL)
++      if (current_callback != 0)
+ 	XtRemoveTimeOut(current_callback);
+       current_callback = XtAddTimeOut(flow_time_start,show_when_flow,NULL);
+     }
+@@ -533,7 +534,7 @@ draw_flow(data,id)
+ caddr_t data;
+ XtIntervalId *id;
+ {
+-  current_callback = NULL;
++  current_callback = 0;
+   if (blktime < 2)
+     {
+       pipe_board[flow_x][flow_y] = blkrstart++;
+@@ -584,7 +585,7 @@ increment_flow()
+ 
+       if (failed) {
+ 	buttons_disabled = 1;
+-	if (current_callback != NULL)
++	if (current_callback != 0)
+ 	  XtRemoveTimeOut(current_callback);
+ 	current_callback = XtAddTimeOut(3000,level_over,NULL);
+       }

Added: head/games/xpipeman/files/patch-graphics.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpipeman/files/patch-graphics.c	Sat Sep 19 20:04:52 2015	(r397338)
@@ -0,0 +1,22 @@
+--- graphics.c.orig	1991-09-13 20:32:11 UTC
++++ graphics.c
+@@ -63,8 +63,8 @@ init_pixmaps(top_shell)
+ 
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+ 
+-  fgcolor.pixel = fg;
+-  bgcolor.pixel = bg;
++  fgcolor.pixel = app_data.fg;
++  bgcolor.pixel = app_data.bg;
+   fgcolor.flags =  DoRed | DoGreen | DoBlue;
+   bgcolor.flags =  DoRed | DoGreen | DoBlue;
+   XQueryColor(display,DefaultColormapOfScreen(XtScreen(playfield_widget)), &fgcolor);
+@@ -444,7 +444,7 @@ void free_pixmaps()
+ {
+   int i;
+ 
+-  for(i=0;i++;i<NUM_TMP_CURSOR_PIXMAPS) 
++  for(i=0;i<NUM_TMP_CURSOR_PIXMAPS;i++)
+     XFreePixmap(display,tmp_pixmap[i]);
+ 
+ }

Modified: head/games/xpipeman/files/patch-main.c
==============================================================================
--- head/games/xpipeman/files/patch-main.c	Sat Sep 19 20:00:54 2015	(r397337)
+++ head/games/xpipeman/files/patch-main.c	Sat Sep 19 20:04:52 2015	(r397338)
@@ -1,43 +1,100 @@
---- ./main.c.orig	1991-09-13 20:32:10.000000000 +0000
-+++ ./main.c	2013-05-31 10:39:59.000000000 +0000
-@@ -146,21 +146,11 @@
- 	{"-scorefile","scorefile",XrmoptionSepArg, NULL },
+--- main.c.orig	1991-09-13 20:32:10 UTC
++++ main.c
+@@ -53,6 +53,9 @@
+ #endif
+ 
+ 
++#include <stdlib.h>
++#include <stdio.h>
++#include <unistd.h>
+ #include "xpipeman.h"
+ 
+ /*----------------------------------------------------------------------*/
+@@ -138,9 +141,7 @@ static XtActionsRec actions[] = {
+   {"do_nothing",(XtActionProc)do_nothing_action},
  };
  
--static XtResource application_resources[] = {
--  {"foreground", "Foreground", XtRPixel, sizeof(Pixel),
+-Pixel fg, bg;
+-
+-XtTranslations translations;
++AppData app_data;
+ 
+ static XrmOptionDescRec options[] = {
+ 	{"-scorefile","scorefile",XrmoptionSepArg, NULL },
+@@ -148,19 +149,20 @@ static XrmOptionDescRec options[] = {
+ 
+ static XtResource application_resources[] = {
+   {"foreground", "Foreground", XtRPixel, sizeof(Pixel),
 -                (Cardinal)&fg, XtRString, (caddr_t) "Black"},
--  {"background", "Background", XtRPixel, sizeof(Pixel),
++                XtOffsetOf(AppData, fg), XtRString, (caddr_t) "Black"},
+   {"background", "Background", XtRPixel, sizeof(Pixel),
 -                (Cardinal)&bg, XtRString, (caddr_t) "White"},
--  {"translations","Translations", XtRTranslationTable, sizeof(XtTranslations),
++                XtOffsetOf(AppData, bg), XtRString, (caddr_t) "White"},
+   {"translations","Translations", XtRTranslationTable, sizeof(XtTranslations),
 -                (Cardinal)&translations, XtRString, (caddr_t)translations_str},
--  {"scorefile","Scorefile", XtRString, sizeof(String),
++                XtOffsetOf(AppData, translations), XtRString, (caddr_t)translations_str},
+   {"scorefile","Scorefile", XtRString, sizeof(String),
 -                (Cardinal)&score_filename, XtRString, (caddr_t)SCORE_FILE},
--};
++                XtOffsetOf(AppData, score_filename), XtRString, (caddr_t)SCORE_FILE},
+ };
  
  /*----------------------------------------------------------------------*/
  
++int
  main(argc, argv)
 -  unsigned int argc;
 +  int argc;
    char **argv;
  {
    Arg args[1];
-@@ -168,6 +158,17 @@
-   Widget quit_command,
- 	 new_game_command;
- 
-+XtResource application_resources[] = {
-+  {"foreground", "Foreground", XtRPixel, sizeof(Pixel),
-+                (Cardinal)&fg, XtRString, (caddr_t) "Black"},
-+  {"background", "Background", XtRPixel, sizeof(Pixel),
-+                (Cardinal)&bg, XtRString, (caddr_t) "White"},
-+  {"translations","Translations", XtRTranslationTable, sizeof(XtTranslations),
-+                (Cardinal)&translations, XtRString, (caddr_t)translations_str},
-+  {"scorefile","Scorefile", XtRString, sizeof(String),
-+                (Cardinal)&score_filename, XtRString, (caddr_t)SCORE_FILE},
-+};
-+
+@@ -170,14 +172,14 @@ main(argc, argv)
+ 
    srandom(getpid());
    current_block = 0;
-   current_callback = NULL;
+-  current_callback = NULL;
++  current_callback = 0;
+ 
+   top_shell = XtInitialize(argv[0], "xpipeman", options, XtNumber(options), &argc, argv);
+   XtSetValues(top_shell, arglisttop_shell, XtNumber(arglisttop_shell));
+ 
+   XtAddActions(actions,XtNumber(actions));
+ 
+-  XtGetApplicationResources(top_shell, 0, application_resources, 
++  XtGetApplicationResources(top_shell, &app_data, application_resources, 
+ 			XtNumber(application_resources), NULL, 0 );
+ 
+   top_widget = XtCreateManagedWidget(
+@@ -193,7 +195,7 @@ main(argc, argv)
+                                     arglistplayfield,
+                                     XtNumber(arglistplayfield));
+ 
+-  XtAugmentTranslations(playfield_widget,translations);
++  XtAugmentTranslations(playfield_widget,app_data.translations);
+ 
+   quit_command = XtCreateManagedWidget(
+                                     "quit_button",
+@@ -263,12 +265,12 @@ main(argc, argv)
+ 
+   display   = XtDisplay(playfield_widget);
+   playfield = XtWindow(playfield_widget);
+-  gcv.foreground = fg;
+-  gcv.background = bg;
++  gcv.foreground = app_data.fg;
++  gcv.background = app_data.bg;
+   gcv.function = GXcopy;
+   gc = XCreateGC(display, playfield, 
+  		GCForeground | GCBackground | GCFunction, &gcv);
+-  gcv.foreground = bg;
++  gcv.foreground = app_data.bg;
+   cleargc = XCreateGC(display, playfield,
+  		 GCForeground | GCBackground | GCFunction, &gcv);
+ 
+@@ -318,7 +320,7 @@ void
+ update_remain(score)
+   int score;
+ {
+-  char text[13];
++  char text[16];
+   (void)sprintf(text,"Remaining: %4d",score);
+   XtSetArg(arglistremain_command[0],XtNlabel,text);
+   XtSetValues(remain_command,arglistremain_command,1);

Modified: head/games/xpipeman/files/patch-score.c
==============================================================================
--- head/games/xpipeman/files/patch-score.c	Sat Sep 19 20:00:54 2015	(r397337)
+++ head/games/xpipeman/files/patch-score.c	Sat Sep 19 20:04:52 2015	(r397338)
@@ -1,5 +1,5 @@
---- score.c.orig	1991-09-13 22:32:12.000000000 +0200
-+++ score.c	2011-02-02 19:34:46.908945354 +0100
+--- score.c.orig	1991-09-13 20:32:12 UTC
++++ score.c
 @@ -50,8 +50,9 @@
  #include <X11/Xaw/Label.h>
  #endif
@@ -11,7 +11,7 @@
  #include "xpipeman.h"
  
  /*----------------------------------------------------------------------*/
-@@ -64,7 +65,7 @@
+@@ -64,13 +65,12 @@ typedef struct {
  
  static SCORE scores[MAXSCORES];
  
@@ -20,7 +20,24 @@
  	new_high_score(), 
  	load_scores(), 
  	write_out_scores();
-@@ -198,7 +199,7 @@
+ 
+ static FILE *scorefile = 0;
+-char *score_filename;
+ 
+ /*----------------------------------------------------------------------*/
+ 
+@@ -100,8 +100,8 @@ load_scores()
+ {
+   int i = 0;
+ 
+-  if( !(scorefile = fopen(score_filename,"r+")) ) {
+-    scorefile = fopen(score_filename, "w");
++  if( !(scorefile = fopen(app_data.score_filename,"r+")) ) {
++    scorefile = fopen(app_data.score_filename, "w");
+     return;
+   }
+ #ifndef SYSV
+@@ -198,7 +198,7 @@ static Arg arglist_popdown[] = {
  
  
  /*ARGSUSED*/

Added: head/games/xpipeman/files/patch-xpipeman.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/xpipeman/files/patch-xpipeman.h	Sat Sep 19 20:04:52 2015	(r397338)
@@ -0,0 +1,44 @@
+--- xpipeman.h.orig	1991-09-13 20:32:14 UTC
++++ xpipeman.h
+@@ -31,6 +31,13 @@
+  * 
+  */
+ 
++typedef struct {
++  Pixel fg;
++  Pixel bg;
++  XtTranslations translations;
++  char *score_filename;
++} AppData;
++
+ /* 
+  * from main.c
+  */
+@@ -39,8 +46,8 @@ extern Window 	playfield;
+ extern Widget 	playfield_widget;
+ extern GC 	gc,
+ 		cleargc;
+-extern Pixel 	fg, 
+-		bg;
++
++extern AppData app_data;
+ 
+ extern void 	update_score();
+ extern void 	update_level();
+@@ -118,8 +125,6 @@ extern void 	check_score(), 
+ 
+ extern void	show_scores_callback();
+ 
+-extern char *score_filename;
+-
+ /*
+  * from game.c
+  */
+@@ -188,4 +193,7 @@ extern void  show_level_over_popup(),
+              show_game_over_popup(),
+ 	     level_over_popdown(),
+ 	     game_over_popdown(),
++	     show_nomore_popup(),
++	     nomore_popdown(),
++	     all_popdown(),
+ 	     create_general_popups();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509192004.t8JK4r7b073476>