Chromium Code Reviews| 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..5f1e9123ccc74eba7819c3e9ab4d799735858ec3 100644 |
| --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp |
| +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp |
| @@ -1143,27 +1143,19 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj( |
| return NULL; |
| } |
| if (m_pResources == m_pPageResources) { |
| - CPDF_Dictionary* pList = m_pResources->GetDictBy(type); |
| - if (!pList) { |
| - return NULL; |
| - } |
| - CPDF_Object* pRes = pList->GetDirectObjectBy(name); |
| + CPDF_Dictionary* pDict = m_pResources->GetDictBy(type); |
| + if (!pDict) |
|
Tom Sepez
2016/06/01 22:23:04
nit: ? operator might be cleaner.
Wei Li
2016/06/01 23:40:12
See below
|
| + return nullptr; |
| + CPDF_Object* pRes = pDict->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 (CPDF_Dictionary* pDict = m_pResources->GetDictBy(type)) |
|
Tom Sepez
2016/06/01 22:23:04
either way, we're going to get m_pResources->GetDi
Wei Li
2016/06/01 23:40:12
Thanks for suggesting this, now it looks much clea
|
| + return pDict->GetDirectObjectBy(name); |
| + |
| + if (!m_pPageResources) |
| + return nullptr; |
| + CPDF_Dictionary* pDict = m_pPageResources->GetDictBy(type); |
|
Tom Sepez
2016/06/01 22:23:04
Then we can call this pPageDict and avoid collisio
Wei Li
2016/06/01 23:40:12
Done.
|
| + return pDict ? pDict->GetDirectObjectBy(name) : nullptr; |
| } |
| CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) { |