From: Yu Watanabe Date: Wed, 2 Jun 2021 06:40:56 +0000 (+0900) Subject: efi: add const qualifier to string utils X-Git-Tag: v249-rc1~113^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef53d52b01967d1b126ca629bb74fd1b633dcf0c;p=thirdparty%2Fsystemd.git efi: add const qualifier to string utils --- diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c index 0061e03eba2..c6aa7954bc1 100644 --- a/src/boot/efi/util.c +++ b/src/boot/efi/util.c @@ -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; } diff --git a/src/boot/efi/util.h b/src/boot/efi/util.h index f3c97186e85..fc7377c0f77 100644 --- a/src/boot/efi/util.h +++ b/src/boot/efi/util.h @@ -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);