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:
Diffstat (limited to 'CPP/7zip/Archive/Com')
-rwxr-xr-xCPP/7zip/Archive/Com/ComHandler.cpp8
-rwxr-xr-xCPP/7zip/Archive/Com/ComIn.cpp22
2 files changed, 7 insertions, 23 deletions
diff --git a/CPP/7zip/Archive/Com/ComHandler.cpp b/CPP/7zip/Archive/Com/ComHandler.cpp
index aa9bf859..2255c021 100755
--- a/CPP/7zip/Archive/Com/ComHandler.cpp
+++ b/CPP/7zip/Archive/Com/ComHandler.cpp
@@ -217,16 +217,14 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
size = (UInt32)rem;
RINOK(_stream->Seek(offset, STREAM_SEEK_SET, NULL));
- UInt32 realProcessedSize;
- RINOK(ReadStream(_stream, sect, size, &realProcessedSize));
+ size_t realProcessedSize = size;
+ RINOK(ReadStream(_stream, sect, &realProcessedSize));
if (realProcessedSize != size)
break;
if (realOutStream)
{
- RINOK(WriteStream(realOutStream, sect, size, &realProcessedSize));
- if (realProcessedSize != size)
- break;
+ RINOK(WriteStream(realOutStream, sect, size));
}
pos += size;
}
diff --git a/CPP/7zip/Archive/Com/ComIn.cpp b/CPP/7zip/Archive/Com/ComIn.cpp
index c3549609..b8dfdb81 100755
--- a/CPP/7zip/Archive/Com/ComIn.cpp
+++ b/CPP/7zip/Archive/Com/ComIn.cpp
@@ -7,6 +7,8 @@ extern "C"
#include "../../../../C/Alloc.h"
}
+#include "../../../../C/CpuArch.h"
+
#include "Common/MyCom.h"
#include "../../Common/StreamUtils.h"
#include "Common/IntToString.h"
@@ -19,22 +21,6 @@ namespace NCom{
static const UInt32 kSignatureSize = 8;
static const Byte kSignature[kSignatureSize] = { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 };
-static HRESULT ReadBytes(ISequentialInStream *inStream, void *data, UInt32 size)
-{
- UInt32 realProcessedSize;
- RINOK(ReadStream(inStream, data, size, &realProcessedSize));
- return (realProcessedSize == size) ? S_OK : S_FALSE;
-}
-
-#ifdef LITTLE_ENDIAN_UNALIGN
-#define GetUi16(p) (*(const UInt16 *)(p))
-#define GetUi32(p) (*(const UInt32 *)(p))
-#else
-#define GetUi16(p) ((p)[0] | ((UInt16)(p)[1] << 8))
-#define GetUi32(p) ((p)[0] | ((UInt32)(p)[1] << 8) | ((UInt32)(p)[2] << 16) | ((UInt32)(p)[3] << 24))
-#endif
-
-
void CUInt32Buf::Free()
{
MyFree(_buf);
@@ -56,7 +42,7 @@ bool CUInt32Buf::Allocate(UInt32 numItems)
static HRESULT ReadSector(IInStream *inStream, Byte *buf, int sectorSizeBits, UInt32 sid)
{
RINOK(inStream->Seek((((UInt64)sid + 1) << sectorSizeBits), STREAM_SEEK_SET, NULL));
- return ReadBytes(inStream, buf, (UInt32)1 << sectorSizeBits);
+ return ReadStream_FALSE(inStream, buf, (UInt32)1 << sectorSizeBits);
}
static HRESULT ReadIDs(IInStream *inStream, Byte *buf, int sectorSizeBits, UInt32 sid, UInt32 *dest)
@@ -219,7 +205,7 @@ HRESULT OpenArchive(IInStream *inStream, CDatabase &db)
{
static const UInt32 kHeaderSize = 512;
Byte p[kHeaderSize];
- RINOK(ReadBytes(inStream, p, kHeaderSize));
+ RINOK(ReadStream_FALSE(inStream, p, kHeaderSize));
if (memcmp(p, kSignature, kSignatureSize) != 0)
return S_FALSE;
UInt16 majorVer = GetUi16(p + 0x1A);