From 93be7d4abfd4233228f58ee1fbbcd76d91be66a4 Mon Sep 17 00:00:00 2001 From: Igor Pavlov <87184205+ip7z@users.noreply.github.com> Date: Sat, 16 Jul 2022 00:00:00 +0000 Subject: 22.01 --- C/7zVersion.h | 6 +++--- C/7zip_gcc_c.mak | 42 ++++++++++++++++++++++++++++++------ C/CpuArch.h | 17 +++++++++------ C/DllSecur.c | 8 +++++-- C/LzmaEnc.c | 11 ++++------ C/Util/7zipInstall/7zipInstall.c | 8 +++++-- C/Util/7zipUninstall/7zipUninstall.c | 6 +++++- 7 files changed, 70 insertions(+), 28 deletions(-) (limited to 'C') diff --git a/C/7zVersion.h b/C/7zVersion.h index 89fffd9..49ea81d 100644 --- a/C/7zVersion.h +++ b/C/7zVersion.h @@ -1,7 +1,7 @@ #define MY_VER_MAJOR 22 -#define MY_VER_MINOR 00 +#define MY_VER_MINOR 01 #define MY_VER_BUILD 0 -#define MY_VERSION_NUMBERS "22.00" +#define MY_VERSION_NUMBERS "22.01" #define MY_VERSION MY_VERSION_NUMBERS #ifdef MY_CPU_NAME @@ -10,7 +10,7 @@ #define MY_VERSION_CPU MY_VERSION #endif -#define MY_DATE "2022-06-15" +#define MY_DATE "2022-07-15" #undef MY_COPYRIGHT #undef MY_VERSION_COPYRIGHT_DATE #define MY_AUTHOR_NAME "Igor Pavlov" diff --git a/C/7zip_gcc_c.mak b/C/7zip_gcc_c.mak index e884440..24505f3 100644 --- a/C/7zip_gcc_c.mak +++ b/C/7zip_gcc_c.mak @@ -16,12 +16,32 @@ CFLAGS_BASE = $(MY_ARCH_2) -O2 $(CFLAGS_BASE_LIST) -Wall -Werror -Wextra $(CFLAG -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -LDFLAGS_STATIC = -DNDEBUG -# -static - ifdef SystemDrive IS_MINGW = 1 +else +ifdef SYSTEMDRIVE +# ifdef OS +IS_MINGW = 1 +endif +endif + +ifdef IS_MINGW +LDFLAGS_STATIC_2 = -static +else +ifndef DEF_FILE +ifndef IS_NOT_STANDALONE +ifndef MY_DYNAMIC_LINK +ifneq ($(CC), clang) +LDFLAGS_STATIC_2 = +# -static +# -static-libstdc++ -static-libgcc +endif +endif +endif endif +endif + +LDFLAGS_STATIC = -DNDEBUG $(LDFLAGS_STATIC_2) ifdef DEF_FILE @@ -62,15 +82,22 @@ endif ifdef IS_MINGW +ifdef MSYSTEM +RM = rm -f +MY_MKDIR=mkdir -p +DEL_OBJ_EXE = -$(RM) $(PROGPATH) $(PROGPATH_STATIC) $(OBJS) +else RM = del MY_MKDIR=mkdir -LIB2 = -loleaut32 -luuid -ladvapi32 -lUser32 +DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll +endif + +LIB2 = -lOle32 -loleaut32 -luuid -ladvapi32 -lUser32 CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE # -Wno-delete-non-virtual-dtor -DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll else @@ -306,7 +333,10 @@ $O/7zMain.o: ../../../C/Util/7z/7zMain.c $(CC) $(CFLAGS) $< $O/LzmaUtil.o: ../../../C/Util/Lzma/LzmaUtil.c $(CC) $(CFLAGS) $< - +$O/7zipInstall.o: ../../../C/Util/7zipInstall/7zipInstall.c + $(CC) $(CFLAGS) $< +$O/7zipUninstall.o: ../../../C/Util/7zipUninstall/7zipUninstall.c + $(CC) $(CFLAGS) $< clean: diff --git a/C/CpuArch.h b/C/CpuArch.h index 529d3a5..4856fbb 100644 --- a/C/CpuArch.h +++ b/C/CpuArch.h @@ -1,5 +1,5 @@ /* CpuArch.h -- CPU specific code -2021-07-13 : Igor Pavlov : Public domain */ +2022-07-15 : Igor Pavlov : Public domain */ #ifndef __CPU_ARCH_H #define __CPU_ARCH_H @@ -123,12 +123,15 @@ MY_CPU_64BIT means that processor can work with 64-bit registers. #endif -#if defined(__sparc64__) - #define MY_CPU_NAME "sparc64" - #define MY_CPU_64BIT -#elif defined(__sparc__) - #define MY_CPU_NAME "sparc" - /* #define MY_CPU_32BIT */ +#if defined(__riscv) \ + || defined(__riscv__) + #if __riscv_xlen == 32 + #define MY_CPU_NAME "riscv32" + #elif __riscv_xlen == 64 + #define MY_CPU_NAME "riscv64" + #else + #define MY_CPU_NAME "riscv" + #endif #endif diff --git a/C/DllSecur.c b/C/DllSecur.c index d81508c..dce0c96 100644 --- a/C/DllSecur.c +++ b/C/DllSecur.c @@ -1,5 +1,5 @@ /* DllSecur.c -- DLL loading security -2021-12-25 : Igor Pavlov : Public domain */ +2022-07-15 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -11,6 +11,10 @@ #ifndef UNDER_CE +#if defined(__GNUC__) && (__GNUC__ >= 8) + #pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + typedef BOOL (WINAPI *Func_SetDefaultDllDirectories)(DWORD DirectoryFlags); #define MY_LOAD_LIBRARY_SEARCH_USER_DIRS 0x400 @@ -34,7 +38,7 @@ static const char * const g_Dlls = #endif // #define MY_CAST_FUNC (void(*)()) -#define MY_CAST_FUNC +#define MY_CAST_FUNC void My_SetDefaultDllDirectories() { diff --git a/C/LzmaEnc.c b/C/LzmaEnc.c index b04a7b7..c8b31a1 100644 --- a/C/LzmaEnc.c +++ b/C/LzmaEnc.c @@ -1,5 +1,5 @@ /* LzmaEnc.c -- LZMA Encoder -2021-11-18: Igor Pavlov : Public domain */ +2022-07-15: Igor Pavlov : Public domain */ #include "Precomp.h" @@ -2970,6 +2970,7 @@ const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) } +// (desiredPackSize == 0) is not allowed SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit, Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) { @@ -2990,14 +2991,10 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit, if (reInit) LzmaEnc_Init(p); LzmaEnc_InitPrices(p); - - nowPos64 = p->nowPos64; RangeEnc_Init(&p->rc); p->rc.outStream = &outStream.vt; - - if (desiredPackSize == 0) - return SZ_ERROR_OUTPUT_EOF; - + nowPos64 = p->nowPos64; + res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize); *unpackSize = (UInt32)(p->nowPos64 - nowPos64); diff --git a/C/Util/7zipInstall/7zipInstall.c b/C/Util/7zipInstall/7zipInstall.c index 00d0f41..2649734 100644 --- a/C/Util/7zipInstall/7zipInstall.c +++ b/C/Util/7zipInstall/7zipInstall.c @@ -1,5 +1,5 @@ /* 7zipInstall.c - 7-Zip Installer -2021-09-02 : Igor Pavlov : Public domain */ +2022-07-15 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -22,6 +22,10 @@ #include "resource.h" +#if defined(__GNUC__) && (__GNUC__ >= 8) + #pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + #define LLL_(quote) L##quote #define LLL(quote) LLL_(quote) @@ -70,7 +74,7 @@ static LPCWSTR const k_Reg_Software_7zip = L"Software\\7-Zip"; #endif #endif -#define k_7zip_with_Ver k_7zip_with_Ver_base k_Postfix +#define k_7zip_with_Ver k_7zip_with_Ver_base k_Postfix static LPCWSTR const k_7zip_with_Ver_str = k_7zip_with_Ver; diff --git a/C/Util/7zipUninstall/7zipUninstall.c b/C/Util/7zipUninstall/7zipUninstall.c index b4c6ff5..c8e8a89 100644 --- a/C/Util/7zipUninstall/7zipUninstall.c +++ b/C/Util/7zipUninstall/7zipUninstall.c @@ -1,5 +1,5 @@ /* 7zipUninstall.c - 7-Zip Uninstaller -2021-11-24 : Igor Pavlov : Public domain */ +2022-07-15 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -17,6 +17,10 @@ #include "resource.h" +#if defined(__GNUC__) && (__GNUC__ >= 8) + #pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + #define LLL_(quote) L##quote #define LLL(quote) LLL_(quote) -- cgit v1.2.3-55-g6feb