dml: Fix build errors from Travis

This commit is contained in:
Joshua Scott 2018-03-30 19:29:12 +01:00
parent 977ea2310e
commit 2e17370337
9 changed files with 49 additions and 20 deletions

View File

@ -1,5 +1,6 @@
#include "ki/dml/Field.h"
#include "ki/util/ValueBytes.h"
#include <algorithm>
namespace ki
{
@ -8,8 +9,10 @@ namespace dml
template <>
void DblField::write_to(std::ostream &ostream) const
{
const ValueBytes<USHRT> endianness_check = { 0x0102 };
ValueBytes<DBL> data = { m_value };
ValueBytes<USHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<DBL> data;
data.value = m_value;
if (endianness_check.buff[0] == 0x01)
std::reverse(&data.buff[0], &data.buff[7]);
ostream.write(data.buff, sizeof(DBL));
@ -18,7 +21,8 @@ namespace dml
template <>
void DblField::read_from(std::istream &istream)
{
const ValueBytes<USHRT> endianness_check = { 0x0102 };
ValueBytes<USHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<DBL> data;
istream.read(data.buff, sizeof(DBL));
if (endianness_check.buff[0] == 0x01)

View File

@ -1,5 +1,6 @@
#include "ki/dml/Field.h"
#include "ki/util/ValueBytes.h"
#include <algorithm>
namespace ki
{
@ -8,8 +9,10 @@ namespace dml
template <>
void FltField::write_to(std::ostream &ostream) const
{
const ValueBytes<USHRT> endianness_check = { 0x0102 };
ValueBytes<FLT> data = { m_value };
ValueBytes<USHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<FLT> data;
data.value = m_value;
if (endianness_check.buff[0] == 0x01)
std::reverse(&data.buff[0], &data.buff[3]);
ostream.write(data.buff, sizeof(FLT));
@ -18,7 +21,8 @@ namespace dml
template <>
void FltField::read_from(std::istream &istream)
{
const ValueBytes<USHRT> endianness_check = { 0x0102 };
ValueBytes<USHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<FLT> data;
istream.read(data.buff, sizeof(FLT));
if (endianness_check.buff[0] == 0x01)

View File

@ -1,5 +1,6 @@
#include "ki/dml/Field.h"
#include "ki/util/ValueBytes.h"
#include <algorithm>
namespace ki
{
@ -8,7 +9,8 @@ namespace dml
template <>
void GidField::write_to(std::ostream &ostream) const
{
ValueBytes<GID> data = { m_value };
ValueBytes<GID> data;
data.value = m_value;
if (data.buff[0] == ((m_value & 0xFF00000000000000) >> 56))
std::reverse(&data.buff[0], &data.buff[7]);
ostream.write(data.buff, sizeof(GID));
@ -17,7 +19,8 @@ namespace dml
template <>
void GidField::read_from(std::istream &istream)
{
const ValueBytes<USHRT> endianness_check = { 0x0102 };
ValueBytes<USHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<GID> data;
istream.read(data.buff, sizeof(GID));
if (endianness_check.buff[0] == 0x01)

View File

@ -1,5 +1,6 @@
#include "ki/dml/Field.h"
#include "ki/util/ValueBytes.h"
#include <algorithm>
namespace ki
{
@ -8,7 +9,8 @@ namespace dml
template <>
void IntField::write_to(std::ostream &ostream) const
{
ValueBytes<INT> data = { m_value };
ValueBytes<INT> data;
data.value = m_value;
if (data.buff[0] == ((m_value & 0xFF000000) >> 24))
std::reverse(&data.buff[0], &data.buff[3]);
ostream.write(data.buff, sizeof(INT));
@ -17,7 +19,8 @@ namespace dml
template <>
void IntField::read_from(std::istream &istream)
{
const ValueBytes<USHRT> endianness_check = { 0x0102 };
ValueBytes<USHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<INT> data;
istream.read(data.buff, sizeof(INT));
if (endianness_check.buff[0] == 0x01)

View File

@ -1,5 +1,6 @@
#include "ki/dml/Field.h"
#include "ki/util/ValueBytes.h"
#include <algorithm>
namespace ki
{
@ -8,7 +9,8 @@ namespace dml
template <>
void ShrtField::write_to(std::ostream &ostream) const
{
ValueBytes<SHRT> data = { m_value };
ValueBytes<SHRT> data;
data.value = m_value;
if (data.buff[0] == ((m_value & 0xFF00) >> 8))
std::reverse(&data.buff[0], &data.buff[1]);
ostream.write(data.buff, sizeof(SHRT));
@ -17,7 +19,8 @@ namespace dml
template <>
void ShrtField::read_from(std::istream &istream)
{
const ValueBytes<SHRT> endianness_check = { 0x0102 };
ValueBytes<SHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<SHRT> data;
istream.read(data.buff, sizeof(SHRT));
if (endianness_check.buff[0] == 0x01)

View File

@ -1,5 +1,6 @@
#include "ki/dml/Field.h"
#include "ki/util/ValueBytes.h"
#include <algorithm>
namespace ki
{
@ -8,7 +9,8 @@ namespace dml
template <>
void StrField::write_to(std::ostream &ostream) const
{
ValueBytes<USHRT> data = { m_value.length() };
ValueBytes<USHRT> data;
data.value = m_value.length();
if (data.buff[0] == ((m_value.length() & 0xFF00) >> 8))
std::reverse(&data.buff[0], &data.buff[1]);
ostream.write(data.buff, sizeof(USHRT));
@ -19,7 +21,8 @@ namespace dml
void StrField::read_from(std::istream &istream)
{
// Get the length
const ValueBytes<USHRT> endianness_check = { 0x0102 };
ValueBytes<USHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<USHRT> length_data;
istream.read(length_data.buff, sizeof(USHRT));
if (endianness_check.buff[0] == 0x01)

View File

@ -1,5 +1,6 @@
#include "ki/dml/Field.h"
#include "ki/util/ValueBytes.h"
#include <algorithm>
namespace ki
{
@ -8,7 +9,8 @@ namespace dml
template <>
void UIntField::write_to(std::ostream &ostream) const
{
ValueBytes<UINT> data = { m_value };
ValueBytes<UINT> data;
data.value = m_value;
if (data.buff[0] == ((m_value & 0xFF000000) >> 24))
std::reverse(&data.buff[0], &data.buff[3]);
ostream.write(data.buff, sizeof(UINT));
@ -17,7 +19,8 @@ namespace dml
template <>
void UIntField::read_from(std::istream &istream)
{
const ValueBytes<USHRT> endianness_check = { 0x0102 };
ValueBytes<USHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<UINT> data;
istream.read(data.buff, sizeof(UINT));
if (endianness_check.buff[0] == 0x01)

View File

@ -1,5 +1,6 @@
#include "ki/dml/Field.h"
#include "ki/util/ValueBytes.h"
#include <algorithm>
namespace ki
{
@ -8,7 +9,8 @@ namespace dml
template <>
void UShrtField::write_to(std::ostream &ostream) const
{
ValueBytes<USHRT> data = { m_value };
ValueBytes<USHRT> data;
data.value = m_value;
if (data.buff[0] == ((m_value & 0xFF00) >> 8))
std::reverse(&data.buff[0], &data.buff[1]);
ostream.write(data.buff, sizeof(USHRT));
@ -17,7 +19,8 @@ namespace dml
template <>
void UShrtField::read_from(std::istream &istream)
{
const ValueBytes<USHRT> endianness_check = { 0x0102 };
ValueBytes<USHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<USHRT> data;
istream.read(data.buff, sizeof(USHRT));
if (endianness_check.buff[0] == 0x01)

View File

@ -1,5 +1,6 @@
#include "ki/dml/Field.h"
#include "ki/util/ValueBytes.h"
#include <algorithm>
namespace ki
{
@ -8,7 +9,8 @@ namespace dml
template <>
void WStrField::write_to(std::ostream &ostream) const
{
ValueBytes<USHRT> data = { m_value.length() };
ValueBytes<USHRT> data;
data.value = m_value.length();
if (data.buff[0] == ((m_value.length() & 0xFF00) >> 8))
std::reverse(&data.buff[0], &data.buff[1]);
ostream.write(data.buff, sizeof(USHRT));
@ -19,7 +21,8 @@ namespace dml
void WStrField::read_from(std::istream &istream)
{
// Get the length
const ValueBytes<USHRT> endianness_check = { 0x0102 };
ValueBytes<USHRT> endianness_check;
endianness_check.value = 0x0102;
ValueBytes<USHRT> length_data;
istream.read(length_data.buff, sizeof(USHRT));
if (endianness_check.buff[0] == 0x01)