From 2e17370337ada3f83ac4909e18494b7675acf37f Mon Sep 17 00:00:00 2001 From: Joshua Scott Date: Fri, 30 Mar 2018 19:29:12 +0100 Subject: [PATCH] dml: Fix build errors from Travis --- src/dml/types/DblField.cpp | 10 +++++++--- src/dml/types/FltField.cpp | 10 +++++++--- src/dml/types/GidField.cpp | 7 +++++-- src/dml/types/IntField.cpp | 7 +++++-- src/dml/types/ShrtField.cpp | 7 +++++-- src/dml/types/StrField.cpp | 7 +++++-- src/dml/types/UIntField.cpp | 7 +++++-- src/dml/types/UShrtField.cpp | 7 +++++-- src/dml/types/WStrField.cpp | 7 +++++-- 9 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/dml/types/DblField.cpp b/src/dml/types/DblField.cpp index 9d1c2e8..a7c2133 100644 --- a/src/dml/types/DblField.cpp +++ b/src/dml/types/DblField.cpp @@ -1,5 +1,6 @@ #include "ki/dml/Field.h" #include "ki/util/ValueBytes.h" +#include namespace ki { @@ -8,8 +9,10 @@ namespace dml template <> void DblField::write_to(std::ostream &ostream) const { - const ValueBytes endianness_check = { 0x0102 }; - ValueBytes data = { m_value }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; + ValueBytes 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 endianness_check = { 0x0102 }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; ValueBytes data; istream.read(data.buff, sizeof(DBL)); if (endianness_check.buff[0] == 0x01) diff --git a/src/dml/types/FltField.cpp b/src/dml/types/FltField.cpp index bfa3fd6..e79b144 100644 --- a/src/dml/types/FltField.cpp +++ b/src/dml/types/FltField.cpp @@ -1,5 +1,6 @@ #include "ki/dml/Field.h" #include "ki/util/ValueBytes.h" +#include namespace ki { @@ -8,8 +9,10 @@ namespace dml template <> void FltField::write_to(std::ostream &ostream) const { - const ValueBytes endianness_check = { 0x0102 }; - ValueBytes data = { m_value }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; + ValueBytes 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 endianness_check = { 0x0102 }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; ValueBytes data; istream.read(data.buff, sizeof(FLT)); if (endianness_check.buff[0] == 0x01) diff --git a/src/dml/types/GidField.cpp b/src/dml/types/GidField.cpp index 8139f4c..94ccd53 100644 --- a/src/dml/types/GidField.cpp +++ b/src/dml/types/GidField.cpp @@ -1,5 +1,6 @@ #include "ki/dml/Field.h" #include "ki/util/ValueBytes.h" +#include namespace ki { @@ -8,7 +9,8 @@ namespace dml template <> void GidField::write_to(std::ostream &ostream) const { - ValueBytes data = { m_value }; + ValueBytes 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 endianness_check = { 0x0102 }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; ValueBytes data; istream.read(data.buff, sizeof(GID)); if (endianness_check.buff[0] == 0x01) diff --git a/src/dml/types/IntField.cpp b/src/dml/types/IntField.cpp index 25efd24..0183585 100644 --- a/src/dml/types/IntField.cpp +++ b/src/dml/types/IntField.cpp @@ -1,5 +1,6 @@ #include "ki/dml/Field.h" #include "ki/util/ValueBytes.h" +#include namespace ki { @@ -8,7 +9,8 @@ namespace dml template <> void IntField::write_to(std::ostream &ostream) const { - ValueBytes data = { m_value }; + ValueBytes 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 endianness_check = { 0x0102 }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; ValueBytes data; istream.read(data.buff, sizeof(INT)); if (endianness_check.buff[0] == 0x01) diff --git a/src/dml/types/ShrtField.cpp b/src/dml/types/ShrtField.cpp index 60a0fcd..cfde347 100644 --- a/src/dml/types/ShrtField.cpp +++ b/src/dml/types/ShrtField.cpp @@ -1,5 +1,6 @@ #include "ki/dml/Field.h" #include "ki/util/ValueBytes.h" +#include namespace ki { @@ -8,7 +9,8 @@ namespace dml template <> void ShrtField::write_to(std::ostream &ostream) const { - ValueBytes data = { m_value }; + ValueBytes 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 endianness_check = { 0x0102 }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; ValueBytes data; istream.read(data.buff, sizeof(SHRT)); if (endianness_check.buff[0] == 0x01) diff --git a/src/dml/types/StrField.cpp b/src/dml/types/StrField.cpp index 02cfb43..bf709d5 100644 --- a/src/dml/types/StrField.cpp +++ b/src/dml/types/StrField.cpp @@ -1,5 +1,6 @@ #include "ki/dml/Field.h" #include "ki/util/ValueBytes.h" +#include namespace ki { @@ -8,7 +9,8 @@ namespace dml template <> void StrField::write_to(std::ostream &ostream) const { - ValueBytes data = { m_value.length() }; + ValueBytes 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 endianness_check = { 0x0102 }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; ValueBytes length_data; istream.read(length_data.buff, sizeof(USHRT)); if (endianness_check.buff[0] == 0x01) diff --git a/src/dml/types/UIntField.cpp b/src/dml/types/UIntField.cpp index 653a552..dbe5b74 100644 --- a/src/dml/types/UIntField.cpp +++ b/src/dml/types/UIntField.cpp @@ -1,5 +1,6 @@ #include "ki/dml/Field.h" #include "ki/util/ValueBytes.h" +#include namespace ki { @@ -8,7 +9,8 @@ namespace dml template <> void UIntField::write_to(std::ostream &ostream) const { - ValueBytes data = { m_value }; + ValueBytes 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 endianness_check = { 0x0102 }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; ValueBytes data; istream.read(data.buff, sizeof(UINT)); if (endianness_check.buff[0] == 0x01) diff --git a/src/dml/types/UShrtField.cpp b/src/dml/types/UShrtField.cpp index e4c3747..41b409c 100644 --- a/src/dml/types/UShrtField.cpp +++ b/src/dml/types/UShrtField.cpp @@ -1,5 +1,6 @@ #include "ki/dml/Field.h" #include "ki/util/ValueBytes.h" +#include namespace ki { @@ -8,7 +9,8 @@ namespace dml template <> void UShrtField::write_to(std::ostream &ostream) const { - ValueBytes data = { m_value }; + ValueBytes 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 endianness_check = { 0x0102 }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; ValueBytes data; istream.read(data.buff, sizeof(USHRT)); if (endianness_check.buff[0] == 0x01) diff --git a/src/dml/types/WStrField.cpp b/src/dml/types/WStrField.cpp index 3673fab..f4c56c2 100644 --- a/src/dml/types/WStrField.cpp +++ b/src/dml/types/WStrField.cpp @@ -1,5 +1,6 @@ #include "ki/dml/Field.h" #include "ki/util/ValueBytes.h" +#include namespace ki { @@ -8,7 +9,8 @@ namespace dml template <> void WStrField::write_to(std::ostream &ostream) const { - ValueBytes data = { m_value.length() }; + ValueBytes 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 endianness_check = { 0x0102 }; + ValueBytes endianness_check; + endianness_check.value = 0x0102; ValueBytes length_data; istream.read(length_data.buff, sizeof(USHRT)); if (endianness_check.buff[0] == 0x01)