diff options
author | weili <weili@chromium.org> | 2016-06-02 15:48:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-02 15:48:16 -0700 |
commit | db444d2063df6c574882d9263e885c4fe1134133 (patch) | |
tree | 27ce4a3f181ae0b5ad4eff6893016e7d49dfce0a /core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp | |
parent | ad700c2c1fc3c3843dae71e5982f462e42efc987 (diff) | |
download | pdfium-db444d2063df6c574882d9263e885c4fe1134133.tar.xz |
Fix all the code which has duplicate variable declarations
When there are duplicate variable declarations, the inner names shadow the
outter ones. This is error prone and harder to read. Remove all the
instances found by /analyze.
BUG=chromium:613623, chromium:427616
Review-Url: https://codereview.chromium.org/2027273002
Diffstat (limited to 'core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp')
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp index 13a9972425..0eeb4a1afa 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp @@ -381,7 +381,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList, if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) return nullptr; - FX_FILESIZE SavedPos = m_Pos; + FX_FILESIZE SavedObjPos = m_Pos; bool bIsNumber; CFX_ByteString word = GetNextWord(&bIsNumber); if (word.GetLength() == 0) @@ -392,10 +392,8 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList, CFX_ByteString nextword = GetNextWord(&bIsNumber); if (bIsNumber) { CFX_ByteString nextword2 = GetNextWord(nullptr); - if (nextword2 == "R") { - uint32_t objnum = FXSYS_atoui(word.c_str()); - return new CPDF_Reference(pObjList, objnum); - } + if (nextword2 == "R") + return new CPDF_Reference(pObjList, FXSYS_atoui(word.c_str())); } m_Pos = SavedPos; return new CPDF_Number(word.AsStringC()); @@ -492,7 +490,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList, } if (word == ">>") - m_Pos = SavedPos; + m_Pos = SavedObjPos; return nullptr; } @@ -505,7 +503,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) return nullptr; - FX_FILESIZE SavedPos = m_Pos; + FX_FILESIZE SavedObjPos = m_Pos; bool bIsNumber; CFX_ByteString word = GetNextWord(&bIsNumber); if (word.GetLength() == 0) @@ -605,7 +603,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( } if (word == ">>") - m_Pos = SavedPos; + m_Pos = SavedObjPos; return nullptr; } |