Bug 117319 - [patch] games/xlogical bad C++ code w/ gcc4.2
Summary: [patch] games/xlogical bad C++ code w/ gcc4.2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Martin Wilke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-19 13:20 UTC by Pietro Cerutti
Modified: 2007-11-06 13:10 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pietro Cerutti 2007-10-19 13:20:02 UTC
games/xlogical fails with bad C++ code error when compiled with gcc 4.2

Fix: Add this patch to files/patch-gamelogic.cpp:



-       currentMap = NULL;
+       currentMap = (list< class Clevel_map *>::iterator)NULL;

        playerName = new char[32+1];
        strcpy( playerName, "nobody" );--1vfzgLrhXpFUfP6YqxS1wz3ZNaCUTERszSb53hvsXLwPGSl7
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- gamelogic.cpp.orig  2007-10-19 14:00:18.000000000 +0200
+++ gamelogic.cpp       2007-10-19 13:57:53.000000000 +0200
@@ -154,7 +154,7 @@
                levelFile = NULL;
        }
How-To-Repeat: cd /usr/ports/games/xlogical && make
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-10-19 13:20:12 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 2 Pietro Cerutti 2007-10-19 17:03:18 UTC
Sergio Mangialardi wrote:
> Pietro Cerutti wrote:
>>
>> -       currentMap = NULL;
>> +       currentMap = (list< class Clevel_map *>::iterator)NULL;
> I'm sorry, but in my opinion this isn't correct. There is no general way
> to initialize an iterator to NULL because iterators are not pointers
> (even though iterators are often implemented by pointers).
> currentMap should be set to the end of the container to which the
> iterator belongs.
> 
> Sergio.


You are right. Please comment on this one:

--- gamelogic.cpp.orig  2007-10-19 17:52:30.000000000 +0200
+++ gamelogic.cpp       2007-10-19 17:53:15.000000000 +0200
@@ -154,7 +154,7 @@
                levelFile = NULL;
        }

-       currentMap = NULL;
+       currentMap = gameLevels.end( );

        playerName = new char[32+1];
        strcpy( playerName, "nobody" );


-- 
Pietro Cerutti

PGP Public Key:
http://gahr.ch/pgp
Comment 3 Pietro Cerutti 2007-10-24 13:42:35 UTC
Sergio Mangialardi wrote:
> Pietro Cerutti wrote:
>>
>> You are right. Please comment on this one:
>>
>> --- gamelogic.cpp.orig  2007-10-19 17:52:30.000000000 +0200
>> +++ gamelogic.cpp       2007-10-19 17:53:15.000000000 +0200
>> @@ -154,7 +154,7 @@
>>                 levelFile = NULL;
>>         }
>>
>> -       currentMap = NULL;
>> +       currentMap = gameLevels.end( );
> This is the correct initialization of currentMap, because it is
> independent of the underlying implementation of the iterator.
> 
> Sergio.

Thanks.

I think the patch is ready to be committed.

-- 
Pietro Cerutti

PGP Public Key:
http://gahr.ch/pgp
Comment 4 Martin Wilke freebsd_committer freebsd_triage 2007-11-04 22:41:05 UTC
Responsible Changed
From-To: freebsd-ports-bugs->miwi

I'll take it.
Comment 5 Dmitry Marakasov 2007-11-05 14:35:10 UTC
Hey, I've tried to fix this port couple of days ago, but dropped it as it
also had install problems. My solution was to just remove line assigning
NULL to iterator. As far as I understand, uninitialized iterator should
behave just as expected.

-- 
Dmitry A. Marakasov    | jabber: amdmi3@jabber.ru
amdmi3@amdmi3.ru       | http://www.amdmi3.ru
Comment 6 Pietro Cerutti 2007-11-05 15:01:58 UTC
Dmitry Marakasov wrote:
> Hey, I've tried to fix this port couple of days ago, but dropped it as it
> also had install problems. My solution was to just remove line assigning
> NULL to iterator. As far as I understand, uninitialized iterator should
> behave just as expected.
> 

Hey thanks.
Actually, the current problem with xlogical is that the tarball is
corrupted. Otherwise, the patch should be ok (look at my patch after
Sergio Mangialardi's comment).

I've send an e-mail to the author.. keep an eye to the PR's follow ups
for updates ;-)

Cheers,


-- 
Pietro Cerutti

PGP Public Key:
http://gahr.ch/pgp
Comment 7 dfilter service freebsd_committer freebsd_triage 2007-11-06 10:26:18 UTC
miwi        2007-11-06 10:26:13 UTC

  FreeBSD ports repository

  Modified files:
    games/xlogical       Makefile 
  Added files:
    games/xlogical/files patch-Makefile.am patch-acinclude.m4 
                         patch-gamelogic.cpp patch-gpl.h 
                         patch-graph_images.cpp patch-levelmap.cpp 
                         patch-mapedit.cpp patch-menuentry.cpp 
                         patch-music_files.cpp 
                         patch-sound_files.cpp 
  Log:
  - Fix build with gcc 4.2
  
  PR:             117319
  Submitted by:   Pietro Cerutti <gahr@gahr.ch>
  Approved by:    portmgr (pav)
  
  Revision  Changes    Path
  1.3       +15 -21    ports/games/xlogical/Makefile
  1.1       +10 -0     ports/games/xlogical/files/patch-Makefile.am (new)
  1.1       +11 -0     ports/games/xlogical/files/patch-acinclude.m4 (new)
  1.1       +499 -0    ports/games/xlogical/files/patch-gamelogic.cpp (new)
  1.1       +11 -0     ports/games/xlogical/files/patch-gpl.h (new)
  1.1       +11 -0     ports/games/xlogical/files/patch-graph_images.cpp (new)
  1.1       +20 -0     ports/games/xlogical/files/patch-levelmap.cpp (new)
  1.1       +88 -0     ports/games/xlogical/files/patch-mapedit.cpp (new)
  1.1       +28 -0     ports/games/xlogical/files/patch-menuentry.cpp (new)
  1.1       +11 -0     ports/games/xlogical/files/patch-music_files.cpp (new)
  1.1       +11 -0     ports/games/xlogical/files/patch-sound_files.cpp (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 8 Martin Wilke freebsd_committer freebsd_triage 2007-11-06 10:26:20 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!
Comment 9 Pietro Cerutti 2007-11-06 13:03:01 UTC
FYI: the final patch is here:

http://www.gahr.ch/FreeBSD/patches/117319_xlogical.diff

-- 
Pietro Cerutti

PGP Public Key:
http://gahr.ch/pgp