case ACPI_EXPLICIT_CONVERT_HEX:     /* Used by to_hex_string operator */ 
case ACPI_EXPLICIT_CONVERT_HEX:     /* Used by to_hex_string */ 
acpi_ex_convert_to_string (	union acpi_operand_object       *obj_desc,	union acpi_operand_object       **result_desc,	u32                             type){	union acpi_operand_object       *return_desc;	u8                              *new_buf;	u32                             i;	u32                             string_length = 0;	u16                             base = 16;	u8                              separator = ',';	ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_string", obj_desc);	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {	case ACPI_TYPE_STRING:		/* No conversion necessary */		*result_desc = obj_desc;		return_ACPI_STATUS (AE_OK);	case ACPI_TYPE_INTEGER:		switch (type) {		case ACPI_EXPLICIT_CONVERT_DECIMAL:			/* Make room for maximum decimal number */			string_length = ACPI_MAX_DECIMAL_DIGITS;			base = 10;			break;		default:			/* Two hex string characters for each integer byte */			string_length = ACPI_MUL_2 (acpi_gbl_integer_byte_width);			break;		}		/*		 * Create a new String		 * Need enough space for one ASCII integer (plus null terminator)		 */		return_desc = acpi_ut_create_string_object ((acpi_size) string_length);		if (!return_desc) {			return_ACPI_STATUS (AE_NO_MEMORY);		}		new_buf = return_desc->buffer.pointer;		/* Convert integer to string */		string_length = acpi_ex_convert_to_ascii (obj_desc->integer.value, base,				   new_buf, acpi_gbl_integer_byte_width);		/* Null terminate at the correct place */		return_desc->string.length = string_length;		new_buf [string_length] = 0;		break;	case ACPI_TYPE_BUFFER:		/* Setup string length, base, and separator */		switch (type) {		case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string operator */			/*			 * From ACPI: "If Data is a buffer, it is converted to a string of			 * decimal values separated by commas."			 */			base = 10;			/*			 * Calculate the final string length.  Individual string values			 * are variable length (include separator for each)			 */			for (i = 0; i < obj_desc->buffer.length; i++) {				if (obj_desc->buffer.pointer[i] >= 100) {					string_length += 4;				}				else if (obj_desc->buffer.pointer[i] >= 10) {					string_length += 3;				}				else {					string_length += 2;				}			}			break;		case ACPI_IMPLICIT_CONVERT_HEX:			/*			 * From the ACPI spec:			 *"The entire contents of the buffer are converted to a string of			 * two-character hexadecimal numbers, each separated by a space."			 */			separator = ' ';			string_length = (obj_desc->buffer.length * 3);			break;		case ACPI_EXPLICIT_CONVERT_HEX:     /* Used by to_hex_string operator */			/*			 * From ACPI: "If Data is a buffer, it is converted to a string of			 * hexadecimal values separated by commas."			 */			string_length = (obj_desc->buffer.length * 3);			break;		default:			return_ACPI_STATUS (AE_BAD_PARAMETER);		}		/*		 * Perform the conversion.		 * (-1 because of extra separator included in string_length from above)		 */		string_length--;		if (string_length > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */ {			return_ACPI_STATUS (AE_AML_STRING_LIMIT);		}		/*		 * Create a new string object and string buffer		 */		return_desc = acpi_ut_create_string_object ((acpi_size) string_length);		if (!return_desc) {			return_ACPI_STATUS (AE_NO_MEMORY);		}		new_buf = return_desc->buffer.pointer;		/*		 * Convert buffer bytes to hex or decimal values		 * (separated by commas or spaces)		 */		for (i = 0; i < obj_desc->buffer.length; i++) {			new_buf += acpi_ex_convert_to_ascii (					 (acpi_integer) obj_desc->buffer.pointer[i], base,					 new_buf, 1);			*new_buf++ = separator; /* each separated by a comma or space */		}		/* Null terminate the string (overwrites final comma/space from above) */		new_buf--;		*new_buf = 0;		break;	default:		return_ACPI_STATUS (AE_TYPE);	}	*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