Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, Google, Bing

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWR FUSS » GCC-4.1.0 expects size passed...
Forum Rules | Mark all | Recent Posts

GCC-4.1.0 expects size passed to "accept()" be signed
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Mar 10, 2006, 2:20 pm
Go to the top of the page
Go to the bottom of the page

Halcyon
Magician
GroupMembers
Posts187
JoinedApr 12, 2005

When I finally got GCC-4.1.0 up and running, I only found one problem compiling... It wasn't happy about accept()'s 3rd argument being pass unsigned.

The fix is simple, and doesn't seem to have any ill effects on previous versions of GCC (Although I only tested 3.4.4, Cygwin's standard), so if someone can confirm this will compile okay on an *NIX box, this should do it.

In comm.c, in function new_descriptor, find the following:

   size = sizeof( sock );
   if( check_bad_desc( new_desc ) )
   {
      set_alarm( 0 );
      return;
   }
   set_alarm( 20 );
   if( ( desc = accept( new_desc, ( struct sockaddr * )&sock, &size ) ) < 0 )
   {
      perror( "New_descriptor: accept" );
      set_alarm( 0 );
      return;
   }
   if( check_bad_desc( new_desc ) )
   {
      set_alarm( 0 );


Change to:

   size = sizeof( sock );
   if( check_bad_desc( new_desc ) )
   {
      set_alarm( 0 );
      return;
   }
   set_alarm( 20 );
   if( ( desc = accept( new_desc, ( struct sockaddr * )&sock,
	   ( signed * )&size ) ) < 0 )
   {
      perror( "New_descriptor: accept" );
      set_alarm( 0 );
      return;
   }
   if( check_bad_desc( new_desc ) )
   {
      set_alarm( 0 );


And that'll do it. :smile:
       
Post is unread #2 Mar 10, 2006, 9:05 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Actually that should have already been fixed because it complained in gcc 4.0 already. I solved it by declaring the size variable as a size_t instead of a plain int. This quieted the compiler and didn't involve a cast.
       
Post is unread #3 Mar 10, 2006, 9:57 pm
Go to the top of the page
Go to the bottom of the page

Halcyon
Magician
GroupMembers
Posts187
JoinedApr 12, 2005

It might be platform-related, not sure. This is on Cygwin, not an actual *NIX system. I dunno if that would make a difference or not... It might just be that they restricted the guidelines on it a bit more for the 4.1 release.
       
Post is unread #4 Mar 11, 2006, 8:15 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

I think it would be best to hold off on doing anything official until versions of gcc 4.1 start showing up in mainstream linux packages. Updating FC4 for example isn't practical right now because gcc 4.1 demands so many other dependencies.
       
Pages:<< prev 1 next >>