efi: Use 16-bit unicode strings
At present we use wide characters for unicode but this is not necessary.
Change the code to use the 'u' literal instead. This helps to fix build
warnings for sandbox on rpi.
Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 4463ae0..f4519c7 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -56,10 +56,10 @@
int i;
size = sizeof(value16);
- ret = efi_get_variable_int(L"CapsuleLast", &efi_guid_capsule_report,
+ ret = efi_get_variable_int(u"CapsuleLast", &efi_guid_capsule_report,
NULL, &size, value16, NULL);
if (ret != EFI_SUCCESS || size != 22 ||
- u16_strncmp(value16, L"Capsule", 7))
+ u16_strncmp(value16, u"Capsule", 7))
goto err;
for (i = 0; i < 4; ++i) {
u16 c = value16[i + 7];
@@ -113,14 +113,14 @@
}
/* Variable CapsuleLast must not include terminating 0x0000 */
- ret = efi_set_variable_int(L"CapsuleLast", &efi_guid_capsule_report,
+ ret = efi_set_variable_int(u"CapsuleLast", &efi_guid_capsule_report,
EFI_VARIABLE_READ_ONLY |
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
22, variable_name16, false);
if (ret != EFI_SUCCESS)
- log_err("Setting %ls failed\n", L"CapsuleLast");
+ log_err("Setting %ls failed\n", u"CapsuleLast");
}
#ifdef CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT
@@ -707,7 +707,7 @@
/* find active boot device in BootNext */
bootnext = 0;
size = sizeof(bootnext);
- ret = efi_get_variable_int(L"BootNext",
+ ret = efi_get_variable_int(u"BootNext",
(efi_guid_t *)&efi_global_variable_guid,
NULL, &size, &bootnext, NULL);
if (ret == EFI_SUCCESS || ret == EFI_BUFFER_TOO_SMALL) {
@@ -734,7 +734,7 @@
skip:
/* find active boot device in BootOrder */
size = 0;
- ret = efi_get_variable_int(L"BootOrder", &efi_global_variable_guid,
+ ret = efi_get_variable_int(u"BootOrder", &efi_global_variable_guid,
NULL, &size, NULL, NULL);
if (ret == EFI_BUFFER_TOO_SMALL) {
boot_order = malloc(size);
@@ -743,7 +743,7 @@
goto out;
}
- ret = efi_get_variable_int(L"BootOrder",
+ ret = efi_get_variable_int(u"BootOrder",
&efi_global_variable_guid,
NULL, &size, boot_order, NULL);
}
@@ -875,8 +875,8 @@
break;
if (!(dirent->attribute & EFI_FILE_DIRECTORY) &&
- u16_strcmp(dirent->file_name, L".") &&
- u16_strcmp(dirent->file_name, L".."))
+ u16_strcmp(dirent->file_name, u".") &&
+ u16_strcmp(dirent->file_name, u".."))
tmp_files[count++] = u16_strdup(dirent->file_name);
}
/* ignore an error */
@@ -1052,7 +1052,7 @@
efi_status_t r;
size = sizeof(os_indications);
- r = efi_get_variable_int(L"OsIndications", &efi_global_variable_guid,
+ r = efi_get_variable_int(u"OsIndications", &efi_global_variable_guid,
NULL, &size, &os_indications, NULL);
if (r != EFI_SUCCESS || size != sizeof(os_indications))
return EFI_NOT_FOUND;
@@ -1061,7 +1061,7 @@
EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED) {
os_indications &=
~EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED;
- r = efi_set_variable_int(L"OsIndications",
+ r = efi_set_variable_int(u"OsIndications",
&efi_global_variable_guid,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |