Fix outputdots so that it doesn't errantly discard the first line of, e.g.,

CODE_FRAGMENT.  Also fix skip_past_newline to not skip past NUL.

	* bfd-in2.h: Regenerate.
	* libcoff.h: Regenerate.

	doc/
	* chew.c (skip_past_newline_1): New function.
	(outputdots): Call it.
	(skip_past_newline): Ditto.
This commit is contained in:
Doug Evans
2014-08-05 09:00:40 -07:00
parent e034b2cc9d
commit aaffae57f3
5 changed files with 43 additions and 7 deletions

View File

@@ -265,6 +265,19 @@ skip_white_and_stars (src, idx)
return idx;
}
static unsigned int
skip_past_newline_1 (ptr, idx)
string_type *ptr;
unsigned int idx;
{
while (at (ptr, idx)
&& at (ptr, idx) != '\n')
idx++;
if (at (ptr, idx) == '\n')
return idx + 1;
return idx;
}
/***********************************************************************/
string_type stack[STACK];
@@ -603,10 +616,12 @@ outputdots ()
while (at (tos, idx))
{
if (at (tos, idx) == '\n' && at (tos, idx + 1) == '.')
/* Every iteration begins at the start of a line. */
if (at (tos, idx) == '.')
{
char c;
idx += 2;
idx++;
while ((c = at (tos, idx)) && c != '\n')
{
@@ -626,11 +641,13 @@ outputdots ()
idx++;
}
}
if (c == '\n')
idx++;
catchar (&out, '\n');
}
else
{
idx++;
idx = skip_past_newline_1 (tos, idx);
}
}
@@ -1095,10 +1112,7 @@ icatstr ()
static void
skip_past_newline ()
{
while (at (ptr, idx)
&& at (ptr, idx) != '\n')
idx++;
idx++;
idx = skip_past_newline_1 (ptr, idx);
pc++;
}