Skip to content

Commit

Permalink
22.00
Browse files Browse the repository at this point in the history
  • Loading branch information
ip7z committed Dec 17, 2023
1 parent f19f813 commit a3e1d22
Show file tree
Hide file tree
Showing 211 changed files with 15,196 additions and 2,397 deletions.
7 changes: 6 additions & 1 deletion Asm/x86/7zAsm.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
; 7zAsm.asm -- ASM macros
; 2021-12-25 : Igor Pavlov : Public domain
; 2022-05-16 : Igor Pavlov : Public domain


; UASM can require these changes
; OPTION FRAMEPRESERVEFLAGS:ON
; OPTION PROLOGUE:NONE
; OPTION EPILOGUE:NONE

ifdef @wordsize
; @wordsize is defined only in JWASM and ASMC and is not defined in MASM
; @wordsize eq 8 for 64-bit x64
Expand Down
32 changes: 22 additions & 10 deletions Asm/x86/Sha256Opt.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; Sha256Opt.asm -- SHA-256 optimized code for SHA-256 x86 hardware instructions
; 2021-03-10 : Igor Pavlov : Public domain
; 2022-04-17 : Igor Pavlov : Public domain

include 7zAsm.asm

Expand Down Expand Up @@ -54,14 +54,20 @@ ifndef x64
.686
.xmm
endif

; jwasm-based assemblers for linux and linker from new versions of binutils
; can generate incorrect code for load [ARRAY + offset] instructions.
; 22.00: we load K_CONST offset to (rTable) register to avoid jwasm+binutils problem
rTable equ r0
; rTable equ K_CONST
ifdef x64
rNum equ REG_ABI_PARAM_2
if (IS_LINUX eq 0)
LOCAL_SIZE equ (16 * 2)
endif
else
rNum equ r0
rNum equ r3
LOCAL_SIZE equ (16 * 1)
endif

Expand Down Expand Up @@ -103,15 +109,18 @@ MY_PROLOG macro
movdqa [r4 + 16], xmm9
endif
else ; x86
push r3
push r5
mov r5, r4
NUM_PUSH_REGS equ 2
PARAM_OFFSET equ (REG_SIZE * (1 + NUM_PUSH_REGS))
if (IS_CDECL gt 0)
mov rState, [r4 + REG_SIZE * 1]
mov rData, [r4 + REG_SIZE * 2]
mov rNum, [r4 + REG_SIZE * 3]
mov rState, [r4 + PARAM_OFFSET]
mov rData, [r4 + PARAM_OFFSET + REG_SIZE * 1]
mov rNum, [r4 + PARAM_OFFSET + REG_SIZE * 2]
else ; fastcall
mov rNum, [r4 + REG_SIZE * 1]
mov rNum, [r4 + PARAM_OFFSET]
endif
push r5
mov r5, r4
and r4, -16
sub r4, LOCAL_SIZE
endif
Expand All @@ -129,6 +138,7 @@ MY_EPILOG macro
else ; x86
mov r4, r5
pop r5
pop r3
endif
MY_ENDP
endm
Expand Down Expand Up @@ -171,7 +181,7 @@ pre2 equ 2


RND4 macro k
movdqa msg, xmmword ptr [K_CONST + (k) * 16]
movdqa msg, xmmword ptr [rTable + (k) * 16]
paddd msg, @CatStr(xmm, %(w_regs + ((k + 0) mod 4)))
MY_sha256rnds2 state0_N, state1_N
pshufd msg, msg, 0eH
Expand Down Expand Up @@ -210,6 +220,8 @@ endm
MY_PROC Sha256_UpdateBlocks_HW, 3
MY_PROLOG

lea rTable, [K_CONST]

cmp rNum, 0
je end_c

Expand Down
14 changes: 9 additions & 5 deletions C/7zTypes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* 7zTypes.h -- Basic types
2021-12-25 : Igor Pavlov : Public domain */
2022-04-01 : Igor Pavlov : Public domain */

#ifndef __7Z_TYPES_H
#define __7Z_TYPES_H
Expand Down Expand Up @@ -133,10 +133,6 @@ typedef int WRes;
#define MY__E_ERROR_NEGATIVE_SEEK MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
*/

// gcc / clang : (sizeof(long) == sizeof(void*)) in 32/64 bits
typedef long INT_PTR;
typedef unsigned long UINT_PTR;

#define TEXT(quote) quote

#define FILE_ATTRIBUTE_READONLY 0x0001
Expand Down Expand Up @@ -520,6 +516,14 @@ struct ISzAlloc

#endif

#define k_PropVar_TimePrec_0 0
#define k_PropVar_TimePrec_Unix 1
#define k_PropVar_TimePrec_DOS 2
#define k_PropVar_TimePrec_HighPrec 3
#define k_PropVar_TimePrec_Base 16
#define k_PropVar_TimePrec_100ns (k_PropVar_TimePrec_Base + 7)
#define k_PropVar_TimePrec_1ns (k_PropVar_TimePrec_Base + 9)

EXTERN_C_END

#endif
10 changes: 5 additions & 5 deletions C/7zVersion.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 21
#define MY_VER_MINOR 07
#define MY_VER_MAJOR 22
#define MY_VER_MINOR 00
#define MY_VER_BUILD 0
#define MY_VERSION_NUMBERS "21.07"
#define MY_VERSION_NUMBERS "22.00"
#define MY_VERSION MY_VERSION_NUMBERS

#ifdef MY_CPU_NAME
Expand All @@ -10,12 +10,12 @@
#define MY_VERSION_CPU MY_VERSION
#endif

#define MY_DATE "2021-12-26"
#define MY_DATE "2022-06-15"
#undef MY_COPYRIGHT
#undef MY_VERSION_COPYRIGHT_DATE
#define MY_AUTHOR_NAME "Igor Pavlov"
#define MY_COPYRIGHT_PD "Igor Pavlov : Public domain"
#define MY_COPYRIGHT_CR "Copyright (c) 1999-2021 Igor Pavlov"
#define MY_COPYRIGHT_CR "Copyright (c) 1999-2022 Igor Pavlov"

#ifdef USE_COPYRIGHT_CR
#define MY_COPYRIGHT MY_COPYRIGHT_CR
Expand Down
8 changes: 8 additions & 0 deletions CPP/7zip/7zip_gcc.mak
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ $O/VirtThread.o: ../../Common/VirtThread.cpp
$(CXX) $(CXXFLAGS) $<


$O/ApfsHandler.o: ../../Archive/ApfsHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/ApmHandler.o: ../../Archive/ApmHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/ArchiveExports.o: ../../Archive/ArchiveExports.cpp
Expand All @@ -390,6 +392,8 @@ $O/ArHandler.o: ../../Archive/ArHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/ArjHandler.o: ../../Archive/ArjHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/AvbHandler.o: ../../Archive/AvbHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/Base64Handler.o: ../../Archive/Base64Handler.cpp
$(CXX) $(CXXFLAGS) $<
$O/Bz2Handler.o: ../../Archive/Bz2Handler.cpp
Expand Down Expand Up @@ -426,6 +430,8 @@ $O/HfsHandler.o: ../../Archive/HfsHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/IhexHandler.o: ../../Archive/IhexHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/LpHandler.o: ../../Archive/LpHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/LzhHandler.o: ../../Archive/LzhHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/LzmaHandler.o: ../../Archive/LzmaHandler.cpp
Expand All @@ -448,6 +454,8 @@ $O/QcowHandler.o: ../../Archive/QcowHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/RpmHandler.o: ../../Archive/RpmHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/SparseHandler.o: ../../Archive/SparseHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/SplitHandler.o: ../../Archive/SplitHandler.cpp
$(CXX) $(CXXFLAGS) $<
$O/SquashfsHandler.o: ../../Archive/SquashfsHandler.cpp
Expand Down
123 changes: 87 additions & 36 deletions CPP/7zip/Archive/7z/7zFolderInStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "StdAfx.h"

#include "../../../Windows/TimeUtils.h"

#include "7zFolderInStream.h"

namespace NArchive {
Expand All @@ -13,17 +15,17 @@ void CFolderInStream::Init(IArchiveUpdateCallback *updateCallback,
_updateCallback = updateCallback;
_indexes = indexes;
_numFiles = numFiles;
_index = 0;

Processed.ClearAndReserve(numFiles);
CRCs.ClearAndReserve(numFiles);
Sizes.ClearAndReserve(numFiles);

_pos = 0;
_crc = CRC_INIT_VAL;
_size_Defined = false;
_size = 0;

if (Need_CTime) CTimes.ClearAndReserve(numFiles);
if (Need_ATime) ATimes.ClearAndReserve(numFiles);
if (Need_MTime) MTimes.ClearAndReserve(numFiles);
if (Need_Attrib) Attribs.ClearAndReserve(numFiles);
TimesDefined.ClearAndReserve(numFiles);

_stream.Release();
}

Expand All @@ -32,44 +34,101 @@ HRESULT CFolderInStream::OpenStream()
_pos = 0;
_crc = CRC_INIT_VAL;
_size_Defined = false;
_times_Defined = false;
_size = 0;
FILETIME_Clear(_cTime);
FILETIME_Clear(_aTime);
FILETIME_Clear(_mTime);
_attrib = 0;

while (_index < _numFiles)
while (Processed.Size() < _numFiles)
{
CMyComPtr<ISequentialInStream> stream;
HRESULT result = _updateCallback->GetStream(_indexes[_index], &stream);
if (result != S_OK)
{
if (result != S_FALSE)
return result;
}
const HRESULT result = _updateCallback->GetStream(_indexes[Processed.Size()], &stream);
if (result != S_OK && result != S_FALSE)
return result;

_stream = stream;

if (stream)
{
CMyComPtr<IStreamGetSize> streamGetSize;
stream.QueryInterface(IID_IStreamGetSize, &streamGetSize);
if (streamGetSize)
{
if (streamGetSize->GetSize(&_size) == S_OK)
_size_Defined = true;
CMyComPtr<IStreamGetProps> getProps;
stream.QueryInterface(IID_IStreamGetProps, (void **)&getProps);
if (getProps)
{
// access could be changed in first myx pass
if (getProps->GetProps(&_size,
Need_CTime ? &_cTime : NULL,
Need_ATime ? &_aTime : NULL,
Need_MTime ? &_mTime : NULL,
Need_Attrib ? &_attrib : NULL)
== S_OK)
{
_size_Defined = true;
_times_Defined = true;
}
return S_OK;
}
}
{
CMyComPtr<IStreamGetSize> streamGetSize;
stream.QueryInterface(IID_IStreamGetSize, &streamGetSize);
if (streamGetSize)
{
if (streamGetSize->GetSize(&_size) == S_OK)
_size_Defined = true;
}
return S_OK;
}
return S_OK;
}

_index++;
RINOK(_updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
AddFileInfo(result == S_OK);
RINOK(AddFileInfo(result == S_OK));
}
return S_OK;
}

void CFolderInStream::AddFileInfo(bool isProcessed)
static void AddFt(CRecordVector<UInt64> &vec, const FILETIME &ft)
{
Processed.Add(isProcessed);
Sizes.Add(_pos);
CRCs.Add(CRC_GET_DIGEST(_crc));
vec.AddInReserved(FILETIME_To_UInt64(ft));
}

/*
HRESULT ReportItemProps(IArchiveUpdateCallbackArcProp *reportArcProp,
UInt32 index, UInt64 size, const UInt32 *crc)
{
PROPVARIANT prop;
prop.vt = VT_EMPTY;
prop.wReserved1 = 0;
NWindows::NCOM::PropVarEm_Set_UInt64(&prop, size);
RINOK(reportArcProp->ReportProp(NEventIndexType::kOutArcIndex, index, kpidSize, &prop));
if (crc)
{
NWindows::NCOM::PropVarEm_Set_UInt32(&prop, *crc);
RINOK(reportArcProp->ReportProp(NEventIndexType::kOutArcIndex, index, kpidCRC, &prop));
}
return reportArcProp->ReportFinished(NEventIndexType::kOutArcIndex, index, NUpdate::NOperationResult::kOK);
}
*/

HRESULT CFolderInStream::AddFileInfo(bool isProcessed)
{
// const UInt32 index = _indexes[Processed.Size()];
Processed.AddInReserved(isProcessed);
Sizes.AddInReserved(_pos);
const UInt32 crc = CRC_GET_DIGEST(_crc);
CRCs.AddInReserved(crc);
TimesDefined.AddInReserved(_times_Defined);
if (Need_CTime) AddFt(CTimes, _cTime);
if (Need_ATime) AddFt(ATimes, _aTime);
if (Need_MTime) AddFt(MTimes, _mTime);
if (Need_Attrib) Attribs.AddInReserved(_attrib);
/*
if (isProcessed && _reportArcProp)
RINOK(ReportItemProps(_reportArcProp, index, _pos, &crc))
*/
return _updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK);
}

STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
Expand All @@ -95,18 +154,10 @@ STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSiz
}

_stream.Release();
_index++;
AddFileInfo(true);

_pos = 0;
_crc = CRC_INIT_VAL;
_size_Defined = false;
_size = 0;

RINOK(_updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
RINOK(AddFileInfo(true));
}

if (_index >= _numFiles)
if (Processed.Size() >= _numFiles)
break;
RINOK(OpenStream());
}
Expand Down
Loading

0 comments on commit a3e1d22

Please sign in to comment.