summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-05-18 15:51:20 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-19 01:39:40 +0000
commit76020fc9751e55661d1c01b6cd92dfcb1fd56e6a (patch)
tree59d5251b23f5acb78891bf2911a79f2c70812c1c /core/fpdfapi/parser
parent22644731e0e46eae1f50927376e557c7d64db1d5 (diff)
downloadpdfium-76020fc9751e55661d1c01b6cd92dfcb1fd56e6a.tar.xz
Move CCodec_ModuleMgr ownership to CPDF_ModuleMgr.
More straight forward than CFX_GEModule owning in and CPDF_ModuleMgr holding a pointer to it. Remove assumptions that the codec modules may return nullptr, and do IWYU. Change-Id: Iba7fc3c7ec223fd6d29a1ab74ed13d35689bc5d5 Reviewed-on: https://pdfium-review.googlesource.com/5654 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_document_unittest.cpp5
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.cpp13
2 files changed, 5 insertions, 13 deletions
diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp
index f052af3aec..2715508015 100644
--- a/core/fpdfapi/parser/cpdf_document_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp
@@ -153,10 +153,7 @@ class CPDF_TestDocPagesWithoutKids : public CPDF_Document {
class cpdf_document_test : public testing::Test {
public:
- void SetUp() override {
- CPDF_ModuleMgr* module_mgr = CPDF_ModuleMgr::Get();
- module_mgr->InitPageModule();
- }
+ void SetUp() override { CPDF_ModuleMgr::Get()->Init(); }
void TearDown() override { CPDF_ModuleMgr::Destroy(); }
};
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 64831e91e5..561b6627bc 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -549,8 +549,7 @@ bool FlateEncode(const uint8_t* src_buf,
uint8_t** dest_buf,
uint32_t* dest_size) {
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
- return pEncoders &&
- pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf,
+ return pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf,
dest_size);
}
@@ -559,8 +558,7 @@ bool PngEncode(const uint8_t* src_buf,
uint8_t** dest_buf,
uint32_t* dest_size) {
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
- return pEncoders &&
- pEncoders->GetFlateModule()->PngEncode(src_buf, src_size, dest_buf,
+ return pEncoders->GetFlateModule()->PngEncode(src_buf, src_size, dest_buf,
dest_size);
}
@@ -569,9 +567,6 @@ uint32_t FlateDecode(const uint8_t* src_buf,
uint8_t*& dest_buf,
uint32_t& dest_size) {
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
- if (pEncoders) {
- return pEncoders->GetFlateModule()->FlateOrLZWDecode(
- false, src_buf, src_size, false, 0, 0, 0, 0, 0, dest_buf, dest_size);
- }
- return 0;
+ return pEncoders->GetFlateModule()->FlateOrLZWDecode(
+ false, src_buf, src_size, false, 0, 0, 0, 0, 0, dest_buf, dest_size);
}