< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate] Fixing signed/unsigned conflict in Socket.hxx


On FreeBSD, I'm getting the following build error:


../../../build/../rutil/Socket.hxx: In member function `void 
resip::FdSet::setRead(resip::Socket)':
../../../build/../rutil/Socket.hxx:131: warning: comparison between signed and 
unsigned integer expressions
../../../build/../rutil/Socket.hxx: In member function `void 
resip::FdSet::setWrite(resip::Socket)':
../../../build/../rutil/Socket.hxx:140: warning: comparison between signed and 
unsigned integer expressions
../../../build/../rutil/Socket.hxx: In member function `void 
resip::FdSet::setExcept(resip::Socket)':
../../../build/../rutil/Socket.hxx:149: warning: comparison between signed and 
unsigned integer expressions

The problem is a comparison between Socket and FD_SETSIZE, which is
1024U on FreeBSD. The fix here seems to me to cast FD_SETSIZE to
(int) or (Socket) before doing the comparison. [Note that sockets
must always be signed because socket() may return -1.]
This only works on !Win32, but these asserts are !Win32 anyway.

Anyone object to my making this change?

-Ekr