summaryrefslogtreecommitdiffstats
path: root/hostTools/lzma/compress/IInOutStreams.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hostTools/lzma/compress/IInOutStreams.cpp')
-rw-r--r--hostTools/lzma/compress/IInOutStreams.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/hostTools/lzma/compress/IInOutStreams.cpp b/hostTools/lzma/compress/IInOutStreams.cpp
new file mode 100644
index 0000000..73bd1e0
--- /dev/null
+++ b/hostTools/lzma/compress/IInOutStreams.cpp
@@ -0,0 +1,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;
+}