Просмотр исходного кода

LibPDF: Remove unused function in Parser

Matthew Olsson 3 лет назад
Родитель
Сommit
c1aa8c4a44
2 измененных файлов с 2 добавлено и 32 удалено
  1. 1 23
      Userland/Libraries/LibPDF/Parser.cpp
  2. 1 9
      Userland/Libraries/LibPDF/Parser.h

+ 1 - 23
Userland/Libraries/LibPDF/Parser.cpp

@@ -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('%'))

+ 1 - 9
Userland/Libraries/LibPDF/Parser.h

@@ -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();