Created
February 25, 2015 13:00
-
-
Save Foaly/745087a4c18c36b545d7 to your computer and use it in GitHub Desktop.
Fixes the erros in ofxNetwork when compiling.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/addons/ofxNetwork/src/ofxNetworkUtils.h b/addons/ofxNetwork/src/ofxNetworkUtils.h | |
index 6244f6b..33aed35 100644 | |
--- a/addons/ofxNetwork/src/ofxNetworkUtils.h | |
+++ b/addons/ofxNetwork/src/ofxNetworkUtils.h | |
@@ -83,13 +83,13 @@ inline int ofxNetworkCheckErrno(const string & file, const string & line){ | |
case OFXNETWORK_ERROR(INPROGRESS): | |
ofLogWarning("ofxNetwork") << file << ": " << line << " EINPROGRESS: the socket is non-blocking and the connection could not be established immediately"; | |
break; | |
- case EALREADY: | |
+ case OFXNETWORK_ERROR(ALREADY): | |
ofLogError("ofxNetwork") << file << ": " << line << " EALREADY: the socket is non-blocking and already has a pending connection in progress"; | |
break; | |
- case ENOPROTOOPT: | |
+ case OFXNETWORK_ERROR(NOPROTOOPT): | |
ofLogError("ofxNetwork") << file << ": " << line << " ENOPROTOOPT: the optname doesn't make sense for the given level"; | |
break; | |
- case EPROTONOSUPPORT: | |
+ case OFXNETWORK_ERROR(PROTONOSUPPORT): | |
ofLogError("ofxNetwork") << file << ": " << line << " EPROTONOSUPPORT: the protocol or style is not supported by the namespace specified"; | |
break; | |
case OFXNETWORK_ERROR(MFILE): | |
diff --git a/addons/ofxNetwork/src/ofxTCPClient.cpp b/addons/ofxNetwork/src/ofxTCPClient.cpp | |
index 20e9e5c..663d6e1 100644 | |
--- a/addons/ofxNetwork/src/ofxTCPClient.cpp | |
+++ b/addons/ofxNetwork/src/ofxTCPClient.cpp | |
@@ -88,7 +88,7 @@ bool ofxTCPClient::close(){ | |
//-------------------------- | |
void ofxTCPClient::setMessageDelimiter(string delim){ | |
if(delim != ""){ | |
- messageDelimiter = delim; | |
+ messageDelimiter = delim; | |
} | |
} | |
@@ -225,7 +225,7 @@ string ofxTCPClient::receive(){ | |
// check for connection reset or disconnection | |
int errorCode = ofxNetworkCheckError(); | |
- if((length==-1 && ( errorCode == ECONNRESET || errorCode == ECONNABORTED )) || length == 0){ | |
+ if((length==-1 && ( errorCode == OFXNETWORK_ERROR(CONNRESET) || errorCode == OFXNETWORK_ERROR(CONNABORTED) )) || length == 0){ | |
close(); | |
if(tmpStr.length()==0) // return if there's no more data left in the buffer | |
return ""; | |
diff --git a/addons/ofxNetwork/src/ofxTCPManager.cpp b/addons/ofxNetwork/src/ofxTCPManager.cpp | |
index d6354df..be2c76c 100644 | |
--- a/addons/ofxNetwork/src/ofxTCPManager.cpp | |
+++ b/addons/ofxNetwork/src/ofxTCPManager.cpp | |
@@ -168,9 +168,9 @@ bool ofxTCPManager::Connect(char *pAddrStr, unsigned short usPort) | |
// set to non-blocking before connect | |
if (m_dwTimeoutConnect != NO_TIMEOUT) fcntl(m_hSocket, F_SETFL, O_NONBLOCK); | |
- | |
+ | |
bool ret = (connect(m_hSocket, (sockaddr *)&addr_in, sizeof(sockaddr)) != SOCKET_ERROR); | |
- | |
+ | |
// set a timeout | |
if (m_dwTimeoutConnect != NO_TIMEOUT) { | |
fd_set fd; | |
@@ -184,11 +184,11 @@ bool ofxTCPManager::Connect(char *pAddrStr, unsigned short usPort) | |
getsockopt(m_hSocket, SOL_SOCKET, SO_ERROR, &so_error, &len); | |
if (so_error == 0) { | |
return true; | |
- } | |
+ } | |
} | |
} | |
- | |
- if(!ret) ofxNetworkCheckError(); | |
+ | |
+ if(!ret) ofxNetworkCheckError(); | |
return ret; | |
} | |
@@ -308,7 +308,7 @@ int ofxTCPManager::SendAll(const char* pBuff, const int iSize) | |
if (GetTickCount() - timestamp > m_dwTimeoutSend * 1000) return SOCKET_TIMEOUT; | |
} | |
- if(err == EPIPE || err == ECONNRESET || err == ECONNABORTED ){ Close(); return 0; } | |
+ if(err == EPIPE || err == OFXNETWORK_ERROR(CONNRESET) || err == OFXNETWORK_ERROR(CONNABORTED) ){ Close(); return 0; } | |
return ret==-1 && bytesleft == iSize?SOCKET_ERROR:total; | |
} | |
@@ -348,12 +348,12 @@ int ofxTCPManager::Receive(char* pBuff, const int iSize) | |
/// | |
int ofxTCPManager::PeekReceive(char* pBuff, const int iSize) | |
{ | |
- if (m_hSocket == INVALID_SOCKET) | |
+ if (m_hSocket == INVALID_SOCKET) | |
return(SOCKET_ERROR); | |
- | |
+ | |
int ret = recv(m_hSocket, pBuff, iSize, MSG_PEEK); | |
- if(ret==-1) | |
+ if(ret==-1) | |
{ | |
// if socket is non-blocking, the result is likely to be EWOULDBLOCK (no data) so return zero-bytes | |
int NetError = ofxNetworkCheckError(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment