From 8a884a481d9f31dbb2d21972b52639b33626b4de Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 2 Nov 2017 18:30:30 +0000 Subject: CMemFile's buffer should be const uint8_t* const. Change-Id: I1c34886a9e33fb16ef121c0aa0b16c139517a940 Reviewed-on: https://pdfium-review.googlesource.com/17392 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- fpdfsdk/fpdfview.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index c86a0123a1..dc2cfef126 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -608,7 +608,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_LoadXFA(FPDF_DOCUMENT document) { class CMemFile final : public IFX_SeekableReadStream { public: - static RetainPtr Create(uint8_t* pBuf, FX_FILESIZE size) { + static RetainPtr Create(const uint8_t* pBuf, FX_FILESIZE size) { return RetainPtr(new CMemFile(pBuf, size)); } @@ -627,15 +627,17 @@ class CMemFile final : public IFX_SeekableReadStream { } private: - CMemFile(uint8_t* pBuf, FX_FILESIZE size) : m_pBuf(pBuf), m_size(size) {} + CMemFile(const uint8_t* pBuf, FX_FILESIZE size) + : m_pBuf(pBuf), m_size(size) {} - uint8_t* const m_pBuf; + const uint8_t* const m_pBuf; const FX_FILESIZE m_size; }; FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_LoadMemDocument(const void* data_buf, int size, FPDF_BYTESTRING password) { - return LoadDocumentImpl(CMemFile::Create((uint8_t*)data_buf, size), password); + return LoadDocumentImpl( + CMemFile::Create(static_cast(data_buf), size), password); } FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV @@ -815,7 +817,7 @@ RetainPtr GetMaskBitmap(CPDF_Page* pPage, int size_x, int size_y, int rotate, - RetainPtr& pSrc, + const RetainPtr& pSrc, const CFX_FloatRect& mask_box, FX_RECT* bitmap_area) { ASSERT(bitmap_area); @@ -1184,7 +1186,8 @@ FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_CreateEx(int width, return nullptr; } auto pBitmap = pdfium::MakeRetain(); - pBitmap->Create(width, height, fx_format, (uint8_t*)first_scan, stride); + pBitmap->Create(width, height, fx_format, static_cast(first_scan), + stride); return pBitmap.Leak(); } -- cgit v1.2.3