mirror of
https://github.com/acpica/acpica/
synced 2025-01-16 14:29:18 +03:00
Fix for base10 integer to ascii string conversion
date 2004.01.30.17.37.00; author rmoore1; state Exp;
This commit is contained in:
parent
f80cc6960d
commit
f493a87489
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exconvrt - Object conversion routines
|
||||
* $Revision: 1.48 $
|
||||
* $Revision: 1.51 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -130,8 +130,9 @@
|
||||
*
|
||||
* FUNCTION: AcpiExConvertToInteger
|
||||
*
|
||||
* PARAMETERS: *ObjDesc - Object to be converted. Must be an
|
||||
* PARAMETERS: ObjDesc - Object to be converted. Must be an
|
||||
* Integer, Buffer, or String
|
||||
* ResultDesc - Where the new Integer object is returned
|
||||
* WalkState - Current method state
|
||||
*
|
||||
* RETURN: Status
|
||||
@ -272,8 +273,9 @@ AcpiExConvertToInteger (
|
||||
*
|
||||
* FUNCTION: AcpiExConvertToBuffer
|
||||
*
|
||||
* PARAMETERS: *ObjDesc - Object to be converted. Must be an
|
||||
* PARAMETERS: ObjDesc - Object to be converted. Must be an
|
||||
* Integer, Buffer, or String
|
||||
* ResultDesc - Where the new buffer object is returned
|
||||
* WalkState - Current method state
|
||||
*
|
||||
* RETURN: Status
|
||||
@ -408,6 +410,7 @@ AcpiExConvertToAscii (
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
if (DataWidth < sizeof (ACPI_INTEGER))
|
||||
{
|
||||
LeadingZero = FALSE;
|
||||
@ -419,25 +422,24 @@ AcpiExConvertToAscii (
|
||||
Length = sizeof (ACPI_INTEGER);
|
||||
}
|
||||
|
||||
|
||||
switch (Base)
|
||||
{
|
||||
case 10:
|
||||
|
||||
Remainder = 0;
|
||||
for (i = ACPI_MAX_DECIMAL_DIGITS; i > 0 ; i--)
|
||||
for (i = ACPI_MAX_DECIMAL_DIGITS; i > 0; i--)
|
||||
{
|
||||
/* Divide by nth factor of 10 */
|
||||
|
||||
Digit = Integer;
|
||||
for (j = 1; j < i; j++)
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
(void) AcpiUtShortDivide (&Digit, 10, &Digit, &Remainder);
|
||||
}
|
||||
|
||||
/* Create the decimal digit */
|
||||
|
||||
if (Digit != 0)
|
||||
if (Remainder != 0)
|
||||
{
|
||||
LeadingZero = FALSE;
|
||||
}
|
||||
@ -450,6 +452,7 @@ AcpiExConvertToAscii (
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 16:
|
||||
|
||||
/* Copy the integer to the buffer */
|
||||
@ -471,13 +474,14 @@ AcpiExConvertToAscii (
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Since leading zeros are supressed, we must check for the case where
|
||||
* the integer equals 0.
|
||||
* the integer equals 0
|
||||
*
|
||||
* Finally, null terminate the string and return the length
|
||||
*/
|
||||
@ -496,8 +500,11 @@ AcpiExConvertToAscii (
|
||||
*
|
||||
* FUNCTION: AcpiExConvertToString
|
||||
*
|
||||
* PARAMETERS: *ObjDesc - Object to be converted. Must be an
|
||||
* Integer, Buffer, or String
|
||||
* PARAMETERS: ObjDesc - Object to be converted. Must be an
|
||||
* Integer, Buffer, or String
|
||||
* ResultDesc - Where the string object is returned
|
||||
* Base - 10 or 16
|
||||
* MaxLength - Max length of the returned string
|
||||
* WalkState - Current method state
|
||||
*
|
||||
* RETURN: Status
|
||||
@ -515,10 +522,10 @@ AcpiExConvertToString (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_OPERAND_OBJECT *RetDesc;
|
||||
UINT32 i;
|
||||
UINT32 StringLength;
|
||||
UINT8 *NewBuf;
|
||||
UINT8 *Pointer;
|
||||
UINT32 i;
|
||||
UINT32 StringLength;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
|
||||
@ -654,7 +661,6 @@ AcpiExConvertToString (
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If we are about to overwrite the original object on the operand stack,
|
||||
* we must remove a reference on the original object because we are
|
||||
@ -679,6 +685,7 @@ AcpiExConvertToString (
|
||||
*
|
||||
* PARAMETERS: DestinationType - Current type of the destination
|
||||
* SourceDesc - Source object to be converted.
|
||||
* ResultDesc - Where the converted object is returned
|
||||
* WalkState - Current method state
|
||||
*
|
||||
* RETURN: Status
|
||||
|
Loading…
Reference in New Issue
Block a user