From cf9ffb0d27e6f037ea3add809e071c1ba675e11c Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Wed, 2 Dec 2009 18:41:22 +0000 Subject: [PATCH] Fixed a const issue in SelectorBase::GetSocketReady on Mac OS X git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1296 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/Network/SelectorBase.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/SFML/Network/SelectorBase.cpp b/src/SFML/Network/SelectorBase.cpp index c3e37e55..bf5cff02 100644 --- a/src/SFML/Network/SelectorBase.cpp +++ b/src/SFML/Network/SelectorBase.cpp @@ -107,11 +107,14 @@ unsigned int SelectorBase::Wait(float timeout) //////////////////////////////////////////////////////////// SocketHelper::SocketType SelectorBase::GetSocketReady(unsigned int index) const { + // We have to drop the const for FD_ISSET + fd_set* set = const_cast(&mySetReady); + // The standard FD_xxx interface doesn't define a direct access, - // so we must go through the whole set to find the socket we're looking for + // so we must iterate through the whole set to find the socket that we're looking for for (int i = 0; i < myMaxSocket + 1; ++i) { - if (FD_ISSET(i, &mySetReady)) + if (FD_ISSET(i, set)) { // Current socket is ready, but is it the index-th one ? if (index > 0)