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>2008-05-05 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:55 +0300
commit3901bf0ab88106a5b031cba7bc18d60cdebf7eef (patch)
tree808a2489abed822223b118b64e0553db80af6087 /CPP/7zip/Archive/Com/ComIn.cpp
parentbd1fa36322ac27f5715433b388742893d6524516 (diff)
4.58 beta
Diffstat (limited to 'CPP/7zip/Archive/Com/ComIn.cpp')
-rwxr-xr-xCPP/7zip/Archive/Com/ComIn.cpp22
1 files changed, 4 insertions, 18 deletions
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);