summaryrefslogtreecommitdiffstats
path: root/hostTools/lzma/compress/IInOutStreams.cpp
blob: 73bd1e04f4468d25ab6d253aa00189f17064b6e6 (plain)
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
#include "Portable.h"
#include "IInOutStreams.h"

HRESULT ISequentialInStream::Read(void *aData, UINT32 aSize, UINT32* aProcessedSize) {
	if (aSize > size)
		aSize = size;
	*aProcessedSize = aSize;
	memcpy(aData, data, aSize);
	size -= aSize;
	data += aSize;
	return S_OK;
}

HRESULT ISequentialOutStream::Write(const void *aData, UINT32 aSize, UINT32* aProcessedSize) {
	if (aSize > size) {
		overflow = true;
		aSize = size;
	}
	*aProcessedSize = aSize;
	memcpy(data, aData, aSize);
	size -= aSize;
	data += aSize;
	total += aSize;
	return S_OK;
}