summaryrefslogtreecommitdiffstats
path: root/hostTools/lzma/decompress/IInOutStreams.h
diff options
context:
space:
mode:
authorroot <root@lamia.panaceas.james.local>2015-12-19 14:18:43 +0000
committerroot <root@lamia.panaceas.james.local>2015-12-19 14:18:43 +0000
commit71478fd62d8483483abb34609cdabb7f9cbadfd6 (patch)
tree37b8eaba1ffe2d5f775227911eb0ed6fdc3c9553 /hostTools/lzma/decompress/IInOutStreams.h
parent1a2238d1bddc823df06f67312d96ccf9de2893cc (diff)
downloadbootloader-71478fd62d8483483abb34609cdabb7f9cbadfd6.tar.gz
bootloader-71478fd62d8483483abb34609cdabb7f9cbadfd6.tar.bz2
bootloader-71478fd62d8483483abb34609cdabb7f9cbadfd6.zip
Add hostTools from https://github.com/Noltari/cfe_bcm63xx
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