1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:57:35 +00:00

LibPDF: Remove unused function in Parser

This commit is contained in:
Matthew Olsson 2022-03-04 19:53:38 -07:00 committed by Andreas Kling
parent 455224d476
commit c1aa8c4a44
2 changed files with 2 additions and 32 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org> * Copyright (c) 2021-2022, Matthew Olsson <mattco@serenityos.org>
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
@ -7,7 +7,6 @@
#include <AK/BitStream.h> #include <AK/BitStream.h>
#include <AK/MemoryStream.h> #include <AK/MemoryStream.h>
#include <AK/ScopeGuard.h> #include <AK/ScopeGuard.h>
#include <AK/TypeCasts.h>
#include <LibPDF/CommonNames.h> #include <LibPDF/CommonNames.h>
#include <LibPDF/Document.h> #include <LibPDF/Document.h>
#include <LibPDF/Filter.h> #include <LibPDF/Filter.h>
@ -561,27 +560,6 @@ bool Parser::navigate_to_after_startxref()
return false; 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() String Parser::parse_comment()
{ {
if (!m_reader.matches('%')) if (!m_reader.matches('%'))

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org> * Copyright (c) 2021-2022, Matthew Olsson <mattco@serenityos.org>
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
@ -102,14 +102,6 @@ private:
bool navigate_to_before_eof_marker(); bool navigate_to_before_eof_marker();
bool navigate_to_after_startxref(); 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(); String parse_comment();
Value parse_value(); Value parse_value();