mirror of
https://github.com/systemd/systemd.git
synced 2025-01-17 06:04:07 +03:00
Merge pull request #19783 from yuwata/efi-build-options
efi: constify several functions and enable more warnings
This commit is contained in:
commit
c17b4f4b0e
65
meson.build
65
meson.build
@ -319,40 +319,38 @@ endif
|
||||
# Those generate many false positives, and we do not want to change the code to
|
||||
# avoid them.
|
||||
basic_disabled_warnings = [
|
||||
'-Wno-unused-parameter',
|
||||
'-Wno-missing-field-initializers',
|
||||
'-Wno-unused-result',
|
||||
'-Wno-format-signedness',
|
||||
'-Wno-missing-field-initializers',
|
||||
'-Wno-unused-parameter',
|
||||
'-Wno-unused-result',
|
||||
]
|
||||
|
||||
possible_cc_flags = [
|
||||
'-Werror=undef',
|
||||
'-Wlogical-op',
|
||||
'-Wmissing-include-dirs',
|
||||
'-Wold-style-definition',
|
||||
'-Wpointer-arith',
|
||||
'-Winit-self',
|
||||
'-Wfloat-equal',
|
||||
'-Wsuggest-attribute=noreturn',
|
||||
'-Werror=missing-prototypes',
|
||||
'-Werror=implicit-function-declaration',
|
||||
'-Werror=missing-declarations',
|
||||
'-Werror=return-type',
|
||||
'-Werror=incompatible-pointer-types',
|
||||
'-Werror=format=2',
|
||||
'-Wstrict-prototypes',
|
||||
'-Wredundant-decls',
|
||||
'-Wmissing-noreturn',
|
||||
'-Wimplicit-fallthrough=5',
|
||||
'-Wshadow',
|
||||
possible_common_cc_flags = [
|
||||
'-Wdate-time',
|
||||
'-Wendif-labels',
|
||||
'-Wstrict-aliasing=2',
|
||||
'-Wwrite-strings',
|
||||
'-Werror=format=2',
|
||||
'-Werror=implicit-function-declaration',
|
||||
'-Werror=incompatible-pointer-types',
|
||||
'-Werror=overflow',
|
||||
'-Werror=return-type',
|
||||
'-Werror=shift-count-overflow',
|
||||
'-Werror=shift-overflow=2',
|
||||
'-Wdate-time',
|
||||
'-Werror=undef',
|
||||
'-Wfloat-equal',
|
||||
'-Wimplicit-fallthrough=5',
|
||||
'-Winit-self',
|
||||
'-Wlogical-op',
|
||||
'-Wmissing-include-dirs',
|
||||
'-Wmissing-noreturn',
|
||||
'-Wnested-externs',
|
||||
'-Wold-style-definition',
|
||||
'-Wpointer-arith',
|
||||
'-Wredundant-decls',
|
||||
'-Wshadow',
|
||||
'-Wstrict-aliasing=2',
|
||||
'-Wstrict-prototypes',
|
||||
'-Wsuggest-attribute=noreturn',
|
||||
'-Wwrite-strings',
|
||||
|
||||
# negative arguments are correctly detected starting with meson 0.46.
|
||||
'-Wno-error=#warnings', # clang
|
||||
@ -363,8 +361,6 @@ possible_cc_flags = [
|
||||
'-fdiagnostics-show-option',
|
||||
'-fno-strict-aliasing',
|
||||
'-fvisibility=hidden',
|
||||
'-fstack-protector',
|
||||
'-fstack-protector-strong',
|
||||
'--param=ssp-buffer-size=4',
|
||||
]
|
||||
|
||||
@ -374,7 +370,7 @@ possible_cc_flags = [
|
||||
# busywork. See https://github.com/systemd/systemd/pull/19226.
|
||||
if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
|
||||
cc.version().version_compare('<10'))
|
||||
possible_cc_flags += '-Wno-maybe-uninitialized'
|
||||
possible_common_cc_flags += '-Wno-maybe-uninitialized'
|
||||
endif
|
||||
|
||||
# --as-needed and --no-undefined are provided by meson by default,
|
||||
@ -386,14 +382,14 @@ possible_link_flags = [
|
||||
]
|
||||
|
||||
if cc.get_id() == 'clang'
|
||||
possible_cc_flags += [
|
||||
possible_common_cc_flags += [
|
||||
'-Wno-typedef-redefinition',
|
||||
'-Wno-gnu-variable-sized-type-not-at-end',
|
||||
]
|
||||
endif
|
||||
|
||||
if get_option('buildtype') != 'debug'
|
||||
possible_cc_flags += [
|
||||
possible_common_cc_flags += [
|
||||
'-ffunction-sections',
|
||||
'-fdata-sections',
|
||||
]
|
||||
@ -401,6 +397,13 @@ if get_option('buildtype') != 'debug'
|
||||
possible_link_flags += '-Wl,--gc-sections'
|
||||
endif
|
||||
|
||||
possible_cc_flags = possible_common_cc_flags + [
|
||||
'-Werror=missing-declarations',
|
||||
'-Werror=missing-prototypes',
|
||||
'-fstack-protector',
|
||||
'-fstack-protector-strong',
|
||||
]
|
||||
|
||||
add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
|
||||
add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
|
||||
add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
|
||||
|
@ -91,7 +91,7 @@ static VOID cursor_right(
|
||||
}
|
||||
|
||||
static BOOLEAN line_edit(
|
||||
CHAR16 *line_in,
|
||||
const CHAR16 *line_in,
|
||||
CHAR16 **line_out,
|
||||
UINTN x_max,
|
||||
UINTN y_pos) {
|
||||
@ -521,7 +521,7 @@ static BOOLEAN menu_run(
|
||||
uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, EFI_LIGHTGRAY|EFI_BACKGROUND_BLACK);
|
||||
|
||||
/* draw a single character to make ClearScreen work on some firmware */
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L" ");
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, (CHAR16*) L" ");
|
||||
|
||||
if (config->console_mode_change != CONSOLE_MODE_KEEP) {
|
||||
err = console_set_mode(&config->console_mode, config->console_mode_change);
|
||||
@ -618,7 +618,7 @@ static BOOLEAN menu_run(
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, lines[i]);
|
||||
if ((INTN)i == config->idx_default_efivar) {
|
||||
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, x_start-3, y_start + i - idx_first);
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"=>");
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, (CHAR16*) L"=>");
|
||||
}
|
||||
}
|
||||
refresh = FALSE;
|
||||
@ -628,7 +628,7 @@ static BOOLEAN menu_run(
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, lines[idx_highlight_prev]);
|
||||
if ((INTN)idx_highlight_prev == config->idx_default_efivar) {
|
||||
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, x_start-3, y_start + idx_highlight_prev - idx_first);
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"=>");
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, (CHAR16*) L"=>");
|
||||
}
|
||||
|
||||
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, 0, y_start + idx_highlight - idx_first);
|
||||
@ -636,7 +636,7 @@ static BOOLEAN menu_run(
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, lines[idx_highlight]);
|
||||
if ((INTN)idx_highlight == config->idx_default_efivar) {
|
||||
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, x_start-3, y_start + idx_highlight - idx_first);
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"=>");
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, (CHAR16*) L"=>");
|
||||
}
|
||||
highlight = FALSE;
|
||||
}
|
||||
@ -916,14 +916,13 @@ static VOID config_entry_free(ConfigEntry *entry) {
|
||||
|
||||
static CHAR8 *line_get_key_value(
|
||||
CHAR8 *content,
|
||||
CHAR8 *sep,
|
||||
const CHAR8 *sep,
|
||||
UINTN *pos,
|
||||
CHAR8 **key_ret,
|
||||
CHAR8 **value_ret) {
|
||||
|
||||
CHAR8 *line;
|
||||
CHAR8 *line, *value;
|
||||
UINTN linelen;
|
||||
CHAR8 *value;
|
||||
|
||||
skip:
|
||||
line = content + *pos;
|
||||
@ -1073,9 +1072,9 @@ static VOID config_defaults_load_from_file(Config *config, CHAR8 *content) {
|
||||
|
||||
static VOID config_entry_parse_tries(
|
||||
ConfigEntry *entry,
|
||||
CHAR16 *path,
|
||||
CHAR16 *file,
|
||||
CHAR16 *suffix) {
|
||||
const CHAR16 *path,
|
||||
const CHAR16 *file,
|
||||
const CHAR16 *suffix) {
|
||||
|
||||
UINTN left = UINTN_MAX, done = UINTN_MAX, factor = 1, i, next_left, next_done;
|
||||
_cleanup_freepool_ CHAR16 *prefix = NULL;
|
||||
@ -1259,10 +1258,10 @@ static VOID config_entry_add_from_file(
|
||||
Config *config,
|
||||
EFI_HANDLE *device,
|
||||
EFI_FILE *root_dir,
|
||||
CHAR16 *path,
|
||||
CHAR16 *file,
|
||||
const CHAR16 *path,
|
||||
const CHAR16 *file,
|
||||
CHAR8 *content,
|
||||
CHAR16 *loaded_image_path) {
|
||||
const CHAR16 *loaded_image_path) {
|
||||
|
||||
ConfigEntry *entry;
|
||||
CHAR8 *line;
|
||||
@ -1437,7 +1436,7 @@ static VOID config_load_entries(
|
||||
EFI_FILE_HANDLE entries_dir;
|
||||
EFI_STATUS err;
|
||||
|
||||
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &entries_dir, L"\\loader\\entries", EFI_FILE_MODE_READ, 0ULL);
|
||||
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &entries_dir, (CHAR16*) L"\\loader\\entries", EFI_FILE_MODE_READ, 0ULL);
|
||||
if (!EFI_ERROR(err)) {
|
||||
for (;;) {
|
||||
CHAR16 buf[256];
|
||||
@ -1689,8 +1688,8 @@ static VOID config_title_generate(Config *config) {
|
||||
|
||||
static BOOLEAN config_entry_add_call(
|
||||
Config *config,
|
||||
CHAR16 *id,
|
||||
CHAR16 *title,
|
||||
const CHAR16 *id,
|
||||
const CHAR16 *title,
|
||||
EFI_STATUS (*call)(VOID)) {
|
||||
|
||||
ConfigEntry *entry;
|
||||
@ -1713,11 +1712,11 @@ static ConfigEntry *config_entry_add_loader(
|
||||
Config *config,
|
||||
EFI_HANDLE *device,
|
||||
enum loader_type type,
|
||||
CHAR16 *id,
|
||||
const CHAR16 *id,
|
||||
CHAR16 key,
|
||||
CHAR16 *title,
|
||||
CHAR16 *loader,
|
||||
CHAR16 *version) {
|
||||
const CHAR16 *title,
|
||||
const CHAR16 *loader,
|
||||
const CHAR16 *version) {
|
||||
|
||||
ConfigEntry *entry;
|
||||
|
||||
@ -1744,11 +1743,11 @@ static BOOLEAN config_entry_add_loader_auto(
|
||||
Config *config,
|
||||
EFI_HANDLE *device,
|
||||
EFI_FILE *root_dir,
|
||||
CHAR16 *loaded_image_path,
|
||||
CHAR16 *id,
|
||||
const CHAR16 *loaded_image_path,
|
||||
const CHAR16 *id,
|
||||
CHAR16 key,
|
||||
CHAR16 *title,
|
||||
CHAR16 *loader) {
|
||||
const CHAR16 *title,
|
||||
const CHAR16 *loader) {
|
||||
|
||||
EFI_FILE_HANDLE handle;
|
||||
ConfigEntry *entry;
|
||||
@ -1774,7 +1773,7 @@ static BOOLEAN config_entry_add_loader_auto(
|
||||
}
|
||||
|
||||
/* check existence */
|
||||
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &handle, loader, EFI_FILE_MODE_READ, 0ULL);
|
||||
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &handle, (CHAR16*) loader, EFI_FILE_MODE_READ, 0ULL);
|
||||
if (EFI_ERROR(err))
|
||||
return FALSE;
|
||||
uefi_call_wrapper(handle->Close, 1, handle);
|
||||
@ -1824,7 +1823,7 @@ static VOID config_entry_add_linux(
|
||||
EFI_STATUS err;
|
||||
ConfigEntry *entry;
|
||||
|
||||
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &linux_dir, L"\\EFI\\Linux", EFI_FILE_MODE_READ, 0ULL);
|
||||
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &linux_dir, (CHAR16*) L"\\EFI\\Linux", EFI_FILE_MODE_READ, 0ULL);
|
||||
if (EFI_ERROR(err))
|
||||
return;
|
||||
|
||||
|
@ -175,23 +175,27 @@ if have_gnu_efi
|
||||
endif
|
||||
|
||||
if have_gnu_efi
|
||||
compile_args = ['-Wall',
|
||||
'-Wextra',
|
||||
'-std=gnu99',
|
||||
'-nostdlib',
|
||||
compile_args = cc.get_supported_arguments(
|
||||
basic_disabled_warnings +
|
||||
possible_common_cc_flags + [
|
||||
'-ffreestanding',
|
||||
'-fno-stack-protector',
|
||||
'-fpic',
|
||||
'-fshort-wchar',
|
||||
'-ffreestanding',
|
||||
'-fno-strict-aliasing',
|
||||
'-fno-stack-protector',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wsign-compare',
|
||||
'-Wno-missing-field-initializers',
|
||||
'-isystem', efi_incdir,
|
||||
'-isystem', join_paths(efi_incdir, gnu_efi_path_arch),
|
||||
'-I', fundamental_path,
|
||||
'-DSD_BOOT',
|
||||
'-include', efi_config_h,
|
||||
'-include', version_h]
|
||||
]
|
||||
) + [
|
||||
'-nostdlib',
|
||||
'-std=gnu99',
|
||||
'-isystem', efi_incdir,
|
||||
'-isystem', join_paths(efi_incdir, gnu_efi_path_arch),
|
||||
'-I', fundamental_path,
|
||||
'-DSD_BOOT',
|
||||
'-include', efi_config_h,
|
||||
'-include', version_h,
|
||||
]
|
||||
if efi_arch == 'x86_64'
|
||||
compile_args += ['-mno-red-zone',
|
||||
'-mno-sse',
|
||||
|
@ -243,7 +243,7 @@ EFI_STATUS process_random_seed(EFI_FILE *root_dir, RandomSeedMode mode) {
|
||||
if (mode != RANDOM_SEED_ALWAYS && EFI_ERROR(err))
|
||||
return err;
|
||||
|
||||
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &handle, L"\\loader\\random-seed", EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0ULL);
|
||||
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &handle, (CHAR16*) L"\\loader\\random-seed", EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0ULL);
|
||||
if (EFI_ERROR(err)) {
|
||||
if (err != EFI_NOT_FOUND)
|
||||
Print(L"Failed to open random seed file: %r\n", err);
|
||||
|
@ -143,9 +143,12 @@ void sha256_process_bytes(const void *buffer, UINTN len, struct sha256_ctx *ctx)
|
||||
|
||||
/* Process available complete blocks. */
|
||||
if (len >= 64) {
|
||||
#if !_STRING_ARCH_unaligned
|
||||
/* To check alignment gcc has an appropriate operator. Other
|
||||
compilers don't. */
|
||||
|
||||
/* The condition below is from glibc's string/string-inline.c.
|
||||
* See definition of _STRING_INLINE_unaligned. */
|
||||
#if !defined(__mc68020__) && !defined(__s390__) && !defined(__i386__)
|
||||
|
||||
/* To check alignment gcc has an appropriate operator. Other compilers don't. */
|
||||
# if __GNUC__ >= 2
|
||||
# define UNALIGNED_P(p) (((UINTN) p) % __alignof__ (UINT32) != 0)
|
||||
# else
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
|
@ -84,14 +84,14 @@ EFI_STATUS efivar_set(const EFI_GUID *vendor, const CHAR16 *name, const CHAR16 *
|
||||
return efivar_set_raw(vendor, name, value, value ? (StrLen(value) + 1) * sizeof(CHAR16) : 0, flags);
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, CHAR16 *name, UINTN i, UINT32 flags) {
|
||||
EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, const CHAR16 *name, UINTN i, UINT32 flags) {
|
||||
CHAR16 str[32];
|
||||
|
||||
SPrint(str, 32, L"%u", i);
|
||||
return efivar_set(vendor, name, str, flags);
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_set_uint32_le(const EFI_GUID *vendor, CHAR16 *name, UINT32 value, UINT32 flags) {
|
||||
EFI_STATUS efivar_set_uint32_le(const EFI_GUID *vendor, const CHAR16 *name, UINT32 value, UINT32 flags) {
|
||||
UINT8 buf[4];
|
||||
|
||||
buf[0] = (UINT8)(value >> 0U & 0xFF);
|
||||
@ -102,7 +102,7 @@ EFI_STATUS efivar_set_uint32_le(const EFI_GUID *vendor, CHAR16 *name, UINT32 val
|
||||
return efivar_set_raw(vendor, name, buf, sizeof(buf), flags);
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_set_uint64_le(const EFI_GUID *vendor, CHAR16 *name, UINT64 value, UINT32 flags) {
|
||||
EFI_STATUS efivar_set_uint64_le(const EFI_GUID *vendor, const CHAR16 *name, UINT64 value, UINT32 flags) {
|
||||
UINT8 buf[8];
|
||||
|
||||
buf[0] = (UINT8)(value >> 0U & 0xFF);
|
||||
@ -233,7 +233,7 @@ EFI_STATUS efivar_get_boolean_u8(const EFI_GUID *vendor, const CHAR16 *name, BOO
|
||||
return err;
|
||||
}
|
||||
|
||||
VOID efivar_set_time_usec(const EFI_GUID *vendor, CHAR16 *name, UINT64 usec) {
|
||||
VOID efivar_set_time_usec(const EFI_GUID *vendor, const CHAR16 *name, UINT64 usec) {
|
||||
CHAR16 str[32];
|
||||
|
||||
if (usec == 0)
|
||||
@ -245,7 +245,7 @@ VOID efivar_set_time_usec(const EFI_GUID *vendor, CHAR16 *name, UINT64 usec) {
|
||||
efivar_set(vendor, name, str, 0);
|
||||
}
|
||||
|
||||
static INTN utf8_to_16(CHAR8 *stra, CHAR16 *c) {
|
||||
static INTN utf8_to_16(const CHAR8 *stra, CHAR16 *c) {
|
||||
CHAR16 unichar;
|
||||
UINTN len;
|
||||
|
||||
@ -296,7 +296,7 @@ static INTN utf8_to_16(CHAR8 *stra, CHAR16 *c) {
|
||||
return len;
|
||||
}
|
||||
|
||||
CHAR16 *stra_to_str(CHAR8 *stra) {
|
||||
CHAR16 *stra_to_str(const CHAR8 *stra) {
|
||||
UINTN strlen;
|
||||
UINTN len;
|
||||
UINTN i;
|
||||
@ -324,7 +324,7 @@ CHAR16 *stra_to_str(CHAR8 *stra) {
|
||||
return str;
|
||||
}
|
||||
|
||||
CHAR16 *stra_to_path(CHAR8 *stra) {
|
||||
CHAR16 *stra_to_path(const CHAR8 *stra) {
|
||||
CHAR16 *str;
|
||||
UINTN strlen;
|
||||
UINTN len;
|
||||
@ -361,10 +361,10 @@ CHAR16 *stra_to_path(CHAR8 *stra) {
|
||||
return str;
|
||||
}
|
||||
|
||||
CHAR8 *strchra(CHAR8 *s, CHAR8 c) {
|
||||
CHAR8 *strchra(const CHAR8 *s, CHAR8 c) {
|
||||
do {
|
||||
if (*s == c)
|
||||
return s;
|
||||
return (CHAR8*) s;
|
||||
} while (*s++);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ UINT64 time_usec(void);
|
||||
|
||||
EFI_STATUS efivar_set(const EFI_GUID *vendor, const CHAR16 *name, const CHAR16 *value, UINT32 flags);
|
||||
EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const CHAR16 *name, const VOID *buf, UINTN size, UINT32 flags);
|
||||
EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, CHAR16 *name, UINTN i, UINT32 flags);
|
||||
EFI_STATUS efivar_set_uint32_le(const EFI_GUID *vendor, CHAR16 *NAME, UINT32 value, UINT32 flags);
|
||||
EFI_STATUS efivar_set_uint64_le(const EFI_GUID *vendor, CHAR16 *name, UINT64 value, UINT32 flags);
|
||||
VOID efivar_set_time_usec(const EFI_GUID *vendor, CHAR16 *name, UINT64 usec);
|
||||
EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, const CHAR16 *name, UINTN i, UINT32 flags);
|
||||
EFI_STATUS efivar_set_uint32_le(const EFI_GUID *vendor, const CHAR16 *NAME, UINT32 value, UINT32 flags);
|
||||
EFI_STATUS efivar_set_uint64_le(const EFI_GUID *vendor, const CHAR16 *name, UINT64 value, UINT32 flags);
|
||||
VOID efivar_set_time_usec(const EFI_GUID *vendor, const CHAR16 *name, UINT64 usec);
|
||||
|
||||
EFI_STATUS efivar_get(const EFI_GUID *vendor, const CHAR16 *name, CHAR16 **value);
|
||||
EFI_STATUS efivar_get_raw(const EFI_GUID *vendor, const CHAR16 *name, CHAR8 **buffer, UINTN *size);
|
||||
@ -32,9 +32,9 @@ EFI_STATUS efivar_get_uint32_le(const EFI_GUID *vendor, const CHAR16 *name, UINT
|
||||
EFI_STATUS efivar_get_uint64_le(const EFI_GUID *vendor, const CHAR16 *name, UINT64 *ret);
|
||||
EFI_STATUS efivar_get_boolean_u8(const EFI_GUID *vendor, const CHAR16 *name, BOOLEAN *ret);
|
||||
|
||||
CHAR8 *strchra(CHAR8 *s, CHAR8 c);
|
||||
CHAR16 *stra_to_path(CHAR8 *stra);
|
||||
CHAR16 *stra_to_str(CHAR8 *stra);
|
||||
CHAR8 *strchra(const CHAR8 *s, CHAR8 c);
|
||||
CHAR16 *stra_to_path(const CHAR8 *stra);
|
||||
CHAR16 *stra_to_str(const CHAR8 *stra);
|
||||
|
||||
EFI_STATUS file_read(EFI_FILE_HANDLE dir, const CHAR16 *name, UINTN off, UINTN size, CHAR8 **content, UINTN *content_size);
|
||||
|
||||
|
@ -152,7 +152,7 @@ sd_int strverscmp_improved(const sd_char *a, const sd_char *b) {
|
||||
* Note that except for '~' prefixed segments, a string has more segments is newer.
|
||||
* So, this check must be after the '~' check. */
|
||||
if (*a == '\0' || *b == '\0')
|
||||
return strcmp(a, b);
|
||||
return CMP(*a, *b);
|
||||
|
||||
/* Handle '-', which separates version and release, e.g 123.4-3.1.fc33.x86_64 */
|
||||
if (*a == '-' || *b == '-') {
|
||||
@ -194,9 +194,9 @@ sd_int strverscmp_improved(const sd_char *a, const sd_char *b) {
|
||||
|
||||
/* Find the leading numeric segments. One may be an empty string. So,
|
||||
* numeric segments are always newer than alpha segments. */
|
||||
for (aa = a; *aa != '\0' && isdigit(*aa); aa++)
|
||||
for (aa = a; isdigit(*aa); aa++)
|
||||
;
|
||||
for (bb = b; *bb != '\0' && isdigit(*bb); bb++)
|
||||
for (bb = b; isdigit(*bb); bb++)
|
||||
;
|
||||
|
||||
/* To compare numeric segments without parsing their values, first compare the
|
||||
@ -211,9 +211,9 @@ sd_int strverscmp_improved(const sd_char *a, const sd_char *b) {
|
||||
return r;
|
||||
} else {
|
||||
/* Find the leading non-numeric segments. */
|
||||
for (aa = a; *aa != '\0' && is_alpha(*aa); aa++)
|
||||
for (aa = a; is_alpha(*aa); aa++)
|
||||
;
|
||||
for (bb = b; *bb != '\0' && is_alpha(*bb); bb++)
|
||||
for (bb = b; is_alpha(*bb); bb++)
|
||||
;
|
||||
|
||||
/* Note that the segments are usually not NUL-terminated. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user