summaryrefslogtreecommitdiff
path: root/source/compiler/dtio.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler/dtio.c')
-rw-r--r--source/compiler/dtio.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c
index b15d3b97f407..bd1890534506 100644
--- a/source/compiler/dtio.c
+++ b/source/compiler/dtio.c
@@ -236,7 +236,7 @@ DtTrim (
/* Skip lines that start with a space */
- if (!strcmp (String, " "))
+ if (*String == 0 || !strcmp (String, " "))
{
ReturnString = UtLocalCacheCalloc (1);
return (ReturnString);
@@ -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)
{