Refactor Endian namespace

This commit is contained in:
Janek Bevendorff authored and Jonathan White committed 2018-01-13 14:23:27 -05:00
1 parent 3461cbfb06
commit d1a19a1009
9 files changed
+99 -320

No files matched your search

+4 -4
View File
@@ -130,7 +130,7 @@ bool HashedBlockStream::readHashedBlock()
{
bool ok;
quint32 index = Endian::readUInt32(m_baseDevice, ByteOrder, &ok);
quint32 index = Endian::readSizedInt<quint32>(m_baseDevice, ByteOrder, &ok);
if (!ok || index != m_blockIndex) {
m_error = true;
setErrorString("Invalid block index.");
@@ -144,7 +144,7 @@ bool HashedBlockStream::readHashedBlock()
return false;
}
m_blockSize = Endian::readInt32(m_baseDevice, ByteOrder, &ok);
m_blockSize = Endian::readSizedInt<qint32>(m_baseDevice, ByteOrder, &ok);
if (!ok || m_blockSize < 0) {
m_error = true;
setErrorString("Invalid block size.");
@@ -217,7 +217,7 @@ qint64 HashedBlockStream::writeData(const char* data, qint64 maxSize)
bool HashedBlockStream::writeHashedBlock()
{
if (!Endian::writeInt32(m_blockIndex, m_baseDevice, ByteOrder)) {
if (!Endian::writeSizedInt<qint32>(m_blockIndex, m_baseDevice, ByteOrder)) {
m_error = true;
setErrorString(m_baseDevice->errorString());
return false;
@@ -238,7 +238,7 @@ bool HashedBlockStream::writeHashedBlock()
return false;
}
if (!Endian::writeInt32(m_buffer.size(), m_baseDevice, ByteOrder)) {
if (!Endian::writeSizedInt<qint32>(m_buffer.size(), m_baseDevice, ByteOrder)) {
m_error = true;
setErrorString(m_baseDevice->errorString());
return false;