Bug 1307945 - ByteWriter asserts that all writes should succeed - r=jya

Writes should always be small, so if any fails, we are in big trouble anyway.
(Effectively ByteWriter is infallible.)

MozReview-Commit-ID: CJVsrTx0PFh

--HG--
extra : rebase_source : fa4dd3230382620a393c8555338e8956df83f748
This commit is contained in:
Gerald Squelart 2016-10-16 19:10:42 +11:00
Родитель 6b07d57631
Коммит 8f130692e8
1 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -24,47 +24,47 @@ public:
void WriteU8(uint8_t aByte)
{
mPtr.append(aByte);
Write(&aByte, 1);
}
void WriteU16(uint16_t aShort)
{
uint8_t c[2];
mozilla::BigEndian::writeUint16(&c[0], aShort);
mPtr.append(&c[0], 2);
Write(&c[0], 2);
}
void WriteU32(uint32_t aLong)
{
uint8_t c[4];
mozilla::BigEndian::writeUint32(&c[0], aLong);
mPtr.append(&c[0], 4);
Write(&c[0], 4);
}
void Write32(int32_t aLong)
{
uint8_t c[4];
mozilla::BigEndian::writeInt32(&c[0], aLong);
mPtr.append(&c[0], 4);
Write(&c[0], 4);
}
void WriteU64(uint64_t aLongLong)
{
uint8_t c[8];
mozilla::BigEndian::writeUint64(&c[0], aLongLong);
mPtr.append(&c[0], 8);
Write(&c[0], 8);
}
void Write64(int64_t aLongLong)
{
uint8_t c[8];
mozilla::BigEndian::writeInt64(&c[0], aLongLong);
mPtr.append(&c[0], 8);
Write(&c[0], 8);
}
void Write(const uint8_t* aSrc, size_t aCount)
{
mPtr.append(aSrc, aCount);
MOZ_RELEASE_ASSERT(mPtr.append(aSrc, aCount));
}
private: