Commit db0a507c authored by Armin Wolf's avatar Armin Wolf Committed by Rafael J. Wysocki

ACPICA: Update integer-to-hex-string conversions

ACPICA commit f2cb44f6deb6325a6b348b225fc82f565a870899

Add "0x" prefix for explicitly converted integers
and suppress leading zeros in such a case.
Provides compatibility with other ACPI implementations.

Link: https://github.com/acpica/acpica/commit/f2cb44f6Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 0e89a0fc
...@@ -417,6 +417,16 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, ...@@ -417,6 +417,16 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
base = 10; base = 10;
break; break;
case ACPI_EXPLICIT_CONVERT_HEX:
/*
* From to_hex_string.
*
* Supress leading zeros and append "0x"
*/
string_length =
ACPI_MUL_2(acpi_gbl_integer_byte_width) + 2;
leading_zeros = FALSE;
break;
default: default:
/* Two hex string characters for each integer byte */ /* Two hex string characters for each integer byte */
...@@ -437,6 +447,13 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, ...@@ -437,6 +447,13 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
} }
new_buf = return_desc->buffer.pointer; new_buf = return_desc->buffer.pointer;
if (type == ACPI_EXPLICIT_CONVERT_HEX) {
/* Append "0x" prefix for explicit hex conversion */
*new_buf++ = '0';
*new_buf++ = 'x';
}
/* Convert integer to string */ /* Convert integer to string */
...@@ -449,6 +466,13 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, ...@@ -449,6 +466,13 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
/* Null terminate at the correct place */ /* Null terminate at the correct place */
return_desc->string.length = string_length; return_desc->string.length = string_length;
if (type == ACPI_EXPLICIT_CONVERT_HEX) {
/* Take "0x" prefix into account */
return_desc->string.length += 2;
}
new_buf[string_length] = 0; new_buf[string_length] = 0;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment