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

@@ -11,15 +11,15 @@ namespace XPC
{
Message::Message() {}
Message Message::ReadFrom(UDPSocket& sock)
Message Message::ReadFrom(const UDPSocket& sock)
{
Message m;
int len = sock.Read(m.buffer, bufferSize, &m.source);
m.size = len < 0 ? 0 : len;
return m;
}
unsigned long Message::GetMagicNumber()
unsigned long Message::GetMagicNumber() const
{
if (size < 4)
{
@@ -28,7 +28,7 @@ namespace XPC
return *((unsigned long*)buffer);
}
std::string Message::GetHead()
std::string Message::GetHead() const
{
if (size < 4)
{
@@ -37,7 +37,7 @@ namespace XPC
return std::string((char*)buffer, 4);
}
const unsigned char* Message::GetBuffer()
const unsigned char* Message::GetBuffer() const
{
if (size == 0)
{
@@ -46,17 +46,17 @@ namespace XPC
return buffer;
}
std::size_t Message::GetSize()
std::size_t Message::GetSize() const
{
return size;
}
struct sockaddr Message::GetSource()
struct sockaddr Message::GetSource() const
{
return source;
}
void Message::PrintToLog()
void Message::PrintToLog() const
{
#if LOG_VERBOSITY > 4
std::stringstream ss;