[misc] miscellaneous cleanup

* Make sure we use _M_IX86 and _M_X64 where required.
* Fix some static analysis warnings.
* Update version for rufus-next.
This commit is contained in:
Pete Batard 2025-04-21 20:20:59 +01:00
parent 88f023e796
commit b895f26ebc
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
16 changed files with 35 additions and 39 deletions

View file

@ -423,6 +423,7 @@
<ClInclude Include="..\src\hdd_vs_ufd.h" />
<ClInclude Include="..\src\mbr_types.h" />
<ClInclude Include="..\src\missing.h" />
<ClInclude Include="..\src\msvc-missing\unistd.h" />
<ClInclude Include="..\src\process.h" />
<ClInclude Include="..\src\re.h" />
<ClInclude Include="..\src\settings.h" />

View file

@ -194,6 +194,9 @@
<ClInclude Include="..\src\efi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\msvc-missing\unistd.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\res\rufus.ico">

View file

@ -1,5 +1,4 @@
#!/bin/sh
rm -f rufus*.exe
./configure --disable-debug "$@"
make -j12 clean
make -j12 release

20
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for rufus 4.7.
# Generated by GNU Autoconf 2.71 for rufus 4.8.
#
# Report bugs to <https://github.com/pbatard/rufus/issues>.
#
@ -611,8 +611,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='rufus'
PACKAGE_TARNAME='rufus'
PACKAGE_VERSION='4.7'
PACKAGE_STRING='rufus 4.7'
PACKAGE_VERSION='4.8'
PACKAGE_STRING='rufus 4.8'
PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues'
PACKAGE_URL='https://rufus.ie'
@ -1269,7 +1269,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures rufus 4.7 to adapt to many kinds of systems.
\`configure' configures rufus 4.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1336,7 +1336,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of rufus 4.7:";;
short | recursive ) echo "Configuration of rufus 4.8:";;
esac
cat <<\_ACEOF
@ -1428,7 +1428,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
rufus configure 4.7
rufus configure 4.8
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@ -1504,7 +1504,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by rufus $as_me 4.7, which was
It was created by rufus $as_me 4.8, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@ -2767,7 +2767,7 @@ fi
# Define the identity of the package.
PACKAGE='rufus'
VERSION='4.7'
VERSION='4.8'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@ -5309,7 +5309,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by rufus $as_me 4.7, which was
This file was extended by rufus $as_me 4.8, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -5365,7 +5365,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
rufus config.status 4.7
rufus config.status 4.8
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"

View file

@ -1,4 +1,4 @@
AC_INIT([rufus], [4.7], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AC_INIT([rufus], [4.8], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies])
AC_CONFIG_SRCDIR([src/rufus.c])
AC_CONFIG_MACRO_DIR([m4])

View file

@ -70,24 +70,24 @@ for %%a in (%ARCHS%) do (
)
rem Use our own get_pe_info executable - source is in this directory
if not exist get_pe_info.exe (
echo get_pe_info.exe must exist in this directory. Compile it with MinGW.
if not exist ..\get_pe_info.exe (
echo ..\get_pe_info.exe must exist in the parent directory. Compile it with MinGW.
goto out
)
rem Make sure we're not trying to create a package from an ALPHA or BETA version!
get_pe_info.exe -i rufus_x64.exe | findstr /C:"ALPHA" 1>nul && (
..\get_pe_info.exe -i rufus_x64.exe | findstr /C:"ALPHA" 1>nul && (
echo Alpha version detected - ABORTED
goto out
)
get_pe_info.exe -i rufus_x64.exe | findstr /C:"BETA" 1>nul && (
..\get_pe_info.exe -i rufus_x64.exe | findstr /C:"BETA" 1>nul && (
echo Beta version detected - ABORTED
goto out
)
rem Populate the version from the executable
if "%VERSION_OVERRIDE%"=="" (
get_pe_info.exe -v rufus_x64.exe > version.txt
..\get_pe_info.exe -v rufus_x64.exe > version.txt
set /p VERSION=<version.txt
del version.txt
) else (

View file

@ -843,7 +843,7 @@ char* FAST_FUNC
unpack_bz2_data(const char *packed, int packed_len, int unpacked_len)
{
char *outbuf = NULL;
bunzip_data *bd;
bunzip_data *bd = NULL;
int i;
jmp_buf jmpbuf;

View file

@ -312,7 +312,7 @@ FORCE_INLINE_TEMPLATE size_t BIT_getMiddleBits(BitContainerType bitContainer, U3
* such cpus old (pre-Haswell, 2013) and their performance is not of that
* importance.
*/
#if defined(__x86_64__) || defined(_M_X86)
#if defined(__x86_64__) || defined(_M_X64)
return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
#else
return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];

View file

@ -304,7 +304,7 @@ void xpipe(int filedes[2]) FAST_FUNC;
static inline void xmove_fd(int from, int to)
{
if (from != to) {
_dup2(from, to);
(void)_dup2(from, to);
_close(from);
}
}

View file

@ -261,7 +261,7 @@ typedef uint64_t bb__aliased_uint64_t FIX_ALIASING;
/* NB: unaligned parameter should be a pointer, aligned one -
* a lvalue. This makes it more likely to not swap them by mistake
*/
#if defined(i386) || defined(__x86_64__) || defined(__powerpc__)
#if defined(i386) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64) || defined(__powerpc__)
# define BB_UNALIGNED_MEMACCESS_OK 1
# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp))
# define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp))

View file

@ -368,7 +368,7 @@ static enum xz_ret XZ_FUNC crc32_validate(struct xz_dec *s, struct xz_buf *b)
*/
static bool XZ_FUNC check_skip(struct xz_dec *s, struct xz_buf *b)
{
while (s->pos < check_sizes[s->check_type]) {
while (s->check_type < 16 && s->pos < check_sizes[s->check_type]) {
if (b->in_pos == b->in_size)
return false;

View file

@ -118,7 +118,7 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
: "a"(7), "c"(0)
: "edx");
}
#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__)
#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
U32 n;
__asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx");
if (n >= 1) {

View file

@ -1697,7 +1697,7 @@ BOOL efi_image_parse(uint8_t* efi, size_t len, struct efi_image_regions** regp)
if (len < 0x80)
return FALSE;
dos = (void*)efi;
if (dos->e_lfanew > len - 0x40)
if (dos->e_lfanew > (LONG)len - 0x40)
return FALSE;
nt = (void*)(efi + dos->e_lfanew);
authsz = 0;
@ -2230,7 +2230,7 @@ static BOOL IsRevokedByDbx(uint8_t* hash, uint8_t* buf, uint32_t len)
goto out;
efi_var_auth = (EFI_VARIABLE_AUTHENTICATION_2*)dbx_data;
fluff_size = efi_var_auth->AuthInfo.Hdr.dwLength + sizeof(EFI_TIME); // +sizeof(EFI_SIGNATURE_LIST);
fluff_size = efi_var_auth->AuthInfo.Hdr.dwLength + sizeof(EFI_TIME);
if (dbx_size <= fluff_size)
goto out;
efi_sig_list = (EFI_SIGNATURE_LIST*)&dbx_data[fluff_size];

View file

@ -923,14 +923,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
dwSize = (DWORD)strlen(FORCE_URL);
#endif
IMG_SAVE img_save = { 0 };
// WTF is wrong with Microsoft's static analyzer reporting a potential buffer overflow here?!?
#if defined(_MSC_VER)
#pragma warning(disable: 6386)
#endif
url[min(dwSize, dwAvail)] = 0;
#if defined(_MSC_VER)
#pragma warning(default: 6386)
#endif
EXT_DECL(img_ext, GetShortName(url), __VA_GROUP__("*.iso"), __VA_GROUP__(lmprintf(MSG_036)));
img_save.Type = VIRTUAL_STORAGE_TYPE_DEVICE_ISO;
img_save.ImagePath = FileDialog(TRUE, NULL, &img_ext, NULL);

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 4.7.2231"
CAPTION "Rufus 4.8.2232"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -407,8 +407,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,7,2231,0
PRODUCTVERSION 4,7,2231,0
FILEVERSION 4,8,2232,0
PRODUCTVERSION 4,8,2232,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -426,13 +426,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "4.7.2231"
VALUE "FileVersion", "4.8.2232"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2025 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-4.7.exe"
VALUE "OriginalFilename", "rufus-4.8.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.7.2231"
VALUE "ProductVersion", "4.8.2232"
END
END
BLOCK "VarFileInfo"

View file

@ -39,7 +39,7 @@ static inline void write8(le8_t * _p, uint8_t _v)
*_p = _v;
}
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
/* Littleendian architectures which support unaligned memory accesses */