From c6c425af1156587fd9b770e5d40bc087df0c63d8 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 29 Sep 2016 12:01:30 -0700 Subject: Move core/fpdfapi/fpdf_parser/include to core/fpdfapi/fpdf_parser BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2383543002 --- .../fpdf_edit/cpdf_pagecontentgenerator.cpp | 12 +- core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h | 2 +- core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 18 +- core/fpdfapi/fpdf_font/cpdf_cidfont.cpp | 6 +- core/fpdfapi/fpdf_font/cpdf_font.cpp | 10 +- core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp | 10 +- core/fpdfapi/fpdf_font/cpdf_simplefont.cpp | 4 +- core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_type1font.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_type3font.cpp | 4 +- core/fpdfapi/fpdf_font/fpdf_font.cpp | 14 +- core/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 6 +- core/fpdfapi/fpdf_page/cpdf_allstates.cpp | 4 +- core/fpdfapi/fpdf_page/cpdf_color.cpp | 4 +- core/fpdfapi/fpdf_page/cpdf_colorspace.cpp | 14 +- core/fpdfapi/fpdf_page/cpdf_contentmark.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_contentmarkitem.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_form.cpp | 4 +- core/fpdfapi/fpdf_page/cpdf_generalstate.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_image.cpp | 6 +- core/fpdfapi/fpdf_page/cpdf_image.h | 2 +- core/fpdfapi/fpdf_page/cpdf_imageobject.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_meshstream.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_meshstream.h | 2 +- core/fpdfapi/fpdf_page/cpdf_page.cpp | 6 +- core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp | 8 +- core/fpdfapi/fpdf_page/cpdf_textstate.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp | 6 +- core/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 12 +- core/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 8 +- core/fpdfapi/fpdf_page/fpdf_page_func.cpp | 10 +- core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 18 +- core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 18 +- core/fpdfapi/fpdf_parser/cfdf_document.cpp | 4 +- core/fpdfapi/fpdf_parser/cfdf_document.h | 42 ++++ core/fpdfapi/fpdf_parser/cpdf_array.cpp | 12 +- core/fpdfapi/fpdf_parser/cpdf_array.h | 72 ++++++ core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp | 6 +- core/fpdfapi/fpdf_parser/cpdf_boolean.h | 2 +- core/fpdfapi/fpdf_parser/cpdf_crypto_handler.cpp | 4 +- core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp | 16 +- core/fpdfapi/fpdf_parser/cpdf_data_avail.h | 253 +++++++++++++++++++++ core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp | 14 +- core/fpdfapi/fpdf_parser/cpdf_dictionary.h | 97 ++++++++ core/fpdfapi/fpdf_parser/cpdf_document.cpp | 12 +- core/fpdfapi/fpdf_parser/cpdf_document.h | 145 ++++++++++++ core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp | 12 +- core/fpdfapi/fpdf_parser/cpdf_hint_tables.h | 2 +- .../fpdf_parser/cpdf_indirect_object_holder.cpp | 6 +- .../fpdf_parser/cpdf_indirect_object_holder.h | 48 ++++ core/fpdfapi/fpdf_parser/cpdf_name.cpp | 4 +- core/fpdfapi/fpdf_parser/cpdf_name.h | 32 +++ core/fpdfapi/fpdf_parser/cpdf_null.h | 2 +- core/fpdfapi/fpdf_parser/cpdf_number.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_number.h | 44 ++++ core/fpdfapi/fpdf_parser/cpdf_object.cpp | 12 +- core/fpdfapi/fpdf_parser/cpdf_object.h | 183 +++++++++++++++ core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp | 16 +- core/fpdfapi/fpdf_parser/cpdf_parser.cpp | 16 +- core/fpdfapi/fpdf_parser/cpdf_parser.h | 177 ++++++++++++++ core/fpdfapi/fpdf_parser/cpdf_parser_unittest.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_reference.cpp | 4 +- core/fpdfapi/fpdf_parser/cpdf_reference.h | 55 +++++ core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp | 8 +- core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_simple_parser.h | 35 +++ .../fpdf_parser/cpdf_simple_parser_unittest.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_stream.cpp | 8 +- core/fpdfapi/fpdf_parser/cpdf_stream.h | 61 +++++ core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp | 4 +- core/fpdfapi/fpdf_parser/cpdf_stream_acc.h | 46 ++++ core/fpdfapi/fpdf_parser/cpdf_string.cpp | 4 +- core/fpdfapi/fpdf_parser/cpdf_string.h | 39 ++++ core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp | 16 +- .../fpdf_parser/cpdf_syntax_parser_unittest.cpp | 2 +- core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 6 +- core/fpdfapi/fpdf_parser/fpdf_parser_decode.h | 77 +++++++ .../fpdf_parser_decode_embeddertest.cpp | 2 +- .../fpdf_parser/fpdf_parser_decode_unittest.cpp | 2 +- core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp | 16 +- core/fpdfapi/fpdf_parser/include/cfdf_document.h | 42 ---- core/fpdfapi/fpdf_parser/include/cpdf_array.h | 72 ------ core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h | 253 --------------------- core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h | 97 -------- core/fpdfapi/fpdf_parser/include/cpdf_document.h | 145 ------------ .../include/cpdf_indirect_object_holder.h | 48 ---- core/fpdfapi/fpdf_parser/include/cpdf_name.h | 32 --- core/fpdfapi/fpdf_parser/include/cpdf_number.h | 44 ---- core/fpdfapi/fpdf_parser/include/cpdf_object.h | 183 --------------- core/fpdfapi/fpdf_parser/include/cpdf_parser.h | 177 -------------- core/fpdfapi/fpdf_parser/include/cpdf_reference.h | 55 ----- .../fpdf_parser/include/cpdf_simple_parser.h | 35 --- core/fpdfapi/fpdf_parser/include/cpdf_stream.h | 61 ----- core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h | 46 ---- core/fpdfapi/fpdf_parser/include/cpdf_string.h | 39 ---- .../fpdf_parser/include/fpdf_parser_decode.h | 77 ------- core/fpdfapi/fpdf_render/fpdf_render.cpp | 6 +- core/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 2 +- core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 6 +- core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 6 +- core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 4 +- core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 4 +- core/fpdfapi/fpdf_render/render_int.h | 2 +- core/fpdfdoc/cpdf_action.cpp | 4 +- core/fpdfdoc/cpdf_actionfields.cpp | 4 +- core/fpdfdoc/cpdf_annot.cpp | 4 +- core/fpdfdoc/cpdf_annotlist.cpp | 4 +- core/fpdfdoc/cpdf_apsettings.cpp | 4 +- core/fpdfdoc/cpdf_bookmark.cpp | 4 +- core/fpdfdoc/cpdf_bookmarktree.cpp | 2 +- core/fpdfdoc/cpdf_defaultappearance.cpp | 4 +- core/fpdfdoc/cpdf_dest.cpp | 4 +- core/fpdfdoc/cpdf_filespec.cpp | 6 +- core/fpdfdoc/cpdf_filespec_unittest.cpp | 6 +- core/fpdfdoc/cpdf_formcontrol.cpp | 8 +- core/fpdfdoc/cpdf_formfield.cpp | 14 +- core/fpdfdoc/cpdf_formfield_unittest.cpp | 4 +- core/fpdfdoc/cpdf_iconfit.cpp | 4 +- core/fpdfdoc/cpdf_interform.cpp | 8 +- core/fpdfdoc/cpdf_link.cpp | 2 +- core/fpdfdoc/cpdf_linklist.cpp | 2 +- core/fpdfdoc/cpdf_metadata.cpp | 6 +- core/fpdfdoc/cpdf_nametree.cpp | 6 +- core/fpdfdoc/cpdf_numbertree.cpp | 4 +- core/fpdfdoc/cpdf_occontext.cpp | 4 +- core/fpdfdoc/cpdf_pagelabel.cpp | 6 +- core/fpdfdoc/cpdf_viewerpreferences.cpp | 2 +- core/fpdfdoc/cpvt_color.cpp | 2 +- core/fpdfdoc/cpvt_color.h | 2 +- core/fpdfdoc/cpvt_fontmap.cpp | 4 +- core/fpdfdoc/cpvt_generateap.cpp | 10 +- core/fpdfdoc/doc_tagged.cpp | 10 +- core/fpdfdoc/include/cpdf_action.h | 2 +- core/fpdfdoc/include/cpdf_interform.h | 2 +- core/fpdftext/cpdf_textpage.cpp | 4 +- core/fxcodec/codec/fx_codec_jbig.cpp | 2 +- core/fxcodec/jbig2/JBig2_BitStream.cpp | 4 +- core/fxcodec/jbig2/JBig2_Context.cpp | 4 +- core/fxcodec/jbig2/JBig2_Context.h | 2 +- core/fxge/dib/fx_dib_engine_unittest.cpp | 6 +- core/fxge/ge/cfx_graphstate.cpp | 2 +- core/fxge/skia/fx_skia_device.cpp | 6 +- 144 files changed, 1734 insertions(+), 1734 deletions(-) create mode 100644 core/fpdfapi/fpdf_parser/cfdf_document.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_array.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_data_avail.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_dictionary.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_document.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_name.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_number.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_object.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_parser.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_reference.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_simple_parser.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_stream.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_stream_acc.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_string.h create mode 100644 core/fpdfapi/fpdf_parser/fpdf_parser_decode.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cfdf_document.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_array.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_document.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_name.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_number.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_object.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_parser.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_reference.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_stream.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h delete mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_string.h delete mode 100644 core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h (limited to 'core') diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp index e0099dd60b..4a6944ba86 100644 --- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp @@ -12,12 +12,12 @@ #include "core/fpdfapi/fpdf_page/cpdf_page.h" #include "core/fpdfapi/fpdf_page/cpdf_pageobject.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& ar, CFX_Matrix& matrix) { ar << matrix.a << " " << matrix.b << " " << matrix.c << " " << matrix.d << " " diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h index d5a69caef8..19b9258979 100644 --- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h +++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h @@ -7,7 +7,7 @@ #ifndef CORE_FPDFAPI_FPDF_EDIT_CPDF_PAGECONTENTGENERATOR_H_ #define CORE_FPDFAPI_FPDF_EDIT_CPDF_PAGECONTENTGENERATOR_H_ -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fxcrt/include/fx_basic.h" #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_system.h" diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 05847232f6..b039ec5535 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -9,17 +9,17 @@ #include #include "core/fpdfapi/fpdf_edit/cpdf_creator.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" #include "core/fpdfapi/fpdf_parser/cpdf_security_handler.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fxcrt/include/fx_ext.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp index 03bf2c45fc..9b786040f4 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp @@ -14,9 +14,9 @@ #include "core/fpdfapi/fpdf_font/font_int.h" #include "core/fpdfapi/fpdf_font/ttgsubtable.h" #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "third_party/base/numerics/safe_math.h" diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp index 15fb4c5add..017cc98c15 100644 --- a/core/fpdfapi/fpdf_font/cpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp @@ -16,11 +16,11 @@ #include "core/fpdfapi/fpdf_font/font_int.h" #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcrt/include/fx_memory.h" #include "core/fxge/include/fx_freetype.h" diff --git a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp index dbe31b57c5..8704aea365 100644 --- a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp @@ -6,11 +6,11 @@ #include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fxge/include/fx_freetype.h" namespace { diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp index 2668efa7b0..94d8a993b7 100644 --- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp @@ -7,8 +7,8 @@ #include "core/fpdfapi/fpdf_font/cpdf_simplefont.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fxge/include/fx_freetype.h" #include "third_party/base/numerics/safe_math.h" diff --git a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp index 841fb79288..c6b8eb6419 100644 --- a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp @@ -7,7 +7,7 @@ #include "core/fpdfapi/fpdf_font/cpdf_truetypefont.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fxge/include/fx_font.h" namespace { diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp index 5b1d976625..04b872f0e0 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp @@ -7,7 +7,7 @@ #include "core/fpdfapi/fpdf_font/cpdf_type1font.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fxge/include/cfx_gemodule.h" #include "core/fxge/include/fx_freetype.h" diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp index 4b4d1439d9..da30e447c0 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp @@ -11,8 +11,8 @@ #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" #include "core/fpdfapi/fpdf_page/cpdf_form.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fxcrt/include/fx_system.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp index 50eaed1e7d..5c042dadc4 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp @@ -9,13 +9,13 @@ #include "core/fpdfapi/fpdf_page/cpdf_form.h" #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcrt/include/fx_ext.h" #include "core/fxge/include/fx_freetype.h" diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp index da6923d6c7..184f9f0a7c 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -9,9 +9,9 @@ #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" #include "core/fpdfapi/fpdf_font/ttgsubtable.h" #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcrt/include/fx_ext.h" #include "core/fxge/include/fx_freetype.h" diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp index 2883c26309..24ec15f3c1 100644 --- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp @@ -7,8 +7,8 @@ #include "core/fpdfapi/fpdf_page/cpdf_allstates.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fxge/include/cfx_graphstatedata.h" namespace { diff --git a/core/fpdfapi/fpdf_page/cpdf_color.cpp b/core/fpdfapi/fpdf_page/cpdf_color.cpp index 425fc0ca4b..913af63331 100644 --- a/core/fpdfapi/fpdf_page/cpdf_color.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_color.cpp @@ -7,8 +7,8 @@ #include "core/fpdfapi/fpdf_page/cpdf_color.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fxcrt/include/fx_system.h" CPDF_Color::CPDF_Color() : m_pCS(nullptr), m_pBuffer(nullptr) {} diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp index 0dc2091e74..61a37f564c 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp @@ -10,13 +10,13 @@ #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcodec/include/fx_codec.h" diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp b/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp index 1c47f00182..f71206e640 100644 --- a/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp @@ -6,7 +6,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_contentmark.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "third_party/base/stl_util.h" CPDF_ContentMark::CPDF_ContentMark() {} diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmarkitem.cpp b/core/fpdfapi/fpdf_page/cpdf_contentmarkitem.cpp index 5e2d21f850..88c5008e0b 100644 --- a/core/fpdfapi/fpdf_page/cpdf_contentmarkitem.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_contentmarkitem.cpp @@ -6,7 +6,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_contentmarkitem.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" CPDF_ContentMarkItem::CPDF_ContentMarkItem() : m_ParamType(None), m_pPropertiesDict(nullptr) {} diff --git a/core/fpdfapi/fpdf_page/cpdf_form.cpp b/core/fpdfapi/fpdf_page/cpdf_form.cpp index c72690d200..2823ee5bab 100644 --- a/core/fpdfapi/fpdf_page/cpdf_form.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_form.cpp @@ -9,8 +9,8 @@ #include "core/fpdfapi/fpdf_page/cpdf_pageobject.h" #include "core/fpdfapi/fpdf_page/cpdf_pageobjectholder.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" CPDF_Form::CPDF_Form(CPDF_Document* pDoc, CPDF_Dictionary* pPageResources, diff --git a/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp b/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp index f37fa7233b..e5208f5c30 100644 --- a/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp @@ -6,7 +6,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_generalstate.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fpdfapi/fpdf_render/render_int.h" namespace { diff --git a/core/fpdfapi/fpdf_page/cpdf_image.cpp b/core/fpdfapi/fpdf_page/cpdf_image.cpp index fc5ce8fd10..ecd3399c7b 100644 --- a/core/fpdfapi/fpdf_page/cpdf_image.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_image.cpp @@ -12,10 +12,10 @@ #include "core/fpdfapi/fpdf_page/cpdf_page.h" #include "core/fpdfapi/fpdf_page/pageint.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/fpdf_render/render_int.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" diff --git a/core/fpdfapi/fpdf_page/cpdf_image.h b/core/fpdfapi/fpdf_page/cpdf_image.h index bf4e73b4d8..d885570d6c 100644 --- a/core/fpdfapi/fpdf_page/cpdf_image.h +++ b/core/fpdfapi/fpdf_page/cpdf_image.h @@ -7,7 +7,7 @@ #ifndef CORE_FPDFAPI_FPDF_PAGE_CPDF_IMAGE_H_ #define CORE_FPDFAPI_FPDF_PAGE_CPDF_IMAGE_H_ -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" #include "core/fxcrt/include/fx_system.h" #define PDF_IMAGE_NO_COMPRESS 0x0000 diff --git a/core/fpdfapi/fpdf_page/cpdf_imageobject.cpp b/core/fpdfapi/fpdf_page/cpdf_imageobject.cpp index b8db154bef..74351b024d 100644 --- a/core/fpdfapi/fpdf_page/cpdf_imageobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_imageobject.cpp @@ -10,7 +10,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_image.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" CPDF_ImageObject::CPDF_ImageObject() : m_pImage(nullptr), m_pImageOwned(false) {} diff --git a/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp b/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp index a9da92ed22..9e707365ec 100644 --- a/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_colorspace.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" namespace { diff --git a/core/fpdfapi/fpdf_page/cpdf_meshstream.h b/core/fpdfapi/fpdf_page/cpdf_meshstream.h index b8a8c38f37..53664b8eb1 100644 --- a/core/fpdfapi/fpdf_page/cpdf_meshstream.h +++ b/core/fpdfapi/fpdf_page/cpdf_meshstream.h @@ -11,7 +11,7 @@ #include #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fxcrt/include/fx_basic.h" #include "core/fxcrt/include/fx_system.h" diff --git a/core/fpdfapi/fpdf_page/cpdf_page.cpp b/core/fpdfapi/fpdf_page/cpdf_page.cpp index 13a44ba88c..4dbfb019a6 100644 --- a/core/fpdfapi/fpdf_page/cpdf_page.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_page.cpp @@ -10,9 +10,9 @@ #include "core/fpdfapi/fpdf_page/cpdf_pageobject.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/include/cpdf_pagerendercontext.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp b/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp index 115cf4694b..fd92e598cd 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_pageobject.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" CPDF_PageObjectHolder::CPDF_PageObjectHolder() : m_pFormDict(nullptr), diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp b/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp index f2e7d97a96..49d0f60353 100644 --- a/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" CPDF_ShadingObject::CPDF_ShadingObject() : m_pShading(nullptr) {} diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp index 8da9b4769f..8b74d1275e 100644 --- a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp @@ -7,10 +7,10 @@ #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" namespace { diff --git a/core/fpdfapi/fpdf_page/cpdf_textstate.cpp b/core/fpdfapi/fpdf_page/cpdf_textstate.cpp index 394af9ec86..578624de0a 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textstate.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textstate.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" CPDF_TextState::CPDF_TextState() {} CPDF_TextState::~CPDF_TextState() {} diff --git a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp index dd80487148..42f4aaa955 100644 --- a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp @@ -7,9 +7,9 @@ #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" #include "core/fpdfapi/fpdf_page/cpdf_form.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, diff --git a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 6fd7621a51..1f643f0b4f 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -10,12 +10,12 @@ #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcodec/include/fx_codec.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp index ba20c7a9f1..5d7b88a152 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -17,10 +17,10 @@ #include "core/fpdfapi/fpdf_page/cpdf_pattern.h" #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp index 266b2bd09f..a9836eb1c0 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -14,11 +14,11 @@ #include #include "core/fpdfapi/fpdf_page/cpdf_psengine.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fxcrt/include/fx_safe_types.h" #include "third_party/base/numerics/safe_conversions_impl.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 3a8fb73d24..f1aca0991e 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -24,15 +24,15 @@ #include "core/fpdfapi/fpdf_page/cpdf_shadingobject.h" #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" #include "core/fpdfapi/fpdf_page/cpdf_textobject.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fxcrt/include/fx_safe_types.h" #include "core/fxge/include/cfx_graphstatedata.h" #include "core/fxge/include/cfx_pathdata.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 244fe76353..9f5b4debdf 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -14,18 +14,18 @@ #include "core/fpdfapi/fpdf_page/cpdf_page.h" #include "core/fpdfapi/fpdf_page/cpdf_pageobject.h" #include "core/fpdfapi/fpdf_page/cpdf_path.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" #include "core/fpdfapi/fpdf_parser/cpdf_null.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcodec/include/fx_codec.h" #include "core/fxcrt/include/fx_ext.h" diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp index 46b9ff5191..860912ab3e 100644 --- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp @@ -4,11 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cfdf_document.h" +#include "core/fpdfapi/fpdf_parser/cfdf_document.h" #include "core/fpdfapi/fpdf_edit/cpdf_creator.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" CFDF_Document::CFDF_Document() : CPDF_IndirectObjectHolder(), diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.h b/core/fpdfapi/fpdf_parser/cfdf_document.h new file mode 100644 index 0000000000..1894cb3e2b --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cfdf_document.h @@ -0,0 +1,42 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CFDF_DOCUMENT_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CFDF_DOCUMENT_H_ + +#include "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fxcrt/include/cfx_string_pool_template.h" +#include "core/fxcrt/include/cfx_weak_ptr.h" +#include "core/fxcrt/include/fx_basic.h" + +class CPDF_Dictionary; + +class CFDF_Document : public CPDF_IndirectObjectHolder { + public: + static CFDF_Document* CreateNewDoc(); + static CFDF_Document* ParseFile(IFX_FileRead* pFile, + FX_BOOL bOwnFile = FALSE); + static CFDF_Document* ParseMemory(const uint8_t* pData, uint32_t size); + ~CFDF_Document() override; + + FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const; + CPDF_Dictionary* GetRoot() const { return m_pRootDict; } + CFX_WeakPtr GetByteStringPool() const { + return m_pByteStringPool; + } + + protected: + CFDF_Document(); + void ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile); + + CPDF_Dictionary* m_pRootDict; + IFX_FileRead* m_pFile; + FX_BOOL m_bOwnFile; + CFX_WeakPtr m_pByteStringPool; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CFDF_DOCUMENT_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp index da935af47d..26e65bca34 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp @@ -4,15 +4,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" #include "third_party/base/logging.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.h b/core/fpdfapi/fpdf_parser/cpdf_array.h new file mode 100644 index 0000000000..b3f480ccd3 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_array.h @@ -0,0 +1,72 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_ARRAY_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_ARRAY_H_ + +#include +#include + +#include "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fxcrt/include/fx_basic.h" +#include "core/fxcrt/include/fx_coordinates.h" + +class CPDF_Array : public CPDF_Object { + public: + using iterator = std::vector::iterator; + using const_iterator = std::vector::const_iterator; + + CPDF_Array(); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone() const override; + bool IsArray() const override; + CPDF_Array* AsArray() override; + const CPDF_Array* AsArray() const override; + + bool IsEmpty() const { return m_Objects.empty(); } + size_t GetCount() const { return m_Objects.size(); } + CPDF_Object* GetObjectAt(size_t index) const; + CPDF_Object* GetDirectObjectAt(size_t index) const; + CFX_ByteString GetStringAt(size_t index) const; + int GetIntegerAt(size_t index) const; + FX_FLOAT GetNumberAt(size_t index) const; + CPDF_Dictionary* GetDictAt(size_t index) const; + CPDF_Stream* GetStreamAt(size_t index) const; + CPDF_Array* GetArrayAt(size_t index) const; + FX_FLOAT GetFloatAt(size_t index) const { return GetNumberAt(index); } + CFX_Matrix GetMatrix(); + CFX_FloatRect GetRect(); + + void SetAt(size_t index, CPDF_Object* pObj); + void InsertAt(size_t index, CPDF_Object* pObj); + void RemoveAt(size_t index, size_t nCount = 1); + + void Add(CPDF_Object* pObj); + void AddNumber(FX_FLOAT f); + void AddInteger(int i); + void AddString(const CFX_ByteString& str); + void AddName(const CFX_ByteString& str); + void AddReference(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum); + + iterator begin() { return m_Objects.begin(); } + iterator end() { return m_Objects.end(); } + const_iterator begin() const { return m_Objects.begin(); } + const_iterator end() const { return m_Objects.end(); } + + protected: + ~CPDF_Array() override; + + CPDF_Object* CloneNonCyclic( + bool bDirect, + std::set* pVisited) const override; + + std::vector m_Objects; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_ARRAY_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp index f08ee6ca63..110fd59e0a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" #include diff --git a/core/fpdfapi/fpdf_parser/cpdf_boolean.h b/core/fpdfapi/fpdf_parser/cpdf_boolean.h index 231b8fe9a4..d15e5b78c0 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_boolean.h +++ b/core/fpdfapi/fpdf_parser/cpdf_boolean.h @@ -7,7 +7,7 @@ #ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_BOOLEAN_H_ #define CORE_FPDFAPI_FPDF_PARSER_CPDF_BOOLEAN_H_ -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_crypto_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_crypto_handler.cpp index 3dbe7b9570..36f74cbd32 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_crypto_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_crypto_handler.cpp @@ -9,9 +9,9 @@ #include #include "core/fdrm/crypto/fx_crypt.h" +#include "core/fpdfapi/fpdf_parser/cpdf_parser.h" #include "core/fpdfapi/fpdf_parser/cpdf_security_handler.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" void CPDF_CryptoHandler::CryptBlock(FX_BOOL bEncrypt, uint32_t objnum, diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp index a8cbeaf5d4..d29eb4afa5 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp @@ -4,21 +4,21 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" +#include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h" #include #include #include +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/cpdf_hint_tables.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcrt/include/fx_ext.h" #include "core/fxcrt/include/fx_safe_types.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h new file mode 100644 index 0000000000..44e242eac1 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h @@ -0,0 +1,253 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_DATA_AVAIL_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_DATA_AVAIL_H_ + +#include "core/fpdfapi/fpdf_parser/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" +#include "core/fxcrt/include/fx_basic.h" + +class CPDF_Dictionary; +class CPDF_HintTables; +class CPDF_IndirectObjectHolder; +class CPDF_Parser; + +enum PDF_DATAAVAIL_STATUS { + PDF_DATAAVAIL_HEADER = 0, + PDF_DATAAVAIL_FIRSTPAGE, + PDF_DATAAVAIL_FIRSTPAGE_PREPARE, + PDF_DATAAVAIL_HINTTABLE, + PDF_DATAAVAIL_END, + PDF_DATAAVAIL_CROSSREF, + PDF_DATAAVAIL_CROSSREF_ITEM, + PDF_DATAAVAIL_CROSSREF_STREAM, + PDF_DATAAVAIL_TRAILER, + PDF_DATAAVAIL_LOADALLCROSSREF, + PDF_DATAAVAIL_ROOT, + PDF_DATAAVAIL_INFO, + PDF_DATAAVAIL_ACROFORM, + PDF_DATAAVAIL_ACROFORM_SUBOBJECT, + PDF_DATAAVAIL_PAGETREE, + PDF_DATAAVAIL_PAGE, + PDF_DATAAVAIL_PAGE_LATERLOAD, + PDF_DATAAVAIL_RESOURCES, + PDF_DATAAVAIL_DONE, + PDF_DATAAVAIL_ERROR, + PDF_DATAAVAIL_LOADALLFILE, + PDF_DATAAVAIL_TRAILER_APPEND +}; + +enum PDF_PAGENODE_TYPE { + PDF_PAGENODE_UNKNOWN = 0, + PDF_PAGENODE_PAGE, + PDF_PAGENODE_PAGES, + PDF_PAGENODE_ARRAY, +}; + +class CPDF_DataAvail final { + public: + // Must match PDF_DATA_* definitions in public/fpdf_dataavail.h, but cannot + // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts + // to make sure the two sets of values match. + enum DocAvailStatus { + DataError = -1, // PDF_DATA_ERROR + DataNotAvailable = 0, // PDF_DATA_NOTAVAIL + DataAvailable = 1, // PDF_DATA_AVAIL + }; + + // Must match PDF_*LINEAR* definitions in public/fpdf_dataavail.h, but cannot + // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts + // to make sure the two sets of values match. + enum DocLinearizationStatus { + LinearizationUnknown = -1, // PDF_LINEARIZATION_UNKNOWN + NotLinearized = 0, // PDF_NOT_LINEARIZED + Linearized = 1, // PDF_LINEARIZED + }; + + // Must match PDF_FORM_* definitions in public/fpdf_dataavail.h, but cannot + // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts + // to make sure the two sets of values match. + enum DocFormStatus { + FormError = -1, // PDF_FORM_ERROR + FormNotAvailable = 0, // PDF_FORM_NOTAVAIL + FormAvailable = 1, // PDF_FORM_AVAIL + FormNotExist = 2, // PDF_FORM_NOTEXIST + }; + + class FileAvail { + public: + virtual ~FileAvail(); + virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0; + }; + + class DownloadHints { + public: + virtual ~DownloadHints(); + virtual void AddSegment(FX_FILESIZE offset, uint32_t size) = 0; + }; + + CPDF_DataAvail(FileAvail* pFileAvail, + IFX_FileRead* pFileRead, + FX_BOOL bSupportHintTable); + ~CPDF_DataAvail(); + + DocAvailStatus IsDocAvail(DownloadHints* pHints); + void SetDocument(CPDF_Document* pDoc); + DocAvailStatus IsPageAvail(uint32_t dwPage, DownloadHints* pHints); + DocFormStatus IsFormAvail(DownloadHints* pHints); + DocLinearizationStatus IsLinearizedPDF(); + FX_BOOL IsLinearized(); + void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize); + IFX_FileRead* GetFileRead() const { return m_pFileRead; } + int GetPageCount() const; + CPDF_Dictionary* GetPage(int index); + + friend class CPDF_HintTables; + + protected: + class PageNode { + public: + PageNode(); + ~PageNode(); + + PDF_PAGENODE_TYPE m_type; + uint32_t m_dwPageNo; + CFX_ArrayTemplate m_childNode; + }; + + static const int kMaxDataAvailRecursionDepth = 64; + static int s_CurrentDataAvailRecursionDepth; + static const int kMaxPageRecursionDepth = 1024; + + uint32_t GetObjectSize(uint32_t objnum, FX_FILESIZE& offset); + FX_BOOL IsObjectsAvail(CFX_ArrayTemplate& obj_array, + FX_BOOL bParsePage, + DownloadHints* pHints, + CFX_ArrayTemplate& ret_array); + FX_BOOL CheckDocStatus(DownloadHints* pHints); + FX_BOOL CheckHeader(DownloadHints* pHints); + FX_BOOL CheckFirstPage(DownloadHints* pHints); + FX_BOOL CheckHintTables(DownloadHints* pHints); + FX_BOOL CheckEnd(DownloadHints* pHints); + FX_BOOL CheckCrossRef(DownloadHints* pHints); + FX_BOOL CheckCrossRefItem(DownloadHints* pHints); + FX_BOOL CheckTrailer(DownloadHints* pHints); + FX_BOOL CheckRoot(DownloadHints* pHints); + FX_BOOL CheckInfo(DownloadHints* pHints); + FX_BOOL CheckPages(DownloadHints* pHints); + FX_BOOL CheckPage(DownloadHints* pHints); + FX_BOOL CheckResources(DownloadHints* pHints); + FX_BOOL CheckAnnots(DownloadHints* pHints); + FX_BOOL CheckAcroForm(DownloadHints* pHints); + FX_BOOL CheckAcroFormSubObject(DownloadHints* pHints); + FX_BOOL CheckTrailerAppend(DownloadHints* pHints); + FX_BOOL CheckPageStatus(DownloadHints* pHints); + FX_BOOL CheckAllCrossRefStream(DownloadHints* pHints); + + int32_t CheckCrossRefStream(DownloadHints* pHints, FX_FILESIZE& xref_offset); + FX_BOOL IsLinearizedFile(uint8_t* pData, uint32_t dwLen); + void SetStartOffset(FX_FILESIZE dwOffset); + FX_BOOL GetNextToken(CFX_ByteString& token); + FX_BOOL GetNextChar(uint8_t& ch); + CPDF_Object* ParseIndirectObjectAt( + FX_FILESIZE pos, + uint32_t objnum, + CPDF_IndirectObjectHolder* pObjList = nullptr); + CPDF_Object* GetObject(uint32_t objnum, + DownloadHints* pHints, + FX_BOOL* pExistInFile); + FX_BOOL GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages); + FX_BOOL PreparePageItem(); + FX_BOOL LoadPages(DownloadHints* pHints); + FX_BOOL LoadAllXref(DownloadHints* pHints); + FX_BOOL LoadAllFile(DownloadHints* pHints); + DocAvailStatus CheckLinearizedData(DownloadHints* pHints); + FX_BOOL CheckPageAnnots(uint32_t dwPage, DownloadHints* pHints); + + DocAvailStatus CheckLinearizedFirstPage(uint32_t dwPage, + DownloadHints* pHints); + FX_BOOL HaveResourceAncestor(CPDF_Dictionary* pDict); + FX_BOOL CheckPage(uint32_t dwPage, DownloadHints* pHints); + FX_BOOL LoadDocPages(DownloadHints* pHints); + FX_BOOL LoadDocPage(uint32_t dwPage, DownloadHints* pHints); + FX_BOOL CheckPageNode(PageNode& pageNodes, + int32_t iPage, + int32_t& iCount, + DownloadHints* pHints, + int level); + FX_BOOL CheckUnkownPageNode(uint32_t dwPageNo, + PageNode* pPageNode, + DownloadHints* pHints); + FX_BOOL CheckArrayPageNode(uint32_t dwPageNo, + PageNode* pPageNode, + DownloadHints* pHints); + FX_BOOL CheckPageCount(DownloadHints* pHints); + bool IsFirstCheck(uint32_t dwPage); + void ResetFirstCheck(uint32_t dwPage); + FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size, DownloadHints* pHints); + + FileAvail* const m_pFileAvail; + IFX_FileRead* const m_pFileRead; + CPDF_Parser m_parser; + CPDF_SyntaxParser m_syntaxParser; + CPDF_Object* m_pRoot; + uint32_t m_dwRootObjNum; + uint32_t m_dwInfoObjNum; + CPDF_Object* m_pLinearized; + CPDF_Object* m_pTrailer; + FX_BOOL m_bDocAvail; + FX_FILESIZE m_dwHeaderOffset; + FX_FILESIZE m_dwLastXRefOffset; + FX_FILESIZE m_dwXRefOffset; + FX_FILESIZE m_dwTrailerOffset; + FX_FILESIZE m_dwCurrentOffset; + PDF_DATAAVAIL_STATUS m_docStatus; + FX_FILESIZE m_dwFileLen; + CPDF_Document* m_pDocument; + std::set m_ObjectSet; + CFX_ArrayTemplate m_objs_array; + FX_FILESIZE m_Pos; + FX_FILESIZE m_bufferOffset; + uint32_t m_bufferSize; + CFX_ByteString m_WordBuf; + uint8_t m_bufferData[512]; + CFX_ArrayTemplate m_XRefStreamList; + CFX_ArrayTemplate m_PageObjList; + uint32_t m_PagesObjNum; + FX_BOOL m_bLinearized; + uint32_t m_dwFirstPageNo; + FX_BOOL m_bLinearedDataOK; + FX_BOOL m_bMainXRefLoadTried; + FX_BOOL m_bMainXRefLoadedOK; + FX_BOOL m_bPagesTreeLoad; + FX_BOOL m_bPagesLoad; + CPDF_Parser* m_pCurrentParser; + FX_FILESIZE m_dwCurrentXRefSteam; + FX_BOOL m_bAnnotsLoad; + FX_BOOL m_bHaveAcroForm; + uint32_t m_dwAcroFormObjNum; + FX_BOOL m_bAcroFormLoad; + CPDF_Object* m_pAcroForm; + CFX_ArrayTemplate m_arrayAcroforms; + CPDF_Dictionary* m_pPageDict; + CPDF_Object* m_pPageResource; + FX_BOOL m_bNeedDownLoadResource; + FX_BOOL m_bPageLoadedOK; + FX_BOOL m_bLinearizedFormParamLoad; + CFX_ArrayTemplate m_PagesArray; + uint32_t m_dwEncryptObjNum; + FX_FILESIZE m_dwPrevXRefOffset; + FX_BOOL m_bTotalLoadPageTree; + FX_BOOL m_bCurPageDictLoadOK; + PageNode m_pageNodes; + std::set m_pageMapCheckState; + std::set m_pagesLoadState; + std::unique_ptr m_pHintTables; + FX_BOOL m_bSupportHintTable; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_DATA_AVAIL_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp index 024adc9c9c..5b9699d019 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp @@ -4,18 +4,18 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include #include +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" #include "third_party/base/logging.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.h b/core/fpdfapi/fpdf_parser/cpdf_dictionary.h new file mode 100644 index 0000000000..c3cfa3f2b3 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.h @@ -0,0 +1,97 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_DICTIONARY_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_DICTIONARY_H_ + +#include +#include + +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fxcrt/include/cfx_string_pool_template.h" +#include "core/fxcrt/include/cfx_weak_ptr.h" +#include "core/fxcrt/include/fx_coordinates.h" +#include "core/fxcrt/include/fx_string.h" + +class CPDF_IndirectObjectHolder; + +class CPDF_Dictionary : public CPDF_Object { + public: + using iterator = std::map::iterator; + using const_iterator = std::map::const_iterator; + + explicit CPDF_Dictionary(const CFX_WeakPtr& pPool); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone() const override; + CPDF_Dictionary* GetDict() const override; + bool IsDictionary() const override; + CPDF_Dictionary* AsDictionary() override; + const CPDF_Dictionary* AsDictionary() const override; + + size_t GetCount() const { return m_Map.size(); } + CPDF_Object* GetObjectFor(const CFX_ByteString& key) const; + CPDF_Object* GetDirectObjectFor(const CFX_ByteString& key) const; + CFX_ByteString GetStringFor(const CFX_ByteString& key) const; + CFX_ByteString GetStringFor(const CFX_ByteString& key, + const CFX_ByteString& default_str) const; + CFX_WideString GetUnicodeTextFor(const CFX_ByteString& key) const; + int GetIntegerFor(const CFX_ByteString& key) const; + int GetIntegerFor(const CFX_ByteString& key, int default_int) const; + bool GetBooleanFor(const CFX_ByteString& key, bool bDefault = false) const; + FX_FLOAT GetNumberFor(const CFX_ByteString& key) const; + CPDF_Dictionary* GetDictFor(const CFX_ByteString& key) const; + CPDF_Stream* GetStreamFor(const CFX_ByteString& key) const; + CPDF_Array* GetArrayFor(const CFX_ByteString& key) const; + CFX_FloatRect GetRectFor(const CFX_ByteString& key) const; + CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const; + FX_FLOAT GetFloatFor(const CFX_ByteString& key) const { + return GetNumberFor(key); + } + + FX_BOOL KeyExist(const CFX_ByteString& key) const; + bool IsSignatureDict() const; + + // Set* functions invalidate iterators for the element with the key |key|. + void SetFor(const CFX_ByteString& key, CPDF_Object* pObj); + void SetNameFor(const CFX_ByteString& key, const CFX_ByteString& name); + void SetStringFor(const CFX_ByteString& key, const CFX_ByteString& str); + void SetIntegerFor(const CFX_ByteString& key, int i); + void SetNumberFor(const CFX_ByteString& key, FX_FLOAT f); + void SetReferenceFor(const CFX_ByteString& key, + CPDF_IndirectObjectHolder* pDoc, + uint32_t objnum); + void SetRectFor(const CFX_ByteString& key, const CFX_FloatRect& rect); + void SetMatrixFor(const CFX_ByteString& key, const CFX_Matrix& matrix); + void SetBooleanFor(const CFX_ByteString& key, bool bValue); + + // Invalidates iterators for the element with the key |key|. + void RemoveFor(const CFX_ByteString& key); + + // Invalidates iterators for the element with the key |oldkey|. + void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); + + iterator begin() { return m_Map.begin(); } + iterator end() { return m_Map.end(); } + const_iterator begin() const { return m_Map.begin(); } + const_iterator end() const { return m_Map.end(); } + + CFX_WeakPtr GetByteStringPool() const { return m_pPool; } + + protected: + ~CPDF_Dictionary() override; + + CFX_ByteString MaybeIntern(const CFX_ByteString& str); + CPDF_Object* CloneNonCyclic( + bool bDirect, + std::set* visited) const override; + + CFX_WeakPtr m_pPool; + std::map m_Map; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_DICTIONARY_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp index 5b402731b6..9d2ecc4175 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include #include @@ -13,11 +13,11 @@ #include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" #include "core/fpdfapi/fpdf_render/render_int.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcodec/include/JBig2_DocumentContext.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.h b/core/fpdfapi/fpdf_parser/cpdf_document.h new file mode 100644 index 0000000000..cac9dfbfdf --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_document.h @@ -0,0 +1,145 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_DOCUMENT_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_DOCUMENT_H_ + +#include +#include + +#include "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fpdfdoc/include/cpdf_linklist.h" +#include "core/fxcrt/include/cfx_string_pool_template.h" +#include "core/fxcrt/include/cfx_weak_ptr.h" +#include "core/fxcrt/include/fx_basic.h" + +class CFX_Font; +class CFX_Matrix; +class CPDF_ColorSpace; +class CPDF_DocPageData; +class CPDF_DocRenderData; +class CPDF_Font; +class CPDF_FontEncoding; +class CPDF_IccProfile; +class CPDF_Image; +class CPDF_Parser; +class CPDF_Pattern; +class CPDF_StreamAcc; +class JBig2_DocumentContext; + +#define FPDFPERM_PRINT 0x0004 +#define FPDFPERM_MODIFY 0x0008 +#define FPDFPERM_EXTRACT 0x0010 +#define FPDFPERM_ANNOT_FORM 0x0020 +#define FPDFPERM_FILL_FORM 0x0100 +#define FPDFPERM_EXTRACT_ACCESS 0x0200 +#define FPDFPERM_ASSEMBLE 0x0400 +#define FPDFPERM_PRINT_HIGH 0x0800 +#define FPDF_PAGE_MAX_NUM 0xFFFFF + +class CPDF_Document : public CPDF_IndirectObjectHolder { + public: + explicit CPDF_Document(std::unique_ptr pParser); + ~CPDF_Document() override; + + CPDF_Parser* GetParser() const { return m_pParser.get(); } + CPDF_Dictionary* GetRoot() const { return m_pRootDict; } + CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } + CFX_WeakPtr GetByteStringPool() const { + return m_pByteStringPool; + } + + void DeletePage(int iPage); + int GetPageCount() const; + + bool IsPageLoaded(int iPage) const; + CPDF_Dictionary* GetPage(int iPage); + int GetPageIndex(uint32_t objnum); + uint32_t GetUserPermissions() const; + CPDF_DocPageData* GetPageData() const { return m_pDocPage; } + + void SetPageObjNum(int iPage, uint32_t objNum); + + std::unique_ptr* CodecContext() { + return &m_pCodecContext; + } + std::unique_ptr* LinksContext() { return &m_pLinksContext; } + + CPDF_DocRenderData* GetRenderData() const { return m_pDocRender.get(); } + + // |pFontDict| must not be null. + CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict); + CPDF_ColorSpace* LoadColorSpace(CPDF_Object* pCSObj, + CPDF_Dictionary* pResources = nullptr); + + CPDF_Pattern* LoadPattern(CPDF_Object* pObj, + FX_BOOL bShading, + const CFX_Matrix& matrix); + + CPDF_Image* LoadImageF(CPDF_Object* pObj); + CPDF_StreamAcc* LoadFontFile(CPDF_Stream* pStream); + CPDF_IccProfile* LoadIccProfile(CPDF_Stream* pStream); + + void LoadDoc(); + void LoadLinearizedDoc(CPDF_Dictionary* pLinearizationParams); + void LoadPages(); + + void CreateNewDoc(); + CPDF_Dictionary* CreateNewPage(int iPage); + + CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding); + CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert); +#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ + CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont, + FX_BOOL bVert, + FX_BOOL bTranslateName = FALSE); + CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, + FX_BOOL bVert, + FX_BOOL bTranslateName = FALSE); +#endif + + private: + friend class CPDF_TestDocument; + + // Retrieve page count information by getting count value from the tree nodes + int RetrievePageCount() const; + CPDF_Dictionary* FindPDFPage(CPDF_Dictionary* pPages, + int iPage, + int nPagesToGo, + int level); + int FindPageIndex(CPDF_Dictionary* pNode, + uint32_t& skip_count, + uint32_t objnum, + int& index, + int level = 0); + CPDF_Object* ParseIndirectObject(uint32_t objnum) override; + void LoadDocInternal(); + size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); + CPDF_Dictionary* GetPagesDict() const; + CPDF_Dictionary* ProcessbCJK( + CPDF_Dictionary* pBaseDict, + int charset, + FX_BOOL bVert, + CFX_ByteString basefont, + std::function Insert); + + std::unique_ptr m_pParser; + CPDF_Dictionary* m_pRootDict; + CPDF_Dictionary* m_pInfoDict; + bool m_bLinearized; + int m_iFirstPageNo; + uint32_t m_dwFirstPageObjNum; + // TODO(thestig): Figure out why this cannot be a std::unique_ptr. + CPDF_DocPageData* m_pDocPage; + std::unique_ptr m_pDocRender; + std::unique_ptr m_pCodecContext; + std::unique_ptr m_pLinksContext; + CFX_ArrayTemplate m_PageList; + CFX_WeakPtr m_pByteStringPool; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_DOCUMENT_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp index b41d0527fd..b1529c463a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp @@ -8,12 +8,12 @@ #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fxcrt/include/fx_safe_types.h" #include "third_party/base/numerics/safe_conversions.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h index 1943c79f44..f932950b95 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h +++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h @@ -9,7 +9,7 @@ #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" +#include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h" #include "core/fxcrt/include/fx_basic.h" #include "core/fxcrt/include/fx_stream.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp index 0a15e2dce1..30d022a36a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp @@ -4,10 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/cpdf_parser.h" CPDF_IndirectObjectHolder::CPDF_IndirectObjectHolder() : m_LastObjNum(0) {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h new file mode 100644 index 0000000000..414f4eeb07 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h @@ -0,0 +1,48 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_ + +#include +#include + +#include "core/fxcrt/include/fx_system.h" + +class CPDF_Object; + +class CPDF_IndirectObjectHolder { + public: + using const_iterator = + std::map>::const_iterator; + + CPDF_IndirectObjectHolder(); + virtual ~CPDF_IndirectObjectHolder(); + + CPDF_Object* GetIndirectObject(uint32_t objnum) const; + CPDF_Object* GetOrParseIndirectObject(uint32_t objnum); + void ReleaseIndirectObject(uint32_t objnum); + + // Take ownership of |pObj|. + uint32_t AddIndirectObject(CPDF_Object* pObj); + bool ReplaceIndirectObjectIfHigherGeneration(uint32_t objnum, + CPDF_Object* pObj); + + uint32_t GetLastObjNum() const { return m_LastObjNum; } + void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; } + + const_iterator begin() const { return m_IndirectObjs.begin(); } + const_iterator end() const { return m_IndirectObjs.end(); } + + protected: + virtual CPDF_Object* ParseIndirectObject(uint32_t objnum); + + private: + uint32_t m_LastObjNum; + std::map> m_IndirectObjs; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_name.cpp b/core/fpdfapi/fpdf_parser/cpdf_name.cpp index 004dd54392..015c3d214a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_name.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_name.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" CPDF_Name::CPDF_Name(const CFX_ByteString& str) : m_Name(str) {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_name.h b/core/fpdfapi/fpdf_parser/cpdf_name.h new file mode 100644 index 0000000000..53b8a35d5e --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_name.h @@ -0,0 +1,32 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_NAME_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_NAME_H_ + +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" + +class CPDF_Name : public CPDF_Object { + public: + explicit CPDF_Name(const CFX_ByteString& str); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone() const override; + CFX_ByteString GetString() const override; + CFX_WideString GetUnicodeText() const override; + void SetString(const CFX_ByteString& str) override; + bool IsName() const override; + CPDF_Name* AsName() override; + const CPDF_Name* AsName() const override; + + protected: + ~CPDF_Name() override; + + CFX_ByteString m_Name; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_NAME_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_null.h b/core/fpdfapi/fpdf_parser/cpdf_null.h index 9ffb0b13c1..45d73953ad 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_null.h +++ b/core/fpdfapi/fpdf_parser/cpdf_null.h @@ -7,7 +7,7 @@ #ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_NULL_H_ #define CORE_FPDFAPI_FPDF_PARSER_CPDF_NULL_H_ -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" class CPDF_Null : public CPDF_Object { public: diff --git a/core/fpdfapi/fpdf_parser/cpdf_number.cpp b/core/fpdfapi/fpdf_parser/cpdf_number.cpp index 9406cc9f11..28692eabab 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_number.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_number.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" CPDF_Number::CPDF_Number() : m_bInteger(true), m_Integer(0) {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_number.h b/core/fpdfapi/fpdf_parser/cpdf_number.h new file mode 100644 index 0000000000..5f8a23753d --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_number.h @@ -0,0 +1,44 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_NUMBER_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_NUMBER_H_ + +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_Number : public CPDF_Object { + public: + CPDF_Number(); + explicit CPDF_Number(int value); + explicit CPDF_Number(FX_FLOAT value); + explicit CPDF_Number(const CFX_ByteStringC& str); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone() const override; + CFX_ByteString GetString() const override; + FX_FLOAT GetNumber() const override; + int GetInteger() const override; + void SetString(const CFX_ByteString& str) override; + bool IsNumber() const override; + CPDF_Number* AsNumber() override; + const CPDF_Number* AsNumber() const override; + + bool IsInteger() const { return m_bInteger; } + + protected: + ~CPDF_Number() override; + + bool m_bInteger; + union { + int m_Integer; + FX_FLOAT m_Float; + }; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_NUMBER_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_object.cpp b/core/fpdfapi/fpdf_parser/cpdf_object.cpp index 442aaeda76..868dc674f0 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_object.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_object.cpp @@ -4,15 +4,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fxcrt/include/fx_string.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_object.h b/core/fpdfapi/fpdf_parser/cpdf_object.h new file mode 100644 index 0000000000..f46741546c --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_object.h @@ -0,0 +1,183 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_OBJECT_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_OBJECT_H_ + +#include +#include + +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_Array; +class CPDF_Boolean; +class CPDF_Dictionary; +class CPDF_Name; +class CPDF_Null; +class CPDF_Number; +class CPDF_Reference; +class CPDF_Stream; +class CPDF_String; + +class CPDF_Object { + public: + static const uint32_t kInvalidObjNum = static_cast(-1); + enum Type { + BOOLEAN = 1, + NUMBER, + STRING, + NAME, + ARRAY, + DICTIONARY, + STREAM, + NULLOBJ, + REFERENCE + }; + + virtual Type GetType() const = 0; + uint32_t GetObjNum() const { return m_ObjNum; } + uint32_t GetGenNum() const { return m_GenNum; } + + // Create a deep copy of the object. + virtual CPDF_Object* Clone() const = 0; + // Create a deep copy of the object except any reference object be + // copied to the object it points to directly. + virtual CPDF_Object* CloneDirectObject() const; + virtual CPDF_Object* GetDirect() const; + + void Release(); + + virtual CFX_ByteString GetString() const; + virtual CFX_WideString GetUnicodeText() const; + virtual FX_FLOAT GetNumber() const; + virtual int GetInteger() const; + virtual CPDF_Dictionary* GetDict() const; + + virtual void SetString(const CFX_ByteString& str); + + virtual bool IsArray() const; + virtual bool IsBoolean() const; + virtual bool IsDictionary() const; + virtual bool IsName() const; + virtual bool IsNumber() const; + virtual bool IsReference() const; + virtual bool IsStream() const; + virtual bool IsString() const; + + virtual CPDF_Array* AsArray(); + virtual const CPDF_Array* AsArray() const; + virtual CPDF_Boolean* AsBoolean(); + virtual const CPDF_Boolean* AsBoolean() const; + virtual CPDF_Dictionary* AsDictionary(); + virtual const CPDF_Dictionary* AsDictionary() const; + virtual CPDF_Name* AsName(); + virtual const CPDF_Name* AsName() const; + virtual CPDF_Number* AsNumber(); + virtual const CPDF_Number* AsNumber() const; + virtual CPDF_Reference* AsReference(); + virtual const CPDF_Reference* AsReference() const; + virtual CPDF_Stream* AsStream(); + virtual const CPDF_Stream* AsStream() const; + virtual CPDF_String* AsString(); + virtual const CPDF_String* AsString() const; + + protected: + friend class CPDF_Array; + friend class CPDF_Dictionary; + friend class CPDF_Document; + friend class CPDF_IndirectObjectHolder; + friend class CPDF_Parser; + friend class CPDF_Reference; + friend class CPDF_Stream; + friend struct std::default_delete; + + CPDF_Object() : m_ObjNum(0), m_GenNum(0) {} + virtual ~CPDF_Object(); + + CPDF_Object* CloneObjectNonCyclic(bool bDirect) const; + + // Create a deep copy of the object with the option to either + // copy a reference object or directly copy the object it refers to + // when |bDirect| is true. + // Also check cyclic reference against |pVisited|, no copy if it is found. + // Complex objects should implement their own CloneNonCyclic() + // function to properly check for possible loop. + virtual CPDF_Object* CloneNonCyclic( + bool bDirect, + std::set* pVisited) const; + + uint32_t m_ObjNum; + uint32_t m_GenNum; + + private: + CPDF_Object(const CPDF_Object& src) {} +}; + +inline CPDF_Boolean* ToBoolean(CPDF_Object* obj) { + return obj ? obj->AsBoolean() : nullptr; +} + +inline const CPDF_Boolean* ToBoolean(const CPDF_Object* obj) { + return obj ? obj->AsBoolean() : nullptr; +} + +inline CPDF_Number* ToNumber(CPDF_Object* obj) { + return obj ? obj->AsNumber() : nullptr; +} + +inline const CPDF_Number* ToNumber(const CPDF_Object* obj) { + return obj ? obj->AsNumber() : nullptr; +} + +inline CPDF_String* ToString(CPDF_Object* obj) { + return obj ? obj->AsString() : nullptr; +} + +inline const CPDF_String* ToString(const CPDF_Object* obj) { + return obj ? obj->AsString() : nullptr; +} + +inline CPDF_Name* ToName(CPDF_Object* obj) { + return obj ? obj->AsName() : nullptr; +} + +inline const CPDF_Name* ToName(const CPDF_Object* obj) { + return obj ? obj->AsName() : nullptr; +} + +inline CPDF_Array* ToArray(CPDF_Object* obj) { + return obj ? obj->AsArray() : nullptr; +} + +inline const CPDF_Array* ToArray(const CPDF_Object* obj) { + return obj ? obj->AsArray() : nullptr; +} + +inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) { + return obj ? obj->AsDictionary() : nullptr; +} + +inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) { + return obj ? obj->AsDictionary() : nullptr; +} +inline CPDF_Reference* ToReference(CPDF_Object* obj) { + return obj ? obj->AsReference() : nullptr; +} + +inline const CPDF_Reference* ToReference(const CPDF_Object* obj) { + return obj ? obj->AsReference() : nullptr; +} + +inline CPDF_Stream* ToStream(CPDF_Object* obj) { + return obj ? obj->AsStream() : nullptr; +} + +inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { + return obj ? obj->AsStream() : nullptr; +} + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_OBJECT_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp index 1548b1914a..d93ccf7be5 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp @@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" #include "core/fpdfapi/fpdf_parser/cpdf_null.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" #include #include #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h" #include "core/fxcrt/include/fx_basic.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp index 1af2bd1482..9dc35ddd12 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp @@ -4,21 +4,21 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_parser.h" #include +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" #include "core/fpdfapi/fpdf_parser/cpdf_security_handler.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" #include "core/fxcrt/include/fx_ext.h" #include "core/fxcrt/include/fx_safe_types.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.h b/core/fpdfapi/fpdf_parser/cpdf_parser.h new file mode 100644 index 0000000000..0368a45611 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_parser.h @@ -0,0 +1,177 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_PARSER_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_PARSER_H_ + +#include +#include +#include + +#include "core/fxcrt/include/fx_basic.h" + +class CPDF_Array; +class CPDF_CryptoHandler; +class CPDF_Dictionary; +class CPDF_Document; +class CPDF_IndirectObjectHolder; +class CPDF_Object; +class CPDF_SecurityHandler; +class CPDF_StreamAcc; +class CPDF_SyntaxParser; +class IFX_FileRead; + +class CPDF_Parser { + public: + enum Error { + SUCCESS = 0, + FILE_ERROR, + FORMAT_ERROR, + PASSWORD_ERROR, + HANDLER_ERROR + }; + + // A limit on the maximum object number in the xref table. Theoretical limits + // are higher, but this may be large enough in practice. + static const uint32_t kMaxObjectNumber = 1048576; + + CPDF_Parser(); + ~CPDF_Parser(); + + Error StartParse(IFX_FileRead* pFile, CPDF_Document* pDocument); + Error StartLinearizedParse(IFX_FileRead* pFile, CPDF_Document* pDocument); + + void SetPassword(const FX_CHAR* password) { m_Password = password; } + CFX_ByteString GetPassword() { return m_Password; } + CPDF_Dictionary* GetTrailer() const { return m_pTrailer; } + FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; } + + uint32_t GetPermissions() const; + uint32_t GetRootObjNum(); + uint32_t GetInfoObjNum(); + CPDF_Array* GetIDArray(); + + CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict; } + + CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList, + uint32_t objnum); + + uint32_t GetLastObjNum() const; + bool IsValidObjectNumber(uint32_t objnum) const; + FX_FILESIZE GetObjectPositionOrZero(uint32_t objnum) const; + uint8_t GetObjectType(uint32_t objnum) const; + uint16_t GetObjectGenNum(uint32_t objnum) const; + bool IsVersionUpdated() const { return m_bVersionUpdated; } + bool IsObjectFreeOrNull(uint32_t objnum) const; + CPDF_CryptoHandler* GetCryptoHandler(); + IFX_FileRead* GetFileAccess() const; + + FX_FILESIZE GetObjectOffset(uint32_t objnum) const; + FX_FILESIZE GetObjectSize(uint32_t objnum) const; + + void GetIndirectBinary(uint32_t objnum, uint8_t*& pBuffer, uint32_t& size); + int GetFileVersion() const { return m_FileVersion; } + FX_BOOL IsXRefStream() const { return m_bXRefStream; } + + CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList, + FX_FILESIZE pos, + uint32_t objnum); + + CPDF_Object* ParseIndirectObjectAtByStrict( + CPDF_IndirectObjectHolder* pObjList, + FX_FILESIZE pos, + uint32_t objnum, + FX_FILESIZE* pResultPos); + + uint32_t GetFirstPageNo() const { return m_dwFirstPageNo; } + + protected: + struct ObjectInfo { + ObjectInfo() : pos(0), type(0), gennum(0) {} + + FX_FILESIZE pos; + uint8_t type; + uint16_t gennum; + }; + + std::unique_ptr m_pSyntax; + std::map m_ObjectInfo; + + bool LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_BOOL bSkip); + FX_BOOL RebuildCrossRef(); + + private: + friend class CPDF_DataAvail; + + enum class ParserState { + kDefault, + kComment, + kWhitespace, + kString, + kHexString, + kEscapedString, + kXref, + kObjNum, + kPostObjNum, + kGenNum, + kPostGenNum, + kTrailer, + kBeginObj, + kEndObj + }; + + CPDF_Object* ParseDirect(CPDF_Object* pObj); + FX_BOOL LoadAllCrossRefV4(FX_FILESIZE pos); + FX_BOOL LoadAllCrossRefV5(FX_FILESIZE pos); + FX_BOOL LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef); + CPDF_Dictionary* LoadTrailerV4(); + Error SetEncryptHandler(); + void ReleaseEncryptHandler(); + FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount); + FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount); + FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); + Error LoadLinearizedMainXRefTable(); + CPDF_StreamAcc* GetObjectStream(uint32_t number); + FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, uint32_t offset); + void SetEncryptDictionary(CPDF_Dictionary* pDict); + void ShrinkObjectMap(uint32_t size); + // A simple check whether the cross reference table matches with + // the objects. + bool VerifyCrossRefV4(); + + CPDF_Document* m_pDocument; // not owned + bool m_bHasParsed; + bool m_bOwnFileRead; + int m_FileVersion; + CPDF_Dictionary* m_pTrailer; + CPDF_Dictionary* m_pEncryptDict; + FX_FILESIZE m_LastXRefOffset; + FX_BOOL m_bXRefStream; + std::unique_ptr m_pSecurityHandler; + CFX_ByteString m_Password; + std::set m_SortedOffset; + CFX_ArrayTemplate m_Trailers; + bool m_bVersionUpdated; + CPDF_Object* m_pLinearized; + uint32_t m_dwFirstPageNo; + uint32_t m_dwXrefStartObjNum; + + // A map of object numbers to indirect streams. Map owns the streams. + std::map> m_ObjectStreamMap; + + // Mapping of object numbers to offsets. The offsets are relative to the first + // object in the stream. + using StreamObjectCache = std::map; + + // Mapping of streams to their object caches. This is valid as long as the + // streams in |m_ObjectStreamMap| are valid. + std::map m_ObjCache; + + // All indirect object numbers that are being parsed. + std::set m_ParsingObjNums; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_PARSER_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser_unittest.cpp index 7a08511e81..8ad2e47cb6 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser_unittest.cpp @@ -5,8 +5,8 @@ #include #include +#include "core/fpdfapi/fpdf_parser/cpdf_parser.h" #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" #include "core/fxcrt/include/fx_ext.h" #include "core/fxcrt/include/fx_stream.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp index 4e7b3786d3..06625a96ea 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h" #include "third_party/base/stl_util.h" CPDF_Reference::CPDF_Reference(CPDF_IndirectObjectHolder* pDoc, int objnum) diff --git a/core/fpdfapi/fpdf_parser/cpdf_reference.h b/core/fpdfapi/fpdf_parser/cpdf_reference.h new file mode 100644 index 0000000000..af52f90c52 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_reference.h @@ -0,0 +1,55 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_REFERENCE_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_REFERENCE_H_ + +#include + +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" + +class CPDF_IndirectObjectHolder; + +class CPDF_Reference : public CPDF_Object { + public: + CPDF_Reference(CPDF_IndirectObjectHolder* pDoc, int objnum); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone() const override; + CPDF_Object* GetDirect() const override; + CFX_ByteString GetString() const override; + FX_FLOAT GetNumber() const override; + int GetInteger() const override; + CPDF_Dictionary* GetDict() const override; + + // TODO(weili): check whether GetUnicodeText() and GetArray() are needed. + bool IsReference() const override; + CPDF_Reference* AsReference() override; + const CPDF_Reference* AsReference() const override; + + CPDF_IndirectObjectHolder* GetObjList() const { return m_pObjList; } + uint32_t GetRefObjNum() const { return m_RefObjNum; } + + void SetRef(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum); + + protected: + ~CPDF_Reference() override; + CPDF_Object* CloneNonCyclic( + bool bDirect, + std::set* pVisited) const override; + CPDF_Object* SafeGetDirect() const { + CPDF_Object* obj = GetDirect(); + if (!obj || obj->IsReference()) + return nullptr; + return obj; + } + + CPDF_IndirectObjectHolder* m_pObjList; + uint32_t m_RefObjNum; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_REFERENCE_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp index 2920d470d9..2a57daab3e 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp @@ -9,11 +9,11 @@ #include #include "core/fdrm/crypto/fx_crypt.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/cpdf_parser.h" namespace { diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp index 394004dfc4..821cd1b75b 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.h b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.h new file mode 100644 index 0000000000..fad0e42b95 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.h @@ -0,0 +1,35 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_SIMPLE_PARSER_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_SIMPLE_PARSER_H_ + +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_SimpleParser { + public: + CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize); + CPDF_SimpleParser(const CFX_ByteStringC& str); + + CFX_ByteStringC GetWord(); + + // Find the token and its |nParams| parameters from the start of data, + // and move the current position to the start of those parameters. + bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams); + + // For testing only. + uint32_t GetCurPos() const { return m_dwCurPos; } + + private: + void ParseWord(const uint8_t*& pStart, uint32_t& dwSize); + + const uint8_t* m_pData; + uint32_t m_dwSize; + uint32_t m_dwCurPos; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_SIMPLE_PARSER_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp index db3ccf5e3d..67a8f5a0a0 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" #include diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp index 3b047205c4..88d04203a1 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp @@ -4,11 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "third_party/base/numerics/safe_conversions.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream.h b/core/fpdfapi/fpdf_parser/cpdf_stream.h new file mode 100644 index 0000000000..9ae6fd64a8 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_stream.h @@ -0,0 +1,61 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_STREAM_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_STREAM_H_ + +#include +#include + +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fxcrt/include/fx_basic.h" + +class CPDF_Stream : public CPDF_Object { + public: + CPDF_Stream(); + + // Takes ownership of |pData| and |pDict|. + CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone() const override; + CPDF_Dictionary* GetDict() const override; + CFX_WideString GetUnicodeText() const override; + bool IsStream() const override; + CPDF_Stream* AsStream() override; + const CPDF_Stream* AsStream() const override; + + uint32_t GetRawSize() const { return m_dwSize; } + uint8_t* GetRawData() const { return m_pDataBuf.get(); } + + // Does not takes onwership of |pData|, copies into internally-owned buffer. + void SetData(const uint8_t* pData, uint32_t size); + + void InitStream(const uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict); + void InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict); + + FX_BOOL ReadRawData(FX_FILESIZE start_pos, + uint8_t* pBuf, + uint32_t buf_size) const; + + bool IsMemoryBased() const { return m_bMemoryBased; } + + protected: + ~CPDF_Stream() override; + CPDF_Object* CloneNonCyclic( + bool bDirect, + std::set* pVisited) const override; + + std::unique_ptr> m_pDict; + bool m_bMemoryBased = true; + uint32_t m_dwSize = 0; + std::unique_ptr m_pDataBuf; + IFX_FileRead* m_pFile = nullptr; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_STREAM_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp index 81144919fe..a19b796151 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" CPDF_StreamAcc::CPDF_StreamAcc() : m_pData(nullptr), diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.h b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.h new file mode 100644 index 0000000000..19fa12b281 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.h @@ -0,0 +1,46 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_STREAM_ACC_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_STREAM_ACC_H_ + +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_StreamAcc { + public: + CPDF_StreamAcc(); + ~CPDF_StreamAcc(); + + void LoadAllData(const CPDF_Stream* pStream, + FX_BOOL bRawAccess = FALSE, + uint32_t estimated_size = 0, + FX_BOOL bImageAcc = FALSE); + + const CPDF_Stream* GetStream() const { return m_pStream; } + CPDF_Dictionary* GetDict() const { + return m_pStream ? m_pStream->GetDict() : nullptr; + } + + const uint8_t* GetData() const; + uint32_t GetSize() const; + const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; } + const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } + uint8_t* DetachData(); + + protected: + uint8_t* m_pData; + uint32_t m_dwSize; + FX_BOOL m_bNewBuf; + CFX_ByteString m_ImageDecoder; + CPDF_Dictionary* m_pImageParam; + const CPDF_Stream* m_pStream; + uint8_t* m_pSrcData; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_STREAM_ACC_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_string.cpp b/core/fpdfapi/fpdf_parser/cpdf_string.cpp index b18d484347..4b42b8c22b 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_string.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_string.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" CPDF_String::CPDF_String() : m_bHex(FALSE) {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_string.h b/core/fpdfapi/fpdf_parser/cpdf_string.h new file mode 100644 index 0000000000..72d548cde1 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_string.h @@ -0,0 +1,39 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_STRING_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_STRING_H_ + +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_String : public CPDF_Object { + public: + CPDF_String(); + CPDF_String(const CFX_ByteString& str, FX_BOOL bHex); + explicit CPDF_String(const CFX_WideString& str); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone() const override; + CFX_ByteString GetString() const override; + CFX_WideString GetUnicodeText() const override; + void SetString(const CFX_ByteString& str) override; + bool IsString() const override; + CPDF_String* AsString() override; + const CPDF_String* AsString() const override; + + FX_BOOL IsHex() const { return m_bHex; } + + protected: + ~CPDF_String() override; + + CFX_ByteString m_String; + FX_BOOL m_bHex; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_STRING_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp index a29137cd43..3238648f25 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp @@ -8,18 +8,18 @@ #include +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" #include "core/fpdfapi/fpdf_parser/cpdf_null.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcrt/include/fx_ext.h" #include "third_party/base/numerics/safe_math.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser_unittest.cpp index bfb6ead563..7bd1c7a407 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser_unittest.cpp @@ -5,8 +5,8 @@ #include #include +#include "core/fpdfapi/fpdf_parser/cpdf_parser.h" #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" #include "core/fxcrt/include/fx_ext.h" #include "core/fxcrt/include/fx_stream.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index eaf1e04193..833f8831d6 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include @@ -12,9 +12,9 @@ #include #include +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcodec/include/fx_codec.h" #include "core/fxcrt/include/fx_ext.h" diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.h b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.h new file mode 100644 index 0000000000..0a0aa81d5a --- /dev/null +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.h @@ -0,0 +1,77 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_PARSER_FPDF_PARSER_DECODE_H_ +#define CORE_FPDFAPI_FPDF_PARSER_FPDF_PARSER_DECODE_H_ + +#include "core/fxcrt/include/fx_basic.h" + +class CPDF_Dictionary; + +// Indexed by 8-bit char code, contains unicode code points. +extern const uint16_t PDFDocEncoding[256]; + +CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig); +CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig); +CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig); +CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, + FX_BOOL bHex = FALSE); +CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size); +CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr); +CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1); +CFX_ByteString PDF_EncodeText(const CFX_WideString& str); + +bool FlateEncode(const uint8_t* src_buf, + uint32_t src_size, + uint8_t** dest_buf, + uint32_t* dest_size); + +// This used to have more parameters like the predictor and bpc, but there was +// only one caller, so the interface has been simplified, the values are hard +// coded, and dead code has been removed. +bool PngEncode(const uint8_t* src_buf, + uint32_t src_size, + uint8_t** dest_buf, + uint32_t* dest_size); + +uint32_t FlateDecode(const uint8_t* src_buf, + uint32_t src_size, + uint8_t*& dest_buf, + uint32_t& dest_size); +uint32_t RunLengthDecode(const uint8_t* src_buf, + uint32_t src_size, + uint8_t*& dest_buf, + uint32_t& dest_size); + +// Public for testing. +uint32_t A85Decode(const uint8_t* src_buf, + uint32_t src_size, + uint8_t*& dest_buf, + uint32_t& dest_size); +// Public for testing. +uint32_t HexDecode(const uint8_t* src_buf, + uint32_t src_size, + uint8_t*& dest_buf, + uint32_t& dest_size); +// Public for testing. +uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, + const uint8_t* src_buf, + uint32_t src_size, + CPDF_Dictionary* pParams, + uint32_t estimated_size, + uint8_t*& dest_buf, + uint32_t& dest_size); +FX_BOOL PDF_DataDecode(const uint8_t* src_buf, + uint32_t src_size, + const CPDF_Dictionary* pDict, + uint8_t*& dest_buf, + uint32_t& dest_size, + CFX_ByteString& ImageEncoding, + CPDF_Dictionary*& pImageParms, + uint32_t estimated_size, + FX_BOOL bImageAcc); + +#endif // CORE_FPDFAPI_FPDF_PARSER_FPDF_PARSER_DECODE_H_ diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp index e9ca958411..27d1f0f486 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include #include diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp index cd96c4a72a..469ca4f150 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index a9f20a9093..e85f996eaf 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -6,14 +6,14 @@ #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fxcrt/include/fx_ext.h" // Indexed by 8-bit character code, contains either: diff --git a/core/fpdfapi/fpdf_parser/include/cfdf_document.h b/core/fpdfapi/fpdf_parser/include/cfdf_document.h deleted file mode 100644 index 25366b0cd4..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cfdf_document.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CFDF_DOCUMENT_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CFDF_DOCUMENT_H_ - -#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fxcrt/include/cfx_string_pool_template.h" -#include "core/fxcrt/include/cfx_weak_ptr.h" -#include "core/fxcrt/include/fx_basic.h" - -class CPDF_Dictionary; - -class CFDF_Document : public CPDF_IndirectObjectHolder { - public: - static CFDF_Document* CreateNewDoc(); - static CFDF_Document* ParseFile(IFX_FileRead* pFile, - FX_BOOL bOwnFile = FALSE); - static CFDF_Document* ParseMemory(const uint8_t* pData, uint32_t size); - ~CFDF_Document() override; - - FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const; - CPDF_Dictionary* GetRoot() const { return m_pRootDict; } - CFX_WeakPtr GetByteStringPool() const { - return m_pByteStringPool; - } - - protected: - CFDF_Document(); - void ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile); - - CPDF_Dictionary* m_pRootDict; - IFX_FileRead* m_pFile; - FX_BOOL m_bOwnFile; - CFX_WeakPtr m_pByteStringPool; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CFDF_DOCUMENT_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_array.h b/core/fpdfapi/fpdf_parser/include/cpdf_array.h deleted file mode 100644 index a63c40cddb..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_array.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ - -#include -#include - -#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fxcrt/include/fx_basic.h" -#include "core/fxcrt/include/fx_coordinates.h" - -class CPDF_Array : public CPDF_Object { - public: - using iterator = std::vector::iterator; - using const_iterator = std::vector::const_iterator; - - CPDF_Array(); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone() const override; - bool IsArray() const override; - CPDF_Array* AsArray() override; - const CPDF_Array* AsArray() const override; - - bool IsEmpty() const { return m_Objects.empty(); } - size_t GetCount() const { return m_Objects.size(); } - CPDF_Object* GetObjectAt(size_t index) const; - CPDF_Object* GetDirectObjectAt(size_t index) const; - CFX_ByteString GetStringAt(size_t index) const; - int GetIntegerAt(size_t index) const; - FX_FLOAT GetNumberAt(size_t index) const; - CPDF_Dictionary* GetDictAt(size_t index) const; - CPDF_Stream* GetStreamAt(size_t index) const; - CPDF_Array* GetArrayAt(size_t index) const; - FX_FLOAT GetFloatAt(size_t index) const { return GetNumberAt(index); } - CFX_Matrix GetMatrix(); - CFX_FloatRect GetRect(); - - void SetAt(size_t index, CPDF_Object* pObj); - void InsertAt(size_t index, CPDF_Object* pObj); - void RemoveAt(size_t index, size_t nCount = 1); - - void Add(CPDF_Object* pObj); - void AddNumber(FX_FLOAT f); - void AddInteger(int i); - void AddString(const CFX_ByteString& str); - void AddName(const CFX_ByteString& str); - void AddReference(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum); - - iterator begin() { return m_Objects.begin(); } - iterator end() { return m_Objects.end(); } - const_iterator begin() const { return m_Objects.begin(); } - const_iterator end() const { return m_Objects.end(); } - - protected: - ~CPDF_Array() override; - - CPDF_Object* CloneNonCyclic( - bool bDirect, - std::set* pVisited) const override; - - std::vector m_Objects; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h b/core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h deleted file mode 100644 index b93394cd8f..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DATA_AVAIL_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DATA_AVAIL_H_ - -#include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" -#include "core/fxcrt/include/fx_basic.h" - -class CPDF_Dictionary; -class CPDF_HintTables; -class CPDF_IndirectObjectHolder; -class CPDF_Parser; - -enum PDF_DATAAVAIL_STATUS { - PDF_DATAAVAIL_HEADER = 0, - PDF_DATAAVAIL_FIRSTPAGE, - PDF_DATAAVAIL_FIRSTPAGE_PREPARE, - PDF_DATAAVAIL_HINTTABLE, - PDF_DATAAVAIL_END, - PDF_DATAAVAIL_CROSSREF, - PDF_DATAAVAIL_CROSSREF_ITEM, - PDF_DATAAVAIL_CROSSREF_STREAM, - PDF_DATAAVAIL_TRAILER, - PDF_DATAAVAIL_LOADALLCROSSREF, - PDF_DATAAVAIL_ROOT, - PDF_DATAAVAIL_INFO, - PDF_DATAAVAIL_ACROFORM, - PDF_DATAAVAIL_ACROFORM_SUBOBJECT, - PDF_DATAAVAIL_PAGETREE, - PDF_DATAAVAIL_PAGE, - PDF_DATAAVAIL_PAGE_LATERLOAD, - PDF_DATAAVAIL_RESOURCES, - PDF_DATAAVAIL_DONE, - PDF_DATAAVAIL_ERROR, - PDF_DATAAVAIL_LOADALLFILE, - PDF_DATAAVAIL_TRAILER_APPEND -}; - -enum PDF_PAGENODE_TYPE { - PDF_PAGENODE_UNKNOWN = 0, - PDF_PAGENODE_PAGE, - PDF_PAGENODE_PAGES, - PDF_PAGENODE_ARRAY, -}; - -class CPDF_DataAvail final { - public: - // Must match PDF_DATA_* definitions in public/fpdf_dataavail.h, but cannot - // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts - // to make sure the two sets of values match. - enum DocAvailStatus { - DataError = -1, // PDF_DATA_ERROR - DataNotAvailable = 0, // PDF_DATA_NOTAVAIL - DataAvailable = 1, // PDF_DATA_AVAIL - }; - - // Must match PDF_*LINEAR* definitions in public/fpdf_dataavail.h, but cannot - // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts - // to make sure the two sets of values match. - enum DocLinearizationStatus { - LinearizationUnknown = -1, // PDF_LINEARIZATION_UNKNOWN - NotLinearized = 0, // PDF_NOT_LINEARIZED - Linearized = 1, // PDF_LINEARIZED - }; - - // Must match PDF_FORM_* definitions in public/fpdf_dataavail.h, but cannot - // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts - // to make sure the two sets of values match. - enum DocFormStatus { - FormError = -1, // PDF_FORM_ERROR - FormNotAvailable = 0, // PDF_FORM_NOTAVAIL - FormAvailable = 1, // PDF_FORM_AVAIL - FormNotExist = 2, // PDF_FORM_NOTEXIST - }; - - class FileAvail { - public: - virtual ~FileAvail(); - virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0; - }; - - class DownloadHints { - public: - virtual ~DownloadHints(); - virtual void AddSegment(FX_FILESIZE offset, uint32_t size) = 0; - }; - - CPDF_DataAvail(FileAvail* pFileAvail, - IFX_FileRead* pFileRead, - FX_BOOL bSupportHintTable); - ~CPDF_DataAvail(); - - DocAvailStatus IsDocAvail(DownloadHints* pHints); - void SetDocument(CPDF_Document* pDoc); - DocAvailStatus IsPageAvail(uint32_t dwPage, DownloadHints* pHints); - DocFormStatus IsFormAvail(DownloadHints* pHints); - DocLinearizationStatus IsLinearizedPDF(); - FX_BOOL IsLinearized(); - void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize); - IFX_FileRead* GetFileRead() const { return m_pFileRead; } - int GetPageCount() const; - CPDF_Dictionary* GetPage(int index); - - friend class CPDF_HintTables; - - protected: - class PageNode { - public: - PageNode(); - ~PageNode(); - - PDF_PAGENODE_TYPE m_type; - uint32_t m_dwPageNo; - CFX_ArrayTemplate m_childNode; - }; - - static const int kMaxDataAvailRecursionDepth = 64; - static int s_CurrentDataAvailRecursionDepth; - static const int kMaxPageRecursionDepth = 1024; - - uint32_t GetObjectSize(uint32_t objnum, FX_FILESIZE& offset); - FX_BOOL IsObjectsAvail(CFX_ArrayTemplate& obj_array, - FX_BOOL bParsePage, - DownloadHints* pHints, - CFX_ArrayTemplate& ret_array); - FX_BOOL CheckDocStatus(DownloadHints* pHints); - FX_BOOL CheckHeader(DownloadHints* pHints); - FX_BOOL CheckFirstPage(DownloadHints* pHints); - FX_BOOL CheckHintTables(DownloadHints* pHints); - FX_BOOL CheckEnd(DownloadHints* pHints); - FX_BOOL CheckCrossRef(DownloadHints* pHints); - FX_BOOL CheckCrossRefItem(DownloadHints* pHints); - FX_BOOL CheckTrailer(DownloadHints* pHints); - FX_BOOL CheckRoot(DownloadHints* pHints); - FX_BOOL CheckInfo(DownloadHints* pHints); - FX_BOOL CheckPages(DownloadHints* pHints); - FX_BOOL CheckPage(DownloadHints* pHints); - FX_BOOL CheckResources(DownloadHints* pHints); - FX_BOOL CheckAnnots(DownloadHints* pHints); - FX_BOOL CheckAcroForm(DownloadHints* pHints); - FX_BOOL CheckAcroFormSubObject(DownloadHints* pHints); - FX_BOOL CheckTrailerAppend(DownloadHints* pHints); - FX_BOOL CheckPageStatus(DownloadHints* pHints); - FX_BOOL CheckAllCrossRefStream(DownloadHints* pHints); - - int32_t CheckCrossRefStream(DownloadHints* pHints, FX_FILESIZE& xref_offset); - FX_BOOL IsLinearizedFile(uint8_t* pData, uint32_t dwLen); - void SetStartOffset(FX_FILESIZE dwOffset); - FX_BOOL GetNextToken(CFX_ByteString& token); - FX_BOOL GetNextChar(uint8_t& ch); - CPDF_Object* ParseIndirectObjectAt( - FX_FILESIZE pos, - uint32_t objnum, - CPDF_IndirectObjectHolder* pObjList = nullptr); - CPDF_Object* GetObject(uint32_t objnum, - DownloadHints* pHints, - FX_BOOL* pExistInFile); - FX_BOOL GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages); - FX_BOOL PreparePageItem(); - FX_BOOL LoadPages(DownloadHints* pHints); - FX_BOOL LoadAllXref(DownloadHints* pHints); - FX_BOOL LoadAllFile(DownloadHints* pHints); - DocAvailStatus CheckLinearizedData(DownloadHints* pHints); - FX_BOOL CheckPageAnnots(uint32_t dwPage, DownloadHints* pHints); - - DocAvailStatus CheckLinearizedFirstPage(uint32_t dwPage, - DownloadHints* pHints); - FX_BOOL HaveResourceAncestor(CPDF_Dictionary* pDict); - FX_BOOL CheckPage(uint32_t dwPage, DownloadHints* pHints); - FX_BOOL LoadDocPages(DownloadHints* pHints); - FX_BOOL LoadDocPage(uint32_t dwPage, DownloadHints* pHints); - FX_BOOL CheckPageNode(PageNode& pageNodes, - int32_t iPage, - int32_t& iCount, - DownloadHints* pHints, - int level); - FX_BOOL CheckUnkownPageNode(uint32_t dwPageNo, - PageNode* pPageNode, - DownloadHints* pHints); - FX_BOOL CheckArrayPageNode(uint32_t dwPageNo, - PageNode* pPageNode, - DownloadHints* pHints); - FX_BOOL CheckPageCount(DownloadHints* pHints); - bool IsFirstCheck(uint32_t dwPage); - void ResetFirstCheck(uint32_t dwPage); - FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size, DownloadHints* pHints); - - FileAvail* const m_pFileAvail; - IFX_FileRead* const m_pFileRead; - CPDF_Parser m_parser; - CPDF_SyntaxParser m_syntaxParser; - CPDF_Object* m_pRoot; - uint32_t m_dwRootObjNum; - uint32_t m_dwInfoObjNum; - CPDF_Object* m_pLinearized; - CPDF_Object* m_pTrailer; - FX_BOOL m_bDocAvail; - FX_FILESIZE m_dwHeaderOffset; - FX_FILESIZE m_dwLastXRefOffset; - FX_FILESIZE m_dwXRefOffset; - FX_FILESIZE m_dwTrailerOffset; - FX_FILESIZE m_dwCurrentOffset; - PDF_DATAAVAIL_STATUS m_docStatus; - FX_FILESIZE m_dwFileLen; - CPDF_Document* m_pDocument; - std::set m_ObjectSet; - CFX_ArrayTemplate m_objs_array; - FX_FILESIZE m_Pos; - FX_FILESIZE m_bufferOffset; - uint32_t m_bufferSize; - CFX_ByteString m_WordBuf; - uint8_t m_bufferData[512]; - CFX_ArrayTemplate m_XRefStreamList; - CFX_ArrayTemplate m_PageObjList; - uint32_t m_PagesObjNum; - FX_BOOL m_bLinearized; - uint32_t m_dwFirstPageNo; - FX_BOOL m_bLinearedDataOK; - FX_BOOL m_bMainXRefLoadTried; - FX_BOOL m_bMainXRefLoadedOK; - FX_BOOL m_bPagesTreeLoad; - FX_BOOL m_bPagesLoad; - CPDF_Parser* m_pCurrentParser; - FX_FILESIZE m_dwCurrentXRefSteam; - FX_BOOL m_bAnnotsLoad; - FX_BOOL m_bHaveAcroForm; - uint32_t m_dwAcroFormObjNum; - FX_BOOL m_bAcroFormLoad; - CPDF_Object* m_pAcroForm; - CFX_ArrayTemplate m_arrayAcroforms; - CPDF_Dictionary* m_pPageDict; - CPDF_Object* m_pPageResource; - FX_BOOL m_bNeedDownLoadResource; - FX_BOOL m_bPageLoadedOK; - FX_BOOL m_bLinearizedFormParamLoad; - CFX_ArrayTemplate m_PagesArray; - uint32_t m_dwEncryptObjNum; - FX_FILESIZE m_dwPrevXRefOffset; - FX_BOOL m_bTotalLoadPageTree; - FX_BOOL m_bCurPageDictLoadOK; - PageNode m_pageNodes; - std::set m_pageMapCheckState; - std::set m_pagesLoadState; - std::unique_ptr m_pHintTables; - FX_BOOL m_bSupportHintTable; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DATA_AVAIL_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h deleted file mode 100644 index 501b287dfc..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ - -#include -#include - -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fxcrt/include/cfx_string_pool_template.h" -#include "core/fxcrt/include/cfx_weak_ptr.h" -#include "core/fxcrt/include/fx_coordinates.h" -#include "core/fxcrt/include/fx_string.h" - -class CPDF_IndirectObjectHolder; - -class CPDF_Dictionary : public CPDF_Object { - public: - using iterator = std::map::iterator; - using const_iterator = std::map::const_iterator; - - explicit CPDF_Dictionary(const CFX_WeakPtr& pPool); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone() const override; - CPDF_Dictionary* GetDict() const override; - bool IsDictionary() const override; - CPDF_Dictionary* AsDictionary() override; - const CPDF_Dictionary* AsDictionary() const override; - - size_t GetCount() const { return m_Map.size(); } - CPDF_Object* GetObjectFor(const CFX_ByteString& key) const; - CPDF_Object* GetDirectObjectFor(const CFX_ByteString& key) const; - CFX_ByteString GetStringFor(const CFX_ByteString& key) const; - CFX_ByteString GetStringFor(const CFX_ByteString& key, - const CFX_ByteString& default_str) const; - CFX_WideString GetUnicodeTextFor(const CFX_ByteString& key) const; - int GetIntegerFor(const CFX_ByteString& key) const; - int GetIntegerFor(const CFX_ByteString& key, int default_int) const; - bool GetBooleanFor(const CFX_ByteString& key, bool bDefault = false) const; - FX_FLOAT GetNumberFor(const CFX_ByteString& key) const; - CPDF_Dictionary* GetDictFor(const CFX_ByteString& key) const; - CPDF_Stream* GetStreamFor(const CFX_ByteString& key) const; - CPDF_Array* GetArrayFor(const CFX_ByteString& key) const; - CFX_FloatRect GetRectFor(const CFX_ByteString& key) const; - CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const; - FX_FLOAT GetFloatFor(const CFX_ByteString& key) const { - return GetNumberFor(key); - } - - FX_BOOL KeyExist(const CFX_ByteString& key) const; - bool IsSignatureDict() const; - - // Set* functions invalidate iterators for the element with the key |key|. - void SetFor(const CFX_ByteString& key, CPDF_Object* pObj); - void SetNameFor(const CFX_ByteString& key, const CFX_ByteString& name); - void SetStringFor(const CFX_ByteString& key, const CFX_ByteString& str); - void SetIntegerFor(const CFX_ByteString& key, int i); - void SetNumberFor(const CFX_ByteString& key, FX_FLOAT f); - void SetReferenceFor(const CFX_ByteString& key, - CPDF_IndirectObjectHolder* pDoc, - uint32_t objnum); - void SetRectFor(const CFX_ByteString& key, const CFX_FloatRect& rect); - void SetMatrixFor(const CFX_ByteString& key, const CFX_Matrix& matrix); - void SetBooleanFor(const CFX_ByteString& key, bool bValue); - - // Invalidates iterators for the element with the key |key|. - void RemoveFor(const CFX_ByteString& key); - - // Invalidates iterators for the element with the key |oldkey|. - void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey); - - iterator begin() { return m_Map.begin(); } - iterator end() { return m_Map.end(); } - const_iterator begin() const { return m_Map.begin(); } - const_iterator end() const { return m_Map.end(); } - - CFX_WeakPtr GetByteStringPool() const { return m_pPool; } - - protected: - ~CPDF_Dictionary() override; - - CFX_ByteString MaybeIntern(const CFX_ByteString& str); - CPDF_Object* CloneNonCyclic( - bool bDirect, - std::set* visited) const override; - - CFX_WeakPtr m_pPool; - std::map m_Map; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h deleted file mode 100644 index 383c6faeb4..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ - -#include -#include - -#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fpdfdoc/include/cpdf_linklist.h" -#include "core/fxcrt/include/cfx_string_pool_template.h" -#include "core/fxcrt/include/cfx_weak_ptr.h" -#include "core/fxcrt/include/fx_basic.h" - -class CFX_Font; -class CFX_Matrix; -class CPDF_ColorSpace; -class CPDF_DocPageData; -class CPDF_DocRenderData; -class CPDF_Font; -class CPDF_FontEncoding; -class CPDF_IccProfile; -class CPDF_Image; -class CPDF_Parser; -class CPDF_Pattern; -class CPDF_StreamAcc; -class JBig2_DocumentContext; - -#define FPDFPERM_PRINT 0x0004 -#define FPDFPERM_MODIFY 0x0008 -#define FPDFPERM_EXTRACT 0x0010 -#define FPDFPERM_ANNOT_FORM 0x0020 -#define FPDFPERM_FILL_FORM 0x0100 -#define FPDFPERM_EXTRACT_ACCESS 0x0200 -#define FPDFPERM_ASSEMBLE 0x0400 -#define FPDFPERM_PRINT_HIGH 0x0800 -#define FPDF_PAGE_MAX_NUM 0xFFFFF - -class CPDF_Document : public CPDF_IndirectObjectHolder { - public: - explicit CPDF_Document(std::unique_ptr pParser); - ~CPDF_Document() override; - - CPDF_Parser* GetParser() const { return m_pParser.get(); } - CPDF_Dictionary* GetRoot() const { return m_pRootDict; } - CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } - CFX_WeakPtr GetByteStringPool() const { - return m_pByteStringPool; - } - - void DeletePage(int iPage); - int GetPageCount() const; - - bool IsPageLoaded(int iPage) const; - CPDF_Dictionary* GetPage(int iPage); - int GetPageIndex(uint32_t objnum); - uint32_t GetUserPermissions() const; - CPDF_DocPageData* GetPageData() const { return m_pDocPage; } - - void SetPageObjNum(int iPage, uint32_t objNum); - - std::unique_ptr* CodecContext() { - return &m_pCodecContext; - } - std::unique_ptr* LinksContext() { return &m_pLinksContext; } - - CPDF_DocRenderData* GetRenderData() const { return m_pDocRender.get(); } - - // |pFontDict| must not be null. - CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict); - CPDF_ColorSpace* LoadColorSpace(CPDF_Object* pCSObj, - CPDF_Dictionary* pResources = nullptr); - - CPDF_Pattern* LoadPattern(CPDF_Object* pObj, - FX_BOOL bShading, - const CFX_Matrix& matrix); - - CPDF_Image* LoadImageF(CPDF_Object* pObj); - CPDF_StreamAcc* LoadFontFile(CPDF_Stream* pStream); - CPDF_IccProfile* LoadIccProfile(CPDF_Stream* pStream); - - void LoadDoc(); - void LoadLinearizedDoc(CPDF_Dictionary* pLinearizationParams); - void LoadPages(); - - void CreateNewDoc(); - CPDF_Dictionary* CreateNewPage(int iPage); - - CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding); - CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert); -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont, - FX_BOOL bVert, - FX_BOOL bTranslateName = FALSE); - CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, - FX_BOOL bVert, - FX_BOOL bTranslateName = FALSE); -#endif - - private: - friend class CPDF_TestDocument; - - // Retrieve page count information by getting count value from the tree nodes - int RetrievePageCount() const; - CPDF_Dictionary* FindPDFPage(CPDF_Dictionary* pPages, - int iPage, - int nPagesToGo, - int level); - int FindPageIndex(CPDF_Dictionary* pNode, - uint32_t& skip_count, - uint32_t objnum, - int& index, - int level = 0); - CPDF_Object* ParseIndirectObject(uint32_t objnum) override; - void LoadDocInternal(); - size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); - CPDF_Dictionary* GetPagesDict() const; - CPDF_Dictionary* ProcessbCJK( - CPDF_Dictionary* pBaseDict, - int charset, - FX_BOOL bVert, - CFX_ByteString basefont, - std::function Insert); - - std::unique_ptr m_pParser; - CPDF_Dictionary* m_pRootDict; - CPDF_Dictionary* m_pInfoDict; - bool m_bLinearized; - int m_iFirstPageNo; - uint32_t m_dwFirstPageObjNum; - // TODO(thestig): Figure out why this cannot be a std::unique_ptr. - CPDF_DocPageData* m_pDocPage; - std::unique_ptr m_pDocRender; - std::unique_ptr m_pCodecContext; - std::unique_ptr m_pLinksContext; - CFX_ArrayTemplate m_PageList; - CFX_WeakPtr m_pByteStringPool; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h deleted file mode 100644 index 2abbda2a36..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ - -#include -#include - -#include "core/fxcrt/include/fx_system.h" - -class CPDF_Object; - -class CPDF_IndirectObjectHolder { - public: - using const_iterator = - std::map>::const_iterator; - - CPDF_IndirectObjectHolder(); - virtual ~CPDF_IndirectObjectHolder(); - - CPDF_Object* GetIndirectObject(uint32_t objnum) const; - CPDF_Object* GetOrParseIndirectObject(uint32_t objnum); - void ReleaseIndirectObject(uint32_t objnum); - - // Take ownership of |pObj|. - uint32_t AddIndirectObject(CPDF_Object* pObj); - bool ReplaceIndirectObjectIfHigherGeneration(uint32_t objnum, - CPDF_Object* pObj); - - uint32_t GetLastObjNum() const { return m_LastObjNum; } - void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; } - - const_iterator begin() const { return m_IndirectObjs.begin(); } - const_iterator end() const { return m_IndirectObjs.end(); } - - protected: - virtual CPDF_Object* ParseIndirectObject(uint32_t objnum); - - private: - uint32_t m_LastObjNum; - std::map> m_IndirectObjs; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_name.h b/core/fpdfapi/fpdf_parser/include/cpdf_name.h deleted file mode 100644 index 3cefa7e8c1..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_name.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NAME_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NAME_H_ - -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" - -class CPDF_Name : public CPDF_Object { - public: - explicit CPDF_Name(const CFX_ByteString& str); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone() const override; - CFX_ByteString GetString() const override; - CFX_WideString GetUnicodeText() const override; - void SetString(const CFX_ByteString& str) override; - bool IsName() const override; - CPDF_Name* AsName() override; - const CPDF_Name* AsName() const override; - - protected: - ~CPDF_Name() override; - - CFX_ByteString m_Name; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NAME_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_number.h b/core/fpdfapi/fpdf_parser/include/cpdf_number.h deleted file mode 100644 index f3d9042b62..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_number.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NUMBER_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NUMBER_H_ - -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fxcrt/include/fx_string.h" -#include "core/fxcrt/include/fx_system.h" - -class CPDF_Number : public CPDF_Object { - public: - CPDF_Number(); - explicit CPDF_Number(int value); - explicit CPDF_Number(FX_FLOAT value); - explicit CPDF_Number(const CFX_ByteStringC& str); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone() const override; - CFX_ByteString GetString() const override; - FX_FLOAT GetNumber() const override; - int GetInteger() const override; - void SetString(const CFX_ByteString& str) override; - bool IsNumber() const override; - CPDF_Number* AsNumber() override; - const CPDF_Number* AsNumber() const override; - - bool IsInteger() const { return m_bInteger; } - - protected: - ~CPDF_Number() override; - - bool m_bInteger; - union { - int m_Integer; - FX_FLOAT m_Float; - }; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NUMBER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h deleted file mode 100644 index de14503bbb..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_object.h +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_ - -#include -#include - -#include "core/fxcrt/include/fx_string.h" -#include "core/fxcrt/include/fx_system.h" - -class CPDF_Array; -class CPDF_Boolean; -class CPDF_Dictionary; -class CPDF_Name; -class CPDF_Null; -class CPDF_Number; -class CPDF_Reference; -class CPDF_Stream; -class CPDF_String; - -class CPDF_Object { - public: - static const uint32_t kInvalidObjNum = static_cast(-1); - enum Type { - BOOLEAN = 1, - NUMBER, - STRING, - NAME, - ARRAY, - DICTIONARY, - STREAM, - NULLOBJ, - REFERENCE - }; - - virtual Type GetType() const = 0; - uint32_t GetObjNum() const { return m_ObjNum; } - uint32_t GetGenNum() const { return m_GenNum; } - - // Create a deep copy of the object. - virtual CPDF_Object* Clone() const = 0; - // Create a deep copy of the object except any reference object be - // copied to the object it points to directly. - virtual CPDF_Object* CloneDirectObject() const; - virtual CPDF_Object* GetDirect() const; - - void Release(); - - virtual CFX_ByteString GetString() const; - virtual CFX_WideString GetUnicodeText() const; - virtual FX_FLOAT GetNumber() const; - virtual int GetInteger() const; - virtual CPDF_Dictionary* GetDict() const; - - virtual void SetString(const CFX_ByteString& str); - - virtual bool IsArray() const; - virtual bool IsBoolean() const; - virtual bool IsDictionary() const; - virtual bool IsName() const; - virtual bool IsNumber() const; - virtual bool IsReference() const; - virtual bool IsStream() const; - virtual bool IsString() const; - - virtual CPDF_Array* AsArray(); - virtual const CPDF_Array* AsArray() const; - virtual CPDF_Boolean* AsBoolean(); - virtual const CPDF_Boolean* AsBoolean() const; - virtual CPDF_Dictionary* AsDictionary(); - virtual const CPDF_Dictionary* AsDictionary() const; - virtual CPDF_Name* AsName(); - virtual const CPDF_Name* AsName() const; - virtual CPDF_Number* AsNumber(); - virtual const CPDF_Number* AsNumber() const; - virtual CPDF_Reference* AsReference(); - virtual const CPDF_Reference* AsReference() const; - virtual CPDF_Stream* AsStream(); - virtual const CPDF_Stream* AsStream() const; - virtual CPDF_String* AsString(); - virtual const CPDF_String* AsString() const; - - protected: - friend class CPDF_Array; - friend class CPDF_Dictionary; - friend class CPDF_Document; - friend class CPDF_IndirectObjectHolder; - friend class CPDF_Parser; - friend class CPDF_Reference; - friend class CPDF_Stream; - friend struct std::default_delete; - - CPDF_Object() : m_ObjNum(0), m_GenNum(0) {} - virtual ~CPDF_Object(); - - CPDF_Object* CloneObjectNonCyclic(bool bDirect) const; - - // Create a deep copy of the object with the option to either - // copy a reference object or directly copy the object it refers to - // when |bDirect| is true. - // Also check cyclic reference against |pVisited|, no copy if it is found. - // Complex objects should implement their own CloneNonCyclic() - // function to properly check for possible loop. - virtual CPDF_Object* CloneNonCyclic( - bool bDirect, - std::set* pVisited) const; - - uint32_t m_ObjNum; - uint32_t m_GenNum; - - private: - CPDF_Object(const CPDF_Object& src) {} -}; - -inline CPDF_Boolean* ToBoolean(CPDF_Object* obj) { - return obj ? obj->AsBoolean() : nullptr; -} - -inline const CPDF_Boolean* ToBoolean(const CPDF_Object* obj) { - return obj ? obj->AsBoolean() : nullptr; -} - -inline CPDF_Number* ToNumber(CPDF_Object* obj) { - return obj ? obj->AsNumber() : nullptr; -} - -inline const CPDF_Number* ToNumber(const CPDF_Object* obj) { - return obj ? obj->AsNumber() : nullptr; -} - -inline CPDF_String* ToString(CPDF_Object* obj) { - return obj ? obj->AsString() : nullptr; -} - -inline const CPDF_String* ToString(const CPDF_Object* obj) { - return obj ? obj->AsString() : nullptr; -} - -inline CPDF_Name* ToName(CPDF_Object* obj) { - return obj ? obj->AsName() : nullptr; -} - -inline const CPDF_Name* ToName(const CPDF_Object* obj) { - return obj ? obj->AsName() : nullptr; -} - -inline CPDF_Array* ToArray(CPDF_Object* obj) { - return obj ? obj->AsArray() : nullptr; -} - -inline const CPDF_Array* ToArray(const CPDF_Object* obj) { - return obj ? obj->AsArray() : nullptr; -} - -inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) { - return obj ? obj->AsDictionary() : nullptr; -} - -inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) { - return obj ? obj->AsDictionary() : nullptr; -} -inline CPDF_Reference* ToReference(CPDF_Object* obj) { - return obj ? obj->AsReference() : nullptr; -} - -inline const CPDF_Reference* ToReference(const CPDF_Object* obj) { - return obj ? obj->AsReference() : nullptr; -} - -inline CPDF_Stream* ToStream(CPDF_Object* obj) { - return obj ? obj->AsStream() : nullptr; -} - -inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { - return obj ? obj->AsStream() : nullptr; -} - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h deleted file mode 100644 index 05288353f2..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ - -#include -#include -#include - -#include "core/fxcrt/include/fx_basic.h" - -class CPDF_Array; -class CPDF_CryptoHandler; -class CPDF_Dictionary; -class CPDF_Document; -class CPDF_IndirectObjectHolder; -class CPDF_Object; -class CPDF_SecurityHandler; -class CPDF_StreamAcc; -class CPDF_SyntaxParser; -class IFX_FileRead; - -class CPDF_Parser { - public: - enum Error { - SUCCESS = 0, - FILE_ERROR, - FORMAT_ERROR, - PASSWORD_ERROR, - HANDLER_ERROR - }; - - // A limit on the maximum object number in the xref table. Theoretical limits - // are higher, but this may be large enough in practice. - static const uint32_t kMaxObjectNumber = 1048576; - - CPDF_Parser(); - ~CPDF_Parser(); - - Error StartParse(IFX_FileRead* pFile, CPDF_Document* pDocument); - Error StartLinearizedParse(IFX_FileRead* pFile, CPDF_Document* pDocument); - - void SetPassword(const FX_CHAR* password) { m_Password = password; } - CFX_ByteString GetPassword() { return m_Password; } - CPDF_Dictionary* GetTrailer() const { return m_pTrailer; } - FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; } - - uint32_t GetPermissions() const; - uint32_t GetRootObjNum(); - uint32_t GetInfoObjNum(); - CPDF_Array* GetIDArray(); - - CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict; } - - CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList, - uint32_t objnum); - - uint32_t GetLastObjNum() const; - bool IsValidObjectNumber(uint32_t objnum) const; - FX_FILESIZE GetObjectPositionOrZero(uint32_t objnum) const; - uint8_t GetObjectType(uint32_t objnum) const; - uint16_t GetObjectGenNum(uint32_t objnum) const; - bool IsVersionUpdated() const { return m_bVersionUpdated; } - bool IsObjectFreeOrNull(uint32_t objnum) const; - CPDF_CryptoHandler* GetCryptoHandler(); - IFX_FileRead* GetFileAccess() const; - - FX_FILESIZE GetObjectOffset(uint32_t objnum) const; - FX_FILESIZE GetObjectSize(uint32_t objnum) const; - - void GetIndirectBinary(uint32_t objnum, uint8_t*& pBuffer, uint32_t& size); - int GetFileVersion() const { return m_FileVersion; } - FX_BOOL IsXRefStream() const { return m_bXRefStream; } - - CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList, - FX_FILESIZE pos, - uint32_t objnum); - - CPDF_Object* ParseIndirectObjectAtByStrict( - CPDF_IndirectObjectHolder* pObjList, - FX_FILESIZE pos, - uint32_t objnum, - FX_FILESIZE* pResultPos); - - uint32_t GetFirstPageNo() const { return m_dwFirstPageNo; } - - protected: - struct ObjectInfo { - ObjectInfo() : pos(0), type(0), gennum(0) {} - - FX_FILESIZE pos; - uint8_t type; - uint16_t gennum; - }; - - std::unique_ptr m_pSyntax; - std::map m_ObjectInfo; - - bool LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_BOOL bSkip); - FX_BOOL RebuildCrossRef(); - - private: - friend class CPDF_DataAvail; - - enum class ParserState { - kDefault, - kComment, - kWhitespace, - kString, - kHexString, - kEscapedString, - kXref, - kObjNum, - kPostObjNum, - kGenNum, - kPostGenNum, - kTrailer, - kBeginObj, - kEndObj - }; - - CPDF_Object* ParseDirect(CPDF_Object* pObj); - FX_BOOL LoadAllCrossRefV4(FX_FILESIZE pos); - FX_BOOL LoadAllCrossRefV5(FX_FILESIZE pos); - FX_BOOL LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef); - CPDF_Dictionary* LoadTrailerV4(); - Error SetEncryptHandler(); - void ReleaseEncryptHandler(); - FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount); - FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount); - FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); - Error LoadLinearizedMainXRefTable(); - CPDF_StreamAcc* GetObjectStream(uint32_t number); - FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, uint32_t offset); - void SetEncryptDictionary(CPDF_Dictionary* pDict); - void ShrinkObjectMap(uint32_t size); - // A simple check whether the cross reference table matches with - // the objects. - bool VerifyCrossRefV4(); - - CPDF_Document* m_pDocument; // not owned - bool m_bHasParsed; - bool m_bOwnFileRead; - int m_FileVersion; - CPDF_Dictionary* m_pTrailer; - CPDF_Dictionary* m_pEncryptDict; - FX_FILESIZE m_LastXRefOffset; - FX_BOOL m_bXRefStream; - std::unique_ptr m_pSecurityHandler; - CFX_ByteString m_Password; - std::set m_SortedOffset; - CFX_ArrayTemplate m_Trailers; - bool m_bVersionUpdated; - CPDF_Object* m_pLinearized; - uint32_t m_dwFirstPageNo; - uint32_t m_dwXrefStartObjNum; - - // A map of object numbers to indirect streams. Map owns the streams. - std::map> m_ObjectStreamMap; - - // Mapping of object numbers to offsets. The offsets are relative to the first - // object in the stream. - using StreamObjectCache = std::map; - - // Mapping of streams to their object caches. This is valid as long as the - // streams in |m_ObjectStreamMap| are valid. - std::map m_ObjCache; - - // All indirect object numbers that are being parsed. - std::set m_ParsingObjNums; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_reference.h b/core/fpdfapi/fpdf_parser/include/cpdf_reference.h deleted file mode 100644 index 388c1697a8..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_reference.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_REFERENCE_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_REFERENCE_H_ - -#include - -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" - -class CPDF_IndirectObjectHolder; - -class CPDF_Reference : public CPDF_Object { - public: - CPDF_Reference(CPDF_IndirectObjectHolder* pDoc, int objnum); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone() const override; - CPDF_Object* GetDirect() const override; - CFX_ByteString GetString() const override; - FX_FLOAT GetNumber() const override; - int GetInteger() const override; - CPDF_Dictionary* GetDict() const override; - - // TODO(weili): check whether GetUnicodeText() and GetArray() are needed. - bool IsReference() const override; - CPDF_Reference* AsReference() override; - const CPDF_Reference* AsReference() const override; - - CPDF_IndirectObjectHolder* GetObjList() const { return m_pObjList; } - uint32_t GetRefObjNum() const { return m_RefObjNum; } - - void SetRef(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum); - - protected: - ~CPDF_Reference() override; - CPDF_Object* CloneNonCyclic( - bool bDirect, - std::set* pVisited) const override; - CPDF_Object* SafeGetDirect() const { - CPDF_Object* obj = GetDirect(); - if (!obj || obj->IsReference()) - return nullptr; - return obj; - } - - CPDF_IndirectObjectHolder* m_pObjList; - uint32_t m_RefObjNum; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_REFERENCE_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h deleted file mode 100644 index c9aa12eaa9..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_SIMPLE_PARSER_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_SIMPLE_PARSER_H_ - -#include "core/fxcrt/include/fx_string.h" -#include "core/fxcrt/include/fx_system.h" - -class CPDF_SimpleParser { - public: - CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize); - CPDF_SimpleParser(const CFX_ByteStringC& str); - - CFX_ByteStringC GetWord(); - - // Find the token and its |nParams| parameters from the start of data, - // and move the current position to the start of those parameters. - bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams); - - // For testing only. - uint32_t GetCurPos() const { return m_dwCurPos; } - - private: - void ParseWord(const uint8_t*& pStart, uint32_t& dwSize); - - const uint8_t* m_pData; - uint32_t m_dwSize; - uint32_t m_dwCurPos; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_SIMPLE_PARSER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h deleted file mode 100644 index 69a612cc0c..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_H_ - -#include -#include - -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fxcrt/include/fx_basic.h" - -class CPDF_Stream : public CPDF_Object { - public: - CPDF_Stream(); - - // Takes ownership of |pData| and |pDict|. - CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone() const override; - CPDF_Dictionary* GetDict() const override; - CFX_WideString GetUnicodeText() const override; - bool IsStream() const override; - CPDF_Stream* AsStream() override; - const CPDF_Stream* AsStream() const override; - - uint32_t GetRawSize() const { return m_dwSize; } - uint8_t* GetRawData() const { return m_pDataBuf.get(); } - - // Does not takes onwership of |pData|, copies into internally-owned buffer. - void SetData(const uint8_t* pData, uint32_t size); - - void InitStream(const uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict); - void InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict); - - FX_BOOL ReadRawData(FX_FILESIZE start_pos, - uint8_t* pBuf, - uint32_t buf_size) const; - - bool IsMemoryBased() const { return m_bMemoryBased; } - - protected: - ~CPDF_Stream() override; - CPDF_Object* CloneNonCyclic( - bool bDirect, - std::set* pVisited) const override; - - std::unique_ptr> m_pDict; - bool m_bMemoryBased = true; - uint32_t m_dwSize = 0; - std::unique_ptr m_pDataBuf; - IFX_FileRead* m_pFile = nullptr; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h deleted file mode 100644 index 6176753deb..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_ACC_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_ACC_H_ - -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fxcrt/include/fx_string.h" -#include "core/fxcrt/include/fx_system.h" - -class CPDF_StreamAcc { - public: - CPDF_StreamAcc(); - ~CPDF_StreamAcc(); - - void LoadAllData(const CPDF_Stream* pStream, - FX_BOOL bRawAccess = FALSE, - uint32_t estimated_size = 0, - FX_BOOL bImageAcc = FALSE); - - const CPDF_Stream* GetStream() const { return m_pStream; } - CPDF_Dictionary* GetDict() const { - return m_pStream ? m_pStream->GetDict() : nullptr; - } - - const uint8_t* GetData() const; - uint32_t GetSize() const; - const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; } - const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } - uint8_t* DetachData(); - - protected: - uint8_t* m_pData; - uint32_t m_dwSize; - FX_BOOL m_bNewBuf; - CFX_ByteString m_ImageDecoder; - CPDF_Dictionary* m_pImageParam; - const CPDF_Stream* m_pStream; - uint8_t* m_pSrcData; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_ACC_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_string.h b/core/fpdfapi/fpdf_parser/include/cpdf_string.h deleted file mode 100644 index 740465c59f..0000000000 --- a/core/fpdfapi/fpdf_parser/include/cpdf_string.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STRING_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STRING_H_ - -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fxcrt/include/fx_string.h" -#include "core/fxcrt/include/fx_system.h" - -class CPDF_String : public CPDF_Object { - public: - CPDF_String(); - CPDF_String(const CFX_ByteString& str, FX_BOOL bHex); - explicit CPDF_String(const CFX_WideString& str); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone() const override; - CFX_ByteString GetString() const override; - CFX_WideString GetUnicodeText() const override; - void SetString(const CFX_ByteString& str) override; - bool IsString() const override; - CPDF_String* AsString() override; - const CPDF_String* AsString() const override; - - FX_BOOL IsHex() const { return m_bHex; } - - protected: - ~CPDF_String() override; - - CFX_ByteString m_String; - FX_BOOL m_bHex; -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STRING_H_ diff --git a/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h b/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h deleted file mode 100644 index 5ae4011c76..0000000000 --- a/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_FPDF_PARSER_DECODE_H_ -#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_FPDF_PARSER_DECODE_H_ - -#include "core/fxcrt/include/fx_basic.h" - -class CPDF_Dictionary; - -// Indexed by 8-bit char code, contains unicode code points. -extern const uint16_t PDFDocEncoding[256]; - -CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig); -CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig); -CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig); -CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, - FX_BOOL bHex = FALSE); -CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size); -CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr); -CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1); -CFX_ByteString PDF_EncodeText(const CFX_WideString& str); - -bool FlateEncode(const uint8_t* src_buf, - uint32_t src_size, - uint8_t** dest_buf, - uint32_t* dest_size); - -// This used to have more parameters like the predictor and bpc, but there was -// only one caller, so the interface has been simplified, the values are hard -// coded, and dead code has been removed. -bool PngEncode(const uint8_t* src_buf, - uint32_t src_size, - uint8_t** dest_buf, - uint32_t* dest_size); - -uint32_t FlateDecode(const uint8_t* src_buf, - uint32_t src_size, - uint8_t*& dest_buf, - uint32_t& dest_size); -uint32_t RunLengthDecode(const uint8_t* src_buf, - uint32_t src_size, - uint8_t*& dest_buf, - uint32_t& dest_size); - -// Public for testing. -uint32_t A85Decode(const uint8_t* src_buf, - uint32_t src_size, - uint8_t*& dest_buf, - uint32_t& dest_size); -// Public for testing. -uint32_t HexDecode(const uint8_t* src_buf, - uint32_t src_size, - uint8_t*& dest_buf, - uint32_t& dest_size); -// Public for testing. -uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, - const uint8_t* src_buf, - uint32_t src_size, - CPDF_Dictionary* pParams, - uint32_t estimated_size, - uint8_t*& dest_buf, - uint32_t& dest_size); -FX_BOOL PDF_DataDecode(const uint8_t* src_buf, - uint32_t src_size, - const CPDF_Dictionary* pDict, - uint8_t*& dest_buf, - uint32_t& dest_size, - CFX_ByteString& ImageEncoding, - CPDF_Dictionary*& pImageParms, - uint32_t estimated_size, - FX_BOOL bImageAcc); - -#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_FPDF_PARSER_DECODE_H_ diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index 355c79612b..1c21d04be7 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -20,9 +20,9 @@ #include "core/fpdfapi/fpdf_page/cpdf_pathobject.h" #include "core/fpdfapi/fpdf_page/cpdf_textobject.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/fpdf_render/cpdf_type3cache.h" #include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" diff --git a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp index fd5d7ff698..c78bde0472 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_page.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/render_int.h" diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index b70f009fd2..5b852d172d 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -17,9 +17,9 @@ #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index ede1d3a401..253613f601 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -13,9 +13,9 @@ #include "core/fpdfapi/fpdf_page/cpdf_image.h" #include "core/fpdfapi/fpdf_page/cpdf_imageobject.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fxcodec/include/fx_codec.h" diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index eb264675df..67b35509a0 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -17,8 +17,8 @@ #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fxge/include/cfx_fxgedevice.h" diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index af2b73c89e..27bafd1c04 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -18,8 +18,8 @@ #include "core/fpdfapi/fpdf_page/cpdf_pathobject.h" #include "core/fpdfapi/fpdf_page/cpdf_textobject.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fpdfapi/fpdf_render/cpdf_type3cache.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h index aa2baa2e26..4eaaf264e3 100644 --- a/core/fpdfapi/fpdf_render/render_int.h +++ b/core/fpdfapi/fpdf_render/render_int.h @@ -14,7 +14,7 @@ #include "core/fpdfapi/fpdf_page/cpdf_clippath.h" #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h" #include "core/fpdfapi/fpdf_page/cpdf_graphicstates.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fxge/include/cfx_fxgedevice.h" #include "core/fxge/include/cfx_renderdevice.h" diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp index 0255392cf7..b6466217ca 100644 --- a/core/fpdfdoc/cpdf_action.cpp +++ b/core/fpdfdoc/cpdf_action.cpp @@ -6,8 +6,8 @@ #include "core/fpdfdoc/include/cpdf_action.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fpdfdoc/include/cpdf_filespec.h" #include "core/fpdfdoc/include/cpdf_nametree.h" diff --git a/core/fpdfdoc/cpdf_actionfields.cpp b/core/fpdfdoc/cpdf_actionfields.cpp index 438c67c7e8..f9ac76e575 100644 --- a/core/fpdfdoc/cpdf_actionfields.cpp +++ b/core/fpdfdoc/cpdf_actionfields.cpp @@ -6,8 +6,8 @@ #include "core/fpdfdoc/include/cpdf_actionfields.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fpdfdoc/include/cpdf_action.h" size_t CPDF_ActionFields::GetFieldsCount() const { diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index f88f4fdc01..847d63a3dd 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -8,8 +8,8 @@ #include "core/fpdfapi/fpdf_page/cpdf_form.h" #include "core/fpdfapi/fpdf_page/cpdf_page.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfdoc/cpvt_generateap.h" diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index f27007ac31..70b82c31a7 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -7,8 +7,8 @@ #include "core/fpdfdoc/include/cpdf_annotlist.h" #include "core/fpdfapi/fpdf_page/cpdf_page.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfdoc/cpvt_generateap.h" #include "core/fpdfdoc/include/cpdf_annot.h" diff --git a/core/fpdfdoc/cpdf_apsettings.cpp b/core/fpdfdoc/cpdf_apsettings.cpp index 3715e8ab89..33d9b0648d 100644 --- a/core/fpdfdoc/cpdf_apsettings.cpp +++ b/core/fpdfdoc/cpdf_apsettings.cpp @@ -6,8 +6,8 @@ #include "core/fpdfdoc/cpdf_apsettings.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fpdfdoc/include/cpdf_formcontrol.h" CPDF_ApSettings::CPDF_ApSettings(CPDF_Dictionary* pDict) : m_pDict(pDict) {} diff --git a/core/fpdfdoc/cpdf_bookmark.cpp b/core/fpdfdoc/cpdf_bookmark.cpp index de9832d233..b82cee8753 100644 --- a/core/fpdfdoc/cpdf_bookmark.cpp +++ b/core/fpdfdoc/cpdf_bookmark.cpp @@ -6,8 +6,8 @@ #include "core/fpdfdoc/include/cpdf_bookmark.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" #include "core/fpdfdoc/include/cpdf_nametree.h" #include "core/fxge/include/fx_dib.h" diff --git a/core/fpdfdoc/cpdf_bookmarktree.cpp b/core/fpdfdoc/cpdf_bookmarktree.cpp index c10fabb240..7ff4b09ad6 100644 --- a/core/fpdfdoc/cpdf_bookmarktree.cpp +++ b/core/fpdfdoc/cpdf_bookmarktree.cpp @@ -6,7 +6,7 @@ #include "core/fpdfdoc/include/cpdf_bookmarktree.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild( const CPDF_Bookmark& parent) const { diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp index 1c71ae5826..40491786d7 100644 --- a/core/fpdfdoc/cpdf_defaultappearance.cpp +++ b/core/fpdfdoc/cpdf_defaultappearance.cpp @@ -6,8 +6,8 @@ #include "core/fpdfdoc/include/cpdf_defaultappearance.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fpdfdoc/include/cpdf_formcontrol.h" FX_BOOL CPDF_DefaultAppearance::HasFont() { diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp index 27626a3d8f..6a843c684f 100644 --- a/core/fpdfdoc/cpdf_dest.cpp +++ b/core/fpdfdoc/cpdf_dest.cpp @@ -6,8 +6,8 @@ #include "core/fpdfdoc/include/cpdf_dest.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" namespace { diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp index 8423d66fc7..6c30cdba81 100644 --- a/core/fpdfdoc/cpdf_filespec.cpp +++ b/core/fpdfdoc/cpdf_filespec.cpp @@ -6,9 +6,9 @@ #include "core/fpdfdoc/include/cpdf_filespec.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fxcrt/include/fx_system.h" namespace { diff --git a/core/fpdfdoc/cpdf_filespec_unittest.cpp b/core/fpdfdoc/cpdf_filespec_unittest.cpp index 25577bb00b..b1b20e172b 100644 --- a/core/fpdfdoc/cpdf_filespec_unittest.cpp +++ b/core/fpdfdoc/cpdf_filespec_unittest.cpp @@ -5,9 +5,9 @@ #include #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" #include "core/fpdfdoc/include/cpdf_filespec.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp index ec71a2f163..07defcb1a6 100644 --- a/core/fpdfdoc/cpdf_formcontrol.cpp +++ b/core/fpdfdoc/cpdf_formcontrol.cpp @@ -9,10 +9,10 @@ #include #include "core/fpdfapi/fpdf_page/cpdf_form.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfdoc/include/cpdf_interform.h" #include "core/fxge/include/cfx_renderdevice.h" diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp index 38f7648e0b..d709a53a61 100644 --- a/core/fpdfdoc/cpdf_formfield.cpp +++ b/core/fpdfdoc/cpdf_formfield.cpp @@ -8,13 +8,13 @@ #include -#include "core/fpdfapi/fpdf_parser/include/cfdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cfdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fpdfdoc/cpvt_generateap.h" #include "core/fpdfdoc/include/cpdf_formcontrol.h" #include "core/fpdfdoc/include/cpdf_interform.h" diff --git a/core/fpdfdoc/cpdf_formfield_unittest.cpp b/core/fpdfdoc/cpdf_formfield_unittest.cpp index eb7a5927e6..6042fa9d9a 100644 --- a/core/fpdfdoc/cpdf_formfield_unittest.cpp +++ b/core/fpdfdoc/cpdf_formfield_unittest.cpp @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.h" #include "core/fpdfdoc/include/cpdf_formfield.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/core/fpdfdoc/cpdf_iconfit.cpp b/core/fpdfdoc/cpdf_iconfit.cpp index d86c4d918d..fe4fc9a02b 100644 --- a/core/fpdfdoc/cpdf_iconfit.cpp +++ b/core/fpdfdoc/cpdf_iconfit.cpp @@ -6,8 +6,8 @@ #include "core/fpdfdoc/include/cpdf_iconfit.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fxcrt/include/fx_string.h" CPDF_IconFit::ScaleMethod CPDF_IconFit::GetScaleMethod() { diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp index 05c3452af0..7e54db2dae 100644 --- a/core/fpdfdoc/cpdf_interform.cpp +++ b/core/fpdfdoc/cpdf_interform.cpp @@ -9,10 +9,10 @@ #include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_page/cpdf_page.h" -#include "core/fpdfapi/fpdf_parser/include/cfdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cfdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" #include "core/fpdfdoc/include/cpdf_filespec.h" #include "core/fpdfdoc/include/cpdf_formcontrol.h" #include "core/fpdfdoc/include/cpdf_interform.h" diff --git a/core/fpdfdoc/cpdf_link.cpp b/core/fpdfdoc/cpdf_link.cpp index b92b3cf45f..6cb53182a2 100644 --- a/core/fpdfdoc/cpdf_link.cpp +++ b/core/fpdfdoc/cpdf_link.cpp @@ -6,7 +6,7 @@ #include "core/fpdfdoc/include/cpdf_link.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fpdfdoc/include/cpdf_nametree.h" CFX_FloatRect CPDF_Link::GetRect() { diff --git a/core/fpdfdoc/cpdf_linklist.cpp b/core/fpdfdoc/cpdf_linklist.cpp index d28571cd88..326bdda339 100644 --- a/core/fpdfdoc/cpdf_linklist.cpp +++ b/core/fpdfdoc/cpdf_linklist.cpp @@ -7,7 +7,7 @@ #include "core/fpdfdoc/include/cpdf_linklist.h" #include "core/fpdfapi/fpdf_page/cpdf_page.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" CPDF_LinkList::CPDF_LinkList() {} diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp index ee6647f07f..5fd8e920c8 100644 --- a/core/fpdfdoc/cpdf_metadata.cpp +++ b/core/fpdfdoc/cpdf_metadata.cpp @@ -6,9 +6,9 @@ #include "core/fpdfdoc/include/cpdf_metadata.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fxcrt/include/fx_xml.h" CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) { diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp index a18ea217ae..c8f6ebfa7c 100644 --- a/core/fpdfdoc/cpdf_nametree.cpp +++ b/core/fpdfdoc/cpdf_nametree.cpp @@ -6,9 +6,9 @@ #include "core/fpdfdoc/include/cpdf_nametree.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" namespace { diff --git a/core/fpdfdoc/cpdf_numbertree.cpp b/core/fpdfdoc/cpdf_numbertree.cpp index 36d18c2d19..47ce194b60 100644 --- a/core/fpdfdoc/cpdf_numbertree.cpp +++ b/core/fpdfdoc/cpdf_numbertree.cpp @@ -6,8 +6,8 @@ #include "core/fpdfdoc/cpdf_numbertree.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" namespace { diff --git a/core/fpdfdoc/cpdf_occontext.cpp b/core/fpdfdoc/cpdf_occontext.cpp index 03edab9294..6cb007514e 100644 --- a/core/fpdfdoc/cpdf_occontext.cpp +++ b/core/fpdfdoc/cpdf_occontext.cpp @@ -7,8 +7,8 @@ #include "core/fpdfdoc/include/cpdf_occontext.h" #include "core/fpdfapi/fpdf_page/cpdf_pageobject.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" namespace { diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp index 2f02e84bf3..35aa2fda9f 100644 --- a/core/fpdfdoc/cpdf_pagelabel.cpp +++ b/core/fpdfdoc/cpdf_pagelabel.cpp @@ -6,9 +6,9 @@ #include "core/fpdfdoc/cpdf_pagelabel.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fpdfdoc/cpdf_numbertree.h" namespace { diff --git a/core/fpdfdoc/cpdf_viewerpreferences.cpp b/core/fpdfdoc/cpdf_viewerpreferences.cpp index 0dc55aad74..5ebe2bb11e 100644 --- a/core/fpdfdoc/cpdf_viewerpreferences.cpp +++ b/core/fpdfdoc/cpdf_viewerpreferences.cpp @@ -6,7 +6,7 @@ #include "core/fpdfdoc/include/cpdf_viewerpreferences.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc) : m_pDoc(pDoc) {} diff --git a/core/fpdfdoc/cpvt_color.cpp b/core/fpdfdoc/cpvt_color.cpp index 72b8140b7b..e42fad3398 100644 --- a/core/fpdfdoc/cpvt_color.cpp +++ b/core/fpdfdoc/cpvt_color.cpp @@ -6,7 +6,7 @@ #include "core/fpdfdoc/cpvt_color.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" // Static. CPVT_Color CPVT_Color::ParseColor(const CFX_ByteString& str) { diff --git a/core/fpdfdoc/cpvt_color.h b/core/fpdfdoc/cpvt_color.h index da23ce4bb9..1be6bebae7 100644 --- a/core/fpdfdoc/cpvt_color.h +++ b/core/fpdfdoc/cpvt_color.h @@ -7,7 +7,7 @@ #ifndef CORE_FPDFDOC_CPVT_COLOR_H_ #define CORE_FPDFDOC_CPVT_COLOR_H_ -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" diff --git a/core/fpdfdoc/cpvt_fontmap.cpp b/core/fpdfdoc/cpvt_fontmap.cpp index 34225fc5f7..cb600fb3a4 100644 --- a/core/fpdfdoc/cpvt_fontmap.cpp +++ b/core/fpdfdoc/cpvt_fontmap.cpp @@ -7,8 +7,8 @@ #include "core/fpdfdoc/cpvt_fontmap.h" #include "core/fpdfapi/fpdf_font/cpdf_font.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" #include "core/fpdfdoc/include/cpdf_interform.h" CPVT_FontMap::CPVT_FontMap(CPDF_Document* pDoc, diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index 23c99412e6..96e11d38ad 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -9,11 +9,11 @@ #include #include "core/fpdfapi/fpdf_font/cpdf_font.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fpdfdoc/cpvt_color.h" #include "core/fpdfdoc/cpvt_fontmap.h" #include "core/fpdfdoc/include/cpdf_annot.h" diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp index 6b60e97e9a..a0ce472270 100644 --- a/core/fpdfdoc/doc_tagged.cpp +++ b/core/fpdfdoc/doc_tagged.cpp @@ -6,11 +6,11 @@ #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" #include "core/fpdfdoc/cpdf_numbertree.h" #include "core/fpdfdoc/include/fpdf_tagged.h" #include "core/fpdfdoc/tagged_int.h" diff --git a/core/fpdfdoc/include/cpdf_action.h b/core/fpdfdoc/include/cpdf_action.h index 0b095e4a66..209f1f9f09 100644 --- a/core/fpdfdoc/include/cpdf_action.h +++ b/core/fpdfdoc/include/cpdf_action.h @@ -7,7 +7,7 @@ #ifndef CORE_FPDFDOC_INCLUDE_CPDF_ACTION_H_ #define CORE_FPDFDOC_INCLUDE_CPDF_ACTION_H_ -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fpdfdoc/include/cpdf_dest.h" #include "core/fxcrt/include/fx_string.h" diff --git a/core/fpdfdoc/include/cpdf_interform.h b/core/fpdfdoc/include/cpdf_interform.h index 9c07ee996f..c5512d4699 100644 --- a/core/fpdfdoc/include/cpdf_interform.h +++ b/core/fpdfdoc/include/cpdf_interform.h @@ -11,7 +11,7 @@ #include #include -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/fpdf_parser_decode.h" #include "core/fpdfdoc/include/cpdf_defaultappearance.h" #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index 6c9857ccc1..44d5a198b0 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -16,8 +16,8 @@ #include "core/fpdfapi/fpdf_page/cpdf_page.h" #include "core/fpdfapi/fpdf_page/cpdf_pageobject.h" #include "core/fpdfapi/fpdf_page/cpdf_textobject.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_string.h" #include "core/fpdftext/unicodenormalizationdata.h" #include "core/fxcrt/fx_bidi.h" #include "core/fxcrt/include/fx_ext.h" diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index 7713ca3ecb..650d616a73 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -8,7 +8,7 @@ #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fxcodec/include/JBig2_DocumentContext.h" #include "core/fxcodec/jbig2/JBig2_Context.h" #include "core/fxcodec/jbig2/JBig2_Image.h" diff --git a/core/fxcodec/jbig2/JBig2_BitStream.cpp b/core/fxcodec/jbig2/JBig2_BitStream.cpp index ddf092dbc4..7aee93d95f 100644 --- a/core/fxcodec/jbig2/JBig2_BitStream.cpp +++ b/core/fxcodec/jbig2/JBig2_BitStream.cpp @@ -8,8 +8,8 @@ #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" CJBig2_BitStream::CJBig2_BitStream(CPDF_StreamAcc* pSrcStream) : m_pBuf(pSrcStream->GetData()), diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index 911eb0bf63..ee5800d7e0 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -11,8 +11,8 @@ #include #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fxcodec/jbig2/JBig2_ArithDecoder.h" #include "core/fxcodec/jbig2/JBig2_BitStream.h" #include "core/fxcodec/jbig2/JBig2_GrdProc.h" diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index a0e1a8fcac..8ae00a9bad 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -12,7 +12,7 @@ #include #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/cpdf_object.h" #include "core/fxcodec/include/fx_codec_def.h" #include "core/fxcodec/jbig2/JBig2_List.h" #include "core/fxcodec/jbig2/JBig2_Page.h" diff --git a/core/fxge/dib/fx_dib_engine_unittest.cpp b/core/fxge/dib/fx_dib_engine_unittest.cpp index 0d0fdbdca7..d35c66ea3f 100644 --- a/core/fxge/dib/fx_dib_engine_unittest.cpp +++ b/core/fxge/dib/fx_dib_engine_unittest.cpp @@ -4,9 +4,9 @@ #include -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream.h" #include "core/fpdfapi/fpdf_render/render_int.h" #include "core/fxcrt/include/fx_memory.h" #include "core/fxge/dib/dib_int.h" diff --git a/core/fxge/ge/cfx_graphstate.cpp b/core/fxge/ge/cfx_graphstate.cpp index 9a6e73810f..de76987fa9 100644 --- a/core/fxge/ge/cfx_graphstate.cpp +++ b/core/fxge/ge/cfx_graphstate.cpp @@ -6,7 +6,7 @@ #include "core/fxge/include/cfx_graphstate.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" CFX_GraphState::CFX_GraphState() {} diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index b1c47bfedf..55d66e037a 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -11,9 +11,9 @@ #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fxge/include/cfx_fxgedevice.h" #include "core/fxge/include/cfx_gemodule.h" #include "core/fxge/include/cfx_graphstatedata.h" -- cgit v1.2.3