summaryrefslogtreecommitdiffstats
path: root/hostTools/lzma/decompress/IInOutStreams.h
diff options
context:
space:
mode:
Diffstat (limited to 'hostTools/lzma/decompress/IInOutStreams.h')
-rw-r--r--hostTools/lzma/decompress/IInOutStreams.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/hostTools/lzma/decompress/IInOutStreams.h b/hostTools/lzma/decompress/IInOutStreams.h
new file mode 100644
index 0000000..69abf39
--- /dev/null
+++ b/hostTools/lzma/decompress/IInOutStreams.h
@@ -0,0 +1,62 @@
+#ifndef __IINOUTSTREAMS_H
+#define __IINOUTSTREAMS_H
+
+#include "Portable.h"
+
+typedef struct ISequentialInStream
+{
+ unsigned char* data;
+ unsigned remainingBytes;
+} ISequentialInStream;
+
+extern ISequentialInStream in_stream;
+
+INLINE void InStreamInit(unsigned char * Adata, unsigned Asize)
+ {
+ in_stream.data = Adata;
+ in_stream.remainingBytes = Asize;
+ }
+
+HRESULT InStreamRead(void *aData, UINT32 aSize, UINT32* aProcessedSize);
+
+#if 0
+BYTE InStreamReadByte();
+#else
+INLINE BYTE InStreamReadByte(ISequentialInStream *in_stream)
+ {
+ if (in_stream->remainingBytes == 0)
+ return 0x0;
+ in_stream->remainingBytes--;
+ return (BYTE) *in_stream->data++;
+ }
+#endif
+
+
+
+typedef struct ISequentialOutStream
+{
+ char* data;
+ unsigned size;
+ BOOL overflow;
+ unsigned total;
+} ISequentialOutStream;
+
+extern ISequentialOutStream out_stream;
+
+#define OutStreamInit(Adata, Asize) \
+{ \
+ out_stream.data = Adata; \
+ out_stream.size = Asize; \
+ out_stream.overflow = FALSE; \
+ out_stream.total = 0; \
+}
+
+#define OutStreamSizeSet(newsize) \
+ { \
+ out_stream.total = newsize; \
+ if (out_stream.total > out_stream.size) \
+ out_stream.overflow = TRUE; \
+ }
+
+
+#endif