From b44df9f1020d69dd788570e53996d067fe94ca3b Mon Sep 17 00:00:00 2001 From: aystarik Date: Wed, 29 Jun 2005 17:19:39 +0000 Subject: [PATCH] Use new CreateBufferObject date 2002.11.14.17.48.00; author rmoore1; state Exp; --- source/components/executer/exconvrt.c | 50 ++++++++------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/source/components/executer/exconvrt.c b/source/components/executer/exconvrt.c index 15d5f2cab..9957d0297 100644 --- a/source/components/executer/exconvrt.c +++ b/source/components/executer/exconvrt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconvrt - Object conversion routines - * $Revision: 1.41 $ + * $Revision: 1.42 $ * *****************************************************************************/ @@ -296,38 +296,23 @@ AcpiExConvertToBuffer ( case ACPI_TYPE_INTEGER: /* - * Create a new Buffer object + * Create a new Buffer object. + * Need enough space for one integer */ - RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); + RetDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth); if (!RetDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } - /* Need enough space for one integer */ - - NewBuf = ACPI_MEM_CALLOCATE (AcpiGbl_IntegerByteWidth); - if (!NewBuf) - { - ACPI_REPORT_ERROR - (("ExConvertToBuffer: Buffer allocation failure\n")); - AcpiUtRemoveReference (RetDesc); - return_ACPI_STATUS (AE_NO_MEMORY); - } - /* Copy the integer to the buffer */ + NewBuf = RetDesc->Buffer.Pointer; for (i = 0; i < AcpiGbl_IntegerByteWidth; i++) { NewBuf[i] = (UINT8) (ObjDesc->Integer.Value >> (i * 8)); } - /* Complete buffer object initialization */ - - RetDesc->Buffer.Flags |= AOPOBJ_DATA_VALID; - RetDesc->Buffer.Pointer = NewBuf; - RetDesc->Buffer.Length = AcpiGbl_IntegerByteWidth; - /* Return the new buffer descriptor */ *ResultDesc = RetDesc; @@ -335,30 +320,22 @@ AcpiExConvertToBuffer ( case ACPI_TYPE_STRING: + /* * Create a new Buffer object + * Size will be the string length */ - RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); + RetDesc = AcpiUtCreateBufferObject (ObjDesc->String.Length); if (!RetDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } - /* Need enough space for one integer */ + /* Copy the string to the buffer */ - NewBuf = ACPI_MEM_CALLOCATE (ObjDesc->String.Length); - if (!NewBuf) - { - ACPI_REPORT_ERROR - (("ExConvertToBuffer: Buffer allocation failure\n")); - AcpiUtRemoveReference (RetDesc); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer, ObjDesc->String.Length); - RetDesc->Buffer.Flags |= AOPOBJ_DATA_VALID; - RetDesc->Buffer.Pointer = NewBuf; - RetDesc->Buffer.Length = ObjDesc->String.Length; + NewBuf = RetDesc->Buffer.Pointer; + ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer, + ObjDesc->String.Length); /* Return the new buffer descriptor */ @@ -367,6 +344,9 @@ AcpiExConvertToBuffer ( case ACPI_TYPE_BUFFER: + + /* No conversion necessary */ + *ResultDesc = ObjDesc; break;