diff --git a/deps/ox/src/ox/mc/read.hpp b/deps/ox/src/ox/mc/read.hpp index 8add0879..5bbf1812 100644 --- a/deps/ox/src/ox/mc/read.hpp +++ b/deps/ox/src/ox/mc/read.hpp @@ -88,7 +88,7 @@ int MetalClawReader::op(const char*, ox::BString *val) { // read the length size_t size = 0; if (m_buffIt + sizeof(StringLength) < m_buffLen) { - size = ox::bigEndianAdapt(*((StringLength*) &m_buff[m_buffIt])); + size = ox::bigEndianAdapt(*(reinterpret_cast(&m_buff[m_buffIt]))); m_buffIt += sizeof(StringLength); } else { err |= MC_BUFFENDED; @@ -117,7 +117,7 @@ int MetalClawReader::readInteger(I *val) { int err = 0; if (m_fieldPresence.get(m_field)) { if (m_buffIt + sizeof(I) < m_buffLen) { - *val = ox::bigEndianAdapt(*((I*) &m_buff[m_buffIt])); + *val = ox::bigEndianAdapt(*(reinterpret_cast(&m_buff[m_buffIt]))); m_buffIt += sizeof(I); } else { err = MC_BUFFENDED; @@ -136,7 +136,7 @@ int MetalClawReader::op(const char*, T *val, size_t valLen) { // read the length size_t len = 0; if (m_buffIt + sizeof(ArrayLength) < m_buffLen) { - len = ox::bigEndianAdapt(*((ArrayLength*) &m_buff[m_buffIt])); + len = ox::bigEndianAdapt(*(reinterpret_cast(&m_buff[m_buffIt]))); m_buffIt += sizeof(ArrayLength); } else { err = MC_BUFFENDED; diff --git a/deps/ox/src/ox/mc/write.hpp b/deps/ox/src/ox/mc/write.hpp index 52c922b5..5511a05d 100644 --- a/deps/ox/src/ox/mc/write.hpp +++ b/deps/ox/src/ox/mc/write.hpp @@ -75,7 +75,7 @@ int MetalClawWriter::op(const char*, ox::BString *val) { // write the length typedef uint32_t StringLength; if (m_buffIt + sizeof(StringLength) + val->size() < m_buffLen) { - *((StringLength*) &m_buff[m_buffIt]) = ox::bigEndianAdapt((StringLength) val->size()); + *(reinterpret_cast(&m_buff[m_buffIt])) = ox::bigEndianAdapt(static_cast(val->size())); m_buffIt += sizeof(StringLength); // write the string @@ -97,7 +97,7 @@ int MetalClawWriter::op(const char*, T *val) { bool fieldSet = false; MetalClawWriter writer(m_buff + m_buffIt, m_buffLen - m_buffIt); err |= ioOp(&writer, val); - if ((size_t) writer.m_fieldPresence.getMaxLen() < writer.m_buffIt) { + if (static_cast(writer.m_fieldPresence.getMaxLen()) < writer.m_buffIt) { m_buffIt += writer.m_buffIt; fieldSet = true; } @@ -112,7 +112,7 @@ int MetalClawWriter::appendInteger(I val) { bool fieldSet = false; if (val) { if (m_buffIt + sizeof(I) < m_buffLen) { - *((I*) &m_buff[m_buffIt]) = ox::bigEndianAdapt(val); + *(reinterpret_cast(&m_buff[m_buffIt])) = ox::bigEndianAdapt(val); fieldSet = true; m_buffIt += sizeof(I); } else { @@ -133,7 +133,7 @@ int MetalClawWriter::op(const char*, T *val, size_t len) { // write the length typedef uint32_t ArrayLength; if (m_buffIt + sizeof(ArrayLength) < m_buffLen) { - *((ArrayLength*) &m_buff[m_buffIt]) = ox::bigEndianAdapt((ArrayLength) len); + *reinterpret_cast(&m_buff[m_buffIt]) = ox::bigEndianAdapt(static_cast(len)); m_buffIt += sizeof(ArrayLength); } else { err = MC_BUFFENDED;