summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schmauss <erik.schmauss@intel.com>2018-10-26 14:10:20 -0700
committerErik Schmauss <erik.schmauss@intel.com>2018-10-26 14:14:20 -0700
commitf526be5563b0d205b4c44a909b6acac9427b6437 (patch)
tree2f42fba85ee0582f8a134f3661b95445f048eb46
parentae65e825c8554bb392239ca21c6ff1179aa3fe6f (diff)
downloadacpica-f526be5563b0d205b4c44a909b6acac9427b6437.tar.gz
iASL: skip carriage return earlier to avoid special-cases in later stages of parsing
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
-rw-r--r--source/compiler/dtio.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c
index 7da4005fe..bd1890534 100644
--- a/source/compiler/dtio.c
+++ b/source/compiler/dtio.c
@@ -258,7 +258,7 @@ DtTrim (
while (End >= Start)
{
- if (*End == '\r' || *End == '\n')
+ if (*End == '\n')
{
End--;
continue;
@@ -522,6 +522,7 @@ DtGetNextLine (
UINT32 CurrentLineOffset;
UINT32 i;
int c;
+ int c1;
memset (AslGbl_CurrentLineBuffer, 0, AslGbl_LineBufferSize);
@@ -569,6 +570,29 @@ DtGetNextLine (
c = '\n';
State = DT_NORMAL_TEXT;
}
+ else if (c == '\r')
+ {
+ c1 = getc (Handle);
+ if (c1 == '\n')
+ {
+ /*
+ * Skip the carriage return as if it didn't exist. This is
+ * onlt meant for input files in DOS format in unix. fopen in
+ * unix may not support "text mode" and leaves CRLF intact.
+ */
+ c = '\n';
+ }
+ else
+ {
+ /* This was not a CRLF. Only a CR */
+
+ ungetc(c1, Handle);
+
+ DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL,
+ "Carriage return without linefeed detected");
+ return (ASL_EOF);
+ }
+ }
switch (State)
{