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

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

Issue 2334323005: Rename dictionary set and get methods (Closed)
Patch Set: Created 4 years, 3 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/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp ('k') | core/fpdfapi/fpdf_font/cpdf_cidfont.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 7ece85a602c1a5028d578cbe082adf56138bb523..cab99ecf7f5bdefc2e7f502a7b58a098a47cc833 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -426,7 +426,7 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(CPDF_Stream* pStream, FX_BOOL bFlateEncode)
m_dwSize = destAcc.GetSize();
m_pData = (uint8_t*)destAcc.DetachData();
m_pDict = ToDictionary(pStream->GetDict()->Clone());
- m_pDict->RemoveAt("Filter");
+ m_pDict->RemoveFor("Filter");
m_bNewData = TRUE;
m_bCloned = TRUE;
} else {
@@ -442,9 +442,9 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(CPDF_Stream* pStream, FX_BOOL bFlateEncode)
// TODO(thestig): Move to Init() and check return value.
::FlateEncode(m_Acc.GetData(), m_Acc.GetSize(), &m_pData, &m_dwSize);
m_pDict = ToDictionary(pStream->GetDict()->Clone());
- m_pDict->SetAtInteger("Length", m_dwSize);
- m_pDict->SetAtName("Filter", "FlateDecode");
- m_pDict->RemoveAt("DecodeParms");
+ m_pDict->SetIntegerFor("Length", m_dwSize);
+ m_pDict->SetNameFor("Filter", "FlateDecode");
+ m_pDict->RemoveFor("DecodeParms");
}
CPDF_FlateEncoder::CPDF_FlateEncoder(const uint8_t* pBuffer,
@@ -923,7 +923,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
if (pObj->IsStream()) {
- if (pDict && pDict->GetStringBy("Type") == "XRef")
+ if (pDict && pDict->GetStringFor("Type") == "XRef")
return 0;
return 1;
}
@@ -933,7 +933,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) {
return 1;
if (pDict->IsSignatureDict())
return 1;
- if (pDict->GetStringBy("Type") == "Page")
+ if (pDict->GetStringFor("Type") == "Page")
return 1;
}
@@ -993,9 +993,10 @@ int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream,
CPDF_FlateEncoder encoder(const_cast<CPDF_Stream*>(pStream->AsStream()),
pStream != m_pMetadata);
CPDF_Encryptor encryptor(pCrypto, objnum, encoder.m_pData, encoder.m_dwSize);
- if ((uint32_t)encoder.m_pDict->GetIntegerBy("Length") != encryptor.m_dwSize) {
+ if ((uint32_t)encoder.m_pDict->GetIntegerFor("Length") !=
+ encryptor.m_dwSize) {
encoder.CloneDict();
- encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize);
+ encoder.m_pDict->SetIntegerFor("Length", encryptor.m_dwSize);
}
if (WriteDirectObj(objnum, encoder.m_pDict) < 0) {
return -1;
@@ -1105,10 +1106,10 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
TRUE);
CPDF_Encryptor encryptor(m_pCryptoHandler, objnum, encoder.m_pData,
encoder.m_dwSize);
- if ((uint32_t)encoder.m_pDict->GetIntegerBy("Length") !=
+ if ((uint32_t)encoder.m_pDict->GetIntegerFor("Length") !=
encryptor.m_dwSize) {
encoder.CloneDict();
- encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize);
+ encoder.m_pDict->SetIntegerFor("Length", encryptor.m_dwSize);
}
if (WriteDirectObj(objnum, encoder.m_pDict) < 0) {
return -1;
@@ -1446,7 +1447,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
m_dwFlags &= ~FPDFCREATE_INCREMENTAL;
}
CPDF_Dictionary* pDict = m_pDocument->GetRoot();
- m_pMetadata = pDict ? pDict->GetDirectObjectBy("Metadata") : nullptr;
+ m_pMetadata = pDict ? pDict->GetDirectObjectFor("Metadata") : nullptr;
if (m_dwFlags & FPDFCREATE_OBJECTSTREAM) {
m_pXRefStream.reset(new CPDF_XRefStream);
m_pXRefStream->Start();
@@ -1959,7 +1960,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) {
}
m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone());
if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) {
- if (m_pEncryptDict->GetStringBy("Filter") == "Standard") {
+ if (m_pEncryptDict->GetStringFor("Filter") == "Standard") {
CFX_ByteString user_pass = m_pParser->GetPassword();
uint32_t flag = PDF_ENCRYPT_CONTENT;
« no previous file with comments | « core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp ('k') | core/fpdfapi/fpdf_font/cpdf_cidfont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698