mirror of https://github.com/libAthena/athena.git
Minor MemoryWriter and VectorWriter behavior changes
This commit is contained in:
parent
b57390e304
commit
488acc8675
|
@ -30,14 +30,6 @@ MemoryReader::MemoryReader(const void* data, atUint64 length, bool takeOwnership
|
||||||
setError();
|
setError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length == 0)
|
|
||||||
{
|
|
||||||
if (m_globalErr)
|
|
||||||
atError("length cannot be 0");
|
|
||||||
setError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryReader::~MemoryReader()
|
MemoryReader::~MemoryReader()
|
||||||
|
@ -57,14 +49,6 @@ MemoryCopyReader::MemoryCopyReader(const void* data, atUint64 length)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length == 0)
|
|
||||||
{
|
|
||||||
if (m_globalErr)
|
|
||||||
atError("length cannot be 0");
|
|
||||||
setError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_dataCopy.reset(new atUint8[m_length]);
|
m_dataCopy.reset(new atUint8[m_length]);
|
||||||
m_data = m_dataCopy.get();
|
m_data = m_dataCopy.get();
|
||||||
memmove(m_dataCopy.get(), data, m_length);
|
memmove(m_dataCopy.get(), data, m_length);
|
||||||
|
|
|
@ -22,11 +22,7 @@ void VectorWriter::seek(atInt64 position, SeekOrigin origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((atUint64)position > m_data.size())
|
if ((atUint64)position > m_data.size())
|
||||||
{
|
m_data.resize(position);
|
||||||
atError("data exceeds vector size");
|
|
||||||
setError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_position = position;
|
m_position = position;
|
||||||
break;
|
break;
|
||||||
|
@ -40,11 +36,7 @@ void VectorWriter::seek(atInt64 position, SeekOrigin origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_position + position > m_data.size())
|
if (m_position + position > m_data.size())
|
||||||
{
|
m_data.resize(m_position + position);
|
||||||
atError("data exceeds vector size");
|
|
||||||
setError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_position += position;
|
m_position += position;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue