summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/lzma/C/Util/SfxSetup
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-12-06 07:58:49 +1100
committer Vas Crabb <vas@vastheman.com>2023-12-06 07:58:49 +1100
commit79bef1e23049fdac25f1fefd132e0b6c7d2cc3a1 (patch)
tree643e9313fe86f583c4022c338677cbc12b761df7 /3rdparty/lzma/C/Util/SfxSetup
parent512ccf0c7c9b4f08e41038b2ed2de220e140385b (diff)
3rdparty/lzma: Updated to version 23.01.
Diffstat (limited to '3rdparty/lzma/C/Util/SfxSetup')
-rw-r--r--3rdparty/lzma/C/Util/SfxSetup/Precomp.h10
-rw-r--r--3rdparty/lzma/C/Util/SfxSetup/SfxSetup.c46
-rw-r--r--3rdparty/lzma/C/Util/SfxSetup/makefile3
-rw-r--r--3rdparty/lzma/C/Util/SfxSetup/makefile_con4
4 files changed, 44 insertions, 19 deletions
diff --git a/3rdparty/lzma/C/Util/SfxSetup/Precomp.h b/3rdparty/lzma/C/Util/SfxSetup/Precomp.h
index 588a66f7eb8..bc8fa219b58 100644
--- a/3rdparty/lzma/C/Util/SfxSetup/Precomp.h
+++ b/3rdparty/lzma/C/Util/SfxSetup/Precomp.h
@@ -1,8 +1,12 @@
/* Precomp.h -- StdAfx
-2013-06-16 : Igor Pavlov : Public domain */
+2023-03-04 : Igor Pavlov : Public domain */
-#ifndef __7Z_PRECOMP_H
-#define __7Z_PRECOMP_H
+#ifndef ZIP7_INC_PRECOMP_H
+#define ZIP7_INC_PRECOMP_H
+
+#if defined(_MSC_VER) && _MSC_VER >= 1800
+#pragma warning(disable : 4464) // relative include path contains '..'
+#endif
#include "../../Compiler.h"
#include "../../7zTypes.h"
diff --git a/3rdparty/lzma/C/Util/SfxSetup/SfxSetup.c b/3rdparty/lzma/C/Util/SfxSetup/SfxSetup.c
index ef19aeac545..7304a0be40d 100644
--- a/3rdparty/lzma/C/Util/SfxSetup/SfxSetup.c
+++ b/3rdparty/lzma/C/Util/SfxSetup/SfxSetup.c
@@ -26,6 +26,12 @@
#define kInputBufSize ((size_t)1 << 18)
+
+#define wcscat lstrcatW
+#define wcslen (size_t)lstrlenW
+#define wcscpy lstrcpyW
+// wcsncpy() and lstrcpynW() work differently. We don't use them.
+
static const char * const kExts[] =
{
"bat"
@@ -64,7 +70,7 @@ static unsigned FindExt(const wchar_t *s, unsigned *extLen)
return len;
}
-#define MAKE_CHAR_UPPER(c) ((((c) >= 'a' && (c) <= 'z') ? (c) -= 0x20 : (c)))
+#define MAKE_CHAR_UPPER(c) ((((c) >= 'a' && (c) <= 'z') ? (c) - 0x20 : (c)))
static unsigned FindItem(const char * const *items, unsigned num, const wchar_t *s, unsigned len)
{
@@ -72,13 +78,13 @@ static unsigned FindItem(const char * const *items, unsigned num, const wchar_t
for (i = 0; i < num; i++)
{
const char *item = items[i];
- unsigned itemLen = (unsigned)strlen(item);
+ const unsigned itemLen = (unsigned)strlen(item);
unsigned j;
if (len != itemLen)
continue;
for (j = 0; j < len; j++)
{
- unsigned c = (Byte)item[j];
+ const unsigned c = (Byte)item[j];
if (c != s[j] && MAKE_CHAR_UPPER(c) != s[j])
break;
}
@@ -96,10 +102,20 @@ static BOOL WINAPI HandlerRoutine(DWORD ctrlType)
}
#endif
+
+#ifdef _CONSOLE
+static void PrintStr(const char *s)
+{
+ fputs(s, stdout);
+}
+#endif
+
static void PrintErrorMessage(const char *message)
{
#ifdef _CONSOLE
- printf("\n7-Zip Error: %s\n", message);
+ PrintStr("\n7-Zip Error: ");
+ PrintStr(message);
+ PrintStr("\n");
#else
#ifdef UNDER_CE
WCHAR messageW[256 + 4];
@@ -179,7 +195,7 @@ static WRes RemoveDirWithSubItems(WCHAR *path)
WIN32_FIND_DATAW fd;
HANDLE handle;
WRes res = 0;
- size_t len = wcslen(path);
+ const size_t len = wcslen(path);
wcscpy(path + len, L"*");
handle = FindFirstFileW(path, &fd);
path[len] = L'\0';
@@ -228,7 +244,7 @@ static WRes RemoveDirWithSubItems(WCHAR *path)
}
#ifdef _CONSOLE
-int MY_CDECL main()
+int Z7_CDECL main(void)
#else
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
#ifdef UNDER_CE
@@ -290,7 +306,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
BoolInt quoteMode = False;
for (;; cmdLineParams++)
{
- wchar_t c = *cmdLineParams;
+ const wchar_t c = *cmdLineParams;
if (c == L'\"')
quoteMode = !quoteMode;
else if (c == 0 || (c == L' ' && !quoteMode))
@@ -324,7 +340,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
unsigned k;
for (k = 0; k < 8; k++)
{
- unsigned t = value & 0xF;
+ const unsigned t = value & 0xF;
value >>= 4;
s[7 - k] = (wchar_t)((t < 10) ? ('0' + t) : ('A' + (t - 10)));
}
@@ -386,7 +402,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
{
lookStream.bufSize = kInputBufSize;
lookStream.realStream = &archiveStream.vt;
- LookToRead2_Init(&lookStream);
+ LookToRead2_INIT(&lookStream)
}
}
@@ -455,11 +471,11 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
unsigned extLen;
const WCHAR *name = temp + nameStartPos;
unsigned len = (unsigned)wcslen(name);
- unsigned nameLen = FindExt(temp + nameStartPos, &extLen);
- unsigned extPrice = FindItem(kExts, sizeof(kExts) / sizeof(kExts[0]), name + len - extLen, extLen);
- unsigned namePrice = FindItem(kNames, sizeof(kNames) / sizeof(kNames[0]), name, nameLen);
+ const unsigned nameLen = FindExt(temp + nameStartPos, &extLen);
+ const unsigned extPrice = FindItem(kExts, sizeof(kExts) / sizeof(kExts[0]), name + len - extLen, extLen);
+ const unsigned namePrice = FindItem(kNames, sizeof(kNames) / sizeof(kNames[0]), name, nameLen);
- unsigned price = namePrice + extPrice * 64 + (nameStartPos == 0 ? 0 : (1 << 12));
+ const unsigned price = namePrice + extPrice * 64 + (nameStartPos == 0 ? 0 : (1 << 12));
if (minPrice > price)
{
minPrice = price;
@@ -500,7 +516,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
#endif
{
- SRes res2 = File_Close(&outFile);
+ const SRes res2 = File_Close(&outFile);
if (res != SZ_OK)
break;
if (res2 != SZ_OK)
@@ -550,7 +566,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
WCHAR oldCurDir[MAX_PATH + 2];
oldCurDir[0] = 0;
{
- DWORD needLen = GetCurrentDirectory(MAX_PATH + 1, oldCurDir);
+ const DWORD needLen = GetCurrentDirectory(MAX_PATH + 1, oldCurDir);
if (needLen == 0 || needLen > MAX_PATH)
oldCurDir[0] = 0;
SetCurrentDirectory(workCurDir);
diff --git a/3rdparty/lzma/C/Util/SfxSetup/makefile b/3rdparty/lzma/C/Util/SfxSetup/makefile
index 544da67dfb5..bc0cf8bc71c 100644
--- a/3rdparty/lzma/C/Util/SfxSetup/makefile
+++ b/3rdparty/lzma/C/Util/SfxSetup/makefile
@@ -1,6 +1,9 @@
PROG = 7zS2.sfx
MY_FIXED = 1
+CFLAGS = $(CFLAGS) \
+ -DZ7_EXTRACT_ONLY \
+
C_OBJS = \
$O\7zAlloc.obj \
$O\7zArcIn.obj \
diff --git a/3rdparty/lzma/C/Util/SfxSetup/makefile_con b/3rdparty/lzma/C/Util/SfxSetup/makefile_con
index d0f8352541e..9f4b91669ca 100644
--- a/3rdparty/lzma/C/Util/SfxSetup/makefile_con
+++ b/3rdparty/lzma/C/Util/SfxSetup/makefile_con
@@ -1,6 +1,8 @@
PROG = 7zS2con.sfx
MY_FIXED = 1
-CFLAGS = $(CFLAGS) -D_CONSOLE
+
+CFLAGS = $(CFLAGS) -D_CONSOLE \
+ -DZ7_EXTRACT_ONLY \
C_OBJS = \
$O\7zAlloc.obj \