mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-27 08:41:02 +08:00
Networking fixes for MacOS
Qualify type for std::abs
This commit is contained in:
parent
f988cd4809
commit
a01187cf55
@ -268,6 +268,12 @@ int EasySocket::accept()
|
||||
//int flag = 1;
|
||||
//int result = setsockopt(m_replySocket,IPPROTO_TCP,TCP_NODELAY,(char *)&flag,sizeof(int));
|
||||
|
||||
// Apple doesn't have MSG_NOSIGNAL, work around it
|
||||
#ifdef __APPLE__
|
||||
int value = 1;
|
||||
setsockopt(m_replySocket, SOL_SOCKET, SO_NOSIGPIPE, &value, sizeof(value));
|
||||
#endif
|
||||
|
||||
//setBlocking(m_replySocket,true);
|
||||
}
|
||||
return (int)m_replySocket;
|
||||
@ -309,6 +315,15 @@ int EasySocket::connect()
|
||||
{
|
||||
res = ::connect(m_socket,(struct sockaddr *) &serv_addr,sizeof(serv_addr));
|
||||
|
||||
// on Apple, treat EISCONN error as success
|
||||
#ifdef __APPLE__
|
||||
if (res == -1 && errno == EISCONN)
|
||||
{
|
||||
res = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
checkResult(res);
|
||||
|
||||
if (res == 0)
|
||||
@ -339,6 +354,12 @@ int EasySocket::connect()
|
||||
|
||||
setsockopt(m_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv,sizeof(struct timeval));
|
||||
|
||||
#ifdef __APPLE__
|
||||
// Apple doesn't have MSG_NOSIGNAL, work around it
|
||||
int value = 1;
|
||||
setsockopt(m_socket, SOL_SOCKET, SO_NOSIGPIPE, &value, sizeof(value));
|
||||
#endif
|
||||
|
||||
m_replySocket = m_socket;
|
||||
}
|
||||
return res;
|
||||
|
@ -1130,8 +1130,8 @@ void EasyGraphicsView::mouseMoveEvent(QMouseEvent* _event)
|
||||
|
||||
if (m_mouseButtons != 0)
|
||||
{
|
||||
m_mouseMovePath.setX(m_mouseMovePath.x() + abs(delta.x()));
|
||||
m_mouseMovePath.setY(m_mouseMovePath.y() + abs(delta.y()));
|
||||
m_mouseMovePath.setX(m_mouseMovePath.x() + ::std::abs((double)delta.x()));
|
||||
m_mouseMovePath.setY(m_mouseMovePath.y() + ::std::abs((double)delta.y()));
|
||||
}
|
||||
|
||||
auto mouseScenePos = mapToScene(m_mousePressPos);
|
||||
|
Loading…
x
Reference in New Issue
Block a user