Addressed issues found by Google code lint.
Fixed: - Removed trailing whitespace. - Removed out of date TODO's. - Added #include<algorithm> to DataManager.cpp - Reordered includes to include C system headers before C++ system headers. - Added username to TODO's - Renamed include guards to use full project name as prefix. - Made methods and parameters const where possible. - Made UDPSocket constructor explicit. Won't Fix: - snprintf is introduced in C++11. - Trailing comments at the end of namespace & header guards - Did not re-inlude headers already included by the matching XPC header. - localtime is fine since X-Plane is not multithreaded at all on the plugin side. - Linter confuses #elif with parens as a function call. - namespace indentation
This commit is contained in:
@@ -18,7 +18,7 @@ namespace XPC
|
||||
localAddr.sin_family = AF_INET;
|
||||
localAddr.sin_addr.s_addr = INADDR_ANY;
|
||||
localAddr.sin_port = htons(recvPort);
|
||||
|
||||
|
||||
//Create and bind the socket
|
||||
#ifdef _WIN32
|
||||
WSADATA wsa;
|
||||
@@ -92,7 +92,7 @@ namespace XPC
|
||||
#endif
|
||||
}
|
||||
|
||||
int UDPSocket::Read(unsigned char* dst, int maxLen, sockaddr* recvAddr)
|
||||
int UDPSocket::Read(unsigned char* dst, int maxLen, sockaddr* recvAddr) const
|
||||
{
|
||||
socklen_t recvaddrlen = sizeof(*recvAddr);
|
||||
int status = 0;
|
||||
@@ -137,7 +137,7 @@ namespace XPC
|
||||
return status;
|
||||
}
|
||||
|
||||
void UDPSocket::SendTo(const unsigned char* buffer, std::size_t len, sockaddr* remote)
|
||||
void UDPSocket::SendTo(const unsigned char* buffer, std::size_t len, sockaddr* remote) const
|
||||
{
|
||||
if (sendto(sock, (char*)buffer, (int)len, 0, remote, sizeof(*remote)) < 0)
|
||||
{
|
||||
@@ -152,7 +152,7 @@ namespace XPC
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string UDPSocket::GetHost(sockaddr* sa)
|
||||
{
|
||||
char ip[INET6_ADDRSTRLEN + 6] = { 0 };
|
||||
|
||||
Reference in New Issue
Block a user