Get rid of CCodec_ModuleMgr::GetBasicModule().
The CCodec_BasicModule class consists of a set of methods that can all
be static. Make the methods static, and make sure CCodec_BasicModule
cannot be instantiated. Then CCodec_ModuleMgr::GetBasicModule() becomes
pointless and all the callers can just call CCodec_BasicModule directly.
While making the above changes, move the CCodec_BasicModule code into
its own separate file.
Change-Id: I11981544f304dbd98ec8cc9e94506209758a338e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55030
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcodec/codec/ccodec_basicmodule.h b/core/fxcodec/codec/ccodec_basicmodule.h
index 72dd016..8f55901 100644
--- a/core/fxcodec/codec/ccodec_basicmodule.h
+++ b/core/fxcodec/codec/ccodec_basicmodule.h
@@ -17,20 +17,24 @@
class CCodec_BasicModule {
public:
- std::unique_ptr<CCodec_ScanlineDecoder> CreateRunLengthDecoder(
+ static std::unique_ptr<CCodec_ScanlineDecoder> CreateRunLengthDecoder(
pdfium::span<const uint8_t> src_buf,
int width,
int height,
int nComps,
int bpc);
- bool RunLengthEncode(pdfium::span<const uint8_t> src_buf,
- std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,
- uint32_t* dest_size);
+ static bool RunLengthEncode(pdfium::span<const uint8_t> src_buf,
+ std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,
+ uint32_t* dest_size);
- bool A85Encode(pdfium::span<const uint8_t> src_buf,
- std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,
- uint32_t* dest_size);
+ static bool A85Encode(pdfium::span<const uint8_t> src_buf,
+ std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,
+ uint32_t* dest_size);
+
+ CCodec_BasicModule() = delete;
+ CCodec_BasicModule(const CCodec_BasicModule&) = delete;
+ CCodec_BasicModule& operator=(const CCodec_BasicModule&) = delete;
};
#endif // CORE_FXCODEC_CODEC_CCODEC_BASICMODULE_H_