Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2009-08-17 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:00 +0300
commitc99f3ebdd639c2adb03d8b44001b10af18516504 (patch)
tree92aaf34e5edbd7287c3f55037190da75ab0a8000 /CPP/7zip/Common/StreamObjects.cpp
parent829409452d85cd6dd9dfc9151f109d6e13a2bb1c (diff)
9.06 beta
Diffstat (limited to 'CPP/7zip/Common/StreamObjects.cpp')
-rwxr-xr-xCPP/7zip/Common/StreamObjects.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/CPP/7zip/Common/StreamObjects.cpp b/CPP/7zip/Common/StreamObjects.cpp
index e043e565..2237b930 100755
--- a/CPP/7zip/Common/StreamObjects.cpp
+++ b/CPP/7zip/Common/StreamObjects.cpp
@@ -3,21 +3,37 @@
#include "StdAfx.h"
#include "StreamObjects.h"
-#include "../../Common/Defs.h"
-
-STDMETHODIMP CSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize)
+STDMETHODIMP CBufInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
{
- size_t rem = _size - _pos;
+ if (processedSize != NULL)
+ *processedSize = 0;
+ if (_pos > _size)
+ return E_FAIL;
+ size_t rem = _size - (size_t)_pos;
if (size < rem)
rem = (size_t)size;
- memcpy(data, _dataPointer + _pos, rem);
+ memcpy(data, _data + (size_t)_pos, rem);
_pos += rem;
if (processedSize != NULL)
*processedSize = (UInt32)rem;
return S_OK;
}
+STDMETHODIMP CBufInStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
+{
+ switch(seekOrigin)
+ {
+ case STREAM_SEEK_SET: _pos = offset; break;
+ case STREAM_SEEK_CUR: _pos += offset; break;
+ case STREAM_SEEK_END: _pos = _size + offset; break;
+ default: return STG_E_INVALIDFUNCTION;
+ }
+ if (newPosition)
+ *newPosition = _pos;
+ return S_OK;
+}
+
void CWriteBuffer::Write(const void *data, size_t size)
{