diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp index f1c76ad2a1..73fab0b345 100644 --- a/Userland/Libraries/LibPDF/Parser.cpp +++ b/Userland/Libraries/LibPDF/Parser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Matthew Olsson + * Copyright (c) 2021-2022, Matthew Olsson * * SPDX-License-Identifier: BSD-2-Clause */ @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -561,27 +560,6 @@ bool Parser::navigate_to_after_startxref() return false; } -bool Parser::sloppy_is_linearized() -{ - ScopeGuard guard([&] { - m_reader.move_to(0); - m_reader.set_reading_forwards(); - }); - - auto limit = min(1024ul, m_reader.bytes().size() - 1); - m_reader.move_to(limit); - m_reader.set_reading_backwards(); - - while (!m_reader.done()) { - m_reader.move_until('/'); - if (m_reader.matches("/Linearized")) - return true; - m_reader.move_by(1); - } - - return false; -} - String Parser::parse_comment() { if (!m_reader.matches('%')) diff --git a/Userland/Libraries/LibPDF/Parser.h b/Userland/Libraries/LibPDF/Parser.h index b862bc67c2..3af930f362 100644 --- a/Userland/Libraries/LibPDF/Parser.h +++ b/Userland/Libraries/LibPDF/Parser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Matthew Olsson + * Copyright (c) 2021-2022, Matthew Olsson * * SPDX-License-Identifier: BSD-2-Clause */ @@ -102,14 +102,6 @@ private: bool navigate_to_before_eof_marker(); bool navigate_to_after_startxref(); - // If the PDF is linearized, the first object will be the linearization - // parameter dictionary, and it will always occur within the first 1024 bytes. - // We do a very sloppy and context-free search for this object. A return value - // of true does not necessarily mean this PDF is linearized, but a return value - // of false does mean this PDF is not linearized. - // FIXME: false doesn't guarantee non-linearization, but we VERIFY the result! - bool sloppy_is_linearized(); - String parse_comment(); Value parse_value();