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:
Jason Watkins
2015-05-08 15:18:24 -07:00
parent 513747867c
commit ceba580450
12 changed files with 77 additions and 75 deletions

View File

@@ -1,14 +1,14 @@
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
//National Aeronautics and Space Administration. All Rights Reserved.
#ifndef XPC_SOCKET_H
#define XPC_SOCKET_H
#ifndef XPCPLUGIN_SOCKET_H_
#define XPCPLUGIN_SOCKET_H_
#include <cstdlib>
#include <string>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#pragma comment(lib,"ws2_32.lib") //Winsock Library
#pragma comment(lib, "ws2_32.lib") //Winsock Library
#elif (__APPLE__ || __linux)
#include <sys/socket.h>
#include <netinet/in.h>
@@ -34,7 +34,7 @@ namespace XPC
/// specified receive port.
///
/// \param recvPort The port on which this instance will receive data.
UDPSocket(unsigned short recvPort);
explicit UDPSocket(unsigned short recvPort);
/// Closes the underlying socket for this instance.
~UDPSocket();
@@ -48,14 +48,14 @@ namespace XPC
/// of the remote host.
/// \returns The number of bytes read, or a negative number if
/// an error occurs.
int Read(unsigned char* buffer, int size, sockaddr* remoteAddr);
int Read(unsigned char* buffer, int size, sockaddr* remoteAddr) const;
/// Sends data to the specified remote endpoint.
///
/// \param data The data to be sent.
/// \param len The number of bytes to send.
/// \param remote The destination socket.
void SendTo(const unsigned char* buffer, std::size_t len, sockaddr* remote);
void SendTo(const unsigned char* buffer, std::size_t len, sockaddr* remote) const;
/// Gets a string containing the IP address and port contained in the given sockaddr.
///