Skip to content

Commit

Permalink
Apply my changes to lzma-sdk 24.08
Browse files Browse the repository at this point in the history
  • Loading branch information
nirbar committed Sep 19, 2024
1 parent bff041d commit 64a4fa9
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ jobs:
- name: Build 7Zap.NET
run: |
msbuild 7Zap\dirs.proj -restore -p:FullVersion=23.1.${{ github.run_number }}
msbuild 7Zap\dirs.proj -restore -p:FullVersion=24.08.${{ github.run_number }}
- name: Nuget pack
run: |
nuget pack 7Zap\Nuget\7Zap.nuspec -Version 23.1.${{ github.run_number }} -BasePath "${{ github.workspace }}" -NonInteractive -Properties "src_root=.;build_x64=build-x64;build_x86=build-x86;build_arm64=build-Arm64;config=Release"
nuget pack 7Zap\Nuget\7Zap.nuspec -Version 24.08.${{ github.run_number }} -BasePath "${{ github.workspace }}" -NonInteractive -Properties "src_root=.;build_x64=build-x64;build_x86=build-x86;build_arm64=build-Arm64;config=Release"
- uses: actions/[email protected]
with:
Expand All @@ -59,5 +59,5 @@ jobs:
dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.TAGGER_PAT }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
dotnet nuget push 7Zap.*.nupkg --api-key ${{ secrets.TAGGER_PAT }} --source github
dotnet nuget push 7Zap.*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json
git tag "v23.01.${{ github.run_number }}"
git tag "v24.08.${{ github.run_number }}"
git push --tags
9 changes: 6 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@ jobs:

- uses: microsoft/setup-msbuild@v1

- name: Prepare for build
run: |
mkdir build-x86
cd build-x86
cmake ..\ -A Win32 "-DCMAKE_SYSTEM_VERSION=10.0.19041.0" -DVERSION_BUILD=${{ github.run_number }}
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Build x86
run: |
mkdir build-x86
cd build-x86
cmake ..\ -A Win32 "-DCMAKE_SYSTEM_VERSION=10.0.19041.0" -DVERSION_BUILD=${{ github.run_number }}
cmake --build . --config Release
- name: Perform CodeQL Analysis
Expand Down
4 changes: 2 additions & 2 deletions 7Zap/7Zap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ cmake_minimum_required (VERSION 3.23)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

# Version number
set (VERSION_MAJOR 23 CACHE STRING "Version number major (first figure)")
set (VERSION_MINOR 1 CACHE STRING "Version number minor (second figure)")
set (VERSION_MAJOR 24 CACHE STRING "Version number major (first figure)")
set (VERSION_MINOR 8 CACHE STRING "Version number minor (second figure)")
set (VERSION_BUILD 0 CACHE STRING "Version number build (third figure)")
configure_file(7Zap.rc 7Zap.rc)

Expand Down
4 changes: 2 additions & 2 deletions 7Zap/7Zap/Extract7z.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern "C" HRESULT __stdcall Extract7z(const FChar * archivePath, const FChar *

//Init
censor.Add_Wildcard();
scan.Init(nullptr, nullptr, nullptr);
scan.Init(nullptr, nullptr, nullptr, true);
censorProps.WildcardMatching = DoesNameContainWildcard(archivePath);
censorProps.Recursive = censorProps.WildcardMatching;
censorProps.MarkMode = NWildcard::kMark_FileOrDir;
Expand All @@ -35,7 +35,7 @@ extern "C" HRESULT __stdcall Extract7z(const FChar * archivePath, const FChar *
CExtractCallbackConsole* ecs = new CExtractCallbackConsole;
CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;

ecs->Init(nullptr, nullptr, nullptr);
ecs->Init(nullptr, nullptr, nullptr, true);
ecs->MultiArcMode = (archivePathsSorted.Size() > 1);

CExtractOptions eo;
Expand Down
2 changes: 1 addition & 1 deletion 7Zap/7Zap/Update7z.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extern "C" HRESULT __stdcall Update7z(const FChar* archivePath, HANDLE hCancelEv
uo.Commands.Add(updateCommand);

COpenCallbackConsole openCallback;
openCallback.Init(nullptr, nullptr, nullptr);
openCallback.Init(nullptr, nullptr, nullptr, true);

CUpdateCallback7Zap callback(hCancelEvent, numFiles, files, entryNames);

Expand Down
2 changes: 1 addition & 1 deletion 7Zap/7Zap/UpdateCallback7Zap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
CUpdateCallback7Zap::CUpdateCallback7Zap(HANDLE hCancelEvent, size_t nFiles, const FChar** ppFiles, const wchar_t** ppEntryNames)
: _hCancelEvent(hCancelEvent)
{
Init(nullptr, nullptr, nullptr);
Init(nullptr, nullptr, nullptr, true);

if (ppFiles && ppEntryNames && nFiles)
{
Expand Down
2 changes: 1 addition & 1 deletion 7Zap/Nuget/7Zap.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>7Zap</id>
<title>7Zap: 7z creator</title>
<version>23.01</version>
<version>24.08</version>
<description>Library to create, update, and extract 7z archives</description>
<authors>Nir Bar</authors>
<repository type="git" url="https://github.com/nirbar/7zap"/>
Expand Down
2 changes: 1 addition & 1 deletion 7Zap/TidyBuild.custom.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)TidyBuild.user.props" Condition="Exists('$(MSBuildThisFileDirectory)TidyBuild.user.props')"/>
<PropertyGroup>
<FullVersion>23.01</FullVersion>
<FullVersion>24.08</FullVersion>
<FullVersion Condition=" '$(GITHUB_RUN_NUMBER)'!='' ">$(FullVersion).$(GITHUB_RUN_NUMBER)</FullVersion>

<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
Expand Down
2 changes: 1 addition & 1 deletion lzma-sdk/C/Ppmd7Enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Z7_FORCE_INLINE
// Z7_NO_INLINE
static void Ppmd7z_RangeEnc_Encode(CPpmd7 *p, UInt32 start, UInt32 size)
{
R->Low += start * R->Range;
R->Low += (UInt64)start * R->Range;
R->Range *= size;
RC_NORM_LOCAL(p)
}
Expand Down
6 changes: 3 additions & 3 deletions lzma-sdk/CMakeLists.7zr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ list(APPEND src_7zr_shared CPP/7zip/UI/Common/UpdateProduce.cpp)
list(APPEND src_7zr_shared C/DllSecur.c)

# AES
list(APPEND src_7zr_shared C/Aes.c) #TODO Not including .asm files
list(APPEND src_7zr_shared C/Aes.c)

# CRC
list(APPEND src_7zr_shared C/7zCrc.c) #TODO Not including .asm files
list(APPEND src_7zr_shared C/7zCrc.c)

# Crc64
list(APPEND src_7zr_shared C/XzCrc64.c) #TODO Not including .asm files
list(APPEND src_7zr_shared C/XzCrc64.c)

# Sha256.mak
list(APPEND src_7zr_shared CPP/Common/Sha256Prepare.cpp)
Expand Down
1 change: 1 addition & 0 deletions lzma-sdk/CPP/7zip/IDecl.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

#define Z7_IFACE_PURE(name) Z7_IFACEN_ ## name(=0;)
#define Z7_IFACE_IMP(name) Z7_IFACEN_ ## name(Z7_override Z7_final;)
#define Z7_IFACE_IMP_NONFINAL(name) Z7_IFACEN_ ## name(Z7_override;)

#define Z7_IFACE_COM7_PURE(name) Z7_IFACEM_ ## name(Z7_COM7F_PURE)
#define Z7_IFACE_COM7_IMP(name) Z7_IFACEM_ ## name(Z7_COM7F_IMP)
Expand Down
1 change: 1 addition & 0 deletions lzma-sdk/CPP/7zip/UI/Common/DirItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Z7_PURE_INTERFACES_BEGIN
#define Z7_IFACEN_IDirItemsCallback(x) \
virtual HRESULT ScanError(const FString &path, DWORD systemError) x \
virtual HRESULT ScanProgress(const CDirItemsStat &st, const FString &path, bool isDir) x \
virtual HRESULT OverrideLogName(const FString &physPath, UString &logPath, bool isDir) x \

Z7_IFACE_DECL_PURE(IDirItemsCallback)

Expand Down
13 changes: 12 additions & 1 deletion lzma-sdk/CPP/7zip/UI/Common/EnumDirItems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,18 @@ FString CDirItems::GetPhyPath(unsigned index) const
UString CDirItems::GetLogPath(unsigned index) const
{
const CDirItem &di = Items[index];
return GetPrefixesPath(LogParents, di.LogParent, di.Name);
FString lp = GetPrefixesPath(LogParents, di.LogParent, di.Name);

if (Callback)
{
FString pp = GetPhyPath(index);
FString fp = pp;

NDir::MyGetFullPathName(pp, fp);
Callback->OverrideLogName(fp, lp, di.IsDir());
}

return lp;
}

void CDirItems::ReserveDown()
Expand Down
4 changes: 4 additions & 0 deletions lzma-sdk/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ HRESULT CExtractScanConsole::ScanError(const FString &path, DWORD systemError)
// return S_OK;
}

HRESULT CExtractScanConsole::OverrideLogName(const FString &physPath, UString &logPath, bool isDir)
{
return S_FALSE;
}

void Print_UInt64_and_String(AString &s, UInt64 val, const char *name);
void Print_UInt64_and_String(AString &s, UInt64 val, const char *name)
Expand Down
5 changes: 5 additions & 0 deletions lzma-sdk/CPP/7zip/UI/Console/HashCon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ HRESULT CHashCallbackConsole::ScanError(const FString &path, DWORD systemError)
return ScanError_Base(path, systemError);
}

HRESULT CHashCallbackConsole::OverrideLogName(const FString &physPath, UString &logPath, bool isDir)
{
return S_FALSE;
}

void Print_DirItemsStat(AString &s, const CDirItemsStat &st);

HRESULT CHashCallbackConsole::FinishScanning(const CDirItemsStat &st)
Expand Down
4 changes: 4 additions & 0 deletions lzma-sdk/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ HRESULT CUpdateCallbackConsole::ScanError(const FString &path, DWORD systemError
return ScanError_Base(path, systemError);
}

HRESULT CUpdateCallbackConsole::OverrideLogName(const FString &physPath, UString &logPath, bool isDir)
{
return S_FALSE;
}

static void PrintPropPair(AString &s, const char *name, UInt64 val)
{
Expand Down
8 changes: 4 additions & 4 deletions lzma-sdk/CPP/7zip/UI/Console/UpdateCallbackConsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ class CCallbackConsoleBase
};


class CUpdateCallbackConsole Z7_final:
class CUpdateCallbackConsole :
public IUpdateCallbackUI2,
public CCallbackConsoleBase
{
// void PrintPropPair(const char *name, const wchar_t *val);
Z7_IFACE_IMP(IUpdateCallbackUI)
Z7_IFACE_IMP(IDirItemsCallback)
Z7_IFACE_IMP(IUpdateCallbackUI2)
Z7_IFACE_IMP_NONFINAL(IUpdateCallbackUI)
Z7_IFACE_IMP_NONFINAL(IDirItemsCallback)
Z7_IFACE_IMP_NONFINAL(IUpdateCallbackUI2)
public:
bool DeleteMessageWasShown;

Expand Down
17 changes: 10 additions & 7 deletions lzma-sdk/CPP/Common/MyString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,8 @@ void AString::SetFromWStr_if_Ascii(const wchar_t *s)
_len = len;
char *dest = _chars;
unsigned i;
for (i = 0; i < len; i++)
for (i = 0; i <= len; ++i)
dest[i] = (char)s[i];
dest[i] = 0;
}

/*
Expand Down Expand Up @@ -1206,7 +1205,8 @@ UString &UString::operator=(const wchar_t *s)
_limit = len;
}
_len = len;
wmemcpy(_chars, s, len + 1);
if (_chars)
wmemcpy(_chars, s, len + 1);
return *this;
}

Expand All @@ -1223,7 +1223,8 @@ UString &UString::operator=(const UString &s)
_limit = len;
}
_len = len;
wmemcpy(_chars, s._chars, len + 1);
if (_chars)
wmemcpy(_chars, s._chars, len + 1);
return *this;
}

Expand All @@ -1237,9 +1238,11 @@ void UString::SetFrom(const wchar_t *s, unsigned len) // no check
_chars = newBuf;
_limit = len;
}
if (len != 0)
if (_chars && len != 0)
{
wmemcpy(_chars, s, len);
_chars[len] = 0;
_chars[len] = 0;
}
_len = len;
}

Expand Down Expand Up @@ -1299,7 +1302,7 @@ void UString::SetFromBstr(LPCOLESTR s)
#else
*/

// if (s)
if (_chars)
wmemcpy(_chars, s, len + 1);

// #endif
Expand Down
3 changes: 2 additions & 1 deletion lzma-sdk/CPP/Common/MyString.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ inline unsigned MyStringLen(const char *s)

inline void MyStringCopy(char *dest, const char *src)
{
while ((*dest++ = *src++) != 0);
if (dest && src)
while ((*dest++ = *src++) != 0);
}

inline char *MyStpCpy(char *dest, const char *src)
Expand Down

0 comments on commit 64a4fa9

Please sign in to comment.