ports/149394: games/magiccube4d - make it usable on 64-bit arch

Gennady Proskurin gpr at mail.ru
Sat Aug 7 10:30:06 UTC 2010


>Number:         149394
>Category:       ports
>Synopsis:       games/magiccube4d - make it usable on 64-bit arch
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 07 10:30:05 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Gennady Proskurin
>Release:        9.0-CURRENT amd64
>Organization:
>Environment:
FreeBSD gpr.nnz-home.ru 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r209892M: Sun Jul 11 15:04:28 MSD 2010     gpr at gpr.nnz-home.ru:/usr/obj/usr/src/freebsd-head/sys/GPR  amd64

>Description:
games/magiccube4d converts from pointer to int which causes compiler errors on architectures with 64-bit pointers.

Attached patch fixes the problem and make port usable.

Probably some other bugs exist, sometimes I see message "WARNING: some of the twists look like garbage (sorry).", usually during auto-solving. For now, I see no impact on application by this.

>How-To-Repeat:

>Fix:
Apply attached patch in games/magiccube4d directory.


Patch attached with submission follows:

diff --git Makefile Makefile
index 5ecddf8..5fb567d 100644
--- Makefile
+++ Makefile
@@ -22,10 +22,6 @@ WRKSRC=		${WRKDIR}/${PORTNAME}-src-${PORTVERSION:S/./_/}
 DOCS=		ChangeLog Intro.txt MagicCube4D-unix.txt \
 		ideas.txt readme-unix.txt
 
-post-patch:
-	@${REINPLACE_CMD} -e 's/stickers)()/stickers)(0)/' \
-		${WRKSRC}/EventHandler.cpp
-
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/magiccube4d ${PREFIX}/bin
 .if !defined(NOPORTDOCS)
@@ -37,10 +33,4 @@ do-install:
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} >= 700042
-.if ${ARCH} == "amd64" || ${ARCH} == "sparc64"
-BROKEN=		Does not compile with GCC 4.2
-.endif
-.endif
-
 .include <bsd.port.post.mk>
diff --git files/patch-EventHandler.cpp files/patch-EventHandler.cpp
new file mode 100644
index 0000000..057e0a9
--- /dev/null
+++ files/patch-EventHandler.cpp
@@ -0,0 +1,65 @@
+diff --git EventHandler.cpp EventHandler.cpp
+index 398fcb7..f5fe00a 100644
+--- EventHandler.cpp
++++ EventHandler.cpp
+@@ -31,6 +31,9 @@ DESCRIPTION:
+ #include "MacroManager.h"
+ #include "PostScriptWriter.h"
+ 
++#include <stdint.h>
++static intptr_t ptr2int(const void* p) { return reinterpret_cast<intptr_t>(p); }
++
+ float const EventHandler::DEF_TWIST_INCREMENT = 0.5;
+ 
+ EventHandler::EventHandler(int argc, char **argv, char const* machine_type) :
+@@ -326,7 +329,7 @@ EventHandler::getAReferenceSticker(Event *event, void *)
+         number_of_reference_stickers_needed--;
+         reference_stickers_needed++;
+         if (number_of_reference_stickers_needed == 0)
+-            (this->*what_to_do_after_got_reference_stickers)();
++            (this->*what_to_do_after_got_reference_stickers)(NULL);
+     }
+ }
+ 
+@@ -415,7 +418,7 @@ EventHandler::buttonDown_handler(Event *event, void *arg)
+ void
+ EventHandler::undo_cb(void* argp)
+ {
+-    int arg = (int) argp;
++    int arg = ptr2int(argp);
+     struct stickerspec grip;
+     int         dir;
+     int         slicesmask;
+@@ -461,7 +464,7 @@ EventHandler::undo_cb(void* argp)
+ void
+ EventHandler::redo_cb(void* argp)
+ {
+-    int arg = (int) argp;
++    int arg = ptr2int(argp);
+     struct stickerspec grip;
+     int         dir;
+     int         slicesmask;
+@@ -507,7 +510,7 @@ EventHandler::redo_cb(void* argp)
+ void
+ EventHandler::scramble_cb(void *arg = NULL)
+ {
+-    int n = (int)arg;
++    int n = ptr2int(arg);
+     struct stickerspec grip;
+     int i, previous_face = -1;
+     int ngrips = NFACES * 3 * 3 * 3;
+@@ -855,12 +858,12 @@ EventHandler::toggleFast_cb(void *)
+ void
+ EventHandler::newPuzzle_cb(void* arg)
+ {
+-    if ((int)arg == preferences.getLength())
++    if (ptr2int(arg) == preferences.getLength())
+     {
+         reset_cb(0);
+         return;
+     }
+-    preferences.setLength((int)arg);
++    preferences.setLength(ptr2int(arg));
+     int length = preferences.getLength();
+ 
+     polymgr->reset(length);


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list