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

Unified Diff: core/fpdfapi/fpdf_page/fpdf_page_parser.cpp

Issue 2027273002: Fix all the code which has duplicate variable declarations (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 7 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_font/cpdf_cidfont.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 52576043e39daf982f43c43f1d45b026feeef7ea..4bd4a4d5290ab98897ad540c49fe0217d5a7dde6 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -1139,31 +1139,16 @@ void CPDF_StreamContentParser::Handle_SetFont() {
CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
const CFX_ByteString& type,
const CFX_ByteString& name) {
- if (!m_pResources) {
- return NULL;
- }
- if (m_pResources == m_pPageResources) {
- CPDF_Dictionary* pList = m_pResources->GetDictBy(type);
- if (!pList) {
- return NULL;
- }
- CPDF_Object* pRes = pList->GetDirectObjectBy(name);
- return pRes;
- }
- CPDF_Dictionary* pList = m_pResources->GetDictBy(type);
- if (!pList) {
- if (!m_pPageResources) {
- return NULL;
- }
- CPDF_Dictionary* pList = m_pPageResources->GetDictBy(type);
- if (!pList) {
- return NULL;
- }
- CPDF_Object* pRes = pList->GetDirectObjectBy(name);
- return pRes;
- }
- CPDF_Object* pRes = pList->GetDirectObjectBy(name);
- return pRes;
+ if (!m_pResources)
+ return nullptr;
+ CPDF_Dictionary* pDict = m_pResources->GetDictBy(type);
+ if (pDict)
+ return pDict->GetDirectObjectBy(name);
+ if (m_pResources == m_pPageResources || !m_pPageResources)
+ return nullptr;
+
+ CPDF_Dictionary* pPageDict = m_pPageResources->GetDictBy(type);
+ return pPageDict ? pPageDict->GetDirectObjectBy(name) : nullptr;
}
CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
« no previous file with comments | « core/fpdfapi/fpdf_font/cpdf_cidfont.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698