summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/lzma/CPP
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/lzma/CPP')
-rw-r--r--3rdparty/lzma/CPP/7zip/Archive/7z/7zDecode.cpp8
-rw-r--r--3rdparty/lzma/CPP/7zip/Archive/7z/7zEncode.cpp14
-rw-r--r--3rdparty/lzma/CPP/7zip/Archive/7z/7zExtract.cpp12
-rw-r--r--3rdparty/lzma/CPP/7zip/Archive/7z/7zHandler.cpp8
-rw-r--r--3rdparty/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp12
-rw-r--r--3rdparty/lzma/CPP/7zip/Archive/7z/7zIn.cpp25
-rw-r--r--3rdparty/lzma/CPP/7zip/Archive/7z/7zOut.cpp52
-rw-r--r--3rdparty/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp37
-rw-r--r--3rdparty/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp2
-rw-r--r--3rdparty/lzma/CPP/7zip/Archive/SplitHandler.cpp10
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp5
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp9
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp65
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/SFXCon/makefile2
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp3
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp9
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp16
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/makefile1
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp9
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp6
-rw-r--r--3rdparty/lzma/CPP/7zip/Bundles/SFXWin/makefile3
-rw-r--r--3rdparty/lzma/CPP/7zip/Common/MethodProps.cpp6
-rw-r--r--3rdparty/lzma/CPP/7zip/Compress/Bcj2Coder.cpp6
-rw-r--r--3rdparty/lzma/CPP/7zip/Compress/Bcj2Coder.h2
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp2
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp7
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Common/Bench.cpp75
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Common/Extract.cpp13
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Common/HashCalc.cpp4
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.cpp17
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.h8
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Common/Update.cpp58
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp2
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp5
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Console/HashCon.cpp2
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Console/List.cpp11
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp4
-rw-r--r--3rdparty/lzma/CPP/Common/TextConfig.cpp2
-rw-r--r--3rdparty/lzma/CPP/Common/Wildcard.cpp2
-rw-r--r--3rdparty/lzma/CPP/Windows/Control/ComboBox.cpp2
-rw-r--r--3rdparty/lzma/CPP/Windows/FileFind.cpp57
-rw-r--r--3rdparty/lzma/CPP/Windows/FileName.cpp48
42 files changed, 375 insertions, 266 deletions
diff --git a/3rdparty/lzma/CPP/7zip/Archive/7z/7zDecode.cpp b/3rdparty/lzma/CPP/7zip/Archive/7z/7zDecode.cpp
index bfe1b24e923..b0d6dd838aa 100644
--- a/3rdparty/lzma/CPP/7zip/Archive/7z/7zDecode.cpp
+++ b/3rdparty/lzma/CPP/7zip/Archive/7z/7zDecode.cpp
@@ -404,11 +404,11 @@ HRESULT CDecoder::Decode(
len = password.Len();
}
CByteBuffer buffer(len * 2);
- for (size_t i = 0; i < len; i++)
+ for (size_t k = 0; k < len; k++)
{
- wchar_t c = passwordBSTR[i];
- ((Byte *)buffer)[i * 2] = (Byte)c;
- ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
+ wchar_t c = passwordBSTR[k];
+ ((Byte *)buffer)[k * 2] = (Byte)c;
+ ((Byte *)buffer)[k * 2 + 1] = (Byte)(c >> 8);
}
RINOK(cryptoSetPassword->CryptoSetPassword((const Byte *)buffer, (UInt32)buffer.Size()));
}
diff --git a/3rdparty/lzma/CPP/7zip/Archive/7z/7zEncode.cpp b/3rdparty/lzma/CPP/7zip/Archive/7z/7zEncode.cpp
index ab251711fd2..97e9ad7adb8 100644
--- a/3rdparty/lzma/CPP/7zip/Archive/7z/7zEncode.cpp
+++ b/3rdparty/lzma/CPP/7zip/Archive/7z/7zEncode.cpp
@@ -148,9 +148,9 @@ HRESULT CEncoder::CreateMixerCoder(
RINOK(_mixer->SetBindInfo(_bindInfo));
- FOR_VECTOR (i, _options.Methods)
+ FOR_VECTOR (m, _options.Methods)
{
- const CMethodFull &methodFull = _options.Methods[i];
+ const CMethodFull &methodFull = _options.Methods[m];
CCreatedCoder cod;
@@ -410,9 +410,9 @@ HRESULT CEncoder::Encode(
mtOutStreamNotifySpec->_stream = outStream;
mtOutStreamNotifySpec->_mtProgresSpec = mtProgressSpec;
- FOR_VECTOR(i, tempBufferSpecs)
+ FOR_VECTOR(t, tempBufferSpecs)
{
- tempBufferSpecs[i]->_mtProgresSpec = mtProgressSpec;
+ tempBufferSpecs[t]->_mtProgresSpec = mtProgressSpec;
}
}
@@ -591,9 +591,9 @@ HRESULT CEncoder::EncoderConstr()
continue;
}
- int i = _bindInfo.FindStream_in_PackStreams(outIndex);
- if (i >= 0)
- _bindInfo.PackStreams.MoveToFront(i);
+ int si = _bindInfo.FindStream_in_PackStreams(outIndex);
+ if (si >= 0)
+ _bindInfo.PackStreams.MoveToFront(si);
break;
}
}
diff --git a/3rdparty/lzma/CPP/7zip/Archive/7z/7zExtract.cpp b/3rdparty/lzma/CPP/7zip/Archive/7z/7zExtract.cpp
index 8396516423c..05fd80de3fd 100644
--- a/3rdparty/lzma/CPP/7zip/Archive/7z/7zExtract.cpp
+++ b/3rdparty/lzma/CPP/7zip/Archive/7z/7zExtract.cpp
@@ -319,13 +319,15 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
curUnpacked += _db.Files[k].Size;
}
- HRESULT result = folderOutStream->Init(fileIndex,
- allFilesMode ? NULL : indices + i,
- numSolidFiles);
+ {
+ HRESULT result = folderOutStream->Init(fileIndex,
+ allFilesMode ? NULL : indices + i,
+ numSolidFiles);
- i += numSolidFiles;
+ i += numSolidFiles;
- RINOK(result);
+ RINOK(result);
+ }
// to test solid block with zero unpacked size we disable that code
if (folderOutStream->WasWritingFinished())
diff --git a/3rdparty/lzma/CPP/7zip/Archive/7z/7zHandler.cpp b/3rdparty/lzma/CPP/7zip/Archive/7z/7zHandler.cpp
index a95fc6a0752..ccd2c624e66 100644
--- a/3rdparty/lzma/CPP/7zip/Archive/7z/7zHandler.cpp
+++ b/3rdparty/lzma/CPP/7zip/Archive/7z/7zHandler.cpp
@@ -429,11 +429,11 @@ HRESULT CHandler::SetMethodToProp(CNum folderIndex, PROPVARIANT *prop) const
name = "LZMA2";
if (propsSize == 1)
{
- Byte p = props[0];
- if ((p & 1) == 0)
- ConvertUInt32ToString((UInt32)((p >> 1) + 12), s);
+ Byte d = props[0];
+ if ((d & 1) == 0)
+ ConvertUInt32ToString((UInt32)((d >> 1) + 12), s);
else
- GetStringForSizeValue(s, 3 << ((p >> 1) + 11));
+ GetStringForSizeValue(s, 3 << ((d >> 1) + 11));
}
}
else if (id == k_PPMD)
diff --git a/3rdparty/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp b/3rdparty/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp
index 41bd6520c80..2b86ed26ab7 100644
--- a/3rdparty/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp
+++ b/3rdparty/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp
@@ -675,14 +675,16 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
static HRESULT ParseBond(UString &srcString, UInt32 &coder, UInt32 &stream)
{
stream = 0;
- int index = ParseStringToUInt32(srcString, coder);
- if (index == 0)
- return E_INVALIDARG;
- srcString.DeleteFrontal(index);
+ {
+ unsigned index = ParseStringToUInt32(srcString, coder);
+ if (index == 0)
+ return E_INVALIDARG;
+ srcString.DeleteFrontal(index);
+ }
if (srcString[0] == 's')
{
srcString.Delete(0);
- int index = ParseStringToUInt32(srcString, stream);
+ unsigned index = ParseStringToUInt32(srcString, stream);
if (index == 0)
return E_INVALIDARG;
srcString.DeleteFrontal(index);
diff --git a/3rdparty/lzma/CPP/7zip/Archive/7z/7zIn.cpp b/3rdparty/lzma/CPP/7zip/Archive/7z/7zIn.cpp
index 0634768b557..d8c2717501c 100644
--- a/3rdparty/lzma/CPP/7zip/Archive/7z/7zIn.cpp
+++ b/3rdparty/lzma/CPP/7zip/Archive/7z/7zIn.cpp
@@ -1097,7 +1097,10 @@ HRESULT CInArchive::ReadAndDecodePackedStreams(
if (CrcCalc(data, unpackSize) != folders.FolderCRCs.Vals[i])
ThrowIncorrect();
}
- HeadersSize += folders.PackPositions[folders.NumPackStreams];
+
+ if (folders.PackPositions)
+ HeadersSize += folders.PackPositions[folders.NumPackStreams];
+
return S_OK;
}
@@ -1150,9 +1153,8 @@ HRESULT CInArchive::ReadHeader(
if (type == NID::kFilesInfo)
{
- CNum numFiles = ReadNum();
+ const CNum numFiles = ReadNum();
db.Files.ClearAndSetSize(numFiles);
- CNum i;
/*
db.Files.Reserve(numFiles);
CNum i;
@@ -1174,8 +1176,8 @@ HRESULT CInArchive::ReadHeader(
for (;;)
{
- UInt64 type = ReadID();
- if (type == NID::kEnd)
+ const UInt64 type2 = ReadID();
+ if (type2 == NID::kEnd)
break;
UInt64 size = ReadNumber();
if (size > _inByteBack->GetRem())
@@ -1184,9 +1186,9 @@ HRESULT CInArchive::ReadHeader(
switchProp.Set(this, _inByteBack->GetPtr(), (size_t)size, true);
bool addPropIdToList = true;
bool isKnownType = true;
- if (type > ((UInt32)1 << 30))
+ if (type2 > ((UInt32)1 << 30))
isKnownType = false;
- else switch ((UInt32)type)
+ else switch ((UInt32)type2)
{
case NID::kName:
{
@@ -1220,7 +1222,7 @@ HRESULT CInArchive::ReadHeader(
ReadBoolVector2(db.Files.Size(), boolVector);
CStreamSwitch streamSwitch;
streamSwitch.Set(this, &dataVector);
- for (i = 0; i < numFiles; i++)
+ for (CNum i = 0; i < numFiles; i++)
{
CFileItem &file = db.Files[i];
file.AttribDefined = boolVector[i];
@@ -1263,7 +1265,7 @@ HRESULT CInArchive::ReadHeader(
{
ReadBoolVector(numFiles, emptyStreamVector);
numEmptyStreams = 0;
- for (i = 0; i < (CNum)emptyStreamVector.Size(); i++)
+ for (CNum i = 0; i < (CNum)emptyStreamVector.Size(); i++)
if (emptyStreamVector[i])
numEmptyStreams++;
@@ -1337,7 +1339,7 @@ HRESULT CInArchive::ReadHeader(
if (isKnownType)
{
if (addPropIdToList)
- db.ArcInfo.FileInfoPopIDs.Add(type);
+ db.ArcInfo.FileInfoPopIDs.Add(type2);
}
else
{
@@ -1358,6 +1360,9 @@ HRESULT CInArchive::ReadHeader(
CNum sizeIndex = 0;
CNum numAntiItems = 0;
+
+ CNum i;
+
for (i = 0; i < numEmptyStreams; i++)
if (antiFileVector[i])
numAntiItems++;
diff --git a/3rdparty/lzma/CPP/7zip/Archive/7z/7zOut.cpp b/3rdparty/lzma/CPP/7zip/Archive/7z/7zOut.cpp
index 2f9065884f8..3e70f466e7b 100644
--- a/3rdparty/lzma/CPP/7zip/Archive/7z/7zOut.cpp
+++ b/3rdparty/lzma/CPP/7zip/Archive/7z/7zOut.cpp
@@ -540,13 +540,13 @@ void COutArchive::WriteHeader(
*/
_useAlign = true;
- unsigned i;
-
- UInt64 packedSize = 0;
- for (i = 0; i < db.PackSizes.Size(); i++)
- packedSize += db.PackSizes[i];
+ {
+ UInt64 packSize = 0;
+ FOR_VECTOR (i, db.PackSizes)
+ packSize += db.PackSizes[i];
+ headerOffset = packSize;
+ }
- headerOffset = packedSize;
WriteByte(NID::kHeader);
@@ -560,7 +560,7 @@ void COutArchive::WriteHeader(
CRecordVector<UInt64> unpackSizes;
CUInt32DefVector digests;
- for (i = 0; i < db.Files.Size(); i++)
+ FOR_VECTOR (i, db.Files)
{
const CFileItem &file = db.Files[i];
if (!file.HasStream)
@@ -588,14 +588,17 @@ void COutArchive::WriteHeader(
CBoolVector emptyStreamVector;
emptyStreamVector.ClearAndSetSize(db.Files.Size());
unsigned numEmptyStreams = 0;
- for (i = 0; i < db.Files.Size(); i++)
- if (db.Files[i].HasStream)
- emptyStreamVector[i] = false;
- else
- {
- emptyStreamVector[i] = true;
- numEmptyStreams++;
- }
+ {
+ FOR_VECTOR (i, db.Files)
+ if (db.Files[i].HasStream)
+ emptyStreamVector[i] = false;
+ else
+ {
+ emptyStreamVector[i] = true;
+ numEmptyStreams++;
+ }
+ }
+
if (numEmptyStreams != 0)
{
WritePropBoolVector(NID::kEmptyStream, emptyStreamVector);
@@ -605,7 +608,8 @@ void COutArchive::WriteHeader(
antiVector.ClearAndSetSize(numEmptyStreams);
bool thereAreEmptyFiles = false, thereAreAntiItems = false;
unsigned cur = 0;
- for (i = 0; i < db.Files.Size(); i++)
+
+ FOR_VECTOR (i, db.Files)
{
const CFileItem &file = db.Files[i];
if (file.HasStream)
@@ -672,17 +676,21 @@ void COutArchive::WriteHeader(
CBoolVector boolVector;
boolVector.ClearAndSetSize(db.Files.Size());
unsigned numDefined = 0;
- for (i = 0; i < db.Files.Size(); i++)
+
{
- bool defined = db.Files[i].AttribDefined;
- boolVector[i] = defined;
- if (defined)
- numDefined++;
+ FOR_VECTOR (i, db.Files)
+ {
+ bool defined = db.Files[i].AttribDefined;
+ boolVector[i] = defined;
+ if (defined)
+ numDefined++;
+ }
}
+
if (numDefined != 0)
{
WriteAlignedBoolHeader(boolVector, numDefined, NID::kWinAttrib, 4);
- for (i = 0; i < db.Files.Size(); i++)
+ FOR_VECTOR (i, db.Files)
{
const CFileItem &file = db.Files[i];
if (file.AttribDefined)
diff --git a/3rdparty/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp b/3rdparty/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp
index e1c7aad8793..68e57f09d5f 100644
--- a/3rdparty/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp
+++ b/3rdparty/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp
@@ -38,7 +38,7 @@ struct CFilterMode
{
if (Id == k_IA64)
Delta = 16;
- else if (Id == k_ARM || Id == k_PPC || Id == k_PPC)
+ else if (Id == k_ARM || Id == k_PPC || Id == k_SPARC)
Delta = 4;
else if (Id == k_ARMT)
Delta = 2;
@@ -779,7 +779,7 @@ struct CSolidGroup
CRecordVector<CFolderRepack> folderRefs;
};
-static const char *g_ExeExts[] =
+static const char * const g_ExeExts[] =
{
"dll"
, "exe"
@@ -1681,17 +1681,18 @@ HRESULT Update(
}
UInt64 inSizeForReduce = 0;
- unsigned i;
- for (i = 0; i < updateItems.Size(); i++)
{
- const CUpdateItem &ui = updateItems[i];
- if (ui.NewData)
+ FOR_VECTOR (i, updateItems)
{
- complexity += ui.Size;
- if (numSolidFiles != 1)
- inSizeForReduce += ui.Size;
- else if (inSizeForReduce < ui.Size)
- inSizeForReduce = ui.Size;
+ const CUpdateItem &ui = updateItems[i];
+ if (ui.NewData)
+ {
+ complexity += ui.Size;
+ if (numSolidFiles != 1)
+ inSizeForReduce += ui.Size;
+ else if (inSizeForReduce < ui.Size)
+ inSizeForReduce = ui.Size;
+ }
}
}
@@ -1753,7 +1754,7 @@ HRESULT Update(
const CCompressionMethodMode &method = *options.Method;
- for (i = 0; i < updateItems.Size(); i++)
+ FOR_VECTOR (i, updateItems)
{
const CUpdateItem &ui = updateItems[i];
if (!ui.NewData || !ui.HasStream())
@@ -1857,6 +1858,8 @@ HRESULT Update(
/* ---------- Write non-AUX dirs and Empty files ---------- */
CUIntVector emptyRefs;
+ unsigned i;
+
for (i = 0; i < updateItems.Size(); i++)
{
const CUpdateItem &ui = updateItems[i];
@@ -1919,7 +1922,8 @@ HRESULT Update(
const CFilterMode2 &filterMode = filters[groupIndex];
CCompressionMethodMode method = *options.Method;
- HRESULT res = MakeExeMethod(method, filterMode,
+ {
+ HRESULT res = MakeExeMethod(method, filterMode,
#ifdef _7ZIP_ST
false
#else
@@ -1927,7 +1931,8 @@ HRESULT Update(
#endif
);
- RINOK(res);
+ RINOK(res);
+ }
if (filterMode.Encrypted)
{
@@ -2266,8 +2271,12 @@ HRESULT Update(
CRecordVector<CRefItem> refItems;
refItems.ClearAndSetSize(numFiles);
bool sortByType = (options.UseTypeSorting && numSolidFiles > 1);
+
+ unsigned i;
+
for (i = 0; i < numFiles; i++)
refItems[i] = CRefItem(group.Indices[i], updateItems[group.Indices[i]], sortByType);
+
CSortParam sortParam;
// sortParam.TreeFolders = &treeFolders;
sortParam.SortByType = sortByType;
diff --git a/3rdparty/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp b/3rdparty/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp
index 95381ea31d6..30ca73bd023 100644
--- a/3rdparty/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp
+++ b/3rdparty/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp
@@ -81,7 +81,7 @@ HRESULT CMultiMethodProps::SetProperty(const wchar_t *nameSpec, const PROPVARIAN
}
UInt32 number;
- int index = ParseStringToUInt32(name, number);
+ unsigned index = ParseStringToUInt32(name, number);
UString realName = name.Ptr(index);
if (index == 0)
{
diff --git a/3rdparty/lzma/CPP/7zip/Archive/SplitHandler.cpp b/3rdparty/lzma/CPP/7zip/Archive/SplitHandler.cpp
index 4ca417e009d..72b52fe732d 100644
--- a/3rdparty/lzma/CPP/7zip/Archive/SplitHandler.cpp
+++ b/3rdparty/lzma/CPP/7zip/Archive/SplitHandler.cpp
@@ -203,7 +203,7 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
_streams.Add(stream);
{
- UInt64 numFiles = _streams.Size();
+ const UInt64 numFiles = _streams.Size();
RINOK(callback->SetCompleted(&numFiles, NULL));
}
@@ -218,7 +218,7 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
break;
if (result != S_OK)
return result;
- if (!stream)
+ if (!nextStream)
break;
{
/*
@@ -228,14 +228,14 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
return E_INVALIDARG;
size = prop.uhVal.QuadPart;
*/
- RINOK(stream->Seek(0, STREAM_SEEK_END, &size));
- RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
+ RINOK(nextStream->Seek(0, STREAM_SEEK_END, &size));
+ RINOK(nextStream->Seek(0, STREAM_SEEK_SET, NULL));
}
_totalSize += size;
_sizes.Add(size);
_streams.Add(nextStream);
{
- UInt64 numFiles = _streams.Size();
+ const UInt64 numFiles = _streams.Size();
RINOK(callback->SetCompleted(&numFiles, NULL));
}
}
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp b/3rdparty/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp
index 5ca288f4696..178753e5373 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp
+++ b/3rdparty/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp
@@ -749,11 +749,10 @@ static int main2(int numArgs, const char *args[])
}
}
- if (!stdOutMode)
- Print_Size("Output size: ", outStreamSpec->ProcessedSize);
-
if (outStreamSpec)
{
+ if (!stdOutMode)
+ Print_Size("Output size: ", outStreamSpec->ProcessedSize);
if (outStreamSpec->Close() != S_OK)
throw "File closing error";
}
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp b/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp
index 4f55d013fee..b21b9e841e5 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp
+++ b/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp
@@ -804,6 +804,15 @@ SOURCE=..\..\..\..\C\Delta.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\C\DllSecur.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\DllSecur.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp b/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp
index 781f810cfd6..d828922f314 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp
+++ b/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp
@@ -24,6 +24,8 @@
#include "../../MyVersion.h"
+#include "../../../../C/DllSecur.h"
+
using namespace NWindows;
using namespace NFile;
using namespace NDir;
@@ -103,7 +105,7 @@ static const wchar_t *kUniversalWildcard = L"*";
static const int kCommandIndex = 0;
static const char *kHelpString =
- "\nUsage: 7zSFX [<command>] [<switches>...]\n"
+ "\nUsage: 7zSFX [<command>] [<switches>...] [<file_name>...]\n"
"\n"
"<Commands>\n"
// " l: List contents of archive\n"
@@ -222,13 +224,6 @@ void AddCommandLineWildcardToCensor(NWildcard::CCensor &wildcardCensor,
ShowMessageAndThrowException(kIncorrectWildcardInCommandLine, NExitCode::kUserError);
}
-void AddToCensorFromNonSwitchesStrings(NWildcard::CCensor &wildcardCensor,
- const UStringVector & /* nonSwitchStrings */, NRecursedType::EEnum type,
- bool /* thereAreSwitchIncludeWildcards */)
-{
- AddCommandLineWildcardToCensor(wildcardCensor, kUniversalWildcard, true, type);
-}
-
#ifndef _WIN32
static void GetArguments(int numArgs, const char *args[], UStringVector &parts)
@@ -248,6 +243,11 @@ int Main2(
#endif
)
{
+ #ifdef _WIN32
+ // do we need load Security DLLs for console program?
+ LoadSecurityDlls();
+ #endif
+
#if defined(_WIN32) && !defined(UNDER_CE)
SetFileApisToOEM();
#endif
@@ -283,9 +283,16 @@ int Main2(
commandStrings.Delete(0);
NCommandLineParser::CParser parser(kNumSwitches);
+
try
{
- parser.ParseStrings(kSwitchForms, commandStrings);
+ if (!parser.ParseStrings(kSwitchForms, commandStrings))
+ {
+ g_StdOut << "Command line error:" << endl
+ << parser.ErrorMessage << endl
+ << parser.ErrorLine << endl;
+ return NExitCode::kUserError;
+ }
}
catch(...)
{
@@ -297,19 +304,23 @@ int Main2(
PrintHelp();
return 0;
}
+
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
- int numNonSwitchStrings = nonSwitchStrings.Size();
+ unsigned curCommandIndex = 0;
CArchiveCommand command;
- if (numNonSwitchStrings == 0)
+ if (nonSwitchStrings.IsEmpty())
command.CommandType = NCommandType::kFullExtract;
else
{
- if (numNonSwitchStrings > 1)
- PrintHelpAndExit();
- if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], command))
- PrintHelpAndExit();
+ const UString &cmd = nonSwitchStrings[curCommandIndex];
+ if (!ParseArchiveCommand(cmd, command))
+ {
+ g_StdOut << "ERROR: Unknown command:" << endl << cmd << endl;
+ return NExitCode::kUserError;
+ }
+ curCommandIndex = 1;
}
@@ -318,11 +329,17 @@ int Main2(
NWildcard::CCensor wildcardCensor;
- bool thereAreSwitchIncludeWildcards;
- thereAreSwitchIncludeWildcards = false;
-
- AddToCensorFromNonSwitchesStrings(wildcardCensor, nonSwitchStrings, recursedType,
- thereAreSwitchIncludeWildcards);
+ {
+ if (nonSwitchStrings.Size() == curCommandIndex)
+ AddCommandLineWildcardToCensor(wildcardCensor, kUniversalWildcard, true, recursedType);
+ for (; curCommandIndex < nonSwitchStrings.Size(); curCommandIndex++)
+ {
+ const UString &s = nonSwitchStrings[curCommandIndex];
+ if (s.IsEmpty())
+ throw "Empty file path";
+ AddCommandLineWildcardToCensor(wildcardCensor, s, true, recursedType);
+ }
+ }
bool yesToAll = parser[NKey::kYes].ThereIs;
@@ -363,9 +380,11 @@ int Main2(
IUnknown
#endif
> compressCodecsInfo = codecs;
- HRESULT result = codecs->Load();
- if (result != S_OK)
- throw CSystemException(result);
+ {
+ HRESULT result = codecs->Load();
+ if (result != S_OK)
+ throw CSystemException(result);
+ }
if (command.CommandType != NCommandType::kList)
{
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/makefile b/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/makefile
index f1cd2f57fd7..4c201c00a70 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/makefile
+++ b/3rdparty/lzma/CPP/7zip/Bundles/SFXCon/makefile
@@ -4,6 +4,7 @@ CFLAGS = $(CFLAGS) \
-DEXTRACT_ONLY \
-DNO_READ_FROM_CODER \
-D_SFX \
+ -D_CONSOLE \
CURRENT_OBJS = \
$O\SfxCon.obj \
@@ -114,6 +115,7 @@ C_OBJS = \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
+ $O\DllSecur.obj \
$O\Lzma2Dec.obj \
$O\LzmaDec.obj \
$O\Ppmd7.obj \
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp b/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp
index ba41fd1add8..b1592993857 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp
+++ b/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp
@@ -55,8 +55,7 @@ struct CThreadExtracting
Result = ArchiveLink.Open2(options, ExtractCallbackSpec);
if (Result != S_OK)
{
- if (Result != S_OK)
- ErrorMessage = kCantOpenArchive;
+ ErrorMessage = kCantOpenArchive;
return;
}
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp b/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp
index f2783e028cf..787c1bdefc5 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp
+++ b/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp
@@ -706,6 +706,15 @@ SOURCE=..\..\..\..\C\Delta.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\C\DllSecur.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\DllSecur.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp b/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp
index d389023574f..aef2e1969c9 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp
+++ b/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp
@@ -23,6 +23,8 @@
#include "ExtractEngine.h"
+#include "../../../../C/DllSecur.h"
+
#include "resource.h"
using namespace NWindows;
@@ -135,6 +137,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
NT_CHECK
+ #ifdef _WIN32
+ LoadSecurityDlls();
+ #endif
+
// InitCommonControls();
UString archiveName, switches;
@@ -207,11 +213,13 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
CCodecs *codecs = new CCodecs;
CMyComPtr<IUnknown> compressCodecsInfo = codecs;
- HRESULT result = codecs->Load();
- if (result != S_OK)
{
- ShowErrorMessage(L"Can not load codecs");
- return 1;
+ HRESULT result = codecs->Load();
+ if (result != S_OK)
+ {
+ ShowErrorMessage(L"Can not load codecs");
+ return 1;
+ }
}
const FString tempDirPath = tempDir.GetPath();
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/makefile b/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/makefile
index 5f6f6032430..5849cf36907 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/makefile
+++ b/3rdparty/lzma/CPP/7zip/Bundles/SFXSetup/makefile
@@ -100,6 +100,7 @@ C_OBJS = \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
+ $O\DllSecur.obj \
$O\Lzma2Dec.obj \
$O\LzmaDec.obj \
$O\Threads.obj \
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp b/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp
index 1f3d88d13b6..301a6c5c756 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp
+++ b/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp
@@ -888,6 +888,15 @@ SOURCE=..\..\..\..\C\Delta.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\C\DllSecur.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\DllSecur.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp b/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp
index c301ecf8894..db7acfef7c8 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp
+++ b/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp
@@ -28,6 +28,8 @@
#include "../../UI/GUI/ExtractGUI.h"
#include "../../UI/GUI/ExtractRes.h"
+#include "../../../../C/DllSecur.h"
+
using namespace NWindows;
using namespace NFile;
using namespace NDir;
@@ -220,6 +222,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
try
{
+ #ifdef _WIN32
+ LoadSecurityDlls();
+ #endif
+
return WinMain2();
}
catch(const CNewException &)
diff --git a/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/makefile b/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/makefile
index 0ffec922d58..dc48ae88a78 100644
--- a/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/makefile
+++ b/3rdparty/lzma/CPP/7zip/Bundles/SFXWin/makefile
@@ -131,8 +131,9 @@ C_OBJS = \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
- $O\Delta.obj \
$O\CpuArch.obj \
+ $O\Delta.obj \
+ $O\DllSecur.obj \
$O\Lzma2Dec.obj \
$O\LzmaDec.obj \
$O\Ppmd7.obj \
diff --git a/3rdparty/lzma/CPP/7zip/Common/MethodProps.cpp b/3rdparty/lzma/CPP/7zip/Common/MethodProps.cpp
index a5149ab5bb5..09f7b29cc24 100644
--- a/3rdparty/lzma/CPP/7zip/Common/MethodProps.cpp
+++ b/3rdparty/lzma/CPP/7zip/Common/MethodProps.cpp
@@ -403,9 +403,9 @@ HRESULT CMethodProps::ParseParamsFromPROPVARIANT(const UString &realName, const
if (value.vt == VT_EMPTY)
{
// {realName}=[empty]
- UString name, value;
- SplitParam(realName, name, value);
- return SetParam(name, value);
+ UString name, valueStr;
+ SplitParam(realName, name, valueStr);
+ return SetParam(name, valueStr);
}
// {realName}=value
diff --git a/3rdparty/lzma/CPP/7zip/Compress/Bcj2Coder.cpp b/3rdparty/lzma/CPP/7zip/Compress/Bcj2Coder.cpp
index fd7ce7ef347..96150c5f8b2 100644
--- a/3rdparty/lzma/CPP/7zip/Compress/Bcj2Coder.cpp
+++ b/3rdparty/lzma/CPP/7zip/Compress/Bcj2Coder.cpp
@@ -514,13 +514,13 @@ HRESULT CDecoder::Code(ISequentialInStream * const *inStreams, const UInt64 * co
STDMETHODIMP CDecoder::SetInStream2(UInt32 streamIndex, ISequentialInStream *inStream)
{
- inStreams[streamIndex] = inStream;
+ _inStreams[streamIndex] = inStream;
return S_OK;
}
STDMETHODIMP CDecoder::ReleaseInStream2(UInt32 streamIndex)
{
- inStreams[streamIndex].Release();
+ _inStreams[streamIndex].Release();
return S_OK;
}
@@ -601,7 +601,7 @@ STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize)
do
{
UInt32 curSize = _bufsCurSizes[dec.state] - (UInt32)totalRead;
- HRESULT res2 = inStreams[dec.state]->Read(_bufs[dec.state] + totalRead, curSize, &curSize);
+ HRESULT res2 = _inStreams[dec.state]->Read(_bufs[dec.state] + totalRead, curSize, &curSize);
_readRes[dec.state] = res2;
if (curSize == 0)
break;
diff --git a/3rdparty/lzma/CPP/7zip/Compress/Bcj2Coder.h b/3rdparty/lzma/CPP/7zip/Compress/Bcj2Coder.h
index 627e505d184..381b9f54a57 100644
--- a/3rdparty/lzma/CPP/7zip/Compress/Bcj2Coder.h
+++ b/3rdparty/lzma/CPP/7zip/Compress/Bcj2Coder.h
@@ -72,7 +72,7 @@ class CDecoder:
unsigned _extraReadSizes[BCJ2_NUM_STREAMS];
UInt64 _inStreamsProcessed[BCJ2_NUM_STREAMS];
HRESULT _readRes[BCJ2_NUM_STREAMS];
- CMyComPtr<ISequentialInStream> inStreams[BCJ2_NUM_STREAMS];
+ CMyComPtr<ISequentialInStream> _inStreams[BCJ2_NUM_STREAMS];
bool _finishMode;
bool _outSizeDefined;
diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
index 61a781af16b..832ec66d9c5 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
@@ -387,7 +387,7 @@ static void AddRenamePair(CObjectVector<CRenamePair> *renamePairs,
val.Add_LF();
if (type == NRecursedType::kRecursed)
val.AddAscii("-r");
- else if (type == NRecursedType::kRecursed)
+ else if (type == NRecursedType::kWildcardOnlyRecursed)
val.AddAscii("-r0");
throw CArcCmdLineException("Unsupported rename command:", val);
}
diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
index 62da5e9fad4..bc116c93d66 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
@@ -1046,8 +1046,7 @@ if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
if (_item.IsAltStream && _item.ParentIndex != (UInt32)(Int32)-1)
{
- CIndexToPathPair pair(_item.ParentIndex);
- int renIndex = _renamedFiles.FindInSorted(pair);
+ int renIndex = _renamedFiles.FindInSorted(CIndexToPathPair(_item.ParentIndex));
if (renIndex >= 0)
{
const CIndexToPathPair &pair = _renamedFiles[renIndex];
@@ -1319,7 +1318,7 @@ if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
if (needWriteFile)
{
_outFileStreamSpec = new COutFileStream;
- CMyComPtr<ISequentialOutStream> outStreamLoc(_outFileStreamSpec);
+ CMyComPtr<ISequentialOutStream> outStreamLoc2(_outFileStreamSpec);
if (!_outFileStreamSpec->Open(fullProcessedPath, _isSplit ? OPEN_ALWAYS: CREATE_ALWAYS))
{
// if (::GetLastError() != ERROR_FILE_EXISTS || !isSplit)
@@ -1346,7 +1345,7 @@ if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
RINOK(_outFileStreamSpec->Seek(_position, STREAM_SEEK_SET, NULL));
}
- _outFileStream = outStreamLoc;
+ _outFileStream = outStreamLoc2;
}
}
}
diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/Bench.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/Bench.cpp
index fb69b544414..ecbacbc9c8e 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Common/Bench.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Common/Bench.cpp
@@ -866,11 +866,10 @@ HRESULT CEncoderInfo::Init(
outStreamSpec = new CBenchmarkOutStream;
+ outStream = outStreamSpec;
if (!outStreamSpec->Alloc(kCompressedBufferSize))
return E_OUTOFMEMORY;
- outStream = outStreamSpec;
-
propStreamSpec = 0;
if (!propStream)
{
@@ -917,15 +916,8 @@ HRESULT CEncoderInfo::Init(
// we must call encoding one time to calculate password key for key cache.
// it must be after WriteCoderProperties!
- CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
- CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
Byte temp[16];
memset(temp, 0, sizeof(temp));
- inStreamSpec->Init(temp, sizeof(temp));
-
- CCrcOutStream *outStreamSpec = new CCrcOutStream;
- CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
- outStreamSpec->Init();
if (_encoderFilter)
{
@@ -934,7 +926,15 @@ HRESULT CEncoderInfo::Init(
}
else
{
- RINOK(_encoder->Code(inStream, outStream, 0, 0, NULL));
+ CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
+ inStreamSpec->Init(temp, sizeof(temp));
+
+ CCrcOutStream *crcStreamSpec = new CCrcOutStream;
+ CMyComPtr<ISequentialOutStream> crcStream = crcStreamSpec;
+ crcStreamSpec->Init();
+
+ RINOK(_encoder->Code(inStream, crcStream, 0, 0, NULL));
}
}
}
@@ -1740,10 +1740,10 @@ struct CTotalBenchRes
}
};
-static void PrintNumber(IBenchPrintCallback &f, UInt64 value, int size)
+static void PrintNumber(IBenchPrintCallback &f, UInt64 value, unsigned size)
{
char s[128];
- int startPos = (int)sizeof(s) - 32;
+ unsigned startPos = (unsigned)sizeof(s) - 32;
memset(s, ' ', startPos);
ConvertUInt64ToString(value, s + startPos);
// if (withSpace)
@@ -1751,7 +1751,7 @@ static void PrintNumber(IBenchPrintCallback &f, UInt64 value, int size)
startPos--;
size++;
}
- int len = (int)strlen(s + startPos);
+ unsigned len = (unsigned)strlen(s + startPos);
if (size > len)
{
startPos -= (size - len);
@@ -1761,26 +1761,26 @@ static void PrintNumber(IBenchPrintCallback &f, UInt64 value, int size)
f.Print(s + startPos);
}
-static const int kFieldSize_Name = 12;
-static const int kFieldSize_SmallName = 4;
-static const int kFieldSize_Speed = 9;
-static const int kFieldSize_Usage = 5;
-static const int kFieldSize_RU = 6;
-static const int kFieldSize_Rating = 6;
-static const int kFieldSize_EU = 5;
-static const int kFieldSize_Effec = 5;
+static const unsigned kFieldSize_Name = 12;
+static const unsigned kFieldSize_SmallName = 4;
+static const unsigned kFieldSize_Speed = 9;
+static const unsigned kFieldSize_Usage = 5;
+static const unsigned kFieldSize_RU = 6;
+static const unsigned kFieldSize_Rating = 6;
+static const unsigned kFieldSize_EU = 5;
+static const unsigned kFieldSize_Effec = 5;
-static const int kFieldSize_TotalSize = 4 + kFieldSize_Speed + kFieldSize_Usage + kFieldSize_RU + kFieldSize_Rating;
-static const int kFieldSize_EUAndEffec = 2 + kFieldSize_EU + kFieldSize_Effec;
+static const unsigned kFieldSize_TotalSize = 4 + kFieldSize_Speed + kFieldSize_Usage + kFieldSize_RU + kFieldSize_Rating;
+static const unsigned kFieldSize_EUAndEffec = 2 + kFieldSize_EU + kFieldSize_Effec;
-static void PrintRating(IBenchPrintCallback &f, UInt64 rating, int size)
+static void PrintRating(IBenchPrintCallback &f, UInt64 rating, unsigned size)
{
PrintNumber(f, (rating + 500000) / 1000000, size);
}
-static void PrintPercents(IBenchPrintCallback &f, UInt64 val, UInt64 divider, int size)
+static void PrintPercents(IBenchPrintCallback &f, UInt64 val, UInt64 divider, unsigned size)
{
PrintNumber(f, (val * 100 + divider / 2) / divider, size);
}
@@ -1882,7 +1882,7 @@ struct CBenchCallbackToPrint: public IBenchCallback
UInt32 DictSize;
bool Use2Columns;
- int NameFieldSize;
+ unsigned NameFieldSize;
bool ShowFreq;
UInt64 CpuFreq;
@@ -2390,10 +2390,10 @@ static void x86cpuid_to_String(const Cx86cpuid &c, AString &s)
{
for (int i = 0; i < 3; i++)
{
- UInt32 c[4] = { 0 };
- MyCPUID(0x80000002 + i, &c[0], &c[1], &c[2], &c[3]);
+ UInt32 d[4] = { 0 };
+ MyCPUID(0x80000002 + i, &d[0], &d[1], &d[2], &d[3]);
for (int j = 0; j < 4; j++)
- PrintCpuChars(s, c[j]);
+ PrintCpuChars(s, d[j]);
}
}
@@ -2469,10 +2469,11 @@ HRESULT Bench(
bool multiThreadTests = false;
COneMethodInfo method;
- unsigned i;
CBenchBuffer fileDataBuffer;
-
+
+ {
+ unsigned i;
for (i = 0; i < props.Size(); i++)
{
const CProperty &property = props[i];
@@ -2568,6 +2569,7 @@ HRESULT Bench(
RINOK(method.ParseMethodFromPROPVARIANT(name, propVariant));
}
+ }
if (printCallback)
{
@@ -2710,7 +2712,7 @@ HRESULT Bench(
f.NewLine();
f.Print("Size");
- const int kFieldSize_CrcSpeed = 6;
+ const unsigned kFieldSize_CrcSpeed = 6;
unsigned numThreadsTests = 0;
for (;;)
{
@@ -2873,7 +2875,7 @@ HRESULT Bench(
showFreq = true;
}
- int fileldSize = kFieldSize_TotalSize;
+ unsigned fileldSize = kFieldSize_TotalSize;
if (showFreq)
fileldSize += kFieldSize_EUAndEffec;
@@ -2941,9 +2943,8 @@ HRESULT Bench(
printCallback->NewLine();
HRESULT res;
- int freqTest;
- const int kNumCpuTests = 3;
- for (freqTest = 0; freqTest < kNumCpuTests; freqTest++)
+ const unsigned kNumCpuTests = 3;
+ for (unsigned freqTest = 0; freqTest < kNumCpuTests; freqTest++)
{
PrintLeft(f, "CPU", kFieldSize_Name);
UInt32 resVal;
@@ -3013,7 +3014,7 @@ HRESULT Bench(
if (needSetComplexity)
callback.BenchProps.SetLzmaCompexity();
- for (i = 0; i < numIterations; i++)
+ for (unsigned i = 0; i < numIterations; i++)
{
const unsigned kStartDicLog = 22;
unsigned pow = (dict < ((UInt32)1 << kStartDicLog)) ? kBenchMinDicLogSize : kStartDicLog;
diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/Extract.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/Extract.cpp
index 14aa74072bc..3da0aadb813 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Common/Extract.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Common/Extract.cpp
@@ -359,14 +359,11 @@ HRESULT Extract(
op.stream = NULL;
op.filePath = arcPath;
- HRESULT result = arcLink.Open3(op, openCallback);
+ HRESULT result = arcLink.Open_Strict(op, openCallback);
if (result == E_ABORT)
return result;
- if (result == S_OK && arcLink.NonOpen_ErrorInfo.ErrorFormatIndex >= 0)
- result = S_FALSE;
-
// arcLink.Set_ErrorsText();
RINOK(extractCallback->OpenResult(codecs, arcLink, arcPath, result));
@@ -375,10 +372,10 @@ HRESULT Extract(
thereAreNotOpenArcs = true;
if (!options.StdInMode)
{
- NFind::CFileInfo fi;
- if (fi.Find(us2fs(arcPath)))
- if (!fi.IsDir())
- totalPackProcessed += fi.Size;
+ NFind::CFileInfo fi2;
+ if (fi2.Find(us2fs(arcPath)))
+ if (!fi2.IsDir())
+ totalPackProcessed += fi2.Size;
}
continue;
}
diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/HashCalc.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/HashCalc.cpp
index c33f837fe77..60a747d5590 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Common/HashCalc.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Common/HashCalc.cpp
@@ -101,8 +101,8 @@ HRESULT CHashBundle::SetMethods(DECL_EXTERNAL_CODECS_LOC_VARS const UStringVecto
h.Hasher = hasher;
h.Name = name;
h.DigestSize = digestSize;
- for (unsigned i = 0; i < k_HashCalc_NumGroups; i++)
- memset(h.Digests[i], 0, digestSize);
+ for (unsigned k = 0; k < k_HashCalc_NumGroups; k++)
+ memset(h.Digests[k], 0, digestSize);
}
return S_OK;
diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.cpp
index 4081b0a67d4..bf3b982e44e 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.cpp
@@ -497,7 +497,7 @@ static HRESULT Archive_GetArcProp_UInt(IInArchive *arc, PROPID propid, UInt64 &r
switch (prop.vt)
{
case VT_UI4: result = prop.ulVal; defined = true; break;
- case VT_I4: result = prop.lVal; defined = true; break;
+ case VT_I4: result = (Int64)prop.lVal; defined = true; break;
case VT_UI8: result = (UInt64)prop.uhVal.QuadPart; defined = true; break;
case VT_I8: result = (UInt64)prop.hVal.QuadPart; defined = true; break;
case VT_EMPTY: break;
@@ -582,9 +582,9 @@ HRESULT CArc::GetItemPathToParent(UInt32 index, UInt32 parent, UStringVector &pa
if (prevWasAltStream)
{
{
- UString &s = parts[parts.Size() - 2];
- s += L':';
- s += parts.Back();
+ UString &s2 = parts[parts.Size() - 2];
+ s2 += L':';
+ s2 += parts.Back();
}
parts.DeleteBack();
}
@@ -864,7 +864,7 @@ HRESULT CArc::GetItem(UInt32 index, CReadArcItem &item) const
{
item.MainPath.DeleteFrom(colon);
item.AltStreamName = item.Path.Ptr(colon + 1);
- item.MainIsDir = (colon == 0 || IsPathSepar(item.Path[colon - 1]));
+ item.MainIsDir = (colon == 0 || IsPathSepar(item.Path[(unsigned)colon - 1]));
item.IsAltStream = true;
}
}
@@ -2015,7 +2015,6 @@ HRESULT CArc::OpenStream2(const COpenOptions &op)
const CArcInfoEx &ai = op.codecs->Formats[formatIndex];
if (ai.FindExtension(extension) >= 0)
{
- const CArcInfoEx &ai = op.codecs->Formats[formatIndex];
if (ai.Flags_FindSignature() && searchMarkerInHandler)
return S_FALSE;
}
@@ -3467,6 +3466,8 @@ static bool ParseTypeParams(const UString &s, COpenType &type)
bool ParseType(CCodecs &codecs, const UString &s, COpenType &type)
{
int pos2 = s.Find(L':');
+
+ {
UString name;
if (pos2 < 0)
{
@@ -3501,13 +3502,15 @@ bool ParseType(CCodecs &codecs, const UString &s, COpenType &type)
}
type.FormatIndex = index;
+
+ }
for (unsigned i = pos2; i < s.Len();)
{
int next = s.Find(L':', i);
if (next < 0)
next = s.Len();
- UString name = s.Mid(i, next - i);
+ const UString name = s.Mid(i, next - i);
if (name.IsEmpty())
return false;
if (!ParseTypeParams(name, type))
diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.h b/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.h
index 10514ec4000..d46d69e8a8d 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.h
+++ b/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.h
@@ -401,6 +401,14 @@ struct CArchiveLink
HRESULT Open2(COpenOptions &options, IOpenCallbackUI *callbackUI);
HRESULT Open3(COpenOptions &options, IOpenCallbackUI *callbackUI);
+ HRESULT Open_Strict(COpenOptions &options, IOpenCallbackUI *callbackUI)
+ {
+ HRESULT result = Open3(options, callbackUI);
+ if (result == S_OK && NonOpen_ErrorInfo.ErrorFormatIndex >= 0)
+ result = S_FALSE;
+ return result;
+ }
+
HRESULT ReOpen(COpenOptions &options);
};
diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/Update.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/Update.cpp
index 2dfb210458d..0db4a87f0d4 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Common/Update.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Common/Update.cpp
@@ -251,8 +251,6 @@ STDMETHODIMP COutMultiVolStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *n
STDMETHODIMP COutMultiVolStream::SetSize(UInt64 newSize)
{
- if (newSize < 0)
- return E_INVALIDARG;
unsigned i = 0;
while (i < Streams.Size())
{
@@ -758,15 +756,15 @@ static HRESULT Compress(
return errorInfo.SetFromLastError("cannot open SFX module", options.SfxModule);
CMyComPtr<ISequentialOutStream> sfxOutStream;
- COutFileStream *outStreamSpec = NULL;
+ COutFileStream *outStreamSpec2 = NULL;
if (options.VolumesSizes.Size() == 0)
sfxOutStream = outStream;
else
{
- outStreamSpec = new COutFileStream;
- sfxOutStream = outStreamSpec;
+ outStreamSpec2 = new COutFileStream;
+ sfxOutStream = outStreamSpec2;
FString realPath = us2fs(archivePath.GetFinalPath());
- if (!outStreamSpec->Create(realPath, false))
+ if (!outStreamSpec2->Create(realPath, false))
return errorInfo.SetFromLastError("cannot open file", realPath);
}
@@ -778,9 +776,9 @@ static HRESULT Compress(
RINOK(NCompress::CopyStream(sfxStream, sfxOutStream, NULL));
- if (outStreamSpec)
+ if (outStreamSpec2)
{
- RINOK(outStreamSpec->Close());
+ RINOK(outStreamSpec2->Close());
}
}
@@ -1060,7 +1058,7 @@ HRESULT UpdateArchive(
!options.SetArcPath(codecs, cmdArcPath2))
return E_NOTIMPL;
}
- UString arcPath = options.ArchivePath.GetFinalPath();
+ const UString arcPath = options.ArchivePath.GetFinalPath();
if (cmdArcPath2.IsEmpty())
{
@@ -1088,10 +1086,10 @@ HRESULT UpdateArchive(
return E_NOTIMPL;
if (options.VolumesSizes.Size() > 0)
return E_NOTIMPL;
- CObjectVector<COpenType> types;
+ CObjectVector<COpenType> types2;
// change it.
if (options.MethodMode.Type_Defined)
- types.Add(options.MethodMode.Type);
+ types2.Add(options.MethodMode.Type);
// We need to set Properties to open archive only in some cases (WIM archives).
CIntVector excl;
@@ -1100,7 +1098,7 @@ HRESULT UpdateArchive(
op.props = &options.MethodMode.Properties;
#endif
op.codecs = codecs;
- op.types = &types;
+ op.types = &types2;
op.excludedFormats = &excl;
op.stdInMode = false;
op.stream = NULL;
@@ -1108,14 +1106,11 @@ HRESULT UpdateArchive(
RINOK(callback->StartOpenArchive(arcPath));
- HRESULT result = arcLink.Open3(op, openCallback);
+ HRESULT result = arcLink.Open_Strict(op, openCallback);
if (result == E_ABORT)
return result;
- if (result == S_OK && arcLink.NonOpen_ErrorInfo.ErrorFormatIndex >= 0)
- result = S_FALSE;
-
HRESULT res2 = callback->OpenResult(codecs, arcLink, arcPath, result);
/*
if (result == S_FALSE)
@@ -1289,10 +1284,11 @@ HRESULT UpdateArchive(
}
}
- unsigned i;
- for (i = 0; i < options.Commands.Size(); i++)
+ unsigned ci;
+
+ for (ci = 0; ci < options.Commands.Size(); ci++)
{
- CArchivePath &ap = options.Commands[i].ArchivePath;
+ CArchivePath &ap = options.Commands[ci].ArchivePath;
if (usesTempDir)
{
// Check it
@@ -1301,7 +1297,7 @@ HRESULT UpdateArchive(
// ap.TempPrefix = tempDirPrefix;
}
if (!options.StdOutMode &&
- (i > 0 || !createTempFile))
+ (ci > 0 || !createTempFile))
{
const FString path = us2fs(ap.GetFinalPath());
if (NFind::DoesFileOrDirExist(path))
@@ -1334,7 +1330,7 @@ HRESULT UpdateArchive(
{
unsigned num = dirItems.Items.Size();
processedItems.Alloc(num);
- for (i = 0; i < num; i++)
+ for (unsigned i = 0; i < num; i++)
processedItems[i] = 0;
}
@@ -1348,10 +1344,10 @@ HRESULT UpdateArchive(
#endif
*/
- for (i = 0; i < options.Commands.Size(); i++)
+ for (ci = 0; ci < options.Commands.Size(); ci++)
{
const CArc *arc = thereIsInArchive ? arcLink.GetArc() : NULL;
- CUpdateArchiveCommand &command = options.Commands[i];
+ CUpdateArchiveCommand &command = options.Commands[ci];
UString name;
bool isUpdating;
@@ -1363,7 +1359,7 @@ HRESULT UpdateArchive(
else
{
name = command.ArchivePath.GetFinalPath();
- isUpdating = (i == 0 && options.UpdateArchiveItself && thereIsInArchive);
+ isUpdating = (ci == 0 && options.UpdateArchiveItself && thereIsInArchive);
}
RINOK(callback->StartArchive(name, isUpdating))
@@ -1455,19 +1451,19 @@ HRESULT UpdateArchive(
{
CArchivePath &ap = options.Commands[i].ArchivePath;
FString finalPath = us2fs(ap.GetFinalPath());
- FString arcPath;
- if (!MyGetFullPathName(finalPath, arcPath))
+ FString arcPath2;
+ if (!MyGetFullPathName(finalPath, arcPath2))
return errorInfo.SetFromLastError("GetFullPathName error", finalPath);
- fullPaths.Add(arcPath);
+ fullPaths.Add(arcPath2);
}
CCurrentDirRestorer curDirRestorer;
for (i = 0; i < fullPaths.Size(); i++)
{
- UString arcPath = fs2us(fullPaths[i]);
- UString fileName = ExtractFileNameFromPath(arcPath);
- AString path = GetAnsiString(arcPath);
+ UString arcPath2 = fs2us(fullPaths[i]);
+ UString fileName = ExtractFileNameFromPath(arcPath2);
+ AString path = GetAnsiString(arcPath2);
AString name = GetAnsiString(fileName);
// Warning!!! MAPISendDocuments function changes Current directory
// fnSend(0, ";", (LPSTR)(LPCSTR)path, (LPSTR)(LPCSTR)name, 0);
@@ -1505,6 +1501,8 @@ HRESULT UpdateArchive(
CRecordVector<CRefSortPair> pairs;
FStringVector foldersNames;
+ unsigned i;
+
for (i = 0; i < dirItems.Items.Size(); i++)
{
const CDirItem &dirItem = dirItems.Items[i];
diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp
index 6c439cfd78d..5499f2a1a9f 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp
@@ -219,9 +219,7 @@ STDMETHODIMP CArchiveUpdateCallback::GetRawProp(UInt32 index, PROPID propID, con
return Arc->GetRawProps->GetRawProp(
ArcItems ? (*ArcItems)[up.ArcIndex].IndexInServer : up.ArcIndex,
propID, data, dataSize, propType);
-
{
- const CUpdatePair2 &up = (*UpdatePairs)[index];
/*
if (!up.NewData)
return E_FAIL;
diff --git a/3rdparty/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp b/3rdparty/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp
index 734981886d0..703f821395c 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp
@@ -59,7 +59,10 @@ CCtrlHandlerSetter::~CCtrlHandlerSetter()
{
#if !defined(UNDER_CE) && defined(_WIN32)
if (!SetConsoleCtrlHandler(HandlerRoutine, FALSE))
- throw "SetConsoleCtrlHandler fails";
+ {
+ // warning for throw in destructor.
+ // throw "SetConsoleCtrlHandler fails";
+ }
#endif
}
diff --git a/3rdparty/lzma/CPP/7zip/UI/Console/HashCon.cpp b/3rdparty/lzma/CPP/7zip/UI/Console/HashCon.cpp
index a71e4b50d21..6a82daf2eb2 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Console/HashCon.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Console/HashCon.cpp
@@ -283,7 +283,7 @@ HRESULT CHashCallbackConsole::SetOperationResult(UInt64 fileSize, const CHashBun
return CheckBreak2();
}
-static const char *k_DigestTitles[] =
+static const char * const k_DigestTitles[] =
{
" : "
, " for data: "
diff --git a/3rdparty/lzma/CPP/7zip/UI/Console/List.cpp b/3rdparty/lzma/CPP/7zip/UI/Console/List.cpp
index e70f1b67ed2..62e813b2834 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Console/List.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Console/List.cpp
@@ -900,10 +900,10 @@ HRESULT Print_OpenArchive_Props(CStdOutStream &so, const CCodecs *codecs, const
RINOK(PrintArcProp(so, archive, kpidPhySize, NULL));
if (er.TailSize != 0)
PrintPropNameAndNumber(so, kpidTailSize, er.TailSize);
- UInt32 numProps;
- RINOK(archive->GetNumberOfArchiveProperties(&numProps));
-
{
+ UInt32 numProps;
+ RINOK(archive->GetNumberOfArchiveProperties(&numProps));
+
for (UInt32 j = 0; j < numProps; j++)
{
CMyComBSTR name;
@@ -1068,7 +1068,7 @@ HRESULT ListArchives(CCodecs *codecs,
g_StdOut << endl << kListing << arcPath << endl << endl;
}
- HRESULT result = arcLink.Open3(options, &openCallback);
+ HRESULT result = arcLink.Open_Strict(options, &openCallback);
if (result != S_OK)
{
@@ -1095,9 +1095,6 @@ HRESULT ListArchives(CCodecs *codecs,
}
{
- if (arcLink.NonOpen_ErrorInfo.ErrorFormatIndex >= 0)
- numErrors++;
-
FOR_VECTOR (r, arcLink.Arcs)
{
const CArcErrorInfo &arc = arcLink.Arcs[r].ErrorInfo;
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
index 378ad9035c3..8c38b81aa0a 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
@@ -939,8 +939,8 @@ INT_PTR CProgressDialog::Create(const UString &title, NWindows::CThread &thread,
CWaitCursor waitCursor;
HANDLE h[] = { thread, _createDialogEvent };
- WRes res = WaitForMultipleObjects(ARRAY_SIZE(h), h, FALSE, kCreateDelay);
- if (res == WAIT_OBJECT_0 && !Sync.ThereIsMessage())
+ WRes res2 = WaitForMultipleObjects(ARRAY_SIZE(h), h, FALSE, kCreateDelay);
+ if (res2 == WAIT_OBJECT_0 && !Sync.ThereIsMessage())
return 0;
}
_title = title;
diff --git a/3rdparty/lzma/CPP/Common/TextConfig.cpp b/3rdparty/lzma/CPP/Common/TextConfig.cpp
index 7606ee7b47e..9ae4074b690 100644
--- a/3rdparty/lzma/CPP/Common/TextConfig.cpp
+++ b/3rdparty/lzma/CPP/Common/TextConfig.cpp
@@ -87,7 +87,7 @@ bool GetTextConfig(const AString &s, CObjectVector<CTextConfigPair> &pairs)
break;
if (c == '\\')
{
- char c = s[pos++];
+ c = s[pos++];
switch (c)
{
case 'n': message += '\n'; break;
diff --git a/3rdparty/lzma/CPP/Common/Wildcard.cpp b/3rdparty/lzma/CPP/Common/Wildcard.cpp
index a83f9f104c0..5e6ddfc6e3f 100644
--- a/3rdparty/lzma/CPP/Common/Wildcard.cpp
+++ b/3rdparty/lzma/CPP/Common/Wildcard.cpp
@@ -484,7 +484,7 @@ unsigned GetNumPrefixParts_if_DrivePath(UStringVector &pathParts)
#endif
-static unsigned GetNumPrefixParts(const UStringVector pathParts)
+static unsigned GetNumPrefixParts(const UStringVector &pathParts)
{
if (pathParts.IsEmpty())
return 0;
diff --git a/3rdparty/lzma/CPP/Windows/Control/ComboBox.cpp b/3rdparty/lzma/CPP/Windows/Control/ComboBox.cpp
index c6d5a8d688b..febc61ef992 100644
--- a/3rdparty/lzma/CPP/Windows/Control/ComboBox.cpp
+++ b/3rdparty/lzma/CPP/Windows/Control/ComboBox.cpp
@@ -51,7 +51,7 @@ LRESULT CComboBox::GetLBText(int index, UString &s)
return len;
if (len > len2)
len = len2;
- s.ReleaseBuf_CalcLen(len);
+ s.ReleaseBuf_CalcLen((unsigned)len);
return len;
}
AString sa;
diff --git a/3rdparty/lzma/CPP/Windows/FileFind.cpp b/3rdparty/lzma/CPP/Windows/FileFind.cpp
index 94486977acd..05196f927bd 100644
--- a/3rdparty/lzma/CPP/Windows/FileFind.cpp
+++ b/3rdparty/lzma/CPP/Windows/FileFind.cpp
@@ -130,7 +130,10 @@ WinXP-64 FindFirstFile():
\\Server\ - ERROR_INVALID_NAME
\\Server\Share - ERROR_BAD_NETPATH
- \\Server\Share - ERROR_BAD_NET_NAME (Win7)
+ \\Server\Share - ERROR_BAD_NET_NAME (Win7).
+ !!! There is problem : Win7 makes some requests for "\\Server\Shar" (look in Procmon),
+ when we call it for "\\Server\Share"
+
\\Server\Share\ - ERROR_FILE_NOT_FOUND
\\?\UNC\Server\Share - ERROR_INVALID_NAME
@@ -508,11 +511,10 @@ bool CFileInfo::Find(CFSTR path)
#endif
CFindFile finder;
- if (finder.FindFirst(path, *this))
- return true;
-
+
#if defined(_WIN32) && !defined(UNDER_CE)
{
+ /*
DWORD lastError = GetLastError();
if (lastError == ERROR_FILE_NOT_FOUND
|| lastError == ERROR_BAD_NETPATH // XP64: "\\Server\Share"
@@ -520,36 +522,39 @@ bool CFileInfo::Find(CFSTR path)
|| lastError == ERROR_INVALID_NAME // XP64: "\\?\UNC\Server\Share"
|| lastError == ERROR_BAD_PATHNAME // Win7: "\\?\UNC\Server\Share"
)
+ */
+
+ unsigned rootSize = 0;
+ if (IsSuperPath(path))
+ rootSize = kSuperPathPrefixSize;
+
+ if (NName::IsDrivePath(path + rootSize) && path[rootSize + 3] == 0)
{
- unsigned rootSize = 0;
- if (IsSuperPath(path))
- rootSize = kSuperPathPrefixSize;
- if (IS_PATH_SEPAR(path[0]) && path[1] == 0)
+ DWORD attrib = GetFileAttrib(path);
+ if (attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
- DWORD attrib = GetFileAttrib(path);
- if (attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
- {
- ClearBase();
- Name.Empty();
- Attrib = attrib;
- return true;
- }
+ ClearBase();
+ Attrib = attrib;
+ Name = path + rootSize;
+ Name.DeleteFrom(2); // we don't need backslash (C:)
+ return true;
}
- else if (NName::IsDrivePath(path + rootSize) && path[rootSize + 3] == 0)
+ }
+ else if (IS_PATH_SEPAR(path[0]))
+ if (path[1] == 0)
{
DWORD attrib = GetFileAttrib(path);
if (attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
ClearBase();
+ Name.Empty();
Attrib = attrib;
- Name = path + rootSize;
- Name.DeleteFrom(2); // we don't need backslash (C:)
return true;
}
}
else
{
- unsigned prefixSize = GetNetworkServerPrefixSize(path);
+ const unsigned prefixSize = GetNetworkServerPrefixSize(path);
if (prefixSize > 0 && path[prefixSize] != 0)
{
if (NName::FindSepar(path + prefixSize) < 0)
@@ -563,7 +568,7 @@ bool CFileInfo::Find(CFSTR path)
{
if (Name == FTEXT("."))
{
- Name = path + prefixSize;;
+ Name = path + prefixSize;
return true;
}
isOK = true;
@@ -583,17 +588,17 @@ bool CFileInfo::Find(CFSTR path)
return true;
}
}
- ::SetLastError(lastError);
+ // ::SetLastError(lastError);
}
}
}
- }
}
#endif
-
- return false;
+
+ return finder.FindFirst(path, *this);
}
+
bool DoesFileExist(CFSTR name)
{
CFileInfo fi;
@@ -706,7 +711,7 @@ bool MyGetLogicalDriveStrings(CObjectVector<FString> &driveStrings)
driveStrings.Add(fas2fs(s));
}
}
- return prev == newSize;;
+ return prev == newSize;
}
else
#endif
diff --git a/3rdparty/lzma/CPP/Windows/FileName.cpp b/3rdparty/lzma/CPP/Windows/FileName.cpp
index 382c2e56677..908ed53f4d0 100644
--- a/3rdparty/lzma/CPP/Windows/FileName.cpp
+++ b/3rdparty/lzma/CPP/Windows/FileName.cpp
@@ -374,54 +374,66 @@ static bool ResolveDotsFolders(UString &s)
#ifdef _WIN32
// s.Replace(L'/', WCHAR_PATH_SEPARATOR);
#endif
+
for (unsigned i = 0;;)
{
- wchar_t c = s[i];
+ const wchar_t c = s[i];
if (c == 0)
return true;
if (c == '.' && (i == 0 || IS_SEPAR(s[i - 1])))
{
- wchar_t c1 = s[i + 1];
+ const wchar_t c1 = s[i + 1];
if (c1 == '.')
{
- wchar_t c2 = s[i + 2];
+ const wchar_t c2 = s[i + 2];
if (IS_SEPAR(c2) || c2 == 0)
{
if (i == 0)
return false;
int k = i - 2;
- for (; k >= 0; k--)
- if (IS_SEPAR(s[(unsigned)k]))
+ i += 2;
+
+ for (;; k--)
+ {
+ if (k < 0)
+ return false;
+ if (!IS_SEPAR(s[(unsigned)k]))
break;
+ }
+
+ do
+ k--;
+ while (k >= 0 && !IS_SEPAR(s[(unsigned)k]));
+
unsigned num;
+
if (k >= 0)
{
- num = i + 2 - k;
+ num = i - k;
i = k;
}
else
{
- num = (c2 == 0 ? (i + 2) : (i + 3));
+ num = (c2 == 0 ? i : (i + 1));
i = 0;
}
+
s.Delete(i, num);
continue;
}
}
- else
+ else if (IS_SEPAR(c1) || c1 == 0)
{
- if (IS_SEPAR(c1) || c1 == 0)
- {
- unsigned num = 2;
- if (i != 0)
- i--;
- else if (c1 == 0)
- num = 1;
- s.Delete(i, num);
- continue;
- }
+ unsigned num = 2;
+ if (i != 0)
+ i--;
+ else if (c1 == 0)
+ num = 1;
+ s.Delete(i, num);
+ continue;
}
}
+
i++;
}
}