Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: third_party/lzma/v4_65/files/CPP/7zip/Common/LimitedStreams.cpp

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // LimitedStreams.cpp
2
3 #include "StdAfx.h"
4
5 #include "LimitedStreams.h"
6 #include "../../Common/Defs.h"
7
8 STDMETHODIMP CLimitedSequentialInStream::Read(void *data, UInt32 size, UInt32 *p rocessedSize)
9 {
10 UInt32 realProcessedSize = 0;
11 UInt32 sizeToRead = (UInt32)MyMin((_size - _pos), (UInt64)size);
12 HRESULT result = S_OK;
13 if (sizeToRead > 0)
14 {
15 result = _stream->Read(data, sizeToRead, &realProcessedSize);
16 _pos += realProcessedSize;
17 if (realProcessedSize == 0)
18 _wasFinished = true;
19 }
20 if(processedSize != NULL)
21 *processedSize = realProcessedSize;
22 return result;
23 }
24
25 STDMETHODIMP CLimitedSequentialOutStream::Write(const void *data, UInt32 size, U Int32 *processedSize)
26 {
27 HRESULT result = S_OK;
28 if (processedSize != NULL)
29 *processedSize = 0;
30 if (size > _size)
31 {
32 size = (UInt32)_size;
33 if (size == 0)
34 {
35 _overflow = true;
36 return E_FAIL;
37 }
38 }
39 if (_stream)
40 result = _stream->Write(data, size, &size);
41 _size -= size;
42 if (processedSize != NULL)
43 *processedSize = size;
44 return result;
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698