aboutsummaryrefslogtreecommitdiff
path: root/zencore/stream.cpp
blob: aa9705764a21d443a4dd67cf0905b00aadb312d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright Epic Games, Inc. All Rights Reserved.

#include <stdarg.h>
#include <zencore/memory.h>
#include <zencore/stream.h>
#include <zencore/testing.h>

#include <algorithm>
#include <stdexcept>

namespace zen {

void
BinaryWriter::Write(const void* data, size_t ByteCount, uint64_t Offset)
{
	RwLock::ExclusiveLockScope _(m_Lock);

	const size_t NeedEnd = Offset + ByteCount;

	if (NeedEnd > m_Buffer.size())
	{
		m_Buffer.resize(NeedEnd);
	}

	memcpy(m_Buffer.data() + Offset, data, ByteCount);
}

//////////////////////////////////////////////////////////////////////////
//
// Testing related code follows...
//

#if ZEN_WITH_TESTS

void
stream_forcelink()
{
}

#endif

}  // namespace zen