Remove unused parameter from CFX_GifContext.
Change-Id: I06092d8b89a9fd440e84bec56fd914310ba434ec
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/69950
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcodec/gif/cfx_gifcontext.cpp b/core/fxcodec/gif/cfx_gifcontext.cpp
index 267098a..c0eb988 100644
--- a/core/fxcodec/gif/cfx_gifcontext.cpp
+++ b/core/fxcodec/gif/cfx_gifcontext.cpp
@@ -10,8 +10,6 @@
#include <utility>
#include "core/fxcodec/cfx_codec_memory.h"
-#include "core/fxcodec/gif/cfx_gif.h"
-#include "core/fxcodec/gif/gifmodule.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
@@ -23,9 +21,8 @@
} // namespace
-CFX_GifContext::CFX_GifContext(GifModule* gif_module,
- GifModule::Delegate* delegate)
- : gif_module_(gif_module), delegate_(delegate) {}
+CFX_GifContext::CFX_GifContext(GifModule::Delegate* delegate)
+ : delegate_(delegate) {}
CFX_GifContext::~CFX_GifContext() = default;
diff --git a/core/fxcodec/gif/cfx_gifcontext.h b/core/fxcodec/gif/cfx_gifcontext.h
index e4630ca..edc3594 100644
--- a/core/fxcodec/gif/cfx_gifcontext.h
+++ b/core/fxcodec/gif/cfx_gifcontext.h
@@ -21,7 +21,7 @@
class CFX_GifContext : public ProgressiveDecoderIface::Context {
public:
- CFX_GifContext(GifModule* gif_module, GifModule::Delegate* delegate);
+ explicit CFX_GifContext(GifModule::Delegate* delegate);
~CFX_GifContext() override;
void RecordCurrentPosition(uint32_t* cur_pos);
@@ -45,7 +45,6 @@
uint32_t GetAvailInput() const;
size_t GetFrameNum() const { return images_.size(); }
- UnownedPtr<GifModule> const gif_module_;
UnownedPtr<GifModule::Delegate> const delegate_;
std::vector<CFX_GifPalette> global_palette_;
uint8_t global_pal_exp_ = 0;
diff --git a/core/fxcodec/gif/cfx_gifcontext_unittest.cpp b/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
index 818e8b9..6ad6784 100644
--- a/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
+++ b/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
@@ -13,9 +13,8 @@
class CFX_GifContextForTest final : public CFX_GifContext {
public:
- CFX_GifContextForTest(GifModule* gif_module, GifModule::Delegate* delegate)
- : CFX_GifContext(gif_module, delegate) {}
- ~CFX_GifContextForTest() override {}
+ CFX_GifContextForTest() : CFX_GifContext(nullptr) {}
+ ~CFX_GifContextForTest() override = default;
using CFX_GifContext::ReadAllOrNone;
using CFX_GifContext::ReadGifSignature;
@@ -31,7 +30,7 @@
TEST(CFX_GifContext, SetInputBuffer) {
uint8_t buffer[] = {0x00, 0x01, 0x02};
- CFX_GifContextForTest context(nullptr, nullptr);
+ CFX_GifContextForTest context;
context.SetTestInputBuffer({nullptr, 0});
EXPECT_EQ(0u, context.InputBuffer()->GetSize());
@@ -50,7 +49,7 @@
std::vector<uint8_t, FxAllocAllocator<uint8_t>> dest_buffer;
uint8_t src_buffer[] = {0x00, 0x01, 0x02, 0x03, 0x04,
0x05, 0x06, 0x07, 0x08, 0x09};
- CFX_GifContextForTest context(nullptr, nullptr);
+ CFX_GifContextForTest context;
context.SetTestInputBuffer({nullptr, 0});
EXPECT_FALSE(context.ReadAllOrNone(nullptr, 0));
@@ -85,7 +84,7 @@
}
TEST(CFX_GifContext, ReadGifSignature) {
- CFX_GifContextForTest context(nullptr, nullptr);
+ CFX_GifContextForTest context;
{
uint8_t data[1];
context.SetTestInputBuffer({data, 0});
@@ -143,7 +142,7 @@
}
TEST(CFX_GifContext, ReadLocalScreenDescriptor) {
- CFX_GifContextForTest context(nullptr, nullptr);
+ CFX_GifContextForTest context;
{
uint8_t data[1];
context.SetTestInputBuffer({data, 0});
@@ -222,7 +221,7 @@
}
TEST(CFX_GifContext, ReadHeader) {
- CFX_GifContextForTest context(nullptr, nullptr);
+ CFX_GifContextForTest context;
// Bad signature
{
struct {
diff --git a/core/fxcodec/gif/gifmodule.cpp b/core/fxcodec/gif/gifmodule.cpp
index c0f09ee..81fe3a591 100644
--- a/core/fxcodec/gif/gifmodule.cpp
+++ b/core/fxcodec/gif/gifmodule.cpp
@@ -21,7 +21,7 @@
std::unique_ptr<ProgressiveDecoderIface::Context> GifModule::Start(
Delegate* pDelegate) {
- return pdfium::MakeUnique<CFX_GifContext>(this, pDelegate);
+ return pdfium::MakeUnique<CFX_GifContext>(pDelegate);
}
CFX_GifDecodeStatus GifModule::ReadHeader(Context* pContext,