summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schmauss <SchmErik@users.noreply.github.com>2018-10-30 10:49:51 -0700
committerGitHub <noreply@github.com>2018-10-30 10:49:51 -0700
commit3f984c8bc7b7bce97dff8448f3612e11d2d380a8 (patch)
tree859b1e9016099779b8c029f6e65090e1555b4733
parentfc7694ac0469463f114e8ea1dabe6cd6d46e99ab (diff)
parentf526be5563b0d205b4c44a909b6acac9427b6437 (diff)
downloadacpica-3f984c8bc7b7bce97dff8448f3612e11d2d380a8.tar.gz
Merge pull request #425 from SchmErik/dtunixdos
iASL: properly detect continuation on dos files
-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)
{