mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
Merge pull request #358 from Poltuu/handle_wrong_return_char
\r only in token scanner
This commit is contained in:
@@ -262,6 +262,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// From the specification: The stream operator should be followed by \r\n or \n, not just \r.
|
// From the specification: The stream operator should be followed by \r\n or \n, not just \r.
|
||||||
|
// While the specification demands a \n we have seen files with \r only in the wild.
|
||||||
// While the specification demands a \n we have seen files with `garbage` before the actual data
|
// While the specification demands a \n we have seen files with `garbage` before the actual data
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -269,6 +270,21 @@
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((char)inputBytes.CurrentByte == '\r')
|
||||||
|
{
|
||||||
|
if (!inputBytes.MoveNext())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((char)inputBytes.CurrentByte != '\n')
|
||||||
|
{
|
||||||
|
inputBytes.Seek(inputBytes.CurrentOffset - 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
} while ((char)inputBytes.CurrentByte != '\n');
|
} while ((char)inputBytes.CurrentByte != '\n');
|
||||||
|
|
||||||
// Store where we started reading the first byte of data.
|
// Store where we started reading the first byte of data.
|
||||||
|
|||||||
Reference in New Issue
Block a user