diff options
Diffstat (limited to 'source/tools/acpixtract/axutils.c')
| -rw-r--r-- | source/tools/acpixtract/axutils.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/source/tools/acpixtract/axutils.c b/source/tools/acpixtract/axutils.c index 8fba70047f93..61cb2d8a8b6a 100644 --- a/source/tools/acpixtract/axutils.c +++ b/source/tools/acpixtract/axutils.c @@ -427,7 +427,7 @@ AxNormalizeSignature ( * ******************************************************************************/ -size_t +int AxConvertToBinary ( char *InputLine, unsigned char *OutputData) @@ -468,14 +468,22 @@ AxConvertToBinary ( &Converted[8], &Converted[9], &Converted[10], &Converted[11], &Converted[12], &Converted[13], &Converted[14], &Converted[15]); - /* Pack converted data into a byte array */ + if (BytesConverted == EOF) + { + printf ("EOF while converting ASCII line to binary\n"); + return (-1); + } + /* + * Pack converted data into a byte array. + * Note: BytesConverted == 0 is acceptable. + */ for (i = 0; i < BytesConverted; i++) { OutputData[i] = (unsigned char) Converted[i]; } - return ((size_t) BytesConverted); + return (BytesConverted); } @@ -603,7 +611,6 @@ AxGetNextInstance ( * * PARAMETERS: OutputFile - Where to write the binary data * ThisSignature - Signature of current ACPI table - * ThisTableBytesWritten - Total count of data written * * RETURN: Length of the converted line * @@ -616,27 +623,29 @@ AxGetNextInstance ( * ******************************************************************************/ -long +int AxConvertAndWrite ( FILE *OutputFile, - char *ThisSignature, - unsigned int ThisTableBytesWritten) + char *ThisSignature) { - size_t BytesWritten; - size_t BytesConverted; + int BytesWritten; + int BytesConverted; /* Convert one line of ascii hex data to binary */ BytesConverted = AxConvertToBinary (Gbl_LineBuffer, Gbl_BinaryData); - - /* Write the binary data */ - + if (BytesConverted == EOF) + { + return (EOF); + } if (!BytesConverted) { return (0); } + /* Write the binary data */ + BytesWritten = fwrite (Gbl_BinaryData, 1, BytesConverted, OutputFile); if (BytesWritten != BytesConverted) { |
