/* * String conversion is different than Buffer conversion */ 
/* String conversion is different than Buffer conversion */  
acpi_ex_convert_to_integer (	union acpi_operand_object       *obj_desc,	union acpi_operand_object       **result_desc,	u32                             flags){	union acpi_operand_object       *return_desc;	u8                              *pointer;	acpi_integer                    result;	u32                             i;	u32                             count;	acpi_status                     status;	ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_integer", obj_desc);	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {	case ACPI_TYPE_INTEGER:		/* No conversion necessary */		*result_desc = obj_desc;		return_ACPI_STATUS (AE_OK);	case ACPI_TYPE_BUFFER:	case ACPI_TYPE_STRING:		/* Note: Takes advantage of common buffer/string fields */		pointer = obj_desc->buffer.pointer;		count   = obj_desc->buffer.length;		break;	default:		return_ACPI_STATUS (AE_TYPE);	}	/*	 * Convert the buffer/string to an integer.  Note that both buffers and	 * strings are treated as raw data - we don't convert ascii to hex for	 * strings.	 *	 * There are two terminating conditions for the loop:	 * 1) The size of an integer has been reached, or	 * 2) The end of the buffer or string has been reached	 */	result = 0;	/*	 * String conversion is different than Buffer conversion	 */	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {	case ACPI_TYPE_STRING:		/*		 * Convert string to an integer - for most cases, the string must be		 * hexadecimal as per the ACPI specification.  The only exception (as		 * of ACPI 3.0) is that the to_integer() operator allows both decimal		 * and hexadecimal strings (hex prefixed with "0x").		 */		status = acpi_ut_strtoul64 ((char *) pointer, flags, &result);		if (ACPI_FAILURE (status)) {			return_ACPI_STATUS (status);		}		break;	case ACPI_TYPE_BUFFER:		/* Check for zero-length buffer */		if (!count) {			return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);		}		/* Transfer no more than an integer's worth of data */		if (count > acpi_gbl_integer_byte_width) {			count = acpi_gbl_integer_byte_width;		}		/*		 * Convert buffer to an integer - we simply grab enough raw data		 * from the buffer to fill an integer		 */		for (i = 0; i < count; i++) {			/*			 * Get next byte and shift it into the Result.			 * Little endian is used, meaning that the first byte of the buffer			 * is the LSB of the integer			 */			result |= (((acpi_integer) pointer[i]) << (i * 8));		}		break;	default:		/* No other types can get here */		break;	}	/*	 * Create a new integer	 */	return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);	if (!return_desc) {		return_ACPI_STATUS (AE_NO_MEMORY);	}	/* Save the Result */	return_desc->integer.value = result;	acpi_ex_truncate_for32bit_table (return_desc);	*result_desc = return_desc;	return_ACPI_STATUS (AE_OK);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/44f6c01242da4e162f28d8e1216a8c7a91174605/exconvrt.c/buggy/drivers/acpi/executer/exconvrt.c