Fix compilation issues on Linux and update Linux binaries.

- The Linux binaries for the 1.1 release were built on the wrong branch, and so include none of the v1.1 changes. This patch fixes some minor compiler errors and includes properly updated binaries.
This commit is contained in:
Jason Watkins
2015-06-01 12:37:36 -07:00
parent 38c0f1b1ff
commit dcdcf22751
4 changed files with 30 additions and 10 deletions

View File

@@ -8,7 +8,9 @@
#include <cstdio>
#include <ctime>
#ifndef LIN
#include <chrono>
#endif
#include <iomanip>
#include <sstream>
@@ -20,6 +22,20 @@ namespace XPC
static std::FILE* fd;
static void WriteTime(FILE* fd)
{
#ifdef LIN
// Can't provide high resolution logging on Linux because C++11 doesn't work with X-Plane.
time_t rawtime;
tm* timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
char buffer[16] = { 0 };
// Format is equivalent to [%F %T], but neither of those specifiers is
// supported on Windows as of Visual Studio 13
strftime(buffer, 16, "[%H:%M:%S] ", timeinfo);
fprintf(fd, buffer);
#else
using namespace std::chrono;
system_clock::time_point now = system_clock::now();
@@ -36,6 +52,7 @@ namespace XPC
<< std::setw(3) << ms.count() << "|";
std::fprintf(fd, ss.str().c_str());
#endif
}
static void WriteLevel(FILE* fd, int level)

View File

@@ -3,6 +3,8 @@
#include "Message.h"
#include "Log.h"
#include <cstring>
#include <iomanip>
#include <sstream>
#include <string>
@@ -53,18 +55,19 @@ namespace XPC
void Message::PrintToLog() const
{
std::stringstream ss;
using namespace std;
stringstream ss;
// Dump raw bytes to string
ss << std::hex << std::setfill('0');
ss << hex << setfill('0');
for (int i = 0; i < size; ++i)
{
ss << ' ' << std::setw(2) << static_cast<unsigned>(buffer[i]);
ss << ' ' << setw(2) << static_cast<unsigned>(buffer[i]);
}
Log::WriteLine(LOG_DEBUG, "DBUG", ss.str());
ss.str("");
ss << "Head: " << GetHead() << "(0x" << std::setw(8) << GetMagicNumber() << ")" << std::dec << " Size: " << GetSize();
ss << "Head: " << GetHead() << "(0x" << setw(8) << GetMagicNumber() << ")" << dec << " Size: " << GetSize();
switch (GetMagicNumber()) // Binary version of head
{
case 0x4E4EF443: // CONN
@@ -95,12 +98,12 @@ namespace XPC
}
case 0x41544144: // DATA
{
std::size_t numCols = (size - 5) / 36;
size_t numCols = (size - 5) / 36;
float values[32][9];
for (int i = 0; i < numCols; ++i)
{
values[i][0] = buffer[5 + 36 * i];
std::memcpy(values[i] + 1, buffer + 9 + 36 * i, 9 * sizeof(float));
memcpy(values[i] + 1, buffer + 9 + 36 * i, 9 * sizeof(float));
}
ss << " (" << numCols << " lines)";
Log::WriteLine(LOG_DEBUG, "DBUG", ss.str());
@@ -119,7 +122,7 @@ namespace XPC
case 0x46455244: // DREF
{
Log::WriteLine(LOG_DEBUG, "DBUG", ss.str());
std::string dref((char*)buffer + 6, buffer[5]);
string dref((char*)buffer + 6, buffer[5]);
Log::FormatLine(LOG_DEBUG, "DBUG", " DREF (size %i) = %s", dref.length(), dref.c_str());
ss.str("");
int values = buffer[6 + buffer[5]];
@@ -137,7 +140,7 @@ namespace XPC
int cur = 6;
for (int i = 0; i < buffer[5]; ++i)
{
std::string dref((char*)buffer + cur + 1, buffer[cur]);
string dref((char*)buffer + cur + 1, buffer[cur]);
Log::FormatLine(LOG_DEBUG, "DBUG", " #%i/%i (size:%i) %s",
i + 1, buffer[5], dref.length(), dref.c_str());
cur += 1 + buffer[cur];
@@ -150,8 +153,8 @@ namespace XPC
float gear = *((float*)(buffer + 30));
float pos[3];
float orient[3];
std::memcpy(pos, buffer + 6, 12);
std::memcpy(orient, buffer + 18, 12);
memcpy(pos, buffer + 6, 12);
memcpy(orient, buffer + 18, 12);
ss << " AC:" << (int)aircraft;
ss << " Pos:(" << pos[0] << ' ' << pos[1] << ' ' << pos[2] << ") Orient:(";
ss << orient[3] << ' ' << orient[4] << ' ' << orient[5] << ") Gear:";

Binary file not shown.

Binary file not shown.