fix for compiler warnings

This commit is contained in:
john30
2016-01-02 12:04:22 +01:00
parent ed858a5d65
commit a7a5e51ff6
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ Device* Device::create(const char* name, const bool checkDevice, const bool read
char* dup = strdup(name);
char* pos = strchr(dup, ':');
result_t result = RESULT_OK;
unsigned long int port = parseInt(pos+1, 10, 1, 65535, result);
unsigned int port = parseInt(pos+1, 10, 1, 65535, result);
if (result!=RESULT_OK) {
free(dup);
return NULL; // invalid port
@@ -69,7 +69,7 @@ Device* Device::create(const char* name, const bool checkDevice, const bool read
}
free(dup);
address.sin_family = AF_INET;
address.sin_port = htons((uint16_t)port);
address.sin_port = (in_port_t)htons((uint16_t)port);
return new NetworkDevice(name, address, readonly, logRawFunc);
}
return new SerialDevice(name, checkDevice, readonly, logRawFunc);
+3 -3
View File
@@ -30,7 +30,7 @@ TCPSocket::TCPSocket(int sfd, struct sockaddr_in* address) : m_sfd(sfd)
char ip[17];
inet_ntop(AF_INET, (struct in_addr*)&(address->sin_addr.s_addr), ip, (socklen_t)sizeof(ip)-1);
m_ip = ip;
m_port = ntohs(address->sin_port);
m_port = (uint16_t)ntohs(address->sin_port);
}
bool TCPSocket::isValid()
@@ -65,7 +65,7 @@ TCPSocket* TCPClient::connect(const string& server, const uint16_t& port)
}
address.sin_family = AF_INET;
address.sin_port = htons(port);
address.sin_port = (in_port_t)htons(port);
int sfd = socket(AF_INET, SOCK_STREAM, 0);
if (sfd < 0)
@@ -90,7 +90,7 @@ int TCPServer::start()
memset(&address, 0, sizeof(address));
address.sin_family = AF_INET;
address.sin_port = htons(m_port);
address.sin_port = (in_port_t)htons(m_port);
if (m_address.size() > 0)
inet_pton(AF_INET, m_address.c_str(), &(address.sin_addr));