diff --git a/src/dml/types/DblField.cpp b/src/dml/types/DblField.cpp index a7c2133..86e389a 100644 --- a/src/dml/types/DblField.cpp +++ b/src/dml/types/DblField.cpp @@ -14,7 +14,7 @@ namespace dml ValueBytes data; data.value = m_value; if (endianness_check.buff[0] == 0x01) - std::reverse(&data.buff[0], &data.buff[7]); + std::reverse(&data.buff[0], &data.buff[8]); ostream.write(data.buff, sizeof(DBL)); } @@ -26,7 +26,7 @@ namespace dml ValueBytes data; istream.read(data.buff, sizeof(DBL)); if (endianness_check.buff[0] == 0x01) - std::reverse(&data.buff[0], &data.buff[3]); + std::reverse(&data.buff[0], &data.buff[8]); m_value = data.value; } diff --git a/src/dml/types/FltField.cpp b/src/dml/types/FltField.cpp index e79b144..59ae031 100644 --- a/src/dml/types/FltField.cpp +++ b/src/dml/types/FltField.cpp @@ -14,7 +14,7 @@ namespace dml ValueBytes data; data.value = m_value; if (endianness_check.buff[0] == 0x01) - std::reverse(&data.buff[0], &data.buff[3]); + std::reverse(&data.buff[0], &data.buff[4]); ostream.write(data.buff, sizeof(FLT)); } @@ -26,7 +26,7 @@ namespace dml ValueBytes data; istream.read(data.buff, sizeof(FLT)); if (endianness_check.buff[0] == 0x01) - std::reverse(&data.buff[0], &data.buff[3]); + std::reverse(&data.buff[0], &data.buff[4]); m_value = data.value; } diff --git a/src/dml/types/GidField.cpp b/src/dml/types/GidField.cpp index 94ccd53..d38a69f 100644 --- a/src/dml/types/GidField.cpp +++ b/src/dml/types/GidField.cpp @@ -12,7 +12,7 @@ namespace dml ValueBytes data; data.value = m_value; if (data.buff[0] == ((m_value & 0xFF00000000000000) >> 56)) - std::reverse(&data.buff[0], &data.buff[7]); + std::reverse(&data.buff[0], &data.buff[8]); ostream.write(data.buff, sizeof(GID)); } @@ -24,7 +24,7 @@ namespace dml ValueBytes data; istream.read(data.buff, sizeof(GID)); if (endianness_check.buff[0] == 0x01) - std::reverse(&data.buff[0], &data.buff[7]); + std::reverse(&data.buff[0], &data.buff[8]); m_value = data.value; } diff --git a/src/dml/types/IntField.cpp b/src/dml/types/IntField.cpp index 0183585..aa4995e 100644 --- a/src/dml/types/IntField.cpp +++ b/src/dml/types/IntField.cpp @@ -12,7 +12,7 @@ namespace dml ValueBytes data; data.value = m_value; if (data.buff[0] == ((m_value & 0xFF000000) >> 24)) - std::reverse(&data.buff[0], &data.buff[3]); + std::reverse(&data.buff[0], &data.buff[4]); ostream.write(data.buff, sizeof(INT)); } @@ -24,7 +24,7 @@ namespace dml ValueBytes data; istream.read(data.buff, sizeof(INT)); if (endianness_check.buff[0] == 0x01) - std::reverse(&data.buff[0], &data.buff[3]); + std::reverse(&data.buff[0], &data.buff[4]); m_value = data.value; } diff --git a/src/dml/types/ShrtField.cpp b/src/dml/types/ShrtField.cpp index cfde347..17bcb60 100644 --- a/src/dml/types/ShrtField.cpp +++ b/src/dml/types/ShrtField.cpp @@ -12,7 +12,7 @@ namespace dml ValueBytes data; data.value = m_value; if (data.buff[0] == ((m_value & 0xFF00) >> 8)) - std::reverse(&data.buff[0], &data.buff[1]); + std::reverse(&data.buff[0], &data.buff[2]); ostream.write(data.buff, sizeof(SHRT)); } @@ -24,7 +24,7 @@ namespace dml ValueBytes data; istream.read(data.buff, sizeof(SHRT)); if (endianness_check.buff[0] == 0x01) - std::reverse(&data.buff[0], &data.buff[1]); + std::reverse(&data.buff[0], &data.buff[2]); m_value = data.value; } diff --git a/src/dml/types/StrField.cpp b/src/dml/types/StrField.cpp index bf709d5..88e22dc 100644 --- a/src/dml/types/StrField.cpp +++ b/src/dml/types/StrField.cpp @@ -12,7 +12,7 @@ namespace dml ValueBytes data; data.value = m_value.length(); if (data.buff[0] == ((m_value.length() & 0xFF00) >> 8)) - std::reverse(&data.buff[0], &data.buff[1]); + std::reverse(&data.buff[0], &data.buff[2]); ostream.write(data.buff, sizeof(USHRT)); ostream.write(m_value.c_str(), m_value.length()); } @@ -26,7 +26,7 @@ namespace dml ValueBytes length_data; istream.read(length_data.buff, sizeof(USHRT)); if (endianness_check.buff[0] == 0x01) - std::reverse(&length_data.buff[0], &length_data.buff[1]); + std::reverse(&length_data.buff[0], &length_data.buff[2]); // Read the data into a buffer char *data = new char[length_data.value + 1] { 0 }; diff --git a/src/dml/types/UIntField.cpp b/src/dml/types/UIntField.cpp index dbe5b74..40326d0 100644 --- a/src/dml/types/UIntField.cpp +++ b/src/dml/types/UIntField.cpp @@ -12,7 +12,7 @@ namespace dml ValueBytes data; data.value = m_value; if (data.buff[0] == ((m_value & 0xFF000000) >> 24)) - std::reverse(&data.buff[0], &data.buff[3]); + std::reverse(&data.buff[0], &data.buff[4]); ostream.write(data.buff, sizeof(UINT)); } @@ -24,7 +24,7 @@ namespace dml ValueBytes data; istream.read(data.buff, sizeof(UINT)); if (endianness_check.buff[0] == 0x01) - std::reverse(&data.buff[0], &data.buff[3]); + std::reverse(&data.buff[0], &data.buff[4]); m_value = data.value; } diff --git a/src/dml/types/UShrtField.cpp b/src/dml/types/UShrtField.cpp index 41b409c..88aabfa 100644 --- a/src/dml/types/UShrtField.cpp +++ b/src/dml/types/UShrtField.cpp @@ -12,7 +12,7 @@ namespace dml ValueBytes data; data.value = m_value; if (data.buff[0] == ((m_value & 0xFF00) >> 8)) - std::reverse(&data.buff[0], &data.buff[1]); + std::reverse(&data.buff[0], &data.buff[2]); ostream.write(data.buff, sizeof(USHRT)); } @@ -24,7 +24,7 @@ namespace dml ValueBytes data; istream.read(data.buff, sizeof(USHRT)); if (endianness_check.buff[0] == 0x01) - std::reverse(&data.buff[0], &data.buff[1]); + std::reverse(&data.buff[0], &data.buff[2]); m_value = data.value; } diff --git a/src/dml/types/WStrField.cpp b/src/dml/types/WStrField.cpp index e0c9fa7..3cb5dad 100644 --- a/src/dml/types/WStrField.cpp +++ b/src/dml/types/WStrField.cpp @@ -12,7 +12,7 @@ namespace dml ValueBytes data; data.value = m_value.length(); if (data.buff[0] == ((m_value.length() & 0xFF00) >> 8)) - std::reverse(&data.buff[0], &data.buff[1]); + std::reverse(&data.buff[0], &data.buff[2]); ostream.write(data.buff, sizeof(USHRT)); ostream.write((char *)m_value.c_str(), m_value.length() * sizeof(char16_t)); } @@ -26,7 +26,7 @@ namespace dml ValueBytes length_data; istream.read(length_data.buff, sizeof(USHRT)); if (endianness_check.buff[0] == 0x01) - std::reverse(&length_data.buff[0], &length_data.buff[1]); + std::reverse(&length_data.buff[0], &length_data.buff[2]); // Read the data into a buffer size_t length = length_data.value * sizeof(char16_t); @@ -35,7 +35,7 @@ namespace dml for (int i = 0; i < length; i += 2) { if (endianness_check.buff[0] == 0x01) - std::reverse(&data[i], &data[i + 1]); + std::reverse(&data[i], &data[i + 2]); } m_value = WSTR((char16_t *)data); delete[] data;