diff options
author | Julian Offenhäuser <offenhaeuser@protonmail.com> | 2023-03-21 19:57:47 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-22 09:04:00 +0100 |
commit | fca9da419108a0b415bfcec9c1bcc960988aceae (patch) | |
tree | 8b1fc75c7e996ba68e0b1844f84f1638903280aa | |
parent | 93062e2b7802a001226ec87f9fd3506dc07bc720 (diff) | |
download | serenity-fca9da419108a0b415bfcec9c1bcc960988aceae.zip |
LibPDF: Don't consume anything other than EOL in Reader::consume_eol()
This was previously a slightly confusing API. Even when there was no EOL
marker at the current location, we would still consume one byte.
It will now consume either EOL or nothing at all.
-rw-r--r-- | Userland/Libraries/LibPDF/Reader.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Libraries/LibPDF/Reader.cpp b/Userland/Libraries/LibPDF/Reader.cpp index 7bef8d6b2d..c9fc720384 100644 --- a/Userland/Libraries/LibPDF/Reader.cpp +++ b/Userland/Libraries/LibPDF/Reader.cpp @@ -46,8 +46,11 @@ bool Reader::consume_eol() consume(2); return true; } - auto consumed = consume(); - return consumed == 0xd || consumed == 0xa; + if (matches_eol()) { + consume(); + return true; + } + return false; } bool Reader::consume_whitespace() |