]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi: add const qualifier to string utils
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Jun 2021 06:40:56 +0000 (15:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Jun 2021 06:40:56 +0000 (15:40 +0900)
src/boot/efi/util.c
src/boot/efi/util.h

index 0061e03eba2eda2b593abc26cc4787cdaa22a8c1..c6aa7954bc10737701afb82cd388779831b579ac 100644 (file)
@@ -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;
 }
index f3c97186e856653b3a08f657008fdb522f4eb269..fc7377c0f7791db9a62f4b820c35297c47f349f7 100644 (file)
@@ -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);