diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2016-05-23 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:17:00 +0300 |
commit | 1eddf527cacc149016ec987d554d3dfb52b69131 (patch) | |
tree | 1e9577086dd9b3461bc3f6727f7449b7fe45eced /CPP/7zip | |
parent | bec3b479dcae1345a466ebe923989b0bd56fd5b6 (diff) |
16.0216.02
Diffstat (limited to 'CPP/7zip')
-rw-r--r-- | CPP/7zip/Archive/Rar/RarHandler.cpp | 8 | ||||
-rw-r--r-- | CPP/7zip/Archive/Rar/RarHandler.h | 4 | ||||
-rw-r--r-- | CPP/7zip/Archive/Rar/RarHeader.h | 3 | ||||
-rw-r--r-- | CPP/7zip/Archive/SplitHandler.cpp | 10 | ||||
-rw-r--r-- | CPP/7zip/Archive/Wim/WimHandler.cpp | 2 | ||||
-rw-r--r-- | CPP/7zip/Crypto/RarAes.cpp | 8 | ||||
-rw-r--r-- | CPP/7zip/Crypto/RarAes.h | 4 | ||||
-rw-r--r-- | CPP/7zip/Crypto/Sha1Cls.h | 2 | ||||
-rw-r--r-- | CPP/7zip/UI/Common/Bench.cpp | 41 | ||||
-rw-r--r-- | CPP/7zip/UI/Common/OpenArchive.cpp | 4 | ||||
-rw-r--r-- | CPP/7zip/UI/FileManager/LinkDialog.cpp | 2 | ||||
-rw-r--r-- | CPP/7zip/UI/FileManager/PanelCrc.cpp | 4 | ||||
-rw-r--r-- | CPP/7zip/UI/GUI/UpdateGUI.cpp | 2 |
13 files changed, 49 insertions, 45 deletions
diff --git a/CPP/7zip/Archive/Rar/RarHandler.cpp b/CPP/7zip/Archive/Rar/RarHandler.cpp index 71237c93..e858c1ea 100644 --- a/CPP/7zip/Archive/Rar/RarHandler.cpp +++ b/CPP/7zip/Archive/Rar/RarHandler.cpp @@ -220,6 +220,8 @@ HRESULT CInArchive::Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit) ArcInfo.Flags = Get16(buf + 3); UInt32 headerSize = NHeader::NArchive::kArchiveHeaderSize; + + /* if (ArcInfo.IsThereEncryptVer()) { if (blockSize <= headerSize) @@ -229,6 +231,8 @@ HRESULT CInArchive::Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit) ArcInfo.EncryptVersion = buf[NHeader::NArchive::kArchiveHeaderSize]; headerSize += 1; } + */ + if (blockSize < headerSize || buf[2] != NHeader::NBlockType::kArchiveHeader || !CheckHeaderCrc(buf, headerSize)) @@ -509,7 +513,7 @@ HRESULT CInArchive::GetNextItem(CItem &item, ICryptoGetTextPassword *getTextPass m_RarAESSpec = new NCrypto::NRar3::CDecoder; m_RarAES = m_RarAESSpec; } - m_RarAESSpec->SetRar350Mode(ArcInfo.IsEncryptOld()); + // m_RarAESSpec->SetRar350Mode(ArcInfo.IsEncryptOld()); // Salt const UInt32 kSaltSize = 8; @@ -1552,7 +1556,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems, rar3CryptoDecoderSpec = new NCrypto::NRar3::CDecoder; rar3CryptoDecoder = rar3CryptoDecoderSpec; } - rar3CryptoDecoderSpec->SetRar350Mode(item.UnPackVersion < 36); + // rar3CryptoDecoderSpec->SetRar350Mode(item.UnPackVersion < 36); /* CMyComPtr<ICompressSetDecoderProperties2> cryptoProperties; RINOK(rar3CryptoDecoder.QueryInterface(IID_ICompressSetDecoderProperties2, diff --git a/CPP/7zip/Archive/Rar/RarHandler.h b/CPP/7zip/Archive/Rar/RarHandler.h index e280eb57..901406d4 100644 --- a/CPP/7zip/Archive/Rar/RarHandler.h +++ b/CPP/7zip/Archive/Rar/RarHandler.h @@ -41,9 +41,9 @@ struct CInArcInfo bool IsRecovery() const { return (Flags & NHeader::NArchive::kRecovery) != 0; } bool IsEncrypted() const { return (Flags & NHeader::NArchive::kBlockEncryption) != 0; } bool IsFirstVolume() const { return (Flags & NHeader::NArchive::kFirstVolume) != 0; } - bool IsThereEncryptVer() const { return (Flags & NHeader::NArchive::kEncryptVer) != 0; } - bool IsEncryptOld() const { return (!IsThereEncryptVer() || EncryptVersion < 36); } + // bool IsThereEncryptVer() const { return (Flags & NHeader::NArchive::kEncryptVer) != 0; } + // bool IsEncryptOld() const { return (!IsThereEncryptVer() || EncryptVersion < 36); } bool AreMoreVolumes() const { return (EndFlags & NHeader::NArchive::kEndOfArc_Flags_NextVol) != 0; } bool Is_VolNumber_Defined() const { return (EndFlags & NHeader::NArchive::kEndOfArc_Flags_VolNumber) != 0; } diff --git a/CPP/7zip/Archive/Rar/RarHeader.h b/CPP/7zip/Archive/Rar/RarHeader.h index b518338a..30c53ec9 100644 --- a/CPP/7zip/Archive/Rar/RarHeader.h +++ b/CPP/7zip/Archive/Rar/RarHeader.h @@ -41,7 +41,8 @@ namespace NArchive const UInt16 kRecovery = 0x40; const UInt16 kBlockEncryption = 0x80; const UInt16 kFirstVolume = 0x100; // (set only by RAR 3.0 and later) - const UInt16 kEncryptVer = 0x200; // RAR 3.6 there is EncryptVer Byte in End of MainHeader + + // const UInt16 kEncryptVer = 0x200; // RAR 3.6 : that feature was discarded by origial RAR const UInt16 kEndOfArc_Flags_NextVol = 1; const UInt16 kEndOfArc_Flags_DataCRC = 2; diff --git a/CPP/7zip/Archive/SplitHandler.cpp b/CPP/7zip/Archive/SplitHandler.cpp index 4ca417e0..72b52fe7 100644 --- a/CPP/7zip/Archive/SplitHandler.cpp +++ b/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/CPP/7zip/Archive/Wim/WimHandler.cpp b/CPP/7zip/Archive/Wim/WimHandler.cpp index d4f53b9c..27d3298a 100644 --- a/CPP/7zip/Archive/Wim/WimHandler.cpp +++ b/CPP/7zip/Archive/Wim/WimHandler.cpp @@ -388,7 +388,7 @@ static void MethodToProp(int method, int chunksSizeBits, NCOM::CPropVariant &pro char temp[32]; if ((unsigned)method < ARRAY_SIZE(k_Methods)) - strcpy(temp, k_Methods[method]); + strcpy(temp, k_Methods[(unsigned)method]); else ConvertUInt32ToString((unsigned)method, temp); diff --git a/CPP/7zip/Crypto/RarAes.cpp b/CPP/7zip/Crypto/RarAes.cpp index 5bae8529..98e9f62d 100644 --- a/CPP/7zip/Crypto/RarAes.cpp +++ b/CPP/7zip/Crypto/RarAes.cpp @@ -11,8 +11,8 @@ namespace NRar3 { CDecoder::CDecoder(): CAesCbcDecoder(kAesKeySize), _thereIsSalt(false), - _needCalc(true), - _rar350Mode(false) + _needCalc(true) + // _rar350Mode(false) { for (unsigned i = 0; i < sizeof(_salt); i++) _salt[i] = 0; @@ -111,9 +111,9 @@ void CDecoder::CalcKey() UInt32 i; for (i = 0; i < kNumRounds; i++) { - sha.UpdateRar(buf, rawSize, _rar350Mode); + sha.UpdateRar(buf, rawSize /* , _rar350Mode */); Byte pswNum[3] = { (Byte)i, (Byte)(i >> 8), (Byte)(i >> 16) }; - sha.UpdateRar(pswNum, 3, _rar350Mode); + sha.UpdateRar(pswNum, 3 /* , _rar350Mode */); if (i % (kNumRounds / 16) == 0) { NSha1::CContext shaTemp = sha; diff --git a/CPP/7zip/Crypto/RarAes.h b/CPP/7zip/Crypto/RarAes.h index 083b4104..645da1af 100644 --- a/CPP/7zip/Crypto/RarAes.h +++ b/CPP/7zip/Crypto/RarAes.h @@ -24,7 +24,7 @@ class CDecoder: Byte _salt[8]; bool _thereIsSalt; bool _needCalc; - bool _rar350Mode; + // bool _rar350Mode; CByteBuffer _password; @@ -44,7 +44,7 @@ public: HRESULT SetDecoderProperties2(const Byte *data, UInt32 size); CDecoder(); - void SetRar350Mode(bool rar350Mode) { _rar350Mode = rar350Mode; } + // void SetRar350Mode(bool rar350Mode) { _rar350Mode = rar350Mode; } }; }} diff --git a/CPP/7zip/Crypto/Sha1Cls.h b/CPP/7zip/Crypto/Sha1Cls.h index 18c761f9..71acbdec 100644 --- a/CPP/7zip/Crypto/Sha1Cls.h +++ b/CPP/7zip/Crypto/Sha1Cls.h @@ -28,7 +28,7 @@ class CContext: public CContextBase { public: void Update(const Byte *data, size_t size) throw() { Sha1_Update(&_s, data, size); } - void UpdateRar(Byte *data, size_t size, bool rar350Mode) throw() { Sha1_Update_Rar(&_s, data, size, rar350Mode ? 1 : 0); } + void UpdateRar(Byte *data, size_t size /* , bool rar350Mode */) throw() { Sha1_Update_Rar(&_s, data, size /* , rar350Mode ? 1 : 0 */); } void Final(Byte *digest) throw() { Sha1_Final(&_s, digest); } }; diff --git a/CPP/7zip/UI/Common/Bench.cpp b/CPP/7zip/UI/Common/Bench.cpp index 255c8273..ecbacbc9 100644 --- a/CPP/7zip/UI/Common/Bench.cpp +++ b/CPP/7zip/UI/Common/Bench.cpp @@ -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; @@ -2712,7 +2712,7 @@ HRESULT Bench( f.NewLine(); f.Print("Size"); - const int kFieldSize_CrcSpeed = 6; + const unsigned kFieldSize_CrcSpeed = 6; unsigned numThreadsTests = 0; for (;;) { @@ -2875,7 +2875,7 @@ HRESULT Bench( showFreq = true; } - int fileldSize = kFieldSize_TotalSize; + unsigned fileldSize = kFieldSize_TotalSize; if (showFreq) fileldSize += kFieldSize_EUAndEffec; @@ -2943,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; diff --git a/CPP/7zip/UI/Common/OpenArchive.cpp b/CPP/7zip/UI/Common/OpenArchive.cpp index 49da1c97..bf3b982e 100644 --- a/CPP/7zip/UI/Common/OpenArchive.cpp +++ b/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; @@ -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; } } diff --git a/CPP/7zip/UI/FileManager/LinkDialog.cpp b/CPP/7zip/UI/FileManager/LinkDialog.cpp index ac12a0eb..2ef2da5b 100644 --- a/CPP/7zip/UI/FileManager/LinkDialog.cpp +++ b/CPP/7zip/UI/FileManager/LinkDialog.cpp @@ -310,7 +310,7 @@ void CLinkDialog::OnButton_Link() void CApp::Link() { - int srcPanelIndex = GetFocusedPanelIndex(); + unsigned srcPanelIndex = GetFocusedPanelIndex(); CPanel &srcPanel = Panels[srcPanelIndex]; if (!srcPanel.IsFSFolder()) { diff --git a/CPP/7zip/UI/FileManager/PanelCrc.cpp b/CPP/7zip/UI/FileManager/PanelCrc.cpp index 3b0ee052..c9697e8b 100644 --- a/CPP/7zip/UI/FileManager/PanelCrc.cpp +++ b/CPP/7zip/UI/FileManager/PanelCrc.cpp @@ -310,7 +310,7 @@ HRESULT CThreadCrc::ProcessVirt() HRESULT CApp::CalculateCrc2(const UString &methodName) { - int srcPanelIndex = GetFocusedPanelIndex(); + unsigned srcPanelIndex = GetFocusedPanelIndex(); CPanel &srcPanel = Panels[srcPanelIndex]; CRecordVector<UInt32> indices; @@ -379,7 +379,7 @@ void CApp::CalculateCrc(const UString &methodName) HRESULT res = CalculateCrc2(methodName); if (res != S_OK && res != E_ABORT) { - int srcPanelIndex = GetFocusedPanelIndex(); + unsigned srcPanelIndex = GetFocusedPanelIndex(); CPanel &srcPanel = Panels[srcPanelIndex]; srcPanel.MessageBoxError(res); } diff --git a/CPP/7zip/UI/GUI/UpdateGUI.cpp b/CPP/7zip/UI/GUI/UpdateGUI.cpp index 64501306..53864f72 100644 --- a/CPP/7zip/UI/GUI/UpdateGUI.cpp +++ b/CPP/7zip/UI/GUI/UpdateGUI.cpp @@ -343,7 +343,7 @@ static HRESULT ShowDialog( int index = FindActionSet(actionSet); if (index < 0) return E_NOTIMPL; - di.UpdateMode = g_UpdateMode_Pairs[index].UpdateMode; + di.UpdateMode = g_UpdateMode_Pairs[(unsigned)index].UpdateMode; } if (dialog.Create(hwndParent) != IDOK) |