diff options
Diffstat (limited to 'CPP')
50 files changed, 345 insertions, 178 deletions
diff --git a/CPP/7zip/Archive/7z/7zIn.cpp b/CPP/7zip/Archive/7z/7zIn.cpp index e2efc52..eb39478 100644 --- a/CPP/7zip/Archive/7z/7zIn.cpp +++ b/CPP/7zip/Archive/7z/7zIn.cpp | |||
| @@ -698,22 +698,24 @@ void CInArchive::ReadPackInfo(CFolders &f) | |||
| 698 | 698 | ||
| 699 | WaitId(NID::kSize); | 699 | WaitId(NID::kSize); |
| 700 | f.PackPositions.Alloc(numPackStreams + 1); | 700 | f.PackPositions.Alloc(numPackStreams + 1); |
| 701 | UInt64 * const packPositions = f.PackPositions; | ||
| 701 | f.NumPackStreams = numPackStreams; | 702 | f.NumPackStreams = numPackStreams; |
| 702 | UInt64 sum = 0; | 703 | UInt64 sum = 0; |
| 703 | for (CNum i = 0; i < numPackStreams; i++) | 704 | for (CNum i = 0;;) |
| 704 | { | 705 | { |
| 705 | f.PackPositions[i] = sum; | 706 | packPositions[i] = sum; |
| 707 | if (i == numPackStreams) | ||
| 708 | break; | ||
| 709 | i++; | ||
| 706 | const UInt64 packSize = ReadNumber(); | 710 | const UInt64 packSize = ReadNumber(); |
| 707 | sum += packSize; | 711 | sum += packSize; |
| 708 | if (sum < packSize) | 712 | if (sum < packSize) |
| 709 | ThrowIncorrect(); | 713 | ThrowIncorrect(); |
| 710 | } | 714 | } |
| 711 | f.PackPositions[numPackStreams] = sum; | ||
| 712 | 715 | ||
| 713 | UInt64 type; | ||
| 714 | for (;;) | 716 | for (;;) |
| 715 | { | 717 | { |
| 716 | type = ReadID(); | 718 | const UInt64 type = ReadID(); |
| 717 | if (type == NID::kEnd) | 719 | if (type == NID::kEnd) |
| 718 | return; | 720 | return; |
| 719 | if (type == NID::kCRC) | 721 | if (type == NID::kCRC) |
| @@ -857,19 +859,20 @@ void CInArchive::ReadUnpackInfo( | |||
| 857 | StreamUsed[index] = true; | 859 | StreamUsed[index] = true; |
| 858 | } | 860 | } |
| 859 | 861 | ||
| 860 | for (i = 0; i < numCoders; i++) | 862 | for (i = 0;;) |
| 863 | { | ||
| 861 | if (!CoderUsed[i]) | 864 | if (!CoderUsed[i]) |
| 862 | { | ||
| 863 | indexOfMainStream = i; | ||
| 864 | break; | 865 | break; |
| 865 | } | 866 | if (++i == numCoders) |
| 866 | 867 | ThrowUnsupported(); | |
| 867 | if (i == numCoders) | 868 | } |
| 868 | ThrowUnsupported(); | 869 | indexOfMainStream = i; |
| 869 | } | 870 | } |
| 870 | 871 | ||
| 871 | folders.FoToCoderUnpackSizes[fo] = numCodersOutStreams; | 872 | folders.FoToCoderUnpackSizes[fo] = numCodersOutStreams; |
| 872 | numCodersOutStreams += numCoders; | 873 | numCodersOutStreams += numCoders; |
| 874 | if (numCodersOutStreams < numCoders) | ||
| 875 | ThrowUnsupported(); | ||
| 873 | folders.FoStartPackStreamIndex[fo] = packStreamIndex; | 876 | folders.FoStartPackStreamIndex[fo] = packStreamIndex; |
| 874 | if (numPackStreams > folders.NumPackStreams - packStreamIndex) | 877 | if (numPackStreams > folders.NumPackStreams - packStreamIndex) |
| 875 | ThrowIncorrect(); | 878 | ThrowIncorrect(); |
| @@ -880,7 +883,7 @@ void CInArchive::ReadUnpackInfo( | |||
| 880 | const size_t dataSize = (size_t)(_inByteBack->GetPtr() - startBufPtr); | 883 | const size_t dataSize = (size_t)(_inByteBack->GetPtr() - startBufPtr); |
| 881 | folders.FoToCoderUnpackSizes[fo] = numCodersOutStreams; | 884 | folders.FoToCoderUnpackSizes[fo] = numCodersOutStreams; |
| 882 | folders.FoStartPackStreamIndex[fo] = packStreamIndex; | 885 | folders.FoStartPackStreamIndex[fo] = packStreamIndex; |
| 883 | folders.FoCodersDataOffset[fo] = (size_t)(_inByteBack->GetPtr() - startBufPtr); | 886 | folders.FoCodersDataOffset[fo] = dataSize; |
| 884 | folders.CodersData.CopyFrom(startBufPtr, dataSize); | 887 | folders.CodersData.CopyFrom(startBufPtr, dataSize); |
| 885 | 888 | ||
| 886 | // if (folders.NumPackStreams != packStreamIndex) ThrowUnsupported(); | 889 | // if (folders.NumPackStreams != packStreamIndex) ThrowUnsupported(); |
| @@ -898,6 +901,8 @@ void CInArchive::ReadUnpackInfo( | |||
| 898 | return; | 901 | return; |
| 899 | if (type == NID::kCRC) | 902 | if (type == NID::kCRC) |
| 900 | { | 903 | { |
| 904 | if (!folders.FolderCRCs.Defs.IsEmpty()) | ||
| 905 | ThrowIncorrect(); | ||
| 901 | ReadHashDigests(numFolders, folders.FolderCRCs); | 906 | ReadHashDigests(numFolders, folders.FolderCRCs); |
| 902 | continue; | 907 | continue; |
| 903 | } | 908 | } |
| @@ -911,19 +916,35 @@ void CInArchive::ReadSubStreamsInfo( | |||
| 911 | CUInt32DefVector &digests) | 916 | CUInt32DefVector &digests) |
| 912 | { | 917 | { |
| 913 | folders.NumUnpackStreamsVector.Alloc(folders.NumFolders); | 918 | folders.NumUnpackStreamsVector.Alloc(folders.NumFolders); |
| 914 | CNum i; | ||
| 915 | for (i = 0; i < folders.NumFolders; i++) | ||
| 916 | folders.NumUnpackStreamsVector[i] = 1; | ||
| 917 | 919 | ||
| 920 | bool NumUnpackStream_isFilled = false; | ||
| 918 | UInt64 type; | 921 | UInt64 type; |
| 922 | |||
| 923 | CNum numUnpackStreams = folders.NumFolders; | ||
| 919 | 924 | ||
| 920 | for (;;) | 925 | for (;;) |
| 921 | { | 926 | { |
| 922 | type = ReadID(); | 927 | type = ReadID(); |
| 923 | if (type == NID::kNumUnpackStream) | 928 | if (type == NID::kNumUnpackStream) |
| 924 | { | 929 | { |
| 925 | for (i = 0; i < folders.NumFolders; i++) | 930 | if (NumUnpackStream_isFilled) |
| 926 | folders.NumUnpackStreamsVector[i] = ReadNum(); | 931 | ThrowIncorrect(); |
| 932 | NumUnpackStream_isFilled = true; | ||
| 933 | CNum numFolders = folders.NumFolders; | ||
| 934 | numUnpackStreams = 0; | ||
| 935 | if (numFolders) | ||
| 936 | { | ||
| 937 | UInt32 *dest = folders.NumUnpackStreamsVector.NonConstData(); | ||
| 938 | do | ||
| 939 | { | ||
| 940 | const CNum num = ReadNum(); | ||
| 941 | *dest++ = num; | ||
| 942 | numUnpackStreams += num; | ||
| 943 | if (numUnpackStreams < num) | ||
| 944 | ThrowUnsupported(); | ||
| 945 | } | ||
| 946 | while (--numFolders); | ||
| 947 | } | ||
| 927 | continue; | 948 | continue; |
| 928 | } | 949 | } |
| 929 | if (type == NID::kCRC || type == NID::kSize || type == NID::kEnd) | 950 | if (type == NID::kCRC || type == NID::kSize || type == NID::kEnd) |
| @@ -931,6 +952,20 @@ void CInArchive::ReadSubStreamsInfo( | |||
| 931 | SkipData(); | 952 | SkipData(); |
| 932 | } | 953 | } |
| 933 | 954 | ||
| 955 | if (!NumUnpackStream_isFilled) | ||
| 956 | { | ||
| 957 | CNum numFolders = folders.NumFolders; | ||
| 958 | if (numFolders) | ||
| 959 | { | ||
| 960 | UInt32 *dest = folders.NumUnpackStreamsVector.NonConstData(); | ||
| 961 | do | ||
| 962 | *dest++ = 1; | ||
| 963 | while (--numFolders); | ||
| 964 | } | ||
| 965 | } | ||
| 966 | |||
| 967 | unpackSizes.ClearAndReserve(numUnpackStreams); | ||
| 968 | CNum i; | ||
| 934 | if (type == NID::kSize) | 969 | if (type == NID::kSize) |
| 935 | { | 970 | { |
| 936 | for (i = 0; i < folders.NumFolders; i++) | 971 | for (i = 0; i < folders.NumFolders; i++) |
| @@ -943,16 +978,20 @@ void CInArchive::ReadSubStreamsInfo( | |||
| 943 | UInt64 sum = 0; | 978 | UInt64 sum = 0; |
| 944 | for (CNum j = 1; j < numSubstreams; j++) | 979 | for (CNum j = 1; j < numSubstreams; j++) |
| 945 | { | 980 | { |
| 981 | if (unpackSizes.Size() >= numUnpackStreams) | ||
| 982 | ThrowIncorrect(); // internal failure | ||
| 946 | const UInt64 size = ReadNumber(); | 983 | const UInt64 size = ReadNumber(); |
| 947 | unpackSizes.Add(size); | 984 | unpackSizes.AddInReserved(size); |
| 948 | sum += size; | 985 | sum += size; |
| 949 | if (sum < size) | 986 | if (sum < size) |
| 950 | ThrowIncorrect(); | 987 | ThrowIncorrect(); |
| 951 | } | 988 | } |
| 989 | if (unpackSizes.Size() >= numUnpackStreams) | ||
| 990 | ThrowIncorrect(); // internal failure | ||
| 952 | const UInt64 folderUnpackSize = folders.GetFolderUnpackSize(i); | 991 | const UInt64 folderUnpackSize = folders.GetFolderUnpackSize(i); |
| 953 | if (folderUnpackSize < sum) | 992 | if (folderUnpackSize < sum) |
| 954 | ThrowIncorrect(); | 993 | ThrowIncorrect(); |
| 955 | unpackSizes.Add(folderUnpackSize - sum); | 994 | unpackSizes.AddInReserved(folderUnpackSize - sum); |
| 956 | } | 995 | } |
| 957 | type = ReadID(); | 996 | type = ReadID(); |
| 958 | } | 997 | } |
| @@ -966,10 +1005,17 @@ void CInArchive::ReadSubStreamsInfo( | |||
| 966 | if (val > 1) | 1005 | if (val > 1) |
| 967 | ThrowIncorrect(); | 1006 | ThrowIncorrect(); |
| 968 | if (val == 1) | 1007 | if (val == 1) |
| 969 | unpackSizes.Add(folders.GetFolderUnpackSize(i)); | 1008 | { |
| 1009 | if (unpackSizes.Size() >= numUnpackStreams) | ||
| 1010 | ThrowIncorrect(); // internal failure | ||
| 1011 | unpackSizes.AddInReserved(folders.GetFolderUnpackSize(i)); | ||
| 1012 | } | ||
| 970 | } | 1013 | } |
| 971 | } | 1014 | } |
| 972 | 1015 | ||
| 1016 | if (unpackSizes.Size() != numUnpackStreams) | ||
| 1017 | ThrowIncorrect(); | ||
| 1018 | |||
| 973 | unsigned numDigests = 0; | 1019 | unsigned numDigests = 0; |
| 974 | for (i = 0; i < folders.NumFolders; i++) | 1020 | for (i = 0; i < folders.NumFolders; i++) |
| 975 | { | 1021 | { |
| @@ -984,6 +1030,8 @@ void CInArchive::ReadSubStreamsInfo( | |||
| 984 | break; | 1030 | break; |
| 985 | if (type == NID::kCRC) | 1031 | if (type == NID::kCRC) |
| 986 | { | 1032 | { |
| 1033 | if (!digests.Defs.IsEmpty()) | ||
| 1034 | ThrowIncorrect(); | ||
| 987 | // CUInt32DefVector digests2; | 1035 | // CUInt32DefVector digests2; |
| 988 | // ReadHashDigests(numDigests, digests2); | 1036 | // ReadHashDigests(numDigests, digests2); |
| 989 | CBoolVector digests2; | 1037 | CBoolVector digests2; |
| @@ -1092,10 +1140,13 @@ void CInArchive::ReadStreamsInfo( | |||
| 1092 | So we don't need to fill digests with values. */ | 1140 | So we don't need to fill digests with values. */ |
| 1093 | // digests.Vals.ClearAndSetSize(folders.NumFolders); | 1141 | // digests.Vals.ClearAndSetSize(folders.NumFolders); |
| 1094 | // BoolVector_Fill_False(digests.Defs, folders.NumFolders); | 1142 | // BoolVector_Fill_False(digests.Defs, folders.NumFolders); |
| 1143 | unpackSizes.ClearAndSetSize(folders.NumFolders); | ||
| 1144 | UInt64 * const unpackSizes2 = unpackSizes.NonConstData(); | ||
| 1145 | CNum * const numUnpackStreamsVector2 = folders.NumUnpackStreamsVector; | ||
| 1095 | for (CNum i = 0; i < folders.NumFolders; i++) | 1146 | for (CNum i = 0; i < folders.NumFolders; i++) |
| 1096 | { | 1147 | { |
| 1097 | folders.NumUnpackStreamsVector[i] = 1; | 1148 | numUnpackStreamsVector2[i] = 1; |
| 1098 | unpackSizes.Add(folders.GetFolderUnpackSize(i)); | 1149 | unpackSizes2[i] = folders.GetFolderUnpackSize(i); |
| 1099 | // digests.Vals[i] = 0; | 1150 | // digests.Vals[i] = 0; |
| 1100 | } | 1151 | } |
| 1101 | } | 1152 | } |
| @@ -1648,8 +1699,8 @@ HRESULT CInArchive::ReadDatabase2( | |||
| 1648 | db.PhySize = kHeaderSize; | 1699 | db.PhySize = kHeaderSize; |
| 1649 | 1700 | ||
| 1650 | db.IsArc = false; | 1701 | db.IsArc = false; |
| 1651 | if ((Int64)nextHeaderOffset < 0 || | 1702 | if (nextHeaderOffset >= (UInt64)1 << 62 || |
| 1652 | nextHeaderSize > ((UInt64)1 << 62)) | 1703 | nextHeaderSize > ((UInt64)1 << 48)) |
| 1653 | return S_FALSE; | 1704 | return S_FALSE; |
| 1654 | 1705 | ||
| 1655 | HeadersSize = kHeaderSize; | 1706 | HeadersSize = kHeaderSize; |
diff --git a/CPP/7zip/Archive/7z/7zUpdate.cpp b/CPP/7zip/Archive/7z/7zUpdate.cpp index 6ba04a2..b05d3cf 100644 --- a/CPP/7zip/Archive/7z/7zUpdate.cpp +++ b/CPP/7zip/Archive/7z/7zUpdate.cpp | |||
| @@ -36,13 +36,6 @@ struct CFilterMode | |||
| 36 | UInt32 Offset; // for k_ARM64 / k_RISCV | 36 | UInt32 Offset; // for k_ARM64 / k_RISCV |
| 37 | // UInt32 AlignSizeOpt; // for k_ARM64 | 37 | // UInt32 AlignSizeOpt; // for k_ARM64 |
| 38 | 38 | ||
| 39 | CFilterMode(): | ||
| 40 | Id(0), | ||
| 41 | Delta(0), | ||
| 42 | Offset(0) | ||
| 43 | // , AlignSizeOpt(0) | ||
| 44 | {} | ||
| 45 | |||
| 46 | void ClearFilterMode() | 39 | void ClearFilterMode() |
| 47 | { | 40 | { |
| 48 | Id = 0; | 41 | Id = 0; |
| @@ -437,7 +430,11 @@ struct CFilterMode2: public CFilterMode | |||
| 437 | bool Encrypted; | 430 | bool Encrypted; |
| 438 | unsigned GroupIndex; | 431 | unsigned GroupIndex; |
| 439 | 432 | ||
| 440 | CFilterMode2(): Encrypted(false) {} | 433 | void Construct() |
| 434 | { | ||
| 435 | ClearFilterMode(); | ||
| 436 | Encrypted = false; | ||
| 437 | } | ||
| 441 | 438 | ||
| 442 | int Compare(const CFilterMode2 &m) const | 439 | int Compare(const CFilterMode2 &m) const |
| 443 | { | 440 | { |
| @@ -546,6 +543,7 @@ static unsigned Get_FilterGroup_for_Folder( | |||
| 546 | CRecordVector<CFilterMode2> &filters, const CFolderEx &f, bool extractFilter) | 543 | CRecordVector<CFilterMode2> &filters, const CFolderEx &f, bool extractFilter) |
| 547 | { | 544 | { |
| 548 | CFilterMode2 m; | 545 | CFilterMode2 m; |
| 546 | m.Construct(); | ||
| 549 | // m.Id = 0; | 547 | // m.Id = 0; |
| 550 | // m.Delta = 0; | 548 | // m.Delta = 0; |
| 551 | // m.Offset = 0; | 549 | // m.Offset = 0; |
| @@ -795,14 +793,14 @@ struct CRefItem | |||
| 795 | unsigned NamePos; | 793 | unsigned NamePos; |
| 796 | unsigned ExtensionIndex; | 794 | unsigned ExtensionIndex; |
| 797 | 795 | ||
| 798 | CRefItem() {} | 796 | void Construct(UInt32 index, const CUpdateItem &ui, bool sortByType) |
| 799 | CRefItem(UInt32 index, const CUpdateItem &ui, bool sortByType): | ||
| 800 | UpdateItem(&ui), | ||
| 801 | Index(index), | ||
| 802 | ExtensionPos(0), | ||
| 803 | NamePos(0), | ||
| 804 | ExtensionIndex(0) | ||
| 805 | { | 797 | { |
| 798 | UpdateItem = &ui; | ||
| 799 | Index = index; | ||
| 800 | ExtensionPos = 0; | ||
| 801 | NamePos = 0; | ||
| 802 | ExtensionIndex = 0; | ||
| 803 | |||
| 806 | if (sortByType) | 804 | if (sortByType) |
| 807 | { | 805 | { |
| 808 | const int slashPos = ui.Name.ReverseFind_PathSepar(); | 806 | const int slashPos = ui.Name.ReverseFind_PathSepar(); |
| @@ -2154,6 +2152,7 @@ HRESULT Update( | |||
| 2154 | continue; | 2152 | continue; |
| 2155 | 2153 | ||
| 2156 | CFilterMode2 fm; | 2154 | CFilterMode2 fm; |
| 2155 | fm.Construct(); | ||
| 2157 | if (useFilters) | 2156 | if (useFilters) |
| 2158 | { | 2157 | { |
| 2159 | // analysis.ATime_Defined = false; | 2158 | // analysis.ATime_Defined = false; |
| @@ -2710,7 +2709,7 @@ HRESULT Update( | |||
| 2710 | unsigned i; | 2709 | unsigned i; |
| 2711 | 2710 | ||
| 2712 | for (i = 0; i < numFiles; i++) | 2711 | for (i = 0; i < numFiles; i++) |
| 2713 | refItems[i] = CRefItem(group.Indices[i], updateItems[group.Indices[i]], sortByType); | 2712 | refItems[i].Construct(group.Indices[i], updateItems[group.Indices[i]], sortByType); |
| 2714 | 2713 | ||
| 2715 | CSortParam sortParam; | 2714 | CSortParam sortParam; |
| 2716 | // sortParam.TreeFolders = &treeFolders; | 2715 | // sortParam.TreeFolders = &treeFolders; |
diff --git a/CPP/7zip/Archive/ApfsHandler.cpp b/CPP/7zip/Archive/ApfsHandler.cpp index 62b00ed..2876991 100644 --- a/CPP/7zip/Archive/ApfsHandler.cpp +++ b/CPP/7zip/Archive/ApfsHandler.cpp | |||
| @@ -3487,7 +3487,7 @@ static const CStatProp kProps[] = | |||
| 3487 | { NULL, kpidChangeTime, VT_FILETIME }, | 3487 | { NULL, kpidChangeTime, VT_FILETIME }, |
| 3488 | { "Added Time", kpidAddTime, VT_FILETIME }, | 3488 | { "Added Time", kpidAddTime, VT_FILETIME }, |
| 3489 | { NULL, kpidMethod, VT_BSTR }, | 3489 | { NULL, kpidMethod, VT_BSTR }, |
| 3490 | { NULL, kpidINode, VT_UI8 }, | 3490 | { NULL, kpidINode, VT_UI4 }, |
| 3491 | { NULL, kpidLinks, VT_UI4 }, | 3491 | { NULL, kpidLinks, VT_UI4 }, |
| 3492 | { NULL, kpidSymLink, VT_BSTR }, | 3492 | { NULL, kpidSymLink, VT_BSTR }, |
| 3493 | { NULL, kpidUserId, VT_UI4 }, | 3493 | { NULL, kpidUserId, VT_UI4 }, |
| @@ -3496,7 +3496,7 @@ static const CStatProp kProps[] = | |||
| 3496 | #ifdef APFS_SHOW_ALT_STREAMS | 3496 | #ifdef APFS_SHOW_ALT_STREAMS |
| 3497 | { NULL, kpidIsAltStream, VT_BOOL }, | 3497 | { NULL, kpidIsAltStream, VT_BOOL }, |
| 3498 | #endif | 3498 | #endif |
| 3499 | { "Parent iNode", kpidParentINode, VT_UI8 }, | 3499 | { "Parent iNode", kpidParentINode, VT_UI4 }, |
| 3500 | { "Primary Name", kpidPrimeName, VT_BSTR }, | 3500 | { "Primary Name", kpidPrimeName, VT_BSTR }, |
| 3501 | { "Generation", kpidGeneration, VT_UI4 }, | 3501 | { "Generation", kpidGeneration, VT_UI4 }, |
| 3502 | { "Written Size", kpidBytesWritten, VT_UI8 }, | 3502 | { "Written Size", kpidBytesWritten, VT_UI8 }, |
diff --git a/CPP/7zip/Archive/ExtHandler.cpp b/CPP/7zip/Archive/ExtHandler.cpp index 5af2a92..d379373 100644 --- a/CPP/7zip/Archive/ExtHandler.cpp +++ b/CPP/7zip/Archive/ExtHandler.cpp | |||
| @@ -628,6 +628,8 @@ struct CNode | |||
| 628 | UInt32 Gid; // fixed 21.02 | 628 | UInt32 Gid; // fixed 21.02 |
| 629 | // UInt16 Checksum; | 629 | // UInt16 Checksum; |
| 630 | 630 | ||
| 631 | UInt32 NumLinksCalced; | ||
| 632 | |||
| 631 | UInt64 FileSize; | 633 | UInt64 FileSize; |
| 632 | CExtTime MTime; | 634 | CExtTime MTime; |
| 633 | CExtTime ATime; | 635 | CExtTime ATime; |
| @@ -639,17 +641,16 @@ struct CNode | |||
| 639 | UInt32 NumLinks; | 641 | UInt32 NumLinks; |
| 640 | UInt32 Flags; | 642 | UInt32 Flags; |
| 641 | 643 | ||
| 642 | UInt32 NumLinksCalced; | ||
| 643 | |||
| 644 | Byte Block[kNodeBlockFieldSize]; | 644 | Byte Block[kNodeBlockFieldSize]; |
| 645 | 645 | ||
| 646 | CNode(): | 646 | void Construct() |
| 647 | ParentNode(-1), | 647 | { |
| 648 | ItemIndex(-1), | 648 | ParentNode = -1; |
| 649 | SymLinkIndex(-1), | 649 | ItemIndex = -1; |
| 650 | DirIndex(-1), | 650 | SymLinkIndex = -1; |
| 651 | NumLinksCalced(0) | 651 | DirIndex = -1; |
| 652 | {} | 652 | NumLinksCalced = 0; |
| 653 | } | ||
| 653 | 654 | ||
| 654 | bool IsFlags_HUGE() const { return (Flags & k_NodeFlags_HUGE) != 0; } | 655 | bool IsFlags_HUGE() const { return (Flags & k_NodeFlags_HUGE) != 0; } |
| 655 | bool IsFlags_EXTENTS() const { return (Flags & k_NodeFlags_EXTENTS) != 0; } | 656 | bool IsFlags_EXTENTS() const { return (Flags & k_NodeFlags_EXTENTS) != 0; } |
| @@ -1172,21 +1173,19 @@ HRESULT CHandler::Open2(IInStream *inStream) | |||
| 1172 | { | 1173 | { |
| 1173 | // ---------- Read groups ---------- | 1174 | // ---------- Read groups ---------- |
| 1174 | 1175 | ||
| 1175 | CByteBuffer gdBuf; | ||
| 1176 | const size_t gdBufSize = (size_t)numGroups << gdBits; | 1176 | const size_t gdBufSize = (size_t)numGroups << gdBits; |
| 1177 | if ((gdBufSize >> gdBits) != numGroups) | 1177 | if ((gdBufSize >> gdBits) != numGroups) |
| 1178 | return S_FALSE; | 1178 | return S_FALSE; |
| 1179 | CByteBuffer gdBuf; | ||
| 1179 | gdBuf.Alloc(gdBufSize); | 1180 | gdBuf.Alloc(gdBufSize); |
| 1180 | RINOK(SeekAndRead(inStream, (_h.BlockBits <= 10 ? 2 : 1), gdBuf, gdBufSize)) | 1181 | RINOK(SeekAndRead(inStream, (_h.BlockBits <= 10 ? 2 : 1), gdBuf, gdBufSize)) |
| 1181 | 1182 | ||
| 1182 | for (unsigned i = 0; i < numGroups; i++) | 1183 | const unsigned gd_Size = (unsigned)1 << gdBits; |
| 1184 | const Byte *p = gdBuf; | ||
| 1185 | for (unsigned i = 0; i < numGroups; i++, p += gd_Size) | ||
| 1183 | { | 1186 | { |
| 1184 | CGroupDescriptor gd; | 1187 | CGroupDescriptor gd; |
| 1185 | |||
| 1186 | const Byte *p = gdBuf + ((size_t)i << gdBits); | ||
| 1187 | const unsigned gd_Size = (unsigned)1 << gdBits; | ||
| 1188 | gd.Parse(p, gd_Size); | 1188 | gd.Parse(p, gd_Size); |
| 1189 | |||
| 1190 | if (_h.UseMetadataChecksum()) | 1189 | if (_h.UseMetadataChecksum()) |
| 1191 | { | 1190 | { |
| 1192 | // use CRC32c | 1191 | // use CRC32c |
| @@ -1228,7 +1227,10 @@ HRESULT CHandler::Open2(IInStream *inStream) | |||
| 1228 | if (numNodes > (1 << 24)) | 1227 | if (numNodes > (1 << 24)) |
| 1229 | return S_FALSE; | 1228 | return S_FALSE; |
| 1230 | } | 1229 | } |
| 1231 | 1230 | ||
| 1231 | const size_t blockSize = (size_t)1 << _h.BlockBits; | ||
| 1232 | if (numNodes > blockSize * 8) | ||
| 1233 | return S_FALSE; | ||
| 1232 | const UInt32 numReserveInodes = _h.NumInodes - _h.NumFreeInodes + 1; | 1234 | const UInt32 numReserveInodes = _h.NumInodes - _h.NumFreeInodes + 1; |
| 1233 | // numReserveInodes = _h.NumInodes + 1; | 1235 | // numReserveInodes = _h.NumInodes + 1; |
| 1234 | if (numReserveInodes != 0) | 1236 | if (numReserveInodes != 0) |
| @@ -1241,7 +1243,6 @@ HRESULT CHandler::Open2(IInStream *inStream) | |||
| 1241 | nodesData.Alloc(nodesDataSize); | 1243 | nodesData.Alloc(nodesDataSize); |
| 1242 | 1244 | ||
| 1243 | CByteBuffer nodesMap; | 1245 | CByteBuffer nodesMap; |
| 1244 | const size_t blockSize = (size_t)1 << _h.BlockBits; | ||
| 1245 | nodesMap.Alloc(blockSize); | 1246 | nodesMap.Alloc(blockSize); |
| 1246 | 1247 | ||
| 1247 | unsigned globalNodeIndex = 0; | 1248 | unsigned globalNodeIndex = 0; |
| @@ -1282,6 +1283,7 @@ HRESULT CHandler::Open2(IInStream *inStream) | |||
| 1282 | } | 1283 | } |
| 1283 | 1284 | ||
| 1284 | CNode node; | 1285 | CNode node; |
| 1286 | node.Construct(); | ||
| 1285 | 1287 | ||
| 1286 | PRF(printf("\nnode = %5d ", (unsigned)n)); | 1288 | PRF(printf("\nnode = %5d ", (unsigned)n)); |
| 1287 | 1289 | ||
diff --git a/CPP/7zip/Archive/HfsHandler.cpp b/CPP/7zip/Archive/HfsHandler.cpp index 46e0239..5df00ed 100644 --- a/CPP/7zip/Archive/HfsHandler.cpp +++ b/CPP/7zip/Archive/HfsHandler.cpp | |||
| @@ -437,7 +437,7 @@ struct CRef | |||
| 437 | int AttrIndex; | 437 | int AttrIndex; |
| 438 | int Parent; | 438 | int Parent; |
| 439 | 439 | ||
| 440 | CRef(): AttrIndex(kAttrIndex_Item), Parent(-1) {} | 440 | void Construct() { AttrIndex = kAttrIndex_Item; Parent = -1; } |
| 441 | bool IsResource() const { return AttrIndex == kAttrIndex_Resource; } | 441 | bool IsResource() const { return AttrIndex == kAttrIndex_Resource; } |
| 442 | bool IsAltStream() const { return AttrIndex != kAttrIndex_Item; } | 442 | bool IsAltStream() const { return AttrIndex != kAttrIndex_Item; } |
| 443 | bool IsItem() const { return AttrIndex == kAttrIndex_Item; } | 443 | bool IsItem() const { return AttrIndex == kAttrIndex_Item; } |
| @@ -1259,6 +1259,7 @@ HRESULT CDatabase::LoadCatalog(const CFork &fork, const CObjectVector<CIdExtents | |||
| 1259 | IdToIndexMap.Add(pair); | 1259 | IdToIndexMap.Add(pair); |
| 1260 | 1260 | ||
| 1261 | CRef ref; | 1261 | CRef ref; |
| 1262 | ref.Construct(); | ||
| 1262 | ref.ItemIndex = i; | 1263 | ref.ItemIndex = i; |
| 1263 | Refs.Add(ref); | 1264 | Refs.Add(ref); |
| 1264 | 1265 | ||
| @@ -1317,6 +1318,7 @@ HRESULT CDatabase::LoadCatalog(const CFork &fork, const CObjectVector<CIdExtents | |||
| 1317 | ThereAreAltStreams = true; | 1318 | ThereAreAltStreams = true; |
| 1318 | 1319 | ||
| 1319 | CRef ref; | 1320 | CRef ref; |
| 1321 | ref.Construct(); | ||
| 1320 | ref.AttrIndex = (int)i; | 1322 | ref.AttrIndex = (int)i; |
| 1321 | ref.Parent = refIndex; | 1323 | ref.Parent = refIndex; |
| 1322 | ref.ItemIndex = Refs[refIndex].ItemIndex; | 1324 | ref.ItemIndex = Refs[refIndex].ItemIndex; |
diff --git a/CPP/7zip/Archive/LpHandler.cpp b/CPP/7zip/Archive/LpHandler.cpp index 926b654..1f44c09 100644 --- a/CPP/7zip/Archive/LpHandler.cpp +++ b/CPP/7zip/Archive/LpHandler.cpp | |||
| @@ -223,12 +223,13 @@ struct CPartition | |||
| 223 | UInt64 GetSize() const { return NumSectors << kSectorSizeLog; } | 223 | UInt64 GetSize() const { return NumSectors << kSectorSizeLog; } |
| 224 | UInt64 GetPackSize() const { return NumSectors_Pack << kSectorSizeLog; } | 224 | UInt64 GetPackSize() const { return NumSectors_Pack << kSectorSizeLog; } |
| 225 | 225 | ||
| 226 | CPartition(): | 226 | void Construct() |
| 227 | MethodsMask(0), | 227 | { |
| 228 | NumSectors(0), | 228 | MethodsMask = 0; |
| 229 | NumSectors_Pack(0), | 229 | NumSectors = 0; |
| 230 | Ext(NULL) | 230 | NumSectors_Pack = 0; |
| 231 | {} | 231 | Ext = NULL; |
| 232 | } | ||
| 232 | }; | 233 | }; |
| 233 | 234 | ||
| 234 | 235 | ||
| @@ -609,6 +610,7 @@ HRESULT CHandler::Open2(IInStream *stream) | |||
| 609 | for (UInt32 i = 0; i < d.num_entries; i++) | 610 | for (UInt32 i = 0; i < d.num_entries; i++) |
| 610 | { | 611 | { |
| 611 | CPartition part; | 612 | CPartition part; |
| 613 | part.Construct(); | ||
| 612 | part.Parse(buffer + d.offset + i * d.entry_size); | 614 | part.Parse(buffer + d.offset + i * d.entry_size); |
| 613 | const UInt32 extLimit = part.first_extent_index + part.num_extents; | 615 | const UInt32 extLimit = part.first_extent_index + part.num_extents; |
| 614 | if (extLimit < part.first_extent_index || | 616 | if (extLimit < part.first_extent_index || |
diff --git a/CPP/7zip/Archive/LvmHandler.cpp b/CPP/7zip/Archive/LvmHandler.cpp index 8d1655e..9e6fed2 100644 --- a/CPP/7zip/Archive/LvmHandler.cpp +++ b/CPP/7zip/Archive/LvmHandler.cpp | |||
| @@ -1050,8 +1050,6 @@ Z7_COM7F_IMF(CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val | |||
| 1050 | COM_TRY_BEGIN | 1050 | COM_TRY_BEGIN |
| 1051 | NCOM::CPropVariant prop; | 1051 | NCOM::CPropVariant prop; |
| 1052 | 1052 | ||
| 1053 | const CItem &item = _items[index]; | ||
| 1054 | |||
| 1055 | // const CLogVol &item = _items[index]; | 1053 | // const CLogVol &item = _items[index]; |
| 1056 | 1054 | ||
| 1057 | if (index >= _items.Size()) | 1055 | if (index >= _items.Size()) |
| @@ -1070,6 +1068,7 @@ Z7_COM7F_IMF(CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val | |||
| 1070 | } | 1068 | } |
| 1071 | else | 1069 | else |
| 1072 | { | 1070 | { |
| 1071 | const CItem &item = _items[index]; | ||
| 1073 | switch (propID) | 1072 | switch (propID) |
| 1074 | { | 1073 | { |
| 1075 | case kpidPath: | 1074 | case kpidPath: |
diff --git a/CPP/7zip/Archive/MbrHandler.cpp b/CPP/7zip/Archive/MbrHandler.cpp index 82d34fd..53663e8 100644 --- a/CPP/7zip/Archive/MbrHandler.cpp +++ b/CPP/7zip/Archive/MbrHandler.cpp | |||
| @@ -53,7 +53,12 @@ struct CChs | |||
| 53 | SectCyl = p[1]; | 53 | SectCyl = p[1]; |
| 54 | Cyl8 = p[2]; | 54 | Cyl8 = p[2]; |
| 55 | } | 55 | } |
| 56 | bool Check() const { return GetSector() > 0; } | 56 | bool Check() const |
| 57 | { | ||
| 58 | if ((Head | SectCyl | Cyl8) == 0) | ||
| 59 | return true; | ||
| 60 | return GetSector() > 0; | ||
| 61 | } | ||
| 57 | }; | 62 | }; |
| 58 | 63 | ||
| 59 | 64 | ||
diff --git a/CPP/7zip/Archive/Nsis/NsisIn.cpp b/CPP/7zip/Archive/Nsis/NsisIn.cpp index 194e5bf..577062e 100644 --- a/CPP/7zip/Archive/Nsis/NsisIn.cpp +++ b/CPP/7zip/Archive/Nsis/NsisIn.cpp | |||
| @@ -190,7 +190,7 @@ static const CCommandInfo k_Commands[kNumCmds] = | |||
| 190 | { 2 }, // "SetFileAttributes" }, | 190 | { 2 }, // "SetFileAttributes" }, |
| 191 | { 3 }, // CreateDirectory, SetOutPath | 191 | { 3 }, // CreateDirectory, SetOutPath |
| 192 | { 3 }, // "IfFileExists" }, | 192 | { 3 }, // "IfFileExists" }, |
| 193 | { 3 }, // SetRebootFlag, ... | 193 | { 4 }, // SetRebootFlag, ... |
| 194 | { 4 }, // "If" }, // IfAbort, IfSilent, IfErrors, IfRebootFlag | 194 | { 4 }, // "If" }, // IfAbort, IfSilent, IfErrors, IfRebootFlag |
| 195 | { 2 }, // "Get" }, // GetInstDirError, GetErrorLevel | 195 | { 2 }, // "Get" }, // GetInstDirError, GetErrorLevel |
| 196 | { 4 }, // "Rename" }, | 196 | { 4 }, // "Rename" }, |
| @@ -3910,6 +3910,10 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh) | |||
| 3910 | if (params[2] != 0) | 3910 | if (params[2] != 0) |
| 3911 | { | 3911 | { |
| 3912 | s += " lastused"; | 3912 | s += " lastused"; |
| 3913 | // (params[3] == (UInt32)(Int32)-1) is possible in NSIS 3.10. | ||
| 3914 | // SetDetailsPrint lastused (special) | ||
| 3915 | if ((Int32)params[3] < 0) | ||
| 3916 | s += " ; (special)"; | ||
| 3913 | break; | 3917 | break; |
| 3914 | } | 3918 | } |
| 3915 | UInt32 v; | 3919 | UInt32 v; |
diff --git a/CPP/7zip/Archive/NtfsHandler.cpp b/CPP/7zip/Archive/NtfsHandler.cpp index d26612b..006f0ad 100644 --- a/CPP/7zip/Archive/NtfsHandler.cpp +++ b/CPP/7zip/Archive/NtfsHandler.cpp | |||
| @@ -1433,7 +1433,12 @@ struct CItem | |||
| 1433 | int ParentHost; /* index in Items array, if it's AltStream | 1433 | int ParentHost; /* index in Items array, if it's AltStream |
| 1434 | -1: if it's not AltStream */ | 1434 | -1: if it's not AltStream */ |
| 1435 | 1435 | ||
| 1436 | CItem(): DataIndex(k_Item_DataIndex_IsDir), ParentFolder(-1), ParentHost(-1) {} | 1436 | void Construct() |
| 1437 | { | ||
| 1438 | DataIndex = k_Item_DataIndex_IsDir; | ||
| 1439 | ParentFolder = -1; | ||
| 1440 | ParentHost = -1; | ||
| 1441 | } | ||
| 1437 | 1442 | ||
| 1438 | bool IsAltStream() const { return ParentHost != -1; } | 1443 | bool IsAltStream() const { return ParentHost != -1; } |
| 1439 | bool IsDir() const { return DataIndex == k_Item_DataIndex_IsDir; } | 1444 | bool IsDir() const { return DataIndex == k_Item_DataIndex_IsDir; } |
| @@ -2060,6 +2065,7 @@ HRESULT CDatabase::Open() | |||
| 2060 | } | 2065 | } |
| 2061 | 2066 | ||
| 2062 | CItem item; | 2067 | CItem item; |
| 2068 | item.Construct(); | ||
| 2063 | item.NameIndex = t; | 2069 | item.NameIndex = t; |
| 2064 | item.RecIndex = i; | 2070 | item.RecIndex = i; |
| 2065 | item.DataIndex = rec.IsDir() ? | 2071 | item.DataIndex = rec.IsDir() ? |
diff --git a/CPP/7zip/Archive/PeHandler.cpp b/CPP/7zip/Archive/PeHandler.cpp index 79f89ef..f5f66b0 100644 --- a/CPP/7zip/Archive/PeHandler.cpp +++ b/CPP/7zip/Archive/PeHandler.cpp | |||
| @@ -758,7 +758,13 @@ struct CMixItem | |||
| 758 | int StringIndex; | 758 | int StringIndex; |
| 759 | int VersionIndex; | 759 | int VersionIndex; |
| 760 | 760 | ||
| 761 | CMixItem(): SectionIndex(-1), ResourceIndex(-1), StringIndex(-1), VersionIndex(-1) {} | 761 | void Construct() |
| 762 | { | ||
| 763 | SectionIndex = -1; | ||
| 764 | ResourceIndex = -1; | ||
| 765 | StringIndex = -1; | ||
| 766 | VersionIndex = -1; | ||
| 767 | } | ||
| 762 | bool IsSectionItem() const { return ResourceIndex < 0 && StringIndex < 0 && VersionIndex < 0; } | 768 | bool IsSectionItem() const { return ResourceIndex < 0 && StringIndex < 0 && VersionIndex < 0; } |
| 763 | }; | 769 | }; |
| 764 | 770 | ||
| @@ -820,20 +826,22 @@ Z7_CLASS_IMP_CHandler_IInArchive_2( | |||
| 820 | CObjectVector<CStringKeyValue> _versionKeys; | 826 | CObjectVector<CStringKeyValue> _versionKeys; |
| 821 | 827 | ||
| 822 | CByteBuffer _buf; | 828 | CByteBuffer _buf; |
| 829 | |||
| 823 | bool _oneLang; | 830 | bool _oneLang; |
| 824 | UString _resourcesPrefix; | ||
| 825 | CUsedBitmap _usedRes; | ||
| 826 | // bool _parseResources; | 831 | // bool _parseResources; |
| 827 | bool _checksumError; | 832 | bool _checksumError; |
| 828 | bool _sectionsError; | 833 | bool _sectionsError; |
| 829 | 834 | ||
| 835 | bool _coffMode; | ||
| 836 | bool _allowTail; | ||
| 837 | |||
| 838 | UString _resourcesPrefix; | ||
| 839 | CUsedBitmap _usedRes; | ||
| 840 | |||
| 830 | bool IsOpt() const { return _header.OptHeaderSize != 0; } | 841 | bool IsOpt() const { return _header.OptHeaderSize != 0; } |
| 831 | 842 | ||
| 832 | COptHeader _optHeader; | 843 | COptHeader _optHeader; |
| 833 | 844 | ||
| 834 | bool _coffMode; | ||
| 835 | bool _allowTail; | ||
| 836 | |||
| 837 | HRESULT LoadDebugSections(IInStream *stream, bool &thereIsSection); | 845 | HRESULT LoadDebugSections(IInStream *stream, bool &thereIsSection); |
| 838 | HRESULT Open2(IInStream *stream, IArchiveOpenCallback *callback); | 846 | HRESULT Open2(IInStream *stream, IArchiveOpenCallback *callback); |
| 839 | 847 | ||
| @@ -2269,6 +2277,7 @@ HRESULT CHandler::OpenResources(unsigned sectionIndex, IInStream *stream, IArchi | |||
| 2269 | if (ParseVersion((const Byte *)_buf + offset, item.Size, f, _versionKeys)) | 2277 | if (ParseVersion((const Byte *)_buf + offset, item.Size, f, _versionKeys)) |
| 2270 | { | 2278 | { |
| 2271 | CMixItem mixItem; | 2279 | CMixItem mixItem; |
| 2280 | mixItem.Construct(); | ||
| 2272 | mixItem.VersionIndex = (int)_versionFiles.Size(); | 2281 | mixItem.VersionIndex = (int)_versionFiles.Size(); |
| 2273 | mixItem.SectionIndex = (int)sectionIndex; // check it !!!! | 2282 | mixItem.SectionIndex = (int)sectionIndex; // check it !!!! |
| 2274 | CByteBuffer_WithLang &vf = _versionFiles.AddNew(); | 2283 | CByteBuffer_WithLang &vf = _versionFiles.AddNew(); |
| @@ -2300,6 +2309,7 @@ HRESULT CHandler::OpenResources(unsigned sectionIndex, IInStream *stream, IArchi | |||
| 2300 | if (_strings[i].FinalSize() == 0) | 2309 | if (_strings[i].FinalSize() == 0) |
| 2301 | continue; | 2310 | continue; |
| 2302 | CMixItem mixItem; | 2311 | CMixItem mixItem; |
| 2312 | mixItem.Construct(); | ||
| 2303 | mixItem.StringIndex = (int)i; | 2313 | mixItem.StringIndex = (int)i; |
| 2304 | mixItem.SectionIndex = (int)sectionIndex; | 2314 | mixItem.SectionIndex = (int)sectionIndex; |
| 2305 | _mixItems.Add(mixItem); | 2315 | _mixItems.Add(mixItem); |
| @@ -2654,6 +2664,7 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback) | |||
| 2654 | if (item.Enabled) | 2664 | if (item.Enabled) |
| 2655 | { | 2665 | { |
| 2656 | CMixItem mixItem; | 2666 | CMixItem mixItem; |
| 2667 | mixItem.Construct(); | ||
| 2657 | mixItem.SectionIndex = (int)i; | 2668 | mixItem.SectionIndex = (int)i; |
| 2658 | mixItem.ResourceIndex = (int)j; | 2669 | mixItem.ResourceIndex = (int)j; |
| 2659 | if (item.IsRcDataOrUnknown()) | 2670 | if (item.IsRcDataOrUnknown()) |
| @@ -2717,6 +2728,7 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback) | |||
| 2717 | } | 2728 | } |
| 2718 | 2729 | ||
| 2719 | CMixItem mixItem; | 2730 | CMixItem mixItem; |
| 2731 | mixItem.Construct(); | ||
| 2720 | mixItem.SectionIndex = (int)i; | 2732 | mixItem.SectionIndex = (int)i; |
| 2721 | _mixItems.Add(mixItem); | 2733 | _mixItems.Add(mixItem); |
| 2722 | } | 2734 | } |
diff --git a/CPP/7zip/Archive/SparseHandler.cpp b/CPP/7zip/Archive/SparseHandler.cpp index 5e666ed..70bcb6f 100644 --- a/CPP/7zip/Archive/SparseHandler.cpp +++ b/CPP/7zip/Archive/SparseHandler.cpp | |||
| @@ -78,7 +78,7 @@ struct CChunk | |||
| 78 | Byte Fill [kFillSize]; | 78 | Byte Fill [kFillSize]; |
| 79 | UInt64 PhyOffset; | 79 | UInt64 PhyOffset; |
| 80 | 80 | ||
| 81 | CChunk() | 81 | void Construct() |
| 82 | { | 82 | { |
| 83 | Fill[0] = | 83 | Fill[0] = |
| 84 | Fill[1] = | 84 | Fill[1] = |
| @@ -293,6 +293,7 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *openCallback) | |||
| 293 | if (size < kChunkHeaderSize) | 293 | if (size < kChunkHeaderSize) |
| 294 | return S_FALSE; | 294 | return S_FALSE; |
| 295 | CChunk c; | 295 | CChunk c; |
| 296 | c.Construct(); | ||
| 296 | c.PhyOffset = offset + kChunkHeaderSize; | 297 | c.PhyOffset = offset + kChunkHeaderSize; |
| 297 | c.VirtBlock = virtBlock; | 298 | c.VirtBlock = virtBlock; |
| 298 | offset += size; | 299 | offset += size; |
| @@ -364,6 +365,7 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *openCallback) | |||
| 364 | 365 | ||
| 365 | { | 366 | { |
| 366 | CChunk c; | 367 | CChunk c; |
| 368 | c.Construct(); | ||
| 367 | c.VirtBlock = virtBlock; | 369 | c.VirtBlock = virtBlock; |
| 368 | c.PhyOffset = offset; | 370 | c.PhyOffset = offset; |
| 369 | Chunks.AddInReserved(c); | 371 | Chunks.AddInReserved(c); |
diff --git a/CPP/7zip/Archive/SquashfsHandler.cpp b/CPP/7zip/Archive/SquashfsHandler.cpp index b66be04..83cb1cf 100644 --- a/CPP/7zip/Archive/SquashfsHandler.cpp +++ b/CPP/7zip/Archive/SquashfsHandler.cpp | |||
| @@ -812,7 +812,7 @@ struct CItem | |||
| 812 | int Parent; | 812 | int Parent; |
| 813 | UInt32 Ptr; | 813 | UInt32 Ptr; |
| 814 | 814 | ||
| 815 | CItem(): Node(-1), Parent(-1), Ptr(0) {} | 815 | void Construct() { Node = -1; Parent = -1; Ptr = 0; } |
| 816 | }; | 816 | }; |
| 817 | 817 | ||
| 818 | struct CData | 818 | struct CData |
| @@ -1497,7 +1497,7 @@ HRESULT CHandler::OpenDir(int parent, UInt32 startBlock, UInt32 offset, unsigned | |||
| 1497 | if (rem == 0) | 1497 | if (rem == 0) |
| 1498 | return S_FALSE; | 1498 | return S_FALSE; |
| 1499 | 1499 | ||
| 1500 | UInt32 nameOffset = _h.GetFileNameOffset(); | 1500 | const UInt32 nameOffset = _h.GetFileNameOffset(); |
| 1501 | if (rem < nameOffset) | 1501 | if (rem < nameOffset) |
| 1502 | return S_FALSE; | 1502 | return S_FALSE; |
| 1503 | 1503 | ||
| @@ -1505,7 +1505,7 @@ HRESULT CHandler::OpenDir(int parent, UInt32 startBlock, UInt32 offset, unsigned | |||
| 1505 | return S_FALSE; | 1505 | return S_FALSE; |
| 1506 | if (_openCallback) | 1506 | if (_openCallback) |
| 1507 | { | 1507 | { |
| 1508 | UInt64 numFiles = _items.Size(); | 1508 | const UInt64 numFiles = _items.Size(); |
| 1509 | if ((numFiles & 0xFFFF) == 0) | 1509 | if ((numFiles & 0xFFFF) == 0) |
| 1510 | { | 1510 | { |
| 1511 | RINOK(_openCallback->SetCompleted(&numFiles, NULL)) | 1511 | RINOK(_openCallback->SetCompleted(&numFiles, NULL)) |
| @@ -1513,6 +1513,7 @@ HRESULT CHandler::OpenDir(int parent, UInt32 startBlock, UInt32 offset, unsigned | |||
| 1513 | } | 1513 | } |
| 1514 | 1514 | ||
| 1515 | CItem item; | 1515 | CItem item; |
| 1516 | item.Construct(); | ||
| 1516 | item.Ptr = (UInt32)(p - (const Byte *)_dirs.Data); | 1517 | item.Ptr = (UInt32)(p - (const Byte *)_dirs.Data); |
| 1517 | 1518 | ||
| 1518 | UInt32 size; | 1519 | UInt32 size; |
diff --git a/CPP/7zip/Archive/Wim/WimHandlerOut.cpp b/CPP/7zip/Archive/Wim/WimHandlerOut.cpp index 3b2cb31..0fd7d23 100644 --- a/CPP/7zip/Archive/Wim/WimHandlerOut.cpp +++ b/CPP/7zip/Archive/Wim/WimHandlerOut.cpp | |||
| @@ -177,7 +177,12 @@ struct CUpdateItem | |||
| 177 | int InArcIndex; // >= 0, if we use OLD Data | 177 | int InArcIndex; // >= 0, if we use OLD Data |
| 178 | // -1, if we use NEW Data | 178 | // -1, if we use NEW Data |
| 179 | 179 | ||
| 180 | CUpdateItem(): MetaIndex(-1), AltStreamIndex(-1), InArcIndex(-1) {} | 180 | void Construct() |
| 181 | { | ||
| 182 | MetaIndex = -1; | ||
| 183 | AltStreamIndex = -1; | ||
| 184 | InArcIndex = -1; | ||
| 185 | } | ||
| 181 | }; | 186 | }; |
| 182 | 187 | ||
| 183 | 188 | ||
| @@ -894,6 +899,7 @@ Z7_COM7F_IMF(CHandler::UpdateItems(ISequentialOutStream *outSeqStream, UInt32 nu | |||
| 894 | for (i = 0; i < numItems; i++) | 899 | for (i = 0; i < numItems; i++) |
| 895 | { | 900 | { |
| 896 | CUpdateItem ui; | 901 | CUpdateItem ui; |
| 902 | ui.Construct(); | ||
| 897 | UInt32 indexInArchive; | 903 | UInt32 indexInArchive; |
| 898 | Int32 newData, newProps; | 904 | Int32 newData, newProps; |
| 899 | RINOK(callback->GetUpdateItemInfo(i, &newData, &newProps, &indexInArchive)) | 905 | RINOK(callback->GetUpdateItemInfo(i, &newData, &newProps, &indexInArchive)) |
diff --git a/CPP/7zip/Archive/Wim/WimIn.cpp b/CPP/7zip/Archive/Wim/WimIn.cpp index b2236dd..33fbe82 100644 --- a/CPP/7zip/Archive/Wim/WimIn.cpp +++ b/CPP/7zip/Archive/Wim/WimIn.cpp | |||
| @@ -609,6 +609,7 @@ HRESULT CDatabase::ParseDirItem(size_t pos, int parent, unsigned dirLevel) | |||
| 609 | return S_FALSE; | 609 | return S_FALSE; |
| 610 | 610 | ||
| 611 | CItem item; | 611 | CItem item; |
| 612 | item.Construct(); | ||
| 612 | const UInt32 attrib = Get32(p + 8); | 613 | const UInt32 attrib = Get32(p + 8); |
| 613 | item.IsDir = ((attrib & 0x10) != 0); | 614 | item.IsDir = ((attrib & 0x10) != 0); |
| 614 | { | 615 | { |
| @@ -729,6 +730,7 @@ HRESULT CDatabase::ParseDirItem(size_t pos, int parent, unsigned dirLevel) | |||
| 729 | { | 730 | { |
| 730 | ThereAreAltStreams = true; | 731 | ThereAreAltStreams = true; |
| 731 | CItem item2; | 732 | CItem item2; |
| 733 | item2.Construct(); | ||
| 732 | item2.Offset = pos; | 734 | item2.Offset = pos; |
| 733 | item2.IsAltStream = true; | 735 | item2.IsAltStream = true; |
| 734 | item2.Parent = (int)prevIndex; | 736 | item2.Parent = (int)prevIndex; |
| @@ -1531,6 +1533,7 @@ HRESULT CDatabase::FillAndCheck(const CObjectVector<CVolume> &volumes) | |||
| 1531 | if (!r.IsSolidBig() || Solids[r.SolidIndex].FirstSmallStream < 0) | 1533 | if (!r.IsSolidBig() || Solids[r.SolidIndex].FirstSmallStream < 0) |
| 1532 | { | 1534 | { |
| 1533 | CItem item; | 1535 | CItem item; |
| 1536 | item.Construct(); | ||
| 1534 | item.Offset = 0; | 1537 | item.Offset = 0; |
| 1535 | item.StreamIndex = (int)i; | 1538 | item.StreamIndex = (int)i; |
| 1536 | item.ImageIndex = -1; | 1539 | item.ImageIndex = -1; |
diff --git a/CPP/7zip/Archive/Wim/WimIn.h b/CPP/7zip/Archive/Wim/WimIn.h index 571f414..ae7cd6b 100644 --- a/CPP/7zip/Archive/Wim/WimIn.h +++ b/CPP/7zip/Archive/Wim/WimIn.h | |||
| @@ -347,15 +347,16 @@ struct CItem | |||
| 347 | 347 | ||
| 348 | bool HasMetadata() const { return ImageIndex >= 0; } | 348 | bool HasMetadata() const { return ImageIndex >= 0; } |
| 349 | 349 | ||
| 350 | CItem(): | 350 | void Construct() |
| 351 | IndexInSorted(-1), | 351 | { |
| 352 | StreamIndex(-1), | 352 | IndexInSorted = -1; |
| 353 | Parent(-1), | 353 | StreamIndex = -1; |
| 354 | IsDir(false), | 354 | Parent = -1; |
| 355 | IsAltStream(false), | 355 | IsDir = false; |
| 356 | DirLevel(0), | 356 | IsAltStream = false; |
| 357 | SubDirOffset(0) | 357 | DirLevel = 0; |
| 358 | {} | 358 | SubDirOffset = 0; |
| 359 | } | ||
| 359 | }; | 360 | }; |
| 360 | 361 | ||
| 361 | struct CImage | 362 | struct CImage |
diff --git a/CPP/7zip/Common/CreateCoder.cpp b/CPP/7zip/Common/CreateCoder.cpp index 93113a0..67873d1 100644 --- a/CPP/7zip/Common/CreateCoder.cpp +++ b/CPP/7zip/Common/CreateCoder.cpp | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | #include "StdAfx.h" | 3 | #include "StdAfx.h" |
| 4 | 4 | ||
| 5 | #include "../../Windows/Defs.h" | 5 | #include "../../Windows/WinDefs.h" |
| 6 | #include "../../Windows/PropVariant.h" | 6 | #include "../../Windows/PropVariant.h" |
| 7 | 7 | ||
| 8 | #include "CreateCoder.h" | 8 | #include "CreateCoder.h" |
diff --git a/CPP/7zip/Common/MethodProps.h b/CPP/7zip/Common/MethodProps.h index be108fa..f7ba569 100644 --- a/CPP/7zip/Common/MethodProps.h +++ b/CPP/7zip/Common/MethodProps.h | |||
| @@ -6,8 +6,7 @@ | |||
| 6 | #include "../../Common/MyString.h" | 6 | #include "../../Common/MyString.h" |
| 7 | #include "../../Common/Defs.h" | 7 | #include "../../Common/Defs.h" |
| 8 | 8 | ||
| 9 | #include "../../Windows/Defs.h" | 9 | #include "../../Windows/WinDefs.h" |
| 10 | |||
| 11 | #include "../../Windows/PropVariant.h" | 10 | #include "../../Windows/PropVariant.h" |
| 12 | 11 | ||
| 13 | #include "../ICoder.h" | 12 | #include "../ICoder.h" |
diff --git a/CPP/7zip/Common/PropId.cpp b/CPP/7zip/Common/PropId.cpp index 6117b0e..b00ad81 100644 --- a/CPP/7zip/Common/PropId.cpp +++ b/CPP/7zip/Common/PropId.cpp | |||
| @@ -3,10 +3,8 @@ | |||
| 3 | #include "StdAfx.h" | 3 | #include "StdAfx.h" |
| 4 | 4 | ||
| 5 | #include "../../Common/MyWindows.h" | 5 | #include "../../Common/MyWindows.h" |
| 6 | |||
| 7 | #include "../PropID.h" | 6 | #include "../PropID.h" |
| 8 | 7 | ||
| 9 | // VARTYPE | ||
| 10 | const Byte k7z_PROPID_To_VARTYPE[kpid_NUM_DEFINED] = | 8 | const Byte k7z_PROPID_To_VARTYPE[kpid_NUM_DEFINED] = |
| 11 | { | 9 | { |
| 12 | VT_EMPTY, | 10 | VT_EMPTY, |
| @@ -84,7 +82,7 @@ const Byte k7z_PROPID_To_VARTYPE[kpid_NUM_DEFINED] = | |||
| 84 | VT_UI4, | 82 | VT_UI4, |
| 85 | VT_BSTR, | 83 | VT_BSTR, |
| 86 | VT_UI8, | 84 | VT_UI8, |
| 87 | VT_UI8, | 85 | VT_UI4, // kpidNumAltStreams |
| 88 | VT_UI8, | 86 | VT_UI8, |
| 89 | VT_UI8, | 87 | VT_UI8, |
| 90 | VT_UI8, | 88 | VT_UI8, |
diff --git a/CPP/7zip/Compress/CodecExports.cpp b/CPP/7zip/Compress/CodecExports.cpp index e37ae14..70be760 100644 --- a/CPP/7zip/Compress/CodecExports.cpp +++ b/CPP/7zip/Compress/CodecExports.cpp | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "../../Common/ComTry.h" | 8 | #include "../../Common/ComTry.h" |
| 9 | #include "../../Common/MyCom.h" | 9 | #include "../../Common/MyCom.h" |
| 10 | 10 | ||
| 11 | #include "../../Windows/Defs.h" | 11 | #include "../../Windows/WinDefs.h" |
| 12 | #include "../../Windows/PropVariant.h" | 12 | #include "../../Windows/PropVariant.h" |
| 13 | 13 | ||
| 14 | #include "../ICoder.h" | 14 | #include "../ICoder.h" |
diff --git a/CPP/7zip/UI/Agent/AgentOut.cpp b/CPP/7zip/UI/Agent/AgentOut.cpp index 903cde2..265b943 100644 --- a/CPP/7zip/UI/Agent/AgentOut.cpp +++ b/CPP/7zip/UI/Agent/AgentOut.cpp | |||
| @@ -497,6 +497,7 @@ HRESULT CAgent::CreateFolder(ISequentialOutStream *outArchiveStream, | |||
| 497 | updatePairs.Add(up2); | 497 | updatePairs.Add(up2); |
| 498 | } | 498 | } |
| 499 | CUpdatePair2 up2; | 499 | CUpdatePair2 up2; |
| 500 | up2.Construct(); | ||
| 500 | up2.NewData = up2.NewProps = true; | 501 | up2.NewData = up2.NewProps = true; |
| 501 | up2.UseArcProps = false; | 502 | up2.UseArcProps = false; |
| 502 | up2.DirIndex = 0; | 503 | up2.DirIndex = 0; |
diff --git a/CPP/7zip/UI/Agent/AgentProxy.cpp b/CPP/7zip/UI/Agent/AgentProxy.cpp index d04ddab..c8edd19 100644 --- a/CPP/7zip/UI/Agent/AgentProxy.cpp +++ b/CPP/7zip/UI/Agent/AgentProxy.cpp | |||
| @@ -233,11 +233,26 @@ void CProxyArc::CalculateSizes(unsigned dirIndex, IInArchive *archive) | |||
| 233 | } | 233 | } |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | |||
| 237 | void CProxyArc::FreeFiles() | ||
| 238 | { | ||
| 239 | const unsigned numFiles = NumFiles; | ||
| 240 | NumFiles = 0; | ||
| 241 | CProxyFile *f = Files; | ||
| 242 | for (unsigned i = 0; i < numFiles; i++, f++) | ||
| 243 | if (f->NeedDeleteName) | ||
| 244 | delete [](wchar_t *)(void *)f->Name; | ||
| 245 | delete []Files; | ||
| 246 | Files = NULL; | ||
| 247 | } | ||
| 248 | |||
| 249 | static const UInt32 k_NumFiles_Max = 0x7fffffff - 15; | ||
| 250 | |||
| 236 | HRESULT CProxyArc::Load(const CArc &arc, IProgress *progress) | 251 | HRESULT CProxyArc::Load(const CArc &arc, IProgress *progress) |
| 237 | { | 252 | { |
| 238 | // DWORD tickCount = GetTickCount(); for (int ttt = 0; ttt < 1; ttt++) { | 253 | // DWORD tickCount = GetTickCount(); for (int ttt = 0; ttt < 1; ttt++) { |
| 239 | 254 | ||
| 240 | Files.Free(); | 255 | FreeFiles(); |
| 241 | Dirs.Clear(); | 256 | Dirs.Clear(); |
| 242 | 257 | ||
| 243 | Dirs.AddNew(); | 258 | Dirs.AddNew(); |
| @@ -245,11 +260,15 @@ HRESULT CProxyArc::Load(const CArc &arc, IProgress *progress) | |||
| 245 | 260 | ||
| 246 | UInt32 numItems; | 261 | UInt32 numItems; |
| 247 | RINOK(archive->GetNumberOfItems(&numItems)) | 262 | RINOK(archive->GetNumberOfItems(&numItems)) |
| 263 | if (numItems > k_NumFiles_Max) | ||
| 264 | return E_OUTOFMEMORY; | ||
| 248 | 265 | ||
| 249 | if (progress) | 266 | if (progress) |
| 250 | RINOK(progress->SetTotal(numItems)) | 267 | RINOK(progress->SetTotal(numItems)) |
| 251 | 268 | ||
| 252 | Files.Alloc(numItems); | 269 | Z7_ARRAY_NEW(Files, CProxyFile, numItems) |
| 270 | memset(Files, 0, (size_t)numItems * sizeof(*Files)); | ||
| 271 | NumFiles = numItems; | ||
| 253 | 272 | ||
| 254 | UString path; | 273 | UString path; |
| 255 | UString name; | 274 | UString name; |
| @@ -375,6 +394,7 @@ HRESULT CProxyArc::Load(const CArc &arc, IProgress *progress) | |||
| 375 | RINOK(Archive_IsItem_Dir(archive, i, isDir)) | 394 | RINOK(Archive_IsItem_Dir(archive, i, isDir)) |
| 376 | 395 | ||
| 377 | CProxyFile &f = Files[i]; | 396 | CProxyFile &f = Files[i]; |
| 397 | f.Construct(); // optional because memset() in code above | ||
| 378 | 398 | ||
| 379 | f.NameLen = len - namePos; | 399 | f.NameLen = len - namePos; |
| 380 | s += namePos; | 400 | s += namePos; |
| @@ -579,6 +599,19 @@ bool CProxyArc2::IsThere_SubDir(unsigned dirIndex, const UString &name) const | |||
| 579 | return false; | 599 | return false; |
| 580 | } | 600 | } |
| 581 | 601 | ||
| 602 | |||
| 603 | void CProxyArc2::FreeFiles() | ||
| 604 | { | ||
| 605 | const unsigned numFiles = NumFiles; | ||
| 606 | NumFiles = 0; | ||
| 607 | CProxyFile2 *f = Files; | ||
| 608 | for (unsigned i = 0; i < numFiles; i++, f++) | ||
| 609 | if (f->NeedDeleteName) | ||
| 610 | delete [](wchar_t *)(void *)f->Name; | ||
| 611 | delete []Files; | ||
| 612 | Files = NULL; | ||
| 613 | } | ||
| 614 | |||
| 582 | HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress) | 615 | HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress) |
| 583 | { | 616 | { |
| 584 | if (!arc.GetRawProps) | 617 | if (!arc.GetRawProps) |
| @@ -587,12 +620,14 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress) | |||
| 587 | // DWORD tickCount = GetTickCount(); for (int ttt = 0; ttt < 1; ttt++) { | 620 | // DWORD tickCount = GetTickCount(); for (int ttt = 0; ttt < 1; ttt++) { |
| 588 | 621 | ||
| 589 | Dirs.Clear(); | 622 | Dirs.Clear(); |
| 590 | Files.Free(); | 623 | FreeFiles(); |
| 591 | 624 | ||
| 592 | IInArchive *archive = arc.Archive; | 625 | IInArchive *archive = arc.Archive; |
| 593 | 626 | ||
| 594 | UInt32 numItems; | 627 | UInt32 numItems; |
| 595 | RINOK(archive->GetNumberOfItems(&numItems)) | 628 | RINOK(archive->GetNumberOfItems(&numItems)) |
| 629 | if (numItems > k_NumFiles_Max) | ||
| 630 | return E_OUTOFMEMORY; | ||
| 596 | if (progress) | 631 | if (progress) |
| 597 | RINOK(progress->SetTotal(numItems)) | 632 | RINOK(progress->SetTotal(numItems)) |
| 598 | UString fileName; | 633 | UString fileName; |
| @@ -609,7 +644,9 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress) | |||
| 609 | dir.PathPrefix = ':'; | 644 | dir.PathPrefix = ':'; |
| 610 | } | 645 | } |
| 611 | 646 | ||
| 612 | Files.Alloc(numItems); | 647 | Z7_ARRAY_NEW(Files, CProxyFile2, numItems) |
| 648 | memset(Files, 0, (size_t)numItems * sizeof(*Files)); | ||
| 649 | NumFiles = numItems; | ||
| 613 | 650 | ||
| 614 | UString tempUString; | 651 | UString tempUString; |
| 615 | AString tempAString; | 652 | AString tempAString; |
| @@ -619,11 +656,12 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress) | |||
| 619 | { | 656 | { |
| 620 | if (progress && (i & 0xFFFFF) == 0) | 657 | if (progress && (i & 0xFFFFF) == 0) |
| 621 | { | 658 | { |
| 622 | UInt64 currentItemIndex = i; | 659 | const UInt64 currentItemIndex = i; |
| 623 | RINOK(progress->SetCompleted(¤tItemIndex)) | 660 | RINOK(progress->SetCompleted(¤tItemIndex)) |
| 624 | } | 661 | } |
| 625 | 662 | ||
| 626 | CProxyFile2 &file = Files[i]; | 663 | CProxyFile2 &file = Files[i]; |
| 664 | file.Construct(); | ||
| 627 | 665 | ||
| 628 | const void *p; | 666 | const void *p; |
| 629 | UInt32 size; | 667 | UInt32 size; |
diff --git a/CPP/7zip/UI/Agent/AgentProxy.h b/CPP/7zip/UI/Agent/AgentProxy.h index c24dd91..c6736a8 100644 --- a/CPP/7zip/UI/Agent/AgentProxy.h +++ b/CPP/7zip/UI/Agent/AgentProxy.h | |||
| @@ -11,8 +11,12 @@ struct CProxyFile | |||
| 11 | unsigned NameLen; | 11 | unsigned NameLen; |
| 12 | bool NeedDeleteName; | 12 | bool NeedDeleteName; |
| 13 | 13 | ||
| 14 | CProxyFile(): Name(NULL), NameLen(0), NeedDeleteName(false) {} | 14 | void Construct() |
| 15 | ~CProxyFile() { if (NeedDeleteName) delete [](wchar_t *)(void *)Name; } // delete [](wchar_t *)Name; | 15 | { |
| 16 | Name = NULL; | ||
| 17 | NameLen = 0; | ||
| 18 | NeedDeleteName = false; | ||
| 19 | } | ||
| 16 | }; | 20 | }; |
| 17 | 21 | ||
| 18 | const unsigned k_Proxy_RootDirIndex = 0; | 22 | const unsigned k_Proxy_RootDirIndex = 0; |
| @@ -47,9 +51,14 @@ class CProxyArc | |||
| 47 | 51 | ||
| 48 | void CalculateSizes(unsigned dirIndex, IInArchive *archive); | 52 | void CalculateSizes(unsigned dirIndex, IInArchive *archive); |
| 49 | unsigned AddDir(unsigned dirIndex, int arcIndex, const UString &name); | 53 | unsigned AddDir(unsigned dirIndex, int arcIndex, const UString &name); |
| 54 | void FreeFiles(); | ||
| 50 | public: | 55 | public: |
| 51 | CObjectVector<CProxyDir> Dirs; // Dirs[0] - root | 56 | CObjectVector<CProxyDir> Dirs; // Dirs[0] - root |
| 52 | CObjArray<CProxyFile> Files; // all items from archive in same order | 57 | CProxyFile *Files; // all items from archive in same order |
| 58 | unsigned NumFiles; | ||
| 59 | |||
| 60 | CProxyArc(): Files(NULL), NumFiles(0) {} | ||
| 61 | ~CProxyArc() { FreeFiles(); } | ||
| 53 | 62 | ||
| 54 | // returns index in Dirs[], or -1, | 63 | // returns index in Dirs[], or -1, |
| 55 | int FindSubDir(unsigned dirIndex, const wchar_t *name) const; | 64 | int FindSubDir(unsigned dirIndex, const wchar_t *name) const; |
| @@ -83,17 +92,17 @@ struct CProxyFile2 | |||
| 83 | int GetDirIndex(bool forAltStreams) const { return forAltStreams ? AltDirIndex : DirIndex; } | 92 | int GetDirIndex(bool forAltStreams) const { return forAltStreams ? AltDirIndex : DirIndex; } |
| 84 | 93 | ||
| 85 | bool IsDir() const { return DirIndex != -1; } | 94 | bool IsDir() const { return DirIndex != -1; } |
| 86 | CProxyFile2(): | 95 | |
| 87 | DirIndex(-1), AltDirIndex(-1), Parent(-1), | 96 | void Construct() |
| 88 | Name(NULL), NameLen(0), | ||
| 89 | NeedDeleteName(false), | ||
| 90 | Ignore(false), | ||
| 91 | IsAltStream(false) | ||
| 92 | {} | ||
| 93 | ~CProxyFile2() | ||
| 94 | { | 97 | { |
| 95 | if (NeedDeleteName) | 98 | DirIndex = -1; |
| 96 | delete [](wchar_t *)(void *)Name; | 99 | AltDirIndex = -1; |
| 100 | Parent = -1; | ||
| 101 | Name = NULL; | ||
| 102 | NameLen = 0; | ||
| 103 | NeedDeleteName = false; | ||
| 104 | Ignore = false; | ||
| 105 | IsAltStream = false; | ||
| 97 | } | 106 | } |
| 98 | }; | 107 | }; |
| 99 | 108 | ||
| @@ -110,8 +119,6 @@ struct CProxyDir2 | |||
| 110 | UInt32 NumSubFiles; | 119 | UInt32 NumSubFiles; |
| 111 | 120 | ||
| 112 | CProxyDir2(): ArcIndex(-1) {} | 121 | CProxyDir2(): ArcIndex(-1) {} |
| 113 | void AddFileSubItem(UInt32 index, const UString &name); | ||
| 114 | void Clear(); | ||
| 115 | }; | 122 | }; |
| 116 | 123 | ||
| 117 | const unsigned k_Proxy2_RootDirIndex = k_Proxy_RootDirIndex; | 124 | const unsigned k_Proxy2_RootDirIndex = k_Proxy_RootDirIndex; |
| @@ -123,10 +130,15 @@ class CProxyArc2 | |||
| 123 | void CalculateSizes(unsigned dirIndex, IInArchive *archive); | 130 | void CalculateSizes(unsigned dirIndex, IInArchive *archive); |
| 124 | // AddRealIndices_of_Dir DOES NOT ADD item itself represented by dirIndex | 131 | // AddRealIndices_of_Dir DOES NOT ADD item itself represented by dirIndex |
| 125 | void AddRealIndices_of_Dir(unsigned dirIndex, bool includeAltStreams, CUIntVector &realIndices) const; | 132 | void AddRealIndices_of_Dir(unsigned dirIndex, bool includeAltStreams, CUIntVector &realIndices) const; |
| 133 | void FreeFiles(); | ||
| 126 | public: | 134 | public: |
| 127 | CObjectVector<CProxyDir2> Dirs; // Dirs[0] - root folder | 135 | CObjectVector<CProxyDir2> Dirs; // Dirs[0] - root folder |
| 128 | // Dirs[1] - for alt streams of root dir | 136 | // Dirs[1] - for alt streams of root dir |
| 129 | CObjArray<CProxyFile2> Files; // all items from archive in same order | 137 | CProxyFile2 *Files; // all items from archive in same order |
| 138 | unsigned NumFiles; | ||
| 139 | |||
| 140 | CProxyArc2(): Files(NULL), NumFiles(0) {} | ||
| 141 | ~CProxyArc2() { FreeFiles(); } | ||
| 130 | 142 | ||
| 131 | bool IsThere_SubDir(unsigned dirIndex, const UString &name) const; | 143 | bool IsThere_SubDir(unsigned dirIndex, const UString &name) const; |
| 132 | 144 | ||
diff --git a/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp b/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp index 6631629..7f6da0c 100644 --- a/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp +++ b/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp | |||
| @@ -1842,6 +1842,11 @@ Z7_COM7F_IMF(CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre | |||
| 1842 | outStreamLoc = new CStdOutFileStream; | 1842 | outStreamLoc = new CStdOutFileStream; |
| 1843 | else | 1843 | else |
| 1844 | { | 1844 | { |
| 1845 | if (_isSplit) | ||
| 1846 | { | ||
| 1847 | RINOK(PrepareOperation(askExtractMode)) | ||
| 1848 | return SetOperationResult(NArchive::NExtract::NOperationResult::kUnsupportedMethod); | ||
| 1849 | } | ||
| 1845 | bool needExit = true; | 1850 | bool needExit = true; |
| 1846 | RINOK(GetExtractStream(outStreamLoc, needExit)) | 1851 | RINOK(GetExtractStream(outStreamLoc, needExit)) |
| 1847 | if (needExit) | 1852 | if (needExit) |
| @@ -2674,6 +2679,7 @@ Z7_COM7F_IMF(CArchiveExtractCallback::SetOperationResult(Int32 opRes)) | |||
| 2674 | { | 2679 | { |
| 2675 | COM_TRY_BEGIN | 2680 | COM_TRY_BEGIN |
| 2676 | 2681 | ||
| 2682 | // if (_isSplit) opRes = NArchive::NExtract::NOperationResult::kUnsupportedMethod; | ||
| 2677 | // printf("\nCArchiveExtractCallback::SetOperationResult: %d %s\n", opRes, GetAnsiString(_diskFilePath)); | 2683 | // printf("\nCArchiveExtractCallback::SetOperationResult: %d %s\n", opRes, GetAnsiString(_diskFilePath)); |
| 2678 | 2684 | ||
| 2679 | #ifndef Z7_SFX | 2685 | #ifndef Z7_SFX |
diff --git a/CPP/7zip/UI/Common/LoadCodecs.cpp b/CPP/7zip/UI/Common/LoadCodecs.cpp index e71158c..c944ee9 100644 --- a/CPP/7zip/UI/Common/LoadCodecs.cpp +++ b/CPP/7zip/UI/Common/LoadCodecs.cpp | |||
| @@ -211,10 +211,11 @@ static FString GetBaseFolderPrefixFromRegistry() | |||
| 211 | && !NFind::DoesFileOrDirExist(moduleFolderPrefix + kFormatsFolderName)) | 211 | && !NFind::DoesFileOrDirExist(moduleFolderPrefix + kFormatsFolderName)) |
| 212 | { | 212 | { |
| 213 | FString path; | 213 | FString path; |
| 214 | if (ReadPathFromRegistry(HKEY_CURRENT_USER, kProgramPath2Value, path)) return path; | 214 | if ( ReadPathFromRegistry(HKEY_CURRENT_USER, kProgramPath2Value, path) |
| 215 | if (ReadPathFromRegistry(HKEY_LOCAL_MACHINE, kProgramPath2Value, path)) return path; | 215 | || ReadPathFromRegistry(HKEY_LOCAL_MACHINE, kProgramPath2Value, path) |
| 216 | if (ReadPathFromRegistry(HKEY_CURRENT_USER, kProgramPathValue, path)) return path; | 216 | || ReadPathFromRegistry(HKEY_CURRENT_USER, kProgramPathValue, path) |
| 217 | if (ReadPathFromRegistry(HKEY_LOCAL_MACHINE, kProgramPathValue, path)) return path; | 217 | || ReadPathFromRegistry(HKEY_LOCAL_MACHINE, kProgramPathValue, path)) |
| 218 | moduleFolderPrefix = path; | ||
| 218 | } | 219 | } |
| 219 | #endif | 220 | #endif |
| 220 | 221 | ||
diff --git a/CPP/7zip/UI/Common/UpdatePair.cpp b/CPP/7zip/UI/Common/UpdatePair.cpp index 99b0aaf..8fc5615 100644 --- a/CPP/7zip/UI/Common/UpdatePair.cpp +++ b/CPP/7zip/UI/Common/UpdatePair.cpp | |||
| @@ -196,6 +196,7 @@ void GetUpdatePairInfoList( | |||
| 196 | while (dirIndex < numDirItems || arcIndex < numArcItems) | 196 | while (dirIndex < numDirItems || arcIndex < numArcItems) |
| 197 | { | 197 | { |
| 198 | CUpdatePair pair; | 198 | CUpdatePair pair; |
| 199 | pair.Construct(); | ||
| 199 | 200 | ||
| 200 | int dirIndex2 = -1; | 201 | int dirIndex2 = -1; |
| 201 | int arcIndex2 = -1; | 202 | int arcIndex2 = -1; |
diff --git a/CPP/7zip/UI/Common/UpdatePair.h b/CPP/7zip/UI/Common/UpdatePair.h index 13228b0..a2855c4 100644 --- a/CPP/7zip/UI/Common/UpdatePair.h +++ b/CPP/7zip/UI/Common/UpdatePair.h | |||
| @@ -15,7 +15,7 @@ struct CUpdatePair | |||
| 15 | int DirIndex; | 15 | int DirIndex; |
| 16 | int HostIndex; // >= 0 for alt streams only, contains index of host pair | 16 | int HostIndex; // >= 0 for alt streams only, contains index of host pair |
| 17 | 17 | ||
| 18 | CUpdatePair(): ArcIndex(-1), DirIndex(-1), HostIndex(-1) {} | 18 | void Construct() { ArcIndex = -1; DirIndex = -1; HostIndex = -1; } |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | void GetUpdatePairInfoList( | 21 | void GetUpdatePairInfoList( |
diff --git a/CPP/7zip/UI/Common/UpdateProduce.cpp b/CPP/7zip/UI/Common/UpdateProduce.cpp index 88d2501..9b66d36 100644 --- a/CPP/7zip/UI/Common/UpdateProduce.cpp +++ b/CPP/7zip/UI/Common/UpdateProduce.cpp | |||
| @@ -19,6 +19,7 @@ void UpdateProduce( | |||
| 19 | const CUpdatePair &pair = updatePairs[i]; | 19 | const CUpdatePair &pair = updatePairs[i]; |
| 20 | 20 | ||
| 21 | CUpdatePair2 up2; | 21 | CUpdatePair2 up2; |
| 22 | up2.Construct(); | ||
| 22 | up2.DirIndex = pair.DirIndex; | 23 | up2.DirIndex = pair.DirIndex; |
| 23 | up2.ArcIndex = pair.ArcIndex; | 24 | up2.ArcIndex = pair.ArcIndex; |
| 24 | up2.NewData = up2.NewProps = true; | 25 | up2.NewData = up2.NewProps = true; |
diff --git a/CPP/7zip/UI/Common/UpdateProduce.h b/CPP/7zip/UI/Common/UpdateProduce.h index 9db6c1e..3d16381 100644 --- a/CPP/7zip/UI/Common/UpdateProduce.h +++ b/CPP/7zip/UI/Common/UpdateProduce.h | |||
| @@ -19,28 +19,28 @@ struct CUpdatePair2 | |||
| 19 | bool IsMainRenameItem; | 19 | bool IsMainRenameItem; |
| 20 | bool IsSameTime; | 20 | bool IsSameTime; |
| 21 | 21 | ||
| 22 | void Construct() | ||
| 23 | { | ||
| 24 | NewData = false; | ||
| 25 | NewProps = false; | ||
| 26 | UseArcProps = false; | ||
| 27 | IsAnti = false; | ||
| 28 | DirIndex = -1; | ||
| 29 | ArcIndex = -1; | ||
| 30 | NewNameIndex = -1; | ||
| 31 | IsMainRenameItem = false; | ||
| 32 | IsSameTime = false; | ||
| 33 | } | ||
| 34 | |||
| 22 | void SetAs_NoChangeArcItem(unsigned arcIndex) // int | 35 | void SetAs_NoChangeArcItem(unsigned arcIndex) // int |
| 23 | { | 36 | { |
| 24 | NewData = NewProps = false; | 37 | Construct(); |
| 25 | UseArcProps = true; | 38 | UseArcProps = true; |
| 26 | IsAnti = false; | ||
| 27 | ArcIndex = (int)arcIndex; | 39 | ArcIndex = (int)arcIndex; |
| 28 | } | 40 | } |
| 29 | 41 | ||
| 30 | bool ExistOnDisk() const { return DirIndex != -1; } | 42 | bool ExistOnDisk() const { return DirIndex != -1; } |
| 31 | bool ExistInArchive() const { return ArcIndex != -1; } | 43 | bool ExistInArchive() const { return ArcIndex != -1; } |
| 32 | |||
| 33 | CUpdatePair2(): | ||
| 34 | NewData(false), | ||
| 35 | NewProps(false), | ||
| 36 | UseArcProps(false), | ||
| 37 | IsAnti(false), | ||
| 38 | DirIndex(-1), | ||
| 39 | ArcIndex(-1), | ||
| 40 | NewNameIndex(-1), | ||
| 41 | IsMainRenameItem(false), | ||
| 42 | IsSameTime(false) | ||
| 43 | {} | ||
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | Z7_PURE_INTERFACES_BEGIN | 46 | Z7_PURE_INTERFACES_BEGIN |
diff --git a/CPP/7zip/UI/Far/FarUtils.cpp b/CPP/7zip/UI/Far/FarUtils.cpp index 3c33d8e..1d331e9 100644 --- a/CPP/7zip/UI/Far/FarUtils.cpp +++ b/CPP/7zip/UI/Far/FarUtils.cpp | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef UNDER_CE | 8 | #ifndef UNDER_CE |
| 9 | #include "../../../Windows/Console.h" | 9 | #include "../../../Windows/Console.h" |
| 10 | #endif | 10 | #endif |
| 11 | #include "../../../Windows/Defs.h" | 11 | #include "../../../Windows/WinDefs.h" |
| 12 | #include "../../../Windows/ErrorMsg.h" | 12 | #include "../../../Windows/ErrorMsg.h" |
| 13 | 13 | ||
| 14 | #include "FarUtils.h" | 14 | #include "FarUtils.h" |
| @@ -259,17 +259,15 @@ void CStartupInfo::SetRegKeyValue(HKEY parentKey, const char *keyName, | |||
| 259 | regKey.SetValue(valueName, value); | 259 | regKey.SetValue(valueName, value); |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | /* | ||
| 262 | CSysString CStartupInfo::QueryRegKeyValue(HKEY parentKey, const char *keyName, | 263 | CSysString CStartupInfo::QueryRegKeyValue(HKEY parentKey, const char *keyName, |
| 263 | LPCTSTR valueName, const CSysString &valueDefault) const | 264 | LPCTSTR valueName, const CSysString &valueDefault) const |
| 264 | { | 265 | { |
| 265 | NRegistry::CKey regKey; | ||
| 266 | if (OpenRegKey(parentKey, keyName, regKey) != ERROR_SUCCESS) | ||
| 267 | return valueDefault; | ||
| 268 | |||
| 269 | CSysString value; | 266 | CSysString value; |
| 270 | if (regKey.QueryValue(valueName, value) != ERROR_SUCCESS) | 267 | NRegistry::CKey regKey; |
| 271 | return valueDefault; | 268 | if (OpenRegKey(parentKey, keyName, regKey) != ERROR_SUCCESS |
| 272 | 269 | || regKey.QueryValue(valueName, value) != ERROR_SUCCESS) | |
| 270 | value = valueDefault; | ||
| 273 | return value; | 271 | return value; |
| 274 | } | 272 | } |
| 275 | 273 | ||
| @@ -286,6 +284,7 @@ UInt32 CStartupInfo::QueryRegKeyValue(HKEY parentKey, const char *keyName, | |||
| 286 | 284 | ||
| 287 | return value; | 285 | return value; |
| 288 | } | 286 | } |
| 287 | */ | ||
| 289 | 288 | ||
| 290 | bool CStartupInfo::QueryRegKeyValue(HKEY parentKey, const char *keyName, | 289 | bool CStartupInfo::QueryRegKeyValue(HKEY parentKey, const char *keyName, |
| 291 | LPCTSTR valueName, bool valueDefault) const | 290 | LPCTSTR valueName, bool valueDefault) const |
diff --git a/CPP/7zip/UI/Far/Plugin.cpp b/CPP/7zip/UI/Far/Plugin.cpp index b7f91d6..f04f712 100644 --- a/CPP/7zip/UI/Far/Plugin.cpp +++ b/CPP/7zip/UI/Far/Plugin.cpp | |||
| @@ -143,8 +143,13 @@ void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex) | |||
| 143 | panelItem.Reserved[1] = 0; | 143 | panelItem.Reserved[1] = 0; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | |||
| 147 | static const UInt32 k_NumFiles_Max = 0x7fffffff - 15; | ||
| 148 | |||
| 146 | int CPlugin::GetFindData(PluginPanelItem **panelItems, int *itemsNumber, int opMode) | 149 | int CPlugin::GetFindData(PluginPanelItem **panelItems, int *itemsNumber, int opMode) |
| 147 | { | 150 | { |
| 151 | *panelItems = NULL; | ||
| 152 | *itemsNumber = 0; | ||
| 148 | // CScreenRestorer screenRestorer; | 153 | // CScreenRestorer screenRestorer; |
| 149 | if ((opMode & OPM_SILENT) == 0 && (opMode & OPM_FIND ) == 0) | 154 | if ((opMode & OPM_SILENT) == 0 && (opMode & OPM_FIND ) == 0) |
| 150 | { | 155 | { |
| @@ -160,8 +165,13 @@ int CPlugin::GetFindData(PluginPanelItem **panelItems, int *itemsNumber, int opM | |||
| 160 | } | 165 | } |
| 161 | 166 | ||
| 162 | UInt32 numItems; | 167 | UInt32 numItems; |
| 163 | _folder->GetNumberOfItems(&numItems); | 168 | if (_folder->GetNumberOfItems(&numItems) != S_OK) |
| 164 | *panelItems = new PluginPanelItem[numItems]; | 169 | return FALSE; |
| 170 | if (numItems > k_NumFiles_Max) | ||
| 171 | return FALSE; | ||
| 172 | |||
| 173 | Z7_ARRAY_NEW(*panelItems, PluginPanelItem, numItems) | ||
| 174 | memset(*panelItems, 0, (size_t)numItems * sizeof(PluginPanelItem)); | ||
| 165 | try | 175 | try |
| 166 | { | 176 | { |
| 167 | for (UInt32 i = 0; i < numItems; i++) | 177 | for (UInt32 i = 0; i < numItems; i++) |
| @@ -174,6 +184,7 @@ int CPlugin::GetFindData(PluginPanelItem **panelItems, int *itemsNumber, int opM | |||
| 174 | catch(...) | 184 | catch(...) |
| 175 | { | 185 | { |
| 176 | delete [](*panelItems); | 186 | delete [](*panelItems); |
| 187 | *panelItems = NULL; | ||
| 177 | throw; | 188 | throw; |
| 178 | } | 189 | } |
| 179 | *itemsNumber = (int)numItems; | 190 | *itemsNumber = (int)numItems; |
diff --git a/CPP/7zip/UI/FileManager/BrowseDialog2.cpp b/CPP/7zip/UI/FileManager/BrowseDialog2.cpp index 9f083c5..f8bfcb5 100644 --- a/CPP/7zip/UI/FileManager/BrowseDialog2.cpp +++ b/CPP/7zip/UI/FileManager/BrowseDialog2.cpp | |||
| @@ -95,15 +95,16 @@ struct CBrowseItem | |||
| 95 | UInt32 NumRootItems; | 95 | UInt32 NumRootItems; |
| 96 | UInt64 Size; | 96 | UInt64 Size; |
| 97 | 97 | ||
| 98 | CBrowseItem(): | 98 | void Construct() |
| 99 | // MainFileIndex(0), | 99 | { |
| 100 | SubFileIndex(-1), | 100 | // MainFileIndex = 0; |
| 101 | WasInterrupted(false), | 101 | SubFileIndex = -1; |
| 102 | NumFiles(0), | 102 | WasInterrupted = false; |
| 103 | NumDirs(0), | 103 | NumFiles = 0; |
| 104 | NumRootItems(0), | 104 | NumDirs = 0; |
| 105 | Size(0) | 105 | NumRootItems = 0; |
| 106 | {} | 106 | Size = 0; |
| 107 | } | ||
| 107 | }; | 108 | }; |
| 108 | 109 | ||
| 109 | 110 | ||
| @@ -114,6 +115,10 @@ struct CBrowseEnumerator | |||
| 114 | CFileInfo fi_SubFile; | 115 | CFileInfo fi_SubFile; |
| 115 | CBrowseItem bi; | 116 | CBrowseItem bi; |
| 116 | 117 | ||
| 118 | CBrowseEnumerator() | ||
| 119 | { | ||
| 120 | bi.Construct(); | ||
| 121 | } | ||
| 117 | void Enumerate(unsigned level); | 122 | void Enumerate(unsigned level); |
| 118 | bool NeedInterrupt() const | 123 | bool NeedInterrupt() const |
| 119 | { | 124 | { |
| @@ -1504,6 +1509,7 @@ HRESULT CBrowseDialog2::Reload(const UString &pathPrefix, const UStringVector &s | |||
| 1504 | if (d.Len() < 2 || d.Back() != '\\') | 1509 | if (d.Len() < 2 || d.Back() != '\\') |
| 1505 | return E_FAIL; | 1510 | return E_FAIL; |
| 1506 | CBrowseItem item; | 1511 | CBrowseItem item; |
| 1512 | item.Construct(); | ||
| 1507 | item.MainFileIndex = files.Size(); | 1513 | item.MainFileIndex = files.Size(); |
| 1508 | CFileInfo &fi = files.AddNew(); | 1514 | CFileInfo &fi = files.AddNew(); |
| 1509 | fi.SetAsDir(); | 1515 | fi.SetAsDir(); |
| @@ -1552,6 +1558,7 @@ HRESULT CBrowseDialog2::Reload(const UString &pathPrefix, const UStringVector &s | |||
| 1552 | } | 1558 | } |
| 1553 | } | 1559 | } |
| 1554 | CBrowseItem item; | 1560 | CBrowseItem item; |
| 1561 | item.Construct(); | ||
| 1555 | item.MainFileIndex = files.Size(); | 1562 | item.MainFileIndex = files.Size(); |
| 1556 | item.Size = fi.Size; | 1563 | item.Size = fi.Size; |
| 1557 | files.Add(fi); | 1564 | files.Add(fi); |
diff --git a/CPP/Common/Common0.h b/CPP/Common/Common0.h index 5781a95..a6b842d 100644 --- a/CPP/Common/Common0.h +++ b/CPP/Common/Common0.h | |||
| @@ -162,7 +162,7 @@ if compiled with new GCC libstdc++, GCC libstdc++ can use: | |||
| 162 | So we can use Z7_ARRAY_NEW macro instead of new[] operator. */ | 162 | So we can use Z7_ARRAY_NEW macro instead of new[] operator. */ |
| 163 | 163 | ||
| 164 | #if defined(_MSC_VER) && (_MSC_VER == 1200) && !defined(_WIN64) | 164 | #if defined(_MSC_VER) && (_MSC_VER == 1200) && !defined(_WIN64) |
| 165 | #define Z7_ARRAY_NEW(p, T, size) p = new T[((size) > 0xFFFFFFFFu / sizeof(T)) ? 0xFFFFFFFFu / sizeof(T) : (size)]; | 165 | #define Z7_ARRAY_NEW(p, T, size) p = new T[((size) > (0xFFFFFFFFu - 0x7fu) / sizeof(T)) ? (0xFFFFFFFFu - 0x7fu) / sizeof(T) : (size)]; |
| 166 | #else | 166 | #else |
| 167 | #define Z7_ARRAY_NEW(p, T, size) p = new T[size]; | 167 | #define Z7_ARRAY_NEW(p, T, size) p = new T[size]; |
| 168 | #endif | 168 | #endif |
diff --git a/CPP/Windows/Clipboard.cpp b/CPP/Windows/Clipboard.cpp index bc7e201..d39c264 100644 --- a/CPP/Windows/Clipboard.cpp +++ b/CPP/Windows/Clipboard.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "../Common/StringConvert.h" | 9 | #include "../Common/StringConvert.h" |
| 10 | 10 | ||
| 11 | #include "Clipboard.h" | 11 | #include "Clipboard.h" |
| 12 | #include "Defs.h" | 12 | #include "WinDefs.h" |
| 13 | #include "MemoryGlobal.h" | 13 | #include "MemoryGlobal.h" |
| 14 | #include "Shell.h" | 14 | #include "Shell.h" |
| 15 | 15 | ||
diff --git a/CPP/Windows/CommonDialog.cpp b/CPP/Windows/CommonDialog.cpp index 7a92d5f..2e3f297 100644 --- a/CPP/Windows/CommonDialog.cpp +++ b/CPP/Windows/CommonDialog.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #endif | 13 | #endif |
| 14 | 14 | ||
| 15 | #include "CommonDialog.h" | 15 | #include "CommonDialog.h" |
| 16 | #include "Defs.h" | 16 | #include "WinDefs.h" |
| 17 | // #include "FileDir.h" | 17 | // #include "FileDir.h" |
| 18 | 18 | ||
| 19 | #ifndef _UNICODE | 19 | #ifndef _UNICODE |
diff --git a/CPP/Windows/Console.h b/CPP/Windows/Console.h index 818b8d4..6b494c8 100644 --- a/CPP/Windows/Console.h +++ b/CPP/Windows/Console.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #ifndef ZIP7_INC_WINDOWS_CONSOLE_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONSOLE_H |
| 4 | #define ZIP7_INC_WINDOWS_CONSOLE_H | 4 | #define ZIP7_INC_WINDOWS_CONSOLE_H |
| 5 | 5 | ||
| 6 | #include "Defs.h" | 6 | #include "WinDefs.h" |
| 7 | 7 | ||
| 8 | namespace NWindows { | 8 | namespace NWindows { |
| 9 | namespace NConsole { | 9 | namespace NConsole { |
diff --git a/CPP/Windows/Control/ImageList.h b/CPP/Windows/Control/ImageList.h index 688f177..c10eea7 100644 --- a/CPP/Windows/Control/ImageList.h +++ b/CPP/Windows/Control/ImageList.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include <CommCtrl.h> | 6 | #include <CommCtrl.h> |
| 7 | 7 | ||
| 8 | #include "../Defs.h" | 8 | #include "../WinDefs.h" |
| 9 | 9 | ||
| 10 | namespace NWindows { | 10 | namespace NWindows { |
| 11 | namespace NControl { | 11 | namespace NControl { |
diff --git a/CPP/Windows/FileFind.h b/CPP/Windows/FileFind.h index 944bca2..9ae1115 100644 --- a/CPP/Windows/FileFind.h +++ b/CPP/Windows/FileFind.h | |||
| @@ -13,8 +13,6 @@ | |||
| 13 | #include "../Common/MyString.h" | 13 | #include "../Common/MyString.h" |
| 14 | #include "../Common/MyWindows.h" | 14 | #include "../Common/MyWindows.h" |
| 15 | 15 | ||
| 16 | #include "Defs.h" | ||
| 17 | |||
| 18 | #include "FileIO.h" | 16 | #include "FileIO.h" |
| 19 | 17 | ||
| 20 | namespace NWindows { | 18 | namespace NWindows { |
diff --git a/CPP/Windows/FileIO.h b/CPP/Windows/FileIO.h index 26edef4..a202df5 100644 --- a/CPP/Windows/FileIO.h +++ b/CPP/Windows/FileIO.h | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | #include "../Windows/TimeUtils.h" | 32 | #include "../Windows/TimeUtils.h" |
| 33 | 33 | ||
| 34 | #include "Defs.h" | 34 | #include "WinDefs.h" |
| 35 | 35 | ||
| 36 | HRESULT GetLastError_noZero_HRESULT(); | 36 | HRESULT GetLastError_noZero_HRESULT(); |
| 37 | 37 | ||
diff --git a/CPP/Windows/FileSystem.cpp b/CPP/Windows/FileSystem.cpp index b402306..6cb9808 100644 --- a/CPP/Windows/FileSystem.cpp +++ b/CPP/Windows/FileSystem.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #endif | 9 | #endif |
| 10 | 10 | ||
| 11 | #include "FileSystem.h" | 11 | #include "FileSystem.h" |
| 12 | #include "Defs.h" | 12 | #include "WinDefs.h" |
| 13 | 13 | ||
| 14 | #ifndef _UNICODE | 14 | #ifndef _UNICODE |
| 15 | extern bool g_IsNT; | 15 | extern bool g_IsNT; |
diff --git a/CPP/Windows/Menu.h b/CPP/Windows/Menu.h index e1de4c4..00aa692 100644 --- a/CPP/Windows/Menu.h +++ b/CPP/Windows/Menu.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "../Common/MyWindows.h" | 6 | #include "../Common/MyWindows.h" |
| 7 | #include "../Common/MyString.h" | 7 | #include "../Common/MyString.h" |
| 8 | 8 | ||
| 9 | #include "Defs.h" | 9 | #include "WinDefs.h" |
| 10 | 10 | ||
| 11 | namespace NWindows { | 11 | namespace NWindows { |
| 12 | 12 | ||
diff --git a/CPP/Windows/ProcessUtils.h b/CPP/Windows/ProcessUtils.h index b1fce3a..34fef8d 100644 --- a/CPP/Windows/ProcessUtils.h +++ b/CPP/Windows/ProcessUtils.h | |||
| @@ -39,7 +39,7 @@ typedef PROCESS_MEMORY_COUNTERS *PPROCESS_MEMORY_COUNTERS; | |||
| 39 | 39 | ||
| 40 | #include "../Common/MyString.h" | 40 | #include "../Common/MyString.h" |
| 41 | 41 | ||
| 42 | #include "Defs.h" | 42 | #include "WinDefs.h" |
| 43 | #include "Handle.h" | 43 | #include "Handle.h" |
| 44 | 44 | ||
| 45 | namespace NWindows { | 45 | namespace NWindows { |
diff --git a/CPP/Windows/PropVariantConv.cpp b/CPP/Windows/PropVariantConv.cpp index 21a7b4e..467c0f8 100644 --- a/CPP/Windows/PropVariantConv.cpp +++ b/CPP/Windows/PropVariantConv.cpp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include "../Common/IntToString.h" | 5 | #include "../Common/IntToString.h" |
| 6 | 6 | ||
| 7 | #include "Defs.h" | 7 | #include "WinDefs.h" |
| 8 | #include "PropVariantConv.h" | 8 | #include "PropVariantConv.h" |
| 9 | 9 | ||
| 10 | #define UINT_TO_STR_2(c, val) { s[0] = (c); s[1] = (char)('0' + (val) / 10); s[2] = (char)('0' + (val) % 10); s += 3; } | 10 | #define UINT_TO_STR_2(c, val) { s[0] = (c); s[1] = (char)('0' + (val) / 10); s[2] = (char)('0' + (val) % 10); s += 3; } |
diff --git a/CPP/Windows/SecurityUtils.h b/CPP/Windows/SecurityUtils.h index 022a8f3..9775d09 100644 --- a/CPP/Windows/SecurityUtils.h +++ b/CPP/Windows/SecurityUtils.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include <NTSecAPI.h> | 9 | #include <NTSecAPI.h> |
| 10 | #endif | 10 | #endif |
| 11 | 11 | ||
| 12 | #include "Defs.h" | 12 | #include "WinDefs.h" |
| 13 | 13 | ||
| 14 | #ifndef _UNICODE | 14 | #ifndef _UNICODE |
| 15 | 15 | ||
diff --git a/CPP/Windows/Shell.h b/CPP/Windows/Shell.h index 9e58e25..163c7d9 100644 --- a/CPP/Windows/Shell.h +++ b/CPP/Windows/Shell.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include "../Common/MyString.h" | 13 | #include "../Common/MyString.h" |
| 14 | 14 | ||
| 15 | #include "Defs.h" | 15 | #include "WinDefs.h" |
| 16 | 16 | ||
| 17 | namespace NWindows { | 17 | namespace NWindows { |
| 18 | namespace NShell { | 18 | namespace NShell { |
diff --git a/CPP/Windows/Synchronization.h b/CPP/Windows/Synchronization.h index 1df84d3..25764b8 100644 --- a/CPP/Windows/Synchronization.h +++ b/CPP/Windows/Synchronization.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "../Common/MyTypes.h" | 8 | #include "../Common/MyTypes.h" |
| 9 | 9 | ||
| 10 | #include "Defs.h" | 10 | #include "WinDefs.h" |
| 11 | 11 | ||
| 12 | #ifdef _WIN32 | 12 | #ifdef _WIN32 |
| 13 | #include "Handle.h" | 13 | #include "Handle.h" |
diff --git a/CPP/Windows/Thread.h b/CPP/Windows/Thread.h index 75c1616..028267b 100644 --- a/CPP/Windows/Thread.h +++ b/CPP/Windows/Thread.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include "../../C/Threads.h" | 6 | #include "../../C/Threads.h" |
| 7 | 7 | ||
| 8 | #include "Defs.h" | 8 | #include "WinDefs.h" |
| 9 | 9 | ||
| 10 | namespace NWindows { | 10 | namespace NWindows { |
| 11 | 11 | ||
diff --git a/CPP/Windows/TimeUtils.cpp b/CPP/Windows/TimeUtils.cpp index 4e3bc59..c83f75d 100644 --- a/CPP/Windows/TimeUtils.cpp +++ b/CPP/Windows/TimeUtils.cpp | |||
| @@ -7,8 +7,8 @@ | |||
| 7 | #include <time.h> | 7 | #include <time.h> |
| 8 | #endif | 8 | #endif |
| 9 | 9 | ||
| 10 | #include "Defs.h" | ||
| 11 | #include "TimeUtils.h" | 10 | #include "TimeUtils.h" |
| 11 | #include "WinDefs.h" | ||
| 12 | 12 | ||
| 13 | namespace NWindows { | 13 | namespace NWindows { |
| 14 | namespace NTime { | 14 | namespace NTime { |
diff --git a/CPP/Windows/Defs.h b/CPP/Windows/WinDefs.h index 8ab9cf5..86512d2 100644 --- a/CPP/Windows/Defs.h +++ b/CPP/Windows/WinDefs.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Defs.h | 1 | // Windows/Defs.h |
| 2 | 2 | ||
| 3 | #ifndef ZIP7_INC_WINDOWS_DEFS_H | 3 | #ifndef ZIP7_INC_WINDOWS_WIN_DEFS_H |
| 4 | #define ZIP7_INC_WINDOWS_DEFS_H | 4 | #define ZIP7_INC_WINDOWS_WIN_DEFS_H |
| 5 | 5 | ||
| 6 | #include "../Common/MyWindows.h" | 6 | #include "../Common/MyWindows.h" |
| 7 | 7 | ||
diff --git a/CPP/Windows/Window.h b/CPP/Windows/Window.h index a99143b..b0ddef9 100644 --- a/CPP/Windows/Window.h +++ b/CPP/Windows/Window.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "../Common/MyWindows.h" | 6 | #include "../Common/MyWindows.h" |
| 7 | #include "../Common/MyString.h" | 7 | #include "../Common/MyString.h" |
| 8 | 8 | ||
| 9 | #include "Defs.h" | 9 | #include "WinDefs.h" |
| 10 | 10 | ||
| 11 | #ifndef UNDER_CE | 11 | #ifndef UNDER_CE |
| 12 | #ifdef WM_CHANGEUISTATE | 12 | #ifdef WM_CHANGEUISTATE |
