This commit is contained in:
Igor Pavlov
2015-10-05 00:00:00 +00:00
committed by Kornel Lesiński
parent f6444c3256
commit 6543c28020
113 changed files with 3101 additions and 382 deletions

View File

@@ -1,5 +1,5 @@
/* 7zArcIn.c -- 7z Input functions
2015-05-16 : Igor Pavlov : Public domain */
2015-09-28 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -1295,7 +1295,7 @@ static SRes SzReadHeader2(
{
SKIP_DATA(sd, size);
}
else switch((unsigned)type)
else switch ((unsigned)type)
{
case k7zIdName:
{

View File

@@ -1,9 +1,9 @@
#define MY_VER_MAJOR 15
#define MY_VER_MINOR 07
#define MY_VER_BUILD 00
#define MY_VERSION_NUMBERS "15.07"
#define MY_VERSION "15.07 beta"
#define MY_DATE "2015-09-17"
#define MY_VER_MINOR 8
#define MY_VER_BUILD 0
#define MY_VERSION_NUMBERS "15.08"
#define MY_VERSION "15.08 beta"
#define MY_DATE "2015-10-01"
#undef MY_COPYRIGHT
#undef MY_VERSION_COPYRIGHT_DATE
#define MY_AUTHOR_NAME "Igor Pavlov"

View File

@@ -1,5 +1,5 @@
/* MtCoder.c -- Multi-thread Coder
2010-09-24 : Igor Pavlov : Public domain */
2015-09-28 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -120,7 +120,7 @@ void CMtThread_Construct(CMtThread *p, CMtCoder *mtCoder)
LoopThread_Construct(&p->thread);
}
#define RINOK_THREAD(x) { if((x) != 0) return SZ_ERROR_THREAD; }
#define RINOK_THREAD(x) { if ((x) != 0) return SZ_ERROR_THREAD; }
static void CMtThread_CloseEvents(CMtThread *p)
{

View File

@@ -1,5 +1,5 @@
/* Ppmd7.c -- PPMdH codec
2010-03-12 : Igor Pavlov : Public domain
2015-09-28 : Igor Pavlov : Public domain
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
#include "Precomp.h"
@@ -66,7 +66,7 @@ void Ppmd7_Construct(CPpmd7 *p)
for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++)
{
unsigned step = (i >= 12 ? 4 : (i >> 2) + 1);
do { p->Units2Indx[k++] = (Byte)i; } while(--step);
do { p->Units2Indx[k++] = (Byte)i; } while (--step);
p->Indx2Units[i] = (Byte)k;
}
@@ -257,7 +257,7 @@ static void *AllocUnits(CPpmd7 *p, unsigned indx)
#define MyMem12Cpy(dest, src, num) \
{ UInt32 *d = (UInt32 *)dest; const UInt32 *s = (const UInt32 *)src; UInt32 n = num; \
do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while(--n); }
do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while (--n); }
static void *ShrinkUnits(CPpmd7 *p, void *oldPtr, unsigned oldNU, unsigned newNU)
{

View File

@@ -1,5 +1,5 @@
/* Ppmd7Enc.c -- PPMdH Encoder
2010-03-12 : Igor Pavlov : Public domain
2015-09-28 : Igor Pavlov : Public domain
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
#include "Precomp.h"
@@ -26,7 +26,7 @@ static void RangeEnc_ShiftLow(CPpmd7z_RangeEnc *p)
p->Stream->Write(p->Stream, (Byte)(temp + (Byte)(p->Low >> 32)));
temp = 0xFF;
}
while(--p->CacheSize != 0);
while (--p->CacheSize != 0);
p->Cache = (Byte)((UInt32)p->Low >> 24);
}
p->CacheSize++;

View File

@@ -1,5 +1,5 @@
/* Ppmd8.c -- PPMdI codec
2013-11-12 : Igor Pavlov : Public domain
2015-09-28 : Igor Pavlov : Public domain
This code is based on PPMd var.I (2002): Dmitry Shkarin : Public domain */
#include "Precomp.h"
@@ -67,7 +67,7 @@ void Ppmd8_Construct(CPpmd8 *p)
for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++)
{
unsigned step = (i >= 12 ? 4 : (i >> 2) + 1);
do { p->Units2Indx[k++] = (Byte)i; } while(--step);
do { p->Units2Indx[k++] = (Byte)i; } while (--step);
p->Indx2Units[i] = (Byte)k;
}
@@ -241,7 +241,7 @@ static void *AllocUnits(CPpmd8 *p, unsigned indx)
#define MyMem12Cpy(dest, src, num) \
{ UInt32 *d = (UInt32 *)dest; const UInt32 *s = (const UInt32 *)src; UInt32 n = num; \
do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while(--n); }
do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while (--n); }
static void *ShrinkUnits(CPpmd8 *p, void *oldPtr, unsigned oldNU, unsigned newNU)
{

View File

@@ -1,5 +1,5 @@
/* 7zipInstall.c - 7-Zip Installer
2015-08-04 : Igor Pavlov : Public domain */
2015-09-28 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -1161,9 +1161,9 @@ if (res == SZ_OK)
if (res == SZ_OK)
{
UInt32 i;
UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call, if(!outBuf) */
UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call, if (!outBuf) */
Byte *outBuf = NULL; /* it must be NULL before first call for each new archive. */
size_t outBufSize = 0; /* it can have any value before first call, if(!outBuf) */
size_t outBufSize = 0; /* it can have any value before first call, if (!outBuf) */
g_TotalSize = 0;

View File

@@ -1180,7 +1180,7 @@ HRESULT CInArchive::ReadHeader(
bool isKnownType = true;
if (type > ((UInt32)1 << 30))
isKnownType = false;
else switch((UInt32)type)
else switch ((UInt32)type)
{
case NID::kName:
{
@@ -1338,7 +1338,7 @@ HRESULT CInArchive::ReadHeader(
db.UnsupportedFeatureWarning = true;
_inByteBack->SkipRem();
}
// SkipData worked incorrectly in some versions before v4.59 (7zVer <= 00.02)
// SkipData worked incorrectly in some versions before v4.59 (7zVer <= 0.02)
if (_inByteBack->GetRem() != 0)
ThrowIncorrect();
}

View File

@@ -14,7 +14,7 @@ namespace N7z {
struct CPropMap
{
UInt32 FilePropID;
STATPROPSTG StatPROPSTG;
CStatProp StatProp;
};
static const CPropMap kPropMap[] =
@@ -24,11 +24,11 @@ static const CPropMap kPropMap[] =
{ NID::kPackInfo, { NULL, kpidPackSize, VT_UI8 } },
#ifdef _MULTI_PACK
{ 100, { L"Pack0", kpidPackedSize0, VT_UI8 } },
{ 101, { L"Pack1", kpidPackedSize1, VT_UI8 } },
{ 102, { L"Pack2", kpidPackedSize2, VT_UI8 } },
{ 103, { L"Pack3", kpidPackedSize3, VT_UI8 } },
{ 104, { L"Pack4", kpidPackedSize4, VT_UI8 } },
{ 100, { "Pack0", kpidPackedSize0, VT_UI8 } },
{ 101, { "Pack1", kpidPackedSize1, VT_UI8 } },
{ 102, { "Pack2", kpidPackedSize2, VT_UI8 } },
{ 103, { "Pack3", kpidPackedSize3, VT_UI8 } },
{ 104, { "Pack4", kpidPackedSize4, VT_UI8 } },
#endif
{ NID::kCTime, { NULL, kpidCTime, VT_FILETIME } },
@@ -90,7 +90,7 @@ void CHandler::FillPopIDs()
_fileInfoPopIDs.Clear();
#ifdef _7Z_VOL
if(_volumes.Size() < 1)
if (_volumes.Size() < 1)
return;
const CVolume &volume = _volumes.Front();
const CArchiveDatabaseEx &_db = volume.Database;
@@ -156,8 +156,8 @@ STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, BSTR *name, PROPID *propID,
const CPropMap &pr = kPropMap[i];
if (pr.FilePropID == id)
{
const STATPROPSTG &st = pr.StatPROPSTG;
*propID = st.propid;
const CStatProp &st = pr.StatProp;
*propID = st.PropID;
*varType = st.vt;
/*
if (st.lpwstrName)

View File

@@ -103,7 +103,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
NCOM::CPropVariant prop;
if (m_Database.NewFormat)
{
switch(propID)
switch (propID)
{
case kpidSize:
prop = (UInt64)m_Database.NewFormatString.Len();
@@ -318,7 +318,7 @@ HRESULT CChmFolderOutStream::Write2(const void *data, UInt32 size, UInt32 *proce
if (processedSize)
*processedSize = 0;
while(size != 0)
while (size != 0)
{
if (m_FileIsOpen)
{

View File

@@ -592,13 +592,13 @@ HRESULT CDatabase::Open(IInStream *inStream)
MainSubfile = -1;
{
FOR_VECTOR(t, Items)
FOR_VECTOR (t, Items)
{
Update_PhySize_WithItem(t);
}
}
{
FOR_VECTOR(t, Items)
FOR_VECTOR (t, Items)
{
const CItem &item = Items[t];
@@ -739,7 +739,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
return S_OK;
UInt32 i;
UInt64 totalSize = 0;
for(i = 0; i < numItems; i++)
for (i = 0; i < numItems; i++)
{
const CItem &item = _db.Items[_db.Refs[allFilesMode ? i : indices[i]].Did];
if (!item.IsDir())

View File

@@ -119,9 +119,9 @@ HRESULT COutVolumeStream::Flush()
/*
STDMETHODIMP COutMultiStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
if(processedSize != NULL)
if (processedSize)
*processedSize = 0;
while(size > 0)
while (size > 0)
{
if (_streamIndex >= Streams.Size())
{
@@ -157,7 +157,7 @@ STDMETHODIMP COutMultiStream::Write(const void *data, UInt32 size, UInt32 *proce
_absPos += realProcessed;
if (_absPos > _length)
_length = _absPos;
if(processedSize != NULL)
if (processedSize)
*processedSize += realProcessed;
if (subStream.Pos == subStream.Size)
{

View File

@@ -5,6 +5,7 @@
#include "../../../C/CpuArch.h"
#include "../../Common/ComTry.h"
#include "../../Common/MyLinux.h"
#include "../../Common/StringConvert.h"
#include "../../Common/StringToInt.h"
#include "../../Common/UTFConvert.h"
@@ -121,7 +122,7 @@ struct CItem
bool IsBin() const { return Type == k_Type_BinLe || Type == k_Type_BinBe; }
bool IsCrcFormat() const { return Type == k_Type_HexCrc; }
bool IsDir() const { return (Mode & 0170000) == 0040000; }
bool IsDir() const { return MY_LIN_S_ISDIR(Mode); }
bool IsTrailer() const { return strcmp(Name, kName_TRAILER) == 0; }
UInt64 GetDataPosition() const { return HeaderPos + HeaderSize; }
};

View File

@@ -8,6 +8,7 @@
#include "../../../C/LzmaDec.h"
#include "../../Common/ComTry.h"
#include "../../Common/MyLinux.h"
#include "../../Common/StringConvert.h"
#include "../../Windows/PropVariantUtils.h"
@@ -98,7 +99,7 @@ struct CNode
#define Get32(p) (be ? GetBe32(p) : GetUi32(p))
static UInt32 GetMode(const Byte *p, bool be) { return be ? GetBe16(p) : GetUi16(p); }
static bool IsDir(const Byte *p, bool be) { return (GetMode(p, be) & 0xF000) == 0x4000; }
static bool IsDir(const Byte *p, bool be) { return MY_LIN_S_ISDIR(GetMode(p, be)); }
static UInt32 GetSize(const Byte *p, bool be)
{
@@ -146,7 +147,7 @@ struct CHeader
{
if (memcmp(p + 16, kSignature, ARRAY_SIZE(kSignature)) != 0)
return false;
switch(GetUi32(p))
switch (GetUi32(p))
{
case 0x28CD3D45: be = false; break;
case 0x453DCD28: be = true; break;
@@ -354,7 +355,7 @@ HRESULT CHandler::Open2(IInStream *inStream)
if (!_h.IsVer2())
{
FOR_VECTOR(i, _items)
FOR_VECTOR (i, _items)
{
const CItem &item = _items[i];
const Byte *p = _data + item.Offset;
@@ -530,7 +531,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
const Byte *p = _data + item.Offset;
bool be = _h.be;
bool isDir = IsDir(p, be);
switch(propID)
switch (propID)
{
case kpidPath: prop = MultiByteToUnicodeString(GetPath(index), CP_OEMCP); break;
case kpidIsDir: prop = isDir; break;
@@ -660,10 +661,6 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
CMyComPtr<ICompressProgressInfo> progress = lps;
lps->Init(extractCallback, false);
CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
CMyComPtr<ISequentialInStream> inStream(streamSpec);
streamSpec->SetStream(_stream);
for (i = 0; i < numItems; i++)
{
lps->InSize = totalPackSize;
@@ -701,20 +698,16 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
int res = NExtract::NOperationResult::kDataError;
{
CMyComPtr<ISequentialInStream> inSeqStream;
CMyComPtr<IInStream> inStream;
HRESULT hres = GetStream(index, &inSeqStream);
if (inSeqStream)
inSeqStream.QueryInterface(IID_IInStream, &inStream);
if (hres == E_OUTOFMEMORY)
return E_OUTOFMEMORY;
if (hres == S_FALSE || !inStream)
if (hres == S_FALSE || !inSeqStream)
res = NExtract::NOperationResult::kUnsupportedMethod;
else
{
RINOK(hres);
if (inStream)
{
HRESULT hres = copyCoder->Code(inStream, outStream, NULL, NULL, progress);
HRESULT hres = copyCoder->Code(inSeqStream, outStream, NULL, NULL, progress);
if (hres == S_OK)
{
if (copyCoderSpec->TotalSize == curSize)
@@ -729,6 +722,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
}
RINOK(extractCallback->SetOperationResult(res));
}
return S_OK;
COM_TRY_END
}

View File

@@ -632,7 +632,7 @@ enum
kpidInfoSection
};
static const STATPROPSTG kProps[] =
static const CStatProp kProps[] =
{
{ NULL, kpidPath, VT_BSTR },
{ NULL, kpidSize, VT_UI8 },
@@ -641,8 +641,8 @@ static const STATPROPSTG kProps[] =
{ NULL, kpidVa, VT_UI8 },
{ NULL, kpidType, VT_BSTR },
{ NULL, kpidCharacts, VT_BSTR }
, { (LPOLESTR)L"Link Section", kpidLinkSection, VT_BSTR}
, { (LPOLESTR)L"Info Section", kpidInfoSection, VT_BSTR}
, { "Link Section", kpidLinkSection, VT_BSTR}
, { "Info Section", kpidInfoSection, VT_BSTR}
};
IMP_IInArchive_Props_WITH_NAME

View File

File diff suppressed because it is too large Load Diff

View File

@@ -805,7 +805,7 @@ enum
// kpidFileSysType
};
static const STATPROPSTG kArcProps[] =
static const CStatProp kArcProps[] =
{
{ NULL, kpidFileSystem, VT_BSTR},
{ NULL, kpidClusterSize, VT_UI4},
@@ -814,12 +814,12 @@ static const STATPROPSTG kArcProps[] =
{ NULL, kpidMTime, VT_FILETIME},
{ NULL, kpidVolumeName, VT_BSTR},
{ (LPOLESTR)L"FATs", kpidNumFats, VT_UI4},
{ "FATs", kpidNumFats, VT_UI4},
{ NULL, kpidSectorSize, VT_UI4},
{ NULL, kpidId, VT_UI4},
// { (LPOLESTR)L"OEM Name", kpidOemName, VT_BSTR},
// { (LPOLESTR)L"Volume Name", kpidVolName, VT_BSTR},
// { (LPOLESTR)L"File System Type", kpidFileSysType, VT_BSTR}
// { "OEM Name", kpidOemName, VT_BSTR},
// { "Volume Name", kpidVolName, VT_BSTR},
// { "File System Type", kpidFileSysType, VT_BSTR}
// { NULL, kpidSectorsPerTrack, VT_UI4},
// { NULL, kpidNumHeads, VT_UI4},
// { NULL, kpidHiddenSectors, VT_UI4}
@@ -858,7 +858,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
NWindows::NCOM::CPropVariant prop;
switch(propID)
switch (propID)
{
case kpidFileSystem:
{
@@ -897,7 +897,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
COM_TRY_BEGIN
NWindows::NCOM::CPropVariant prop;
const CItem &item = Items[index];
switch(propID)
switch (propID)
{
case kpidPath: prop = GetItemPath(index); break;
case kpidShortName: prop = item.GetShortName(); break;

View File

@@ -145,7 +145,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
{
NWindows::NCOM::CPropVariant prop;
const CItem2 &item = _items2[index];
switch(propID)
switch (propID)
{
case kpidExtension:
prop = _isRaw ?
@@ -209,7 +209,7 @@ AString CHandler::GetComment()
Byte type = *p++;
size--;
bool ok = false;
switch(type)
switch (type)
{
case 0:
{
@@ -256,7 +256,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{
// COM_TRY_BEGIN
NWindows::NCOM::CPropVariant prop;
switch(propID)
switch (propID)
{
// case kpidComment: prop = GetComment(); break;
case kpidPhySize: prop = (UInt64)_phySize; break;

View File

@@ -227,4 +227,30 @@ STDMETHODIMP CHandlerImg::Extract(const UInt32 *indices, UInt32 numItems,
COM_TRY_END
}
HRESULT ReadZeroTail(ISequentialInStream *stream, bool &areThereNonZeros, UInt64 &numZeros, UInt64 maxSize)
{
areThereNonZeros = false;
numZeros = 0;
const size_t kBufSize = 1 << 11;
Byte buf[kBufSize];
for (;;)
{
UInt32 size = 0;
HRESULT(stream->Read(buf, kBufSize, &size));
if (size == 0)
return S_OK;
for (UInt32 i = 0; i < size; i++)
if (buf[i] != 0)
{
areThereNonZeros = true;
numZeros += i;
return S_OK;
}
numZeros += size;
if (numZeros > maxSize)
return S_OK;
}
}
}

View File

@@ -85,6 +85,9 @@ public:
STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
};
HRESULT ReadZeroTail(ISequentialInStream *stream, bool &areThereNonZeros, UInt64 &numZeros, UInt64 maxSize);
}
#endif

View File

@@ -293,12 +293,14 @@ namespace NPropDataType
const UInt32 kMask_ZeroEnd = 1 << 4;
// const UInt32 kMask_BigEndian = 1 << 5;
const UInt32 kMask_Utf = 1 << 6;
// const UInt32 kMask_Utf8 = kMask_Utf | 0;
const UInt32 kMask_Utf8 = kMask_Utf | 0;
const UInt32 kMask_Utf16 = kMask_Utf | 1;
// const UInt32 kMask_Utf32 = kMask_Utf | 2;
const UInt32 kNotDefined = 0;
const UInt32 kRaw = 1;
const UInt32 kUtf8z = kMask_Utf8 | kMask_ZeroEnd;
const UInt32 kUtf16z = kMask_Utf16 | kMask_ZeroEnd;
};
@@ -512,12 +514,26 @@ ARCHIVE_INTERFACE(IArchiveAllowTail, 0x05)
{ if (index >= ARRAY_SIZE(k)) return E_INVALIDARG; \
*propID = k[index]; *varType = k7z_PROPID_To_VARTYPE[(unsigned)*propID]; *name = 0; return S_OK; } \
struct CStatProp
{
const char *Name;
UInt32 PropID;
VARTYPE vt;
};
namespace NWindows {
namespace NCOM {
// PropVariant.cpp
BSTR AllocBstrFromAscii(const char *s) throw();
}}
#define IMP_IInArchive_GetProp_WITH_NAME(k) \
(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) \
{ if (index >= ARRAY_SIZE(k)) return E_INVALIDARG; \
const STATPROPSTG &srcItem = k[index]; \
*propID = srcItem.propid; *varType = srcItem.vt; \
if (srcItem.lpwstrName == 0) *name = 0; else *name = ::SysAllocString(srcItem.lpwstrName); return S_OK; } \
const CStatProp &prop = k[index]; \
*propID = (PROPID)prop.PropID; *varType = prop.vt; \
*name = NWindows::NCOM::AllocBstrFromAscii(prop.Name); return S_OK; } \
#define IMP_IInArchive_Props \
STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProps) \

View File

@@ -8,6 +8,8 @@
#include "../../Common/StreamUtils.h"
#include "../HandlerCont.h"
#include "IsoIn.h"
namespace NArchive {
@@ -596,7 +598,7 @@ HRESULT CInArchive::Open2()
ReadBootInfo();
{
FOR_VECTOR(i, Refs)
FOR_VECTOR (i, Refs)
{
const CRef &ref = Refs[i];
for (UInt32 j = 0; j < ref.NumExtents; j++)
@@ -608,12 +610,28 @@ HRESULT CInArchive::Open2()
}
}
{
FOR_VECTOR(i, BootEntries)
FOR_VECTOR (i, BootEntries)
{
const CBootInitialEntry &be = BootEntries[i];
UpdatePhySize(be.LoadRBA, GetBootItemSize(i));
}
}
if (PhySize < _fileSize)
{
UInt64 rem = _fileSize - PhySize;
const UInt64 kRemMax = 1 << 21;
if (rem <= kRemMax)
{
RINOK(_stream->Seek(PhySize, STREAM_SEEK_SET, NULL));
bool areThereNonZeros = false;
UInt64 numZeros = 0;
RINOK(ReadZeroTail(_stream, areThereNonZeros, numZeros, kRemMax));
if (!areThereNonZeros)
PhySize += numZeros;
}
}
return S_OK;
}

View File

@@ -332,15 +332,15 @@ enum
kpidEndChs
};
static const STATPROPSTG kProps[] =
static const CStatProp kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
{ NULL, kpidSize, VT_UI8},
{ NULL, kpidFileSystem, VT_BSTR},
{ NULL, kpidOffset, VT_UI8},
{ (LPOLESTR)L"Primary", kpidPrimary, VT_BOOL},
{ (LPOLESTR)L"Begin CHS", kpidBegChs, VT_BSTR},
{ (LPOLESTR)L"End CHS", kpidEndChs, VT_BSTR}
{ "Primary", kpidPrimary, VT_BOOL},
{ "Begin CHS", kpidBegChs, VT_BSTR},
{ "End CHS", kpidEndChs, VT_BSTR}
};
IMP_IInArchive_Props_WITH_NAME

View File

@@ -519,7 +519,7 @@ bool CAttr::ParseExtents(CRecordVector<CExtent> &extents, UInt64 numClustersMax,
UInt64 vSize = 0;
{
unsigned i = num;
do vSize = (vSize << 8) | p[--i]; while(i);
do vSize = (vSize << 8) | p[--i]; while (i);
}
if (vSize == 0)
return false;
@@ -1835,7 +1835,7 @@ HRESULT CDatabase::Open()
int indexOfUnnamedStream = -1;
if (!rec.IsDir())
{
FOR_VECTOR(di, rec.DataRefs)
FOR_VECTOR (di, rec.DataRefs)
if (rec.DataAttrs[rec.DataRefs[di].Start].Name.IsEmpty())
{
indexOfUnnamedStream = di;
@@ -1849,7 +1849,7 @@ HRESULT CDatabase::Open()
if (i < kNumSysRecs)
{
needShow = false;
FOR_VECTOR(di, rec.DataRefs)
FOR_VECTOR (di, rec.DataRefs)
if (rec.GetSize(di) != 0)
{
needShow = true;
@@ -1905,7 +1905,7 @@ HRESULT CDatabase::Open()
unsigned numAltStreams = 0;
FOR_VECTOR(di, rec.DataRefs)
FOR_VECTOR (di, rec.DataRefs)
{
if (!rec.IsDir() && (int)di == indexOfUnnamedStream)
continue;
@@ -2173,7 +2173,7 @@ enum
kpidATime2
};
static const STATPROPSTG kProps[] =
static const CStatProp kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
{ NULL, kpidSize, VT_UI8},
@@ -2181,20 +2181,20 @@ static const STATPROPSTG kProps[] =
// { NULL, kpidLink, VT_BSTR},
// { (LPOLESTR)L"Link 2", kpidLink2, VT_BSTR},
// { (LPOLESTR)L"Link Type", kpidLinkType, VT_UI2},
// { "Link 2", kpidLink2, VT_BSTR},
// { "Link Type", kpidLinkType, VT_UI2},
{ NULL, kpidINode, VT_UI8},
{ NULL, kpidMTime, VT_FILETIME},
{ NULL, kpidCTime, VT_FILETIME},
{ NULL, kpidATime, VT_FILETIME},
// { (LPOLESTR)L"Record Modified", kpidRecMTime, VT_FILETIME},
// { "Record Modified", kpidRecMTime, VT_FILETIME},
// { (LPOLESTR)L"Modified 2", kpidMTime2, VT_FILETIME},
// { (LPOLESTR)L"Created 2", kpidCTime2, VT_FILETIME},
// { (LPOLESTR)L"Accessed 2", kpidATime2, VT_FILETIME},
// { (LPOLESTR)L"Record Modified 2", kpidRecMTime2, VT_FILETIME},
// { "Modified 2", kpidMTime2, VT_FILETIME},
// { "Created 2", kpidCTime2, VT_FILETIME},
// { "Accessed 2", kpidATime2, VT_FILETIME},
// { "Record Modified 2", kpidRecMTime2, VT_FILETIME},
{ NULL, kpidAttrib, VT_UI4},
{ NULL, kpidNumBlocks, VT_UI4},
@@ -2226,13 +2226,13 @@ enum
kpidRecordSize = kpidUserDefined
};
static const STATPROPSTG kArcProps[] =
static const CStatProp kArcProps[] =
{
{ NULL, kpidVolumeName, VT_BSTR},
{ NULL, kpidFileSystem, VT_BSTR},
{ NULL, kpidClusterSize, VT_UI4},
{ NULL, kpidSectorSize, VT_UI4},
{ (LPOLESTR)L"Record Size", kpidRecordSize, VT_UI4},
{ "Record Size", kpidRecordSize, VT_UI4},
{ NULL, kpidHeadersSize, VT_UI8},
{ NULL, kpidCTime, VT_FILETIME},
{ NULL, kpidId, VT_UI8},

View File

@@ -765,7 +765,7 @@ enum
// kpidBaseOfData32,
};
static const STATPROPSTG kArcProps[] =
static const CStatProp kArcProps[] =
{
// { NULL, kpidWarning, VT_BSTR},
{ NULL, kpidCpu, VT_BSTR},
@@ -776,28 +776,28 @@ static const STATPROPSTG kArcProps[] =
{ NULL, kpidChecksum, VT_UI4},
{ NULL, kpidName, VT_BSTR},
{ (LPOLESTR)L"Image Size", kpidImageSize, VT_UI4},
{ (LPOLESTR)L"Section Alignment", kpidSectAlign, VT_UI4},
{ (LPOLESTR)L"File Alignment", kpidFileAlign, VT_UI4},
{ (LPOLESTR)L"Code Size", kpidCodeSize, VT_UI4},
{ (LPOLESTR)L"Initialized Data Size", kpidInitDataSize, VT_UI4},
{ (LPOLESTR)L"Uninitialized Data Size", kpidUnInitDataSize, VT_UI4},
{ (LPOLESTR)L"Linker Version", kpidLinkerVer, VT_BSTR},
{ (LPOLESTR)L"OS Version", kpidOsVer, VT_BSTR},
{ (LPOLESTR)L"Image Version", kpidImageVer, VT_BSTR},
{ (LPOLESTR)L"Subsystem Version", kpidSubsysVer, VT_BSTR},
{ (LPOLESTR)L"Subsystem", kpidSubSystem, VT_BSTR},
{ (LPOLESTR)L"DLL Characteristics", kpidDllCharacts, VT_BSTR},
{ (LPOLESTR)L"Stack Reserve", kpidStackReserve, VT_UI8},
{ (LPOLESTR)L"Stack Commit", kpidStackCommit, VT_UI8},
{ (LPOLESTR)L"Heap Reserve", kpidHeapReserve, VT_UI8},
{ (LPOLESTR)L"Heap Commit", kpidHeapCommit, VT_UI8},
{ (LPOLESTR)L"Image Base", kpidImageBase, VT_UI8},
{ "Image Size", kpidImageSize, VT_UI4},
{ "Section Alignment", kpidSectAlign, VT_UI4},
{ "File Alignment", kpidFileAlign, VT_UI4},
{ "Code Size", kpidCodeSize, VT_UI4},
{ "Initialized Data Size", kpidInitDataSize, VT_UI4},
{ "Uninitialized Data Size", kpidUnInitDataSize, VT_UI4},
{ "Linker Version", kpidLinkerVer, VT_BSTR},
{ "OS Version", kpidOsVer, VT_BSTR},
{ "Image Version", kpidImageVer, VT_BSTR},
{ "Subsystem Version", kpidSubsysVer, VT_BSTR},
{ "Subsystem", kpidSubSystem, VT_BSTR},
{ "DLL Characteristics", kpidDllCharacts, VT_BSTR},
{ "Stack Reserve", kpidStackReserve, VT_UI8},
{ "Stack Commit", kpidStackCommit, VT_UI8},
{ "Heap Reserve", kpidHeapReserve, VT_UI8},
{ "Heap Commit", kpidHeapCommit, VT_UI8},
{ "Image Base", kpidImageBase, VT_UI8},
{ NULL, kpidComment, VT_BSTR},
// { (LPOLESTR)L"Address Of Entry Point", kpidAddressOfEntryPoint, VT_UI8},
// { (LPOLESTR)L"Base Of Code", kpidBaseOfCode, VT_UI8},
// { (LPOLESTR)L"Base Of Data", kpidBaseOfData32, VT_UI8},
// { "Address Of Entry Point", kpidAddressOfEntryPoint, VT_UI8},
// { "Base Of Code", kpidBaseOfCode, VT_UI8},
// { "Base Of Data", kpidBaseOfData32, VT_UI8},
};
static const Byte kProps[] =
@@ -2233,7 +2233,7 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
sections.Sort();
UInt32 limit = (1 << 12);
unsigned num = 0;
FOR_VECTOR(i, sections)
FOR_VECTOR (i, sections)
{
const CSection &s = sections[i];
if (s.Pa > limit)
@@ -2798,12 +2798,12 @@ enum
// , kpidImageBase
};
static const STATPROPSTG kArcProps[] =
static const CStatProp kArcProps[] =
{
// { NULL, kpidHeadersSize, VT_UI4 },
{ NULL, kpidCpu, VT_BSTR},
{ (LPOLESTR)L"Subsystem", kpidSubSystem, VT_BSTR },
// { (LPOLESTR)L"Image Base", kpidImageBase, VT_UI8 }
{ "Subsystem", kpidSubSystem, VT_BSTR },
// { "Image Base", kpidImageBase, VT_UI8 }
};
IMP_IInArchive_Props

View File

@@ -30,6 +30,8 @@
#include "../Common/FindSignature.h"
#include "../Common/ItemNameUtils.h"
#include "../HandlerCont.h"
#include "RarVol.h"
#include "Rar5Handler.h"
@@ -38,13 +40,6 @@ using namespace NWindows;
#define Get32(p) GetUi32(p)
namespace NArchive {
namespace NRar {
HRESULT ReadZeroTail(ISequentialInStream *stream, bool &areThereNonZeros, UInt64 &numZeros, UInt64 maxSize);
}
namespace NRar5 {
static const unsigned kMarkerSize = 8;
@@ -1938,7 +1933,7 @@ HRESULT CHandler::Open2(IInStream *stream,
bool areThereNonZeros;
UInt64 numZeros;
const UInt64 maxSize = 1 << 12;
RINOK(NRar::ReadZeroTail(inStream, areThereNonZeros, numZeros, maxSize));
RINOK(ReadZeroTail(inStream, areThereNonZeros, numZeros, maxSize));
if (!areThereNonZeros && numZeros != 0 && numZeros <= maxSize)
arcInfo.EndPos += numZeros;
}

View File

@@ -30,6 +30,8 @@
#include "../Common/ItemNameUtils.h"
#include "../Common/OutStreamWithCRC.h"
#include "../HandlerCont.h"
#include "RarVol.h"
#include "RarHandler.h"
@@ -938,7 +940,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
if (item.BaseFileIndex >= 0)
mainItem = &_items[_refItems[item.BaseFileIndex].ItemIndex];
*/
switch(propID)
switch (propID)
{
case kpidPath:
{
@@ -998,31 +1000,6 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
}
HRESULT ReadZeroTail(ISequentialInStream *stream, bool &areThereNonZeros, UInt64 &numZeros, UInt64 maxSize)
{
areThereNonZeros = false;
numZeros = 0;
const size_t kBufSize = 1 << 9;
Byte buf[kBufSize];
for (;;)
{
UInt32 size = 0;
HRESULT(stream->Read(buf, kBufSize, &size));
if (size == 0)
return S_OK;
for (UInt32 i = 0; i < size; i++)
if (buf[i] != 0)
{
areThereNonZeros = true;
numZeros += i;
return S_OK;
}
numZeros += size;
if (numZeros > maxSize)
return S_OK;
}
}
HRESULT CHandler::Open2(IInStream *stream,
const UInt64 *maxCheckStartPosition,
IArchiveOpenCallback *openCallback)
@@ -1593,7 +1570,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
CMyComPtr<ICompressCoder> commonCoder;
switch(item.Method)
switch (item.Method)
{
case '0':
{

View File

@@ -8,6 +8,7 @@
#include "../../../C/Xz.h"
#include "../../Common/ComTry.h"
#include "../../Common/MyLinux.h"
#include "../../Common/IntToString.h"
#include "../../Common/StringConvert.h"
@@ -76,14 +77,6 @@ static const char * const k_Methods[] =
static const UInt32 kMetadataBlockSizeLog = 13;
static const UInt32 kMetadataBlockSize = (1 << kMetadataBlockSizeLog);
#define MY_S_IFIFO 0x1000
#define MY_S_IFCHR 0x2000
#define MY_S_IFDIR 0x4000
#define MY_S_IFBLK 0x6000
#define MY_S_IFREG 0x8000
#define MY_S_IFLNK 0xA000
#define MY_S_IFSOCK 0xC000
enum
{
kType_IPC,
@@ -99,8 +92,8 @@ enum
static const UInt32 k_TypeToMode[] =
{
0,
MY_S_IFDIR, MY_S_IFREG, MY_S_IFLNK, MY_S_IFBLK, MY_S_IFCHR, MY_S_IFIFO, MY_S_IFSOCK,
MY_S_IFDIR, MY_S_IFREG, MY_S_IFLNK, MY_S_IFBLK, MY_S_IFCHR, MY_S_IFIFO, MY_S_IFSOCK
MY_LIN_S_IFDIR, MY_LIN_S_IFREG, MY_LIN_S_IFLNK, MY_LIN_S_IFBLK, MY_LIN_S_IFCHR, MY_LIN_S_IFIFO, MY_LIN_S_IFSOCK,
MY_LIN_S_IFDIR, MY_LIN_S_IFREG, MY_LIN_S_IFLNK, MY_LIN_S_IFBLK, MY_LIN_S_IFCHR, MY_LIN_S_IFIFO, MY_LIN_S_IFSOCK
};
@@ -754,7 +747,7 @@ UInt32 CNode::Parse4(const Byte *p, UInt32 size, const CHeader &_h)
}
unsigned offset = 20;
switch(Type)
switch (Type)
{
case kType_FIFO: case kType_FIFO + 7:
case kType_SOCK: case kType_SOCK + 7:
@@ -939,7 +932,7 @@ static const Byte kArcProps[] =
kpidHeadersSize,
kpidFileSystem,
kpidMethod,
kpidBlock,
kpidClusterSize,
kpidBigEndian,
kpidCTime,
kpidCharacts
@@ -1552,7 +1545,7 @@ HRESULT CHandler::Open2(IInStream *inStream)
const Byte *p = _inodesData.Data + pos;
UInt32 size = totalSize - pos;
switch(_h.Major)
switch (_h.Major)
{
case 1: size = n.Parse1(p, size, _h); break;
case 2: size = n.Parse2(p, size, _h); break;
@@ -1817,7 +1810,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
NWindows::NCOM::CPropVariant prop;
switch(propID)
switch (propID)
{
case kpidMethod:
{
@@ -1850,7 +1843,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
prop = res;
break;
}
case kpidBlock: prop = _h.BlockSize; break;
case kpidClusterSize: prop = _h.BlockSize; break;
case kpidBigEndian: prop = _h.be; break;
case kpidCTime:
if (_h.CTime != 0)
@@ -1882,7 +1875,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
bool isDir = node.IsDir();
bool be = _h.be;
switch(propID)
switch (propID)
{
case kpidPath: prop = MultiByteToUnicodeString(GetPath(index), CP_OEMCP); break;
case kpidIsDir: prop = isDir; break;
@@ -1899,7 +1892,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
case kpidMTime:
{
UInt32 offset = 0;
switch(_h.Major)
switch (_h.Major)
{
case 1:
if (node.Type == kType_FILE)
@@ -2111,11 +2104,8 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
int res = NExtract::NOperationResult::kDataError;
{
CMyComPtr<ISequentialInStream> inSeqStream;
CMyComPtr<IInStream> inStream;
HRESULT hres = GetStream(index, &inSeqStream);
if (inSeqStream)
inSeqStream.QueryInterface(IID_IInStream, &inStream);
if (hres == S_FALSE || !inStream)
if (hres == S_FALSE || !inSeqStream)
{
if (hres == E_OUTOFMEMORY)
return hres;
@@ -2124,9 +2114,8 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
else
{
RINOK(hres);
if (inStream)
{
HRESULT hres = copyCoder->Code(inStream, outStream, NULL, NULL, progress);
HRESULT hres = copyCoder->Code(inSeqStream, outStream, NULL, NULL, progress);
if (hres == S_OK)
{
if (copyCoderSpec->TotalSize == unpackSize)
@@ -2136,15 +2125,17 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
{
res = NExtract::NOperationResult::kUnsupportedMethod;
}
else if(hres != S_FALSE)
else if (hres != S_FALSE)
{
RINOK(hres);
}
}
}
}
RINOK(extractCallback->SetOperationResult(res));
}
return S_OK;
COM_TRY_END
}

View File

@@ -639,6 +639,7 @@ void CHandler::Init()
_forceCodePage = false;
// _codePage = CP_OEMCP;
_curCodePage = _specifiedCodePage = CP_UTF8; // CP_OEMCP;
_thereIsPaxExtendedHeader = false;
}
STDMETHODIMP CHandler::SetProperties(const wchar_t * const *names, const PROPVARIANT *values, UInt32 numProps)

View File

@@ -4,6 +4,7 @@
#include "../../../Common/ComTry.h"
#include "../../../Common/Defs.h"
#include "../../../Common/MyLinux.h"
#include "../../../Common/StringConvert.h"
#include "../../../Common/UTFConvert.h"
@@ -113,7 +114,11 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(i, kpidPosixAttrib, &prop));
if (prop.vt == VT_EMPTY)
ui.Mode = 0777 | (ui.IsDir ? 0040000 : 0100000);
ui.Mode =
MY_LIN_S_IRWXO
| MY_LIN_S_IRWXG
| MY_LIN_S_IRWXU
| (ui.IsDir ? MY_LIN_S_IFDIR : MY_LIN_S_IFREG);
else if (prop.vt != VT_UI4)
return E_INVALIDARG;
else

View File

@@ -58,7 +58,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
NWindows::NCOM::CPropVariant prop;
switch(propID)
switch (propID)
{
case kpidPhySize: prop = _archive.PhySize; break;

View File

@@ -694,7 +694,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
NWindows::NCOM::CPropVariant prop;
const CItem2 &item2 = _items2[index];
const CItem &item = _items[item2.MainIndex];
switch(propID)
switch (propID)
{
case kpidPath:
{
@@ -754,7 +754,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
NWindows::NCOM::CPropVariant prop;
switch(propID)
switch (propID)
{
case kpidMethod:
{
@@ -1039,7 +1039,7 @@ HRESULT CHandler::ParseSections(int bufIndex, UInt32 posBase, UInt32 size, int p
else
{
bool needAdd = true;
switch(type)
switch (type)
{
case SECTION_RAW:
{

View File

@@ -599,17 +599,17 @@ enum
kpidSavedState
};
static const STATPROPSTG kArcProps[] =
static const CStatProp kArcProps[] =
{
{ NULL, kpidSize, VT_UI8},
{ NULL, kpidOffset, VT_UI8},
{ NULL, kpidCTime, VT_FILETIME},
{ NULL, kpidClusterSize, VT_UI8},
{ NULL, kpidMethod, VT_BSTR},
{ (LPOLESTR)L"Parent", kpidParent, VT_BSTR},
{ "Parent", kpidParent, VT_BSTR},
{ NULL, kpidCreatorApp, VT_BSTR},
{ NULL, kpidHostOS, VT_BSTR},
{ (LPOLESTR)L"Saved State", kpidSavedState, VT_BOOL},
{ "Saved State", kpidSavedState, VT_BOOL},
{ NULL, kpidId, VT_BSTR}
};

View File

@@ -56,7 +56,7 @@ enum
kpidBootImage
};
static const STATPROPSTG kArcProps[] =
static const CStatProp kArcProps[] =
{
{ NULL, kpidSize, VT_UI8},
{ NULL, kpidPackSize, VT_UI8},
@@ -69,8 +69,8 @@ static const STATPROPSTG kArcProps[] =
{ NULL, kpidIsVolume, VT_BOOL},
{ NULL, kpidVolume, VT_UI4},
{ NULL, kpidNumVolumes, VT_UI4},
{ (LPOLESTR)L"Images", kpidNumImages, VT_UI4},
{ (LPOLESTR)L"Boot Image", kpidBootImage, VT_UI4}
{ "Images", kpidNumImages, VT_UI4},
{ "Boot Image", kpidBootImage, VT_UI4}
};

View File

@@ -21,7 +21,7 @@
#include "../../Common/StreamObjects.h"
#include "../../Common/StreamUtils.h"
#include "../../Compress/XPressDecoder.h"
#include "../../Compress/XpressDecoder.h"
#include "../Common/OutStreamWithSha1.h"

View File

@@ -221,6 +221,7 @@ namespace NHeaderFlags
const UInt32 kXPRESS = (UInt32)1 << 17;
const UInt32 kLZX = (UInt32)1 << 18;
const UInt32 kLZMS = (UInt32)1 << 19;
const UInt32 kXPRESS2 = (UInt32)1 << 21; // XPRESS with nonstandard chunk size ?
const UInt32 kMethodMask = 0xFFFE0000;
}
@@ -277,7 +278,8 @@ struct CHeader
return (!IsCompressed()
|| (Flags & NHeaderFlags::kLZX) != 0
|| (Flags & NHeaderFlags::kXPRESS) != 0
|| (Flags & NHeaderFlags::kLZMS) != 0);
|| (Flags & NHeaderFlags::kLZMS) != 0
|| (Flags & NHeaderFlags::kXPRESS2) != 0);
}
unsigned GetMethod() const
@@ -289,6 +291,7 @@ struct CHeader
if (mask == NHeaderFlags::kXPRESS) return NMethod::kXPRESS;
if (mask == NHeaderFlags::kLZX) return NMethod::kLZX;
if (mask == NHeaderFlags::kLZMS) return NMethod::kLZMS;
if (mask == NHeaderFlags::kXPRESS2) return NMethod::kXPRESS;
return mask;
}

View File

@@ -5,6 +5,7 @@
#include "../../../C/CpuArch.h"
#include "../../Common/ComTry.h"
#include "../../Common/MyLinux.h"
#include "../../Common/MyXml.h"
#include "../../Common/StringToInt.h"
#include "../../Common/UTFConvert.h"
@@ -360,7 +361,7 @@ HRESULT CHandler::Open2(IInStream *stream)
UInt64 totalPackSize = 0;
unsigned numMainFiles = 0;
FOR_VECTOR(i, _files)
FOR_VECTOR (i, _files)
{
const CFile &file = _files[i];
file.UpdateTotalPackSize(totalPackSize);
@@ -511,10 +512,8 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
if (item.ModeDefined)
{
UInt32 mode = item.Mode;
const UInt32 k_PosixAttrib_Dir = (1 << 14);
const UInt32 k_PosixAttrib_RegFile = (1 << 15);
if ((mode & 0xF000) == 0)
mode |= (item.IsDir ? k_PosixAttrib_Dir : k_PosixAttrib_RegFile);
if ((mode & MY_LIN_S_IFMT) == 0)
mode |= (item.IsDir ? MY_LIN_S_IFDIR : MY_LIN_S_IFREG);
prop = mode;
}
break;

View File

@@ -271,7 +271,7 @@ HRESULT CAddCommon::Compress(
else
{
CMethodId methodId;
switch(method)
switch (method)
{
case NFileHeader::NCompressionMethod::kBZip2:
methodId = kMethodId_BZip2;

View File

@@ -929,7 +929,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
bool allFilesMode = (numItems == (UInt32)(Int32)-1);
if (allFilesMode)
numItems = m_Items.Size();
if(numItems == 0)
if (numItems == 0)
return S_OK;
UInt32 i;
for (i = 0; i < numItems; i++)

View File

@@ -153,35 +153,6 @@ namespace NFileHeader
};
}
namespace NUnixAttrib
{
const UInt32 kIFMT = 0170000; // file type mask
const UInt32 kIFDIR = 0040000; // directory
const UInt32 kIFREG = 0100000; // regular file
const UInt32 kIFSOCK = 0140000; // socket (BSD, not SysV or Amiga)
const UInt32 kIFLNK = 0120000; // symbolic link (not SysV, Amiga)
const UInt32 kIFBLK = 0060000; // block special (not Amiga)
const UInt32 kIFCHR = 0020000; // character special (not Amiga)
const UInt32 kIFIFO = 0010000; // fifo (BCC, not MSC or Amiga)
const UInt32 kISUID = 04000; // set user id on execution
const UInt32 kISGID = 02000; // set group id on execution
const UInt32 kISVTX = 01000; // directory permissions control
const UInt32 kENFMT = kISGID; // record locking enforcement flag
const UInt32 kIRWXU = 00700; // read, write, execute: owner
const UInt32 kIRUSR = 00400; // read permission: owner
const UInt32 kIWUSR = 00200; // write permission: owner
const UInt32 kIXUSR = 00100; // execute permission: owner
const UInt32 kIRWXG = 00070; // read, write, execute: group
const UInt32 kIRGRP = 00040; // read permission: group
const UInt32 kIWGRP = 00020; // write permission: group
const UInt32 kIXGRP = 00010; // execute permission: group
const UInt32 kIRWXO = 00007; // read, write, execute: other
const UInt32 kIROTH = 00004; // read permission: other
const UInt32 kIWOTH = 00002; // write permission: other
const UInt32 kIXOTH = 00001; // execute permission: other
}
namespace NAmigaAttrib
{

View File

@@ -579,7 +579,7 @@ static bool FlagsAreSame(const CItem &i1, const CItem &i2)
if (i1.Flags == i2.Flags)
return true;
UInt32 mask = 0xFFFF;
switch(i1.Method)
switch (i1.Method)
{
case NFileHeader::NCompressionMethod::kDeflated:
mask = 0x7FF9;

View File

@@ -2,11 +2,14 @@
#include "StdAfx.h"
#include "ZipHeader.h"
#include "ZipItem.h"
#include "../Common/ItemNameUtils.h"
#include "../../../../C/CpuArch.h"
#include "../../../Common/MyLinux.h"
#include "../Common/ItemNameUtils.h"
#include "ZipItem.h"
namespace NArchive {
namespace NZip {
@@ -114,7 +117,7 @@ bool CItem::IsDir() const
case NHostOS::kMVS:
return false; // change it throw kUnknownAttributes;
case NHostOS::kUnix:
return ((highAttrib & NUnixAttrib::kIFMT) == NUnixAttrib::kIFDIR);
return MY_LIN_S_ISDIR(highAttrib);
default:
return false;
}
@@ -151,7 +154,7 @@ bool CItem::GetPosixAttrib(UInt32 &attrib) const
}
attrib = 0;
if (IsDir())
attrib = NUnixAttrib::kIFDIR;
attrib = MY_LIN_S_IFDIR;
return false;
}

View File

@@ -61,6 +61,7 @@ AR_OBJS = \
$O\DeflateProps.obj \
$O\DmgHandler.obj \
$O\ElfHandler.obj \
$O\ExtHandler.obj \
$O\FatHandler.obj \
$O\FlvHandler.obj \
$O\GzHandler.obj \

View File

@@ -283,6 +283,10 @@ SOURCE=..\..\..\Common\MyInitGuid.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyLinux.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyMap.cpp
# End Source File
# Begin Source File
@@ -2431,6 +2435,10 @@ SOURCE=..\..\Archive\ElfHandler.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Archive\ExtHandler.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Archive\FatHandler.cpp
# End Source File
# Begin Source File

View File

@@ -141,7 +141,7 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index,
}
RINOK(_archiveHandler->GetProperty(index, kpidMTime, &prop));
switch(prop.vt)
switch (prop.vt)
{
case VT_EMPTY: _processedFileInfo.MTime = _defaultMTime; break;
case VT_FILETIME: _processedFileInfo.MTime = prop.filetime; break;
@@ -215,7 +215,7 @@ STDMETHODIMP CExtractCallbackImp::PrepareOperation(Int32 askExtractMode)
STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 resultEOperationResult)
{
switch(resultEOperationResult)
switch (resultEOperationResult)
{
case NArchive::NExtract::NOperationResult::kOK:
break;
@@ -223,7 +223,7 @@ STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 resultEOperationResul
default:
{
_outFileStream.Release();
switch(resultEOperationResult)
switch (resultEOperationResult)
{
case NArchive::NExtract::NOperationResult::kUnsupportedMethod:
_message = kUnsupportedMethod;

View File

@@ -281,7 +281,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
execInfo.hProcess = 0;
/* BOOL success = */ ::ShellExecuteEx(&execInfo);
UINT32 result = (UINT32)(UINT_PTR)execInfo.hInstApp;
if(result <= 32)
if (result <= 32)
{
if (!assumeYes)
ShowErrorMessage(L"Can not open file");

View File

@@ -86,7 +86,7 @@ CSeqOutStreamWrap::CSeqOutStreamWrap(ISequentialOutStream *stream) throw()
HRESULT SResToHRESULT(SRes res) throw()
{
switch(res)
switch (res)
{
case SZ_OK: return S_OK;
case SZ_ERROR_MEM: return E_OUTOFMEMORY;
@@ -111,7 +111,7 @@ static SRes InStreamWrap_Seek(void *pp, Int64 *offset, ESzSeek origin) throw()
{
CSeekInStreamWrap *p = (CSeekInStreamWrap *)pp;
UInt32 moveMethod;
switch(origin)
switch (origin)
{
case SZ_SEEK_SET: moveMethod = STREAM_SEEK_SET; break;
case SZ_SEEK_CUR: moveMethod = STREAM_SEEK_CUR; break;

View File

@@ -103,7 +103,7 @@ void CMemBlockManagerMt::FreeBlock(void *p, bool lockMode)
void CMemBlocks::Free(CMemBlockManagerMt *manager)
{
while(Blocks.Size() > 0)
while (Blocks.Size() > 0)
{
manager->FreeBlock(Blocks.Back());
Blocks.DeleteBack();

View File

@@ -8,7 +8,6 @@
#include "../../Common/MyCom.h"
#include "../../Windows/Defs.h"
#include "../../Windows/PropVariant.h"
#include "../ICoder.h"
@@ -23,7 +22,7 @@ extern const CHasherInfo *g_Hashers[];
static void SetPropFromAscii(const char *s, PROPVARIANT *prop) throw()
{
UINT len = (UINT)strlen(s);
OLECHAR *dest = ::SysAllocStringLen(NULL, len);
BSTR dest = ::SysAllocStringLen(NULL, len);
if (dest)
{
for (UINT i = 0; i <= len; i++)

View File

@@ -10,7 +10,7 @@
static HRESULT SResToHRESULT(SRes res)
{
switch(res)
switch (res)
{
case SZ_OK: return S_OK;
case SZ_ERROR_MEM: return E_OUTOFMEMORY;

View File

@@ -10,7 +10,7 @@
static HRESULT SResToHRESULT(SRes res)
{
switch(res)
switch (res)
{
case SZ_OK: return S_OK;
case SZ_ERROR_MEM: return E_OUTOFMEMORY;

View File

@@ -457,17 +457,16 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
HRESULT CDecoder::Code(const Byte *inData, size_t inSize, UInt32 outSize)
{
if (_pos == _winSize)
{
_pos = 0;
_overDict = true;
}
if (!_keepHistory)
{
_pos = 0;
_overDict = false;
}
else if (_pos == _winSize)
{
_pos = 0;
_overDict = true;
}
_writePos = _pos;
_unpackedData = _win + _pos;

View File

@@ -49,7 +49,7 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *props, UInt32 size)
HRESULT CDecoder::CodeSpec(Byte *memStream, UInt32 size)
{
switch(_status)
switch (_status)
{
case kStatus_Finished: return S_OK;
case kStatus_Error: return S_FALSE;

View File

@@ -56,7 +56,7 @@ Byte CFilter::Decode(int &channelDelta, Byte deltaByte)
Dif[i] = 0;
}
switch(numMinDif)
switch (numMinDif)
{
case 1: if (K1 >= -16) K1--; break;
case 2: if (K1 < 16) K1++; break;

View File

@@ -254,7 +254,7 @@ public:
_winPos += len;
do
*dest++ = *src++;
while(--len != 0);
while (--len != 0);
return;
}
do
@@ -263,7 +263,7 @@ public:
winPos = (winPos + 1) & kWindowMask;
pos = (pos + 1) & kWindowMask;
}
while(--len != 0);
while (--len != 0);
_winPos = winPos;
}

View File

@@ -23,7 +23,7 @@ void CBitDecoder::Prepare2() throw()
size_t rem = _bufLim - _buf;
if (rem != 0)
memcpy(_bufBase, _buf, rem);
memmove(_bufBase, _buf, rem);
_bufLim = _bufBase + rem;
_processedSize += (_buf - _bufBase);

View File

@@ -70,7 +70,7 @@ void CKeyInfo::CalcKey()
if (++(ctr[i]) != 0)
break;
}
while(--numRounds != 0);
while (--numRounds != 0);
Sha256_Final(&sha, Key);
}

View File

@@ -163,6 +163,7 @@ Handler GUIDs:
0C xz
0D ppmd
C7 Ext
C8 VMDK
C9 VDI
CA Qcow

View File

@@ -265,7 +265,7 @@ STDMETHODIMP CAgent::DoOperation(
UInt32 value;
RINOK(outArchive->GetFileTimeType(&value));
switch(value)
switch (value)
{
case NFileTimeType::kWindows:
case NFileTimeType::kDOS:

View File

@@ -3,10 +3,16 @@
#include "StdAfx.h"
// #include <stdio.h>
#ifdef _WIN32
#include <wchar.h>
#else
#include <ctype.h>
#endif
#include "../../../../C/Sort.h"
#include "../../../../C/CpuArch.h"
#include "../../../Common/UTFConvert.h"
#include "../../../Common/Wildcard.h"
#include "../../../Windows/PropVariant.h"
@@ -556,6 +562,9 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress)
Files.Alloc(numItems);
UString tempUString;
AString tempAString;
UInt32 i;
for (i = 0; i < numItems; i++)
{
@@ -567,12 +576,12 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress)
CProxyFile2 &file = Files[i];
#ifdef MY_CPU_LE
const void *p;
UInt32 size;
UInt32 propType;
RINOK(arc.GetRawProps->GetRawProp(i, kpidName, &p, &size, &propType));
#ifdef MY_CPU_LE
if (p && propType == PROP_DATA_TYPE_wchar_t_PTR_Z_LE)
{
file.Name = (const wchar_t *)p;
@@ -582,6 +591,16 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress)
}
else
#endif
if (p && propType == NPropDataType::kUtf8z)
{
tempAString = (const char *)p;
ConvertUTF8ToUnicode(tempAString, tempUString);
file.NameLen = tempUString.Len();
file.Name = new wchar_t[file.NameLen + 1];
file.NeedDeleteName = true;
wmemcpy((wchar_t *)file.Name, tempUString.Ptr(), file.NameLen + 1);
}
else
{
NCOM::CPropVariant prop;
RINOK(arc.Archive->GetProperty(i, kpidName, &prop));
@@ -595,7 +614,7 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress)
file.NameLen = MyStringLen(s);
file.Name = new wchar_t[file.NameLen + 1];
file.NeedDeleteName = true;
MyStringCopy((wchar_t *)file.Name, s);
wmemcpy((wchar_t *)file.Name, s, file.NameLen + 1);
}
UInt32 parent = (UInt32)(Int32)-1;

View File

@@ -309,7 +309,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
NCOM::CPropVariant prop;
RINOK(_archiveHandler->GetProperty(index, kpidMTime, &prop));
_processedFileInfo.MTimeDefined = false;
switch(prop.vt)
switch (prop.vt)
{
case VT_EMPTY:
// _processedFileInfo.MTime = _utcMTimeDefault;
@@ -582,7 +582,7 @@ STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PR
{
const CDirItem &dirItem = (*DirItems)[index];
switch(propID)
switch (propID)
{
case kpidPath: prop = dirItem.Name; break;
case kpidIsDir: prop = dirItem.isDir(); break;

View File

@@ -1329,5 +1329,5 @@ void CArcCmdLineParser::Parse2(CArcCmdLineOptions &options)
{
}
else
throw 9815676711;
throw 20150919;
}

View File

@@ -608,6 +608,10 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
_curSizeDefined = false;
_index = index;
_diskFilePath.Empty();
// _fi.Clear();
#ifdef SUPPORT_LINKS
// _CopyFile_Path.Empty();
linkPath.Empty();
@@ -1454,7 +1458,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
}
#ifdef _USE_SECURITY_CODE
if (_ntOptions.NtSecurity.Val && _arc->GetRawProps)
if (!_stdOutMode && _extractMode && _ntOptions.NtSecurity.Val && _arc->GetRawProps)
{
const void *data;
UInt32 dataSize;
@@ -1497,7 +1501,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
else
NumFiles++;
if (_extractMode && _fi.AttribDefined)
if (!_stdOutMode && _extractMode && _fi.AttribDefined)
SetFileAttrib(_diskFilePath, _fi.Attrib);
RINOK(_extractCallback2->SetOperationResult(opRes, BoolToInt(_encrypted)));

View File

@@ -40,12 +40,12 @@ STDMETHODIMP COpenCallbackImp::GetProperty(PROPID propID, PROPVARIANT *value)
COM_TRY_BEGIN
NCOM::CPropVariant prop;
if (_subArchiveMode)
switch(propID)
switch (propID)
{
case kpidName: prop = _subArchiveName; break;
}
else
switch(propID)
switch (propID)
{
case kpidName: prop = _fileInfo.Name; break;
case kpidIsDir: prop = _fileInfo.IsDir(); break;

View File

@@ -18,7 +18,7 @@ static void ReplaceIncorrectChars(UString &s)
#ifdef _WIN32
c == ':' || c == '*' || c == '?' || c < 0x20 || c == '<' || c == '>' || c == '|' || c == '"'
|| c == '/'
|| c == 0x202E // RLO
// || c == 0x202E // RLO
||
#endif
c == WCHAR_PATH_SEPARATOR)
@@ -190,9 +190,7 @@ void Correct_FsPath(bool absIsAllowed, UStringVector &parts, bool isDir)
{
UString &s = parts[i];
#ifdef _WIN32
Correct_PathPart(s);
#endif
if (s.IsEmpty())
{

View File

@@ -268,7 +268,7 @@ void CHandler::AddItem(const CParseItem &item)
}
/*
static const STATPROPSTG kProps[] =
static const CStatProp kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
{ NULL, kpidSize, VT_UI8},

View File

@@ -571,6 +571,7 @@ static HRESULT Compress(
const CArcItem &ai = arcItems[i];
bool needRename = false;
UString dest;
if (ai.Censored)
{
FOR_VECTOR (j, options.RenamePairs)
@@ -581,6 +582,8 @@ static HRESULT Compress(
needRename = true;
break;
}
#ifdef SUPPORT_ALT_STREAMS
if (ai.IsAltStream)
{
int colonPos = FindAltStreamColon_in_Path(ai.Name);
@@ -600,8 +603,10 @@ static HRESULT Compress(
}
}
}
#endif
}
}
CUpdatePair2 up2;
up2.SetAs_NoChangeArcItem(ai.IndexInServer);
if (needRename)

View File

@@ -92,7 +92,7 @@ STDMETHODIMP CArchiveUpdateCallback::SetRatioInfo(const UInt64 *inSize, const UI
/*
static const STATPROPSTG kProps[] =
static const CStatProp kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
{ NULL, kpidIsDir, VT_BOOL},

View File

@@ -27,7 +27,7 @@ static BOOL WINAPI HandlerRoutine(DWORD ctrlType)
return TRUE;
return FALSE;
/*
switch(ctrlType)
switch (ctrlType)
{
case CTRL_C_EVENT:
case CTRL_BREAK_EVENT:
@@ -50,7 +50,7 @@ void CheckCtrlBreak()
CCtrlHandlerSetter::CCtrlHandlerSetter()
{
#if !defined(UNDER_CE) && defined(_WIN32)
if(!SetConsoleCtrlHandler(HandlerRoutine, TRUE))
if (!SetConsoleCtrlHandler(HandlerRoutine, TRUE))
throw "SetConsoleCtrlHandler fails";
#endif
}
@@ -58,7 +58,7 @@ CCtrlHandlerSetter::CCtrlHandlerSetter()
CCtrlHandlerSetter::~CCtrlHandlerSetter()
{
#if !defined(UNDER_CE) && defined(_WIN32)
if(!SetConsoleCtrlHandler(HandlerRoutine, FALSE))
if (!SetConsoleCtrlHandler(HandlerRoutine, FALSE))
throw "SetConsoleCtrlHandler fails";
#endif
}

View File

@@ -34,7 +34,7 @@ NUserAnswerMode::EEnum ScanUserYesNoAllQuit(CStdOutStream *outStream)
AString scannedString = g_StdIn.ScanStringUntilNewLine();
scannedString.Trim();
if (!scannedString.IsEmpty())
switch(::MyCharLower_Ascii(scannedString[0]))
switch (::MyCharLower_Ascii(scannedString[0]))
{
case kYes: return NUserAnswerMode::kYes;
case kNo: return NUserAnswerMode::kNo;

View File

@@ -940,7 +940,7 @@ STDMETHODIMP CZipContextMenu::GetCommandString(UINT_PTR commandOffset, UINT uTyp
UINT * /* pwReserved */ , LPSTR pszName, UINT /* cchMax */)
{
int cmdOffset = (int)commandOffset;
switch(uType)
switch (uType)
{
#ifdef UNDER_CE
case GCS_VALIDATE:

View File

@@ -100,7 +100,7 @@ STDMETHODIMP CExtractCallbackImp::AskOverwrite(
NOverwriteDialog::NResult::EEnum result =
NOverwriteDialog::Execute(oldFileInfo, newFileInfo);
switch(result)
switch (result)
{
case NOverwriteDialog::NResult::kCancel:
// *answer = NOverwriteAnswer::kCancel;

View File

@@ -259,13 +259,13 @@ STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value
NCOM::CPropVariant prop;
if (_subArchiveMode)
{
switch(propID)
switch (propID)
{
case kpidName: prop = _subArchiveName; break;
}
}
else
switch(propID)
switch (propID)
{
case kpidName: prop = GetUnicodeString(_fileInfo.Name, CP_OEMCP); break;
case kpidIsDir: prop = _fileInfo.IsDir(); break;
@@ -447,30 +447,34 @@ EXTERN_C HANDLE WINAPI OpenFilePluginW(const wchar_t *name,const unsigned char *
EXTERN_C HANDLE WINAPI OpenPlugin(int openFrom, INT_PTR item)
{
MY_TRY_BEGIN;
if(openFrom == OPEN_COMMANDLINE)
if (openFrom == OPEN_COMMANDLINE)
{
AString fileName = (const char *)item;
if(fileName.IsEmpty())
if (fileName.IsEmpty())
return INVALID_HANDLE_VALUE;
if (fileName.Len() >= 2 &&
fileName[0] == '\"' && fileName.Back() == '\"')
if (fileName.Len() >= 2
&& fileName[0] == '\"'
&& fileName.Back() == '\"')
{
fileName.DeleteBack();
fileName.DeleteFrontal(1);
}
return MyOpenFilePlugin(fileName);
}
if(openFrom == OPEN_PLUGINSMENU)
if (openFrom == OPEN_PLUGINSMENU)
{
switch(item)
switch (item)
{
case 0:
{
PluginPanelItem pluginPanelItem;
if(!g_StartupInfo.ControlGetActivePanelCurrentItemInfo(pluginPanelItem))
if (!g_StartupInfo.ControlGetActivePanelCurrentItemInfo(pluginPanelItem))
throw 142134;
return MyOpenFilePlugin(pluginPanelItem.FindData.cFileName);
}
case 1:
{
CObjectVector<PluginPanelItem> pluginPanelItem;
@@ -491,10 +495,12 @@ EXTERN_C HANDLE WINAPI OpenPlugin(int openFrom, INT_PTR item)
}
return INVALID_HANDLE_VALUE;
}
default:
throw 4282215;
}
}
return INVALID_HANDLE_VALUE;
MY_TRY_END2("OpenPlugin", INVALID_HANDLE_VALUE);
}

View File

@@ -166,6 +166,14 @@ SOURCE=..\..\..\Common\StringToInt.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\UTFConvert.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\UTFConvert.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Wildcard.cpp
# End Source File
# Begin Source File

View File

@@ -40,11 +40,11 @@ CPlugin::CPlugin(const FString &fileName, CAgent *agent, UString archiveTypeName
CPlugin::~CPlugin() {}
static void MyGetFileTime(IFolderFolder *anArchiveFolder, UInt32 itemIndex,
static void MyGetFileTime(IFolderFolder *folder, UInt32 itemIndex,
PROPID propID, FILETIME &fileTime)
{
NCOM::CPropVariant prop;
if (anArchiveFolder->GetProperty(itemIndex, propID, &prop) != S_OK)
if (folder->GetProperty(itemIndex, propID, &prop) != S_OK)
throw 271932;
if (prop.vt == VT_EMPTY)
{

View File

@@ -10,7 +10,7 @@ void CPlugin::AddRealIndexOfFile(const CArchiveFolderItem &aFolder,
{
const CArchiveFolderFileItem &anItem = aFolder.m_FileSubItems[anIndexInVector];
int aHandlerItemIndex = m_ProxyHandler->GetHandlerItemIndex(anItem.m_Properties);
if(aHandlerItemIndex < 0)
if (aHandlerItemIndex < 0)
throw "error";
aRealIndexes.push_back(aHandlerItemIndex);
}
@@ -19,11 +19,11 @@ void CPlugin::AddRealIndexes(const CArchiveFolderItem &anItem,
vector<int> &aRealIndexes)
{
int aHandlerItemIndex = m_ProxyHandler->GetHandlerItemIndex(anItem.m_Properties);
if(aHandlerItemIndex >= 0) // test -1 value
if (aHandlerItemIndex >= 0) // test -1 value
aRealIndexes.push_back(aHandlerItemIndex);
for(int i = 0; i < anItem.m_DirSubItems.Size(); i++)
for (int i = 0; i < anItem.m_DirSubItems.Size(); i++)
AddRealIndexes(anItem.m_DirSubItems[i], aRealIndexes);
for(i = 0; i < anItem.m_FileSubItems.Size(); i++)
for (i = 0; i < anItem.m_FileSubItems.Size(); i++)
AddRealIndexOfFile(anItem, i , aRealIndexes);
}
@@ -32,7 +32,7 @@ void CPlugin::GetRealIndexes(PluginPanelItem *aPanelItems, int anItemsNumber,
vector<int> &aRealIndexes)
{
aRealIndexes.clear();
for(int i = 0; i < anItemsNumber; i++)
for (int i = 0; i < anItemsNumber; i++)
{
int anIndex = aPanelItems[i].UserData;
if (anIndex < m_FolderItem->m_DirSubItems.Size())

View File

@@ -20,6 +20,7 @@ CURRENT_OBJS = \
$O\PluginWrite.obj \
$O\ProgressBox.obj \
$O\UpdateCallbackFar.obj \
$O\UTFConvert.obj \
COMMON_OBJS = \
$O\IntToString.obj \

View File

@@ -277,7 +277,7 @@ bool CBrowseDialog::OnInit()
if (!GetParentPath(FilePath, DirPrefix, name))
DirPrefix = _topDirPrefix;
for(;;)
for (;;)
{
UString baseFolder = DirPrefix;
if (Reload(baseFolder, name) == S_OK)

View File

@@ -75,7 +75,7 @@ bool CCopyDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
bool CCopyDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(buttonID)
switch (buttonID)
{
case IDB_COPY_SET_PATH:
OnButtonSetPath();

View File

@@ -30,7 +30,7 @@ private:
static void DeepCopyFormatEtc(FORMATETC *dest, const FORMATETC *src)
{
*dest = *src;
if(src->ptd)
if (src->ptd)
{
dest->ptd = (DVTARGETDEVICE*)CoTaskMemAlloc(sizeof(DVTARGETDEVICE));
*(dest->ptd) = *(src->ptd);
@@ -43,20 +43,20 @@ CEnumFormatEtc::CEnumFormatEtc(const FORMATETC *pFormatEtc, ULONG numFormats)
m_Index = 0;
m_NumFormats = 0;
m_Formats = new FORMATETC[numFormats];
if(m_Formats)
if (m_Formats)
{
m_NumFormats = numFormats;
for(ULONG i = 0; i < numFormats; i++)
for (ULONG i = 0; i < numFormats; i++)
DeepCopyFormatEtc(&m_Formats[i], &pFormatEtc[i]);
}
}
CEnumFormatEtc::~CEnumFormatEtc()
{
if(m_Formats)
if (m_Formats)
{
for(ULONG i = 0; i < m_NumFormats; i++)
if(m_Formats[i].ptd)
for (ULONG i = 0; i < m_NumFormats; i++)
if (m_Formats[i].ptd)
CoTaskMemFree(m_Formats[i].ptd);
delete[]m_Formats;
}
@@ -65,15 +65,15 @@ CEnumFormatEtc::~CEnumFormatEtc()
STDMETHODIMP CEnumFormatEtc::Next(ULONG celt, FORMATETC *pFormatEtc, ULONG *pceltFetched)
{
ULONG copied = 0;
if(celt == 0 || pFormatEtc == 0)
if (celt == 0 || pFormatEtc == 0)
return E_INVALIDARG;
while(m_Index < m_NumFormats && copied < celt)
while (m_Index < m_NumFormats && copied < celt)
{
DeepCopyFormatEtc(&pFormatEtc[copied], &m_Formats[m_Index]);
copied++;
m_Index++;
}
if(pceltFetched != 0)
if (pceltFetched != 0)
*pceltFetched = copied;
return (copied == celt) ? S_OK : S_FALSE;
}
@@ -93,7 +93,7 @@ STDMETHODIMP CEnumFormatEtc::Reset(void)
STDMETHODIMP CEnumFormatEtc::Clone(IEnumFORMATETC ** ppEnumFormatEtc)
{
HRESULT hResult = CreateEnumFormatEtc(m_NumFormats, m_Formats, ppEnumFormatEtc);
if(hResult == S_OK)
if (hResult == S_OK)
((CEnumFormatEtc *)*ppEnumFormatEtc)->m_Index = m_Index;
return hResult;
}
@@ -101,7 +101,7 @@ STDMETHODIMP CEnumFormatEtc::Clone(IEnumFORMATETC ** ppEnumFormatEtc)
// replacement for SHCreateStdEnumFmtEtc
HRESULT CreateEnumFormatEtc(UINT numFormats, const FORMATETC *formats, IEnumFORMATETC **enumFormat)
{
if(numFormats == 0 || formats == 0 || enumFormat == 0)
if (numFormats == 0 || formats == 0 || enumFormat == 0)
return E_INVALIDARG;
*enumFormat = new CEnumFormatEtc(formats, numFormats);
return (*enumFormat) ? S_OK : E_OUTOFMEMORY;

View File

@@ -100,7 +100,7 @@ static HRESULT CopyFileSpec(CFSTR fromPath, CFSTR toPath, bool writeToDisk, UInt
return S_OK;
}
static const PROPID kProps[] =
static const Byte kProps[] =
{
kpidName,
// kpidOutName,

View File

@@ -52,7 +52,7 @@ bool CFoldersPage::OnInit()
int CFoldersPage::GetWorkMode() const
{
for (int i = 0; i < kNumWorkModeButtons; i++)
if(IsButtonCheckedBool(kWorkModeButtons[i]))
if (IsButtonCheckedBool(kWorkModeButtons[i]))
return i;
throw 0;
}
@@ -104,7 +104,7 @@ bool CFoldersPage::OnButtonClicked(int buttonID, HWND buttonHWND)
ModifiedEvent();
return true;
}
switch(buttonID)
switch (buttonID)
{
case IDB_FOLDERS_WORK_PATH:
OnFoldersWorkButtonPath();

View File

@@ -78,7 +78,7 @@ bool CListViewDialog::OnNotify(UINT /* controlID */, LPNMHDR header)
{
if (header->hwndFrom != _listView)
return false;
switch(header->code)
switch (header->code)
{
case LVN_ITEMACTIVATE:
if (g_LVN_ITEMACTIVATE_Support)
@@ -99,7 +99,7 @@ bool CListViewDialog::OnNotify(UINT /* controlID */, LPNMHDR header)
case LVN_KEYDOWN:
{
LPNMLVKEYDOWN keyDownInfo = LPNMLVKEYDOWN(header);
switch(keyDownInfo->wVKey)
switch (keyDownInfo->wVKey)
{
case VK_DELETE:
{

View File

@@ -95,7 +95,7 @@ public:
// it's hack for supporting Windows NT
// constants are from WinUser.h
#if(WINVER < 0x0500)
#if (WINVER < 0x0500)
#define MIIM_STRING 0x00000040
#define MIIM_BITMAP 0x00000080
#define MIIM_FTYPE 0x00000100
@@ -162,6 +162,8 @@ static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
if (langID == IDM_OPEN_INSIDE_ONE || langID == IDM_OPEN_INSIDE_PARSER)
{
LangString_OnlyFromLangFile(IDM_OPEN_INSIDE, newString);
if (newString.IsEmpty())
continue;
newString.Replace(L"&", L"");
int tabPos = newString.Find(L"\t");
if (tabPos >= 0)

View File

@@ -13,7 +13,7 @@
using namespace NWindows;
using namespace NNet;
static const PROPID kProps[] =
static const Byte kProps[] =
{
kpidName,
kpidLocalName,
@@ -170,7 +170,7 @@ STDMETHODIMP CNetFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIAN
{
NCOM::CPropVariant prop;
const CResourceEx &item = _items[itemIndex];
switch(propID)
switch (propID)
{
case kpidIsDir: prop = true; break;
case kpidName:
@@ -243,7 +243,7 @@ IMP_IFolderFolder_Props(CNetFolder)
STDMETHODIMP CNetFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value)
{
NWindows::NCOM::CPropVariant prop;
switch(propID)
switch (propID)
{
case kpidType: prop = "NetFolder"; break;
case kpidPath: prop = _path; break;

View File

@@ -60,14 +60,14 @@ STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value
NCOM::CPropVariant prop;
if (_subArchiveMode)
{
switch(propID)
switch (propID)
{
case kpidName: prop = _subArchiveName; break;
}
}
else
{
switch(propID)
switch (propID)
{
case kpidName: prop = _fileInfo.Name; break;
case kpidIsDir: prop = _fileInfo.IsDir(); break;

View File

@@ -460,7 +460,7 @@ extern UString RootFolder_GetName_Documents(int &iconIndex);
bool CPanel::OnComboBoxCommand(UINT code, LPARAM /* param */, LRESULT &result)
{
result = FALSE;
switch(code)
switch (code)
{
case CBN_DROPDOWN:
{

View File

@@ -544,7 +544,7 @@ static HRESULT StartApplication(const UString &dir, const UString &path, HWND wi
}
if (result <= 32)
{
switch(result)
switch (result)
{
case SE_ERR_NOASSOC:
::MessageBoxW(window,
@@ -1241,7 +1241,7 @@ static bool CheckDeleteItem(UINT64 currentFileTime, UINT64 folderFileTime)
void DeleteOldTempFiles()
{
UString tempPath;
if(!MyGetTempPath(tempPath))
if (!MyGetTempPath(tempPath))
throw 1;
UINT64 currentFileTime;
@@ -1250,12 +1250,12 @@ void DeleteOldTempFiles()
searchWildCard += WCHAR(NName::kAnyStringWildcard);
NFind::CEnumeratorW enumerator(searchWildCard);
NFind::CFileInfo fileInfo;
while(enumerator.Next(fileInfo))
while (enumerator.Next(fileInfo))
{
if (!fileInfo.IsDir())
continue;
const UINT64 &cTime = *(const UINT64 *)(&fileInfo.CTime);
if(CheckDeleteItem(cTime, currentFileTime))
if (CheckDeleteItem(cTime, currentFileTime))
RemoveDirectoryWithSubItems(tempPath + fileInfo.Name);
}
}

View File

@@ -78,14 +78,14 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
g_App.SwitchOnOffOnePanel();
}
if(keyDownInfo->wVKey >= VK_F3 && keyDownInfo->wVKey <= VK_F12 && ctrl)
if (keyDownInfo->wVKey >= VK_F3 && keyDownInfo->wVKey <= VK_F12 && ctrl)
{
int index = FindVKeyPropIDPair(keyDownInfo->wVKey);
if (index >= 0)
SortItemsWithPropID(g_VKeyPropIDPairs[index].PropID);
}
switch(keyDownInfo->wVKey)
switch (keyDownInfo->wVKey)
{
case VK_SHIFT:
{
@@ -191,7 +191,7 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
}
case VK_DOWN:
{
if(shift)
if (shift)
OnArrowWithShift();
return false;
}
@@ -199,7 +199,7 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
{
if (alt)
_panelCallback->OnSetSameFolder();
else if(shift)
else if (shift)
OnArrowWithShift();
return false;
}
@@ -207,7 +207,7 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
{
if (alt)
_panelCallback->OnSetSubFolder();
else if(shift)
else if (shift)
OnArrowWithShift();
return false;
}
@@ -215,7 +215,7 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
{
if (alt)
_panelCallback->OnSetSubFolder();
else if(shift)
else if (shift)
OnArrowWithShift();
return false;
}
@@ -234,7 +234,7 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
SelectByType(true);
else if (shift)
SelectAll(true);
else if(!ctrl)
else if (!ctrl)
SelectSpec(true);
return true;
}
@@ -272,7 +272,7 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
}
*/
case 'A':
if(ctrl)
if (ctrl)
{
SelectAll(true);
return true;
@@ -307,14 +307,14 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
}
return false;
case 'R':
if(ctrl)
if (ctrl)
{
OnReload();
return true;
}
return false;
case 'Z':
if(ctrl)
if (ctrl)
{
ChangeComment();
return true;
@@ -324,7 +324,7 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
case '2':
case '3':
case '4':
if(ctrl)
if (ctrl)
{
int styleIndex = keyDownInfo->wVKey - '1';
SetListViewMode(styleIndex);

View File

@@ -465,7 +465,7 @@ void CPanel::OnNotifyActivateItems()
bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result)
{
switch(header->code)
switch (header->code)
{
case LVN_ITEMCHANGED:
{
@@ -507,7 +507,7 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result)
{
LPNMLVKEYDOWN keyDownInfo = LPNMLVKEYDOWN(header);
bool boolResult = OnKeyDown(keyDownInfo, result);
switch(keyDownInfo->wVKey)
switch (keyDownInfo->wVKey)
{
case VK_CONTROL:
case VK_SHIFT:
@@ -602,7 +602,7 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result)
bool CPanel::OnCustomDraw(LPNMLVCUSTOMDRAW lplvcd, LRESULT &result)
{
switch(lplvcd->nmcd.dwDrawStage)
switch (lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT :
result = CDRF_NOTIFYITEMDRAW;

View File

@@ -480,7 +480,7 @@ void CPanel::CreateSystemMenu(HMENU menuSpec,
// HMENU hMenu = CreatePopupMenu();
CMenu popupMenu;
// CMenuDestroyer menuDestroyer(popupMenu);
if(!popupMenu.CreatePopup())
if (!popupMenu.CreatePopup())
throw 210503;
HMENU hMenu = popupMenu;

View File

@@ -57,7 +57,7 @@ public:
HRESULT CThreadFolderOperations::ProcessVirt()
{
NCOM::CComInitializer comInitializer;
switch(OpType)
switch (OpType)
{
case FOLDER_TYPE_CREATE_FOLDER:
Result = FolderOperations->CreateFolder(Name, UpdateCallback);

View File

@@ -132,7 +132,7 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
switch (message)
{
case kCloseMessage:
{
@@ -158,7 +158,7 @@ bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(buttonID)
switch (buttonID)
{
case IDCANCEL:
{

View File

@@ -41,7 +41,7 @@ static const unsigned kNumRootFolderItems =
using namespace NWindows;
static const PROPID kProps[] =
static const Byte kProps[] =
{
kpidName
};
@@ -108,7 +108,7 @@ STDMETHODIMP CRootFolder::GetNumberOfItems(UInt32 *numItems)
STDMETHODIMP CRootFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
switch(propID)
switch (propID)
{
case kpidIsDir: prop = true; break;
case kpidName: prop = _names[itemIndex]; break;

View File

@@ -93,7 +93,7 @@ void CSettingsPage::OnNotifyHelp()
bool CSettingsPage::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(buttonID)
switch (buttonID)
{
case IDX_SETTINGS_SINGLE_CLICK:
/*

View File

@@ -77,7 +77,7 @@ bool CSplitDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
bool CSplitDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(buttonID)
switch (buttonID)
{
case IDB_SPLIT_PATH:
OnButtonSetPath();

View File

@@ -505,7 +505,7 @@ bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(buttonID)
switch (buttonID)
{
case IDB_RESTART:
OnRestartButton();

View File

@@ -253,7 +253,7 @@ void CExtractDialog::UpdatePasswordControl()
bool CExtractDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(buttonID)
switch (buttonID)
{
case IDB_EXTRACT_SET_PATH:
OnButtonSetPath();

View File

@@ -229,7 +229,7 @@ HRESULT ExtractGUI(
NName::NormalizeDirPathPrefix(options.OutputDir);
/*
if(!CreateComplexDirectory(options.OutputDir))
if (!CreateComplexDirectory(options.OutputDir))
{
UString s = GetUnicodeString(NError::MyFormatMessage(GetLastError()));
UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,

View File

@@ -13,7 +13,7 @@
#include "../FileManager/ProgressDialog2.h"
#include "../FileManager/ProgressDialog2Res.h"
#include "../FileManager/PropertyNameRes.h"
#include "../FileManager/resourceGUI.h"
#include "../FileManager/resourceGui.h"
#include "HashGUI.h"

Some files were not shown because too many files have changed in this diff Show More