Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp

Issue 1420583003: Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/include/fpdfdoc/fpdf_doc.h ('k') | core/src/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 4e6c72355d168dd5a5cdef928c2a1fe6237934ff..054cf10c22d42a0f1e04a20c6f95c8cb06764605 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -110,7 +110,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
return -1;
}
offset += 2;
- CPDF_Dictionary* p = (CPDF_Dictionary*)pObj;
+ const CPDF_Dictionary* p = pObj->AsDictionary();
FX_POSITION pos = p->GetStartPos();
while (pos) {
CFX_ByteString key;
@@ -334,7 +334,8 @@ CPDF_FlateEncoder::CPDF_FlateEncoder() {
}
void CPDF_FlateEncoder::CloneDict() {
if (!m_bCloned) {
- m_pDict = (CPDF_Dictionary*)m_pDict->Clone();
+ m_pDict = ToDictionary(m_pDict->Clone());
+ ASSERT(m_pDict);
m_bCloned = TRUE;
}
}
@@ -349,7 +350,7 @@ FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream,
destAcc.LoadAllData(pStream);
m_dwSize = destAcc.GetSize();
m_pData = (uint8_t*)destAcc.DetachData();
- m_pDict = (CPDF_Dictionary*)pStream->GetDict()->Clone();
+ m_pDict = ToDictionary(pStream->GetDict()->Clone());
m_pDict->RemoveAt(FX_BSTRC("Filter"));
m_bNewData = TRUE;
m_bCloned = TRUE;
@@ -365,7 +366,7 @@ FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream,
m_bNewData = TRUE;
m_bCloned = TRUE;
::FlateEncode(m_Acc.GetData(), m_Acc.GetSize(), m_pData, m_dwSize);
- m_pDict = (CPDF_Dictionary*)pStream->GetDict()->Clone();
+ m_pDict = ToDictionary(pStream->GetDict()->Clone());
m_pDict->SetAtInteger("Length", m_dwSize);
m_pDict->SetAtName("Filter", "FlateDecode");
m_pDict->RemoveAt("DecodeParms");
@@ -1227,7 +1228,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
return -1;
}
m_Offset += 2;
- CPDF_Dictionary* p = (CPDF_Dictionary*)pObj;
+ const CPDF_Dictionary* p = pObj->AsDictionary();
FX_BOOL bSignDict = IsSignatureDict(p);
FX_POSITION pos = p->GetStartPos();
while (pos) {
« no previous file with comments | « core/include/fpdfdoc/fpdf_doc.h ('k') | core/src/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698