HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

4.1beta2 util/Socket.h compile problem on Solaris 2.5.1, gcc 2.95.2




Hello,

	I came across a problem compiling on 4.1beta2 on Solaris
2.5.1, using gcc 2.95.2. util/Socket.h defines two member functions:

	static int bind(int s, const void* addr, int addrlen)
		{ return ::bind(s, (const struct sockaddr*) addr, addrlen); }
        static int connect(int s, const void* addr, int addrlen)
		{ return ::connect(s, (const struct sockaddr*) addr, addrlen); }

In /usr/include/sys/socket.h, these are define as:

extern int bind(int, struct sockaddr *, int);
extern int connect(int, struct sockaddr *, int);

gcc does not like 'const' in the cast. Unless I remove them, I get:

In file included from InetTransport.c++:41:
Socket.h: In function `static int Socket::bind(int, const void *,
int)':
Socket.h:62: passing `const sockaddr *' as argument 2 of `bind(int,
sockaddr *, int)' discards qualifiers

I checked 4.0pl2 Socket.h, and it has not changed. Previously I
compiled with 2.7.2.2, which was fine. I think this just due to gcc
2.95.2 being a bit more pedantic. 

I'm not sure of the proper way to fix this. Should I just ifdef
Socket.h? Or maybe make a typedef for 'struct sockaddr *', const or
not as required? Is there some way that configure can figure out const
vs non const bind and connect?

I checked the cvs tree, but very little has changed there since
4.1beta2.

Thanks,

	Andy




Project hosted by iFAX Solutions