diff options
author | Lei Zhang <thestig@chromium.org> | 2017-12-01 22:52:42 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-01 22:52:42 +0000 |
commit | b8d86800487df4021860f08407c323ed82243c79 (patch) | |
tree | ac91e7e9405cf47594316623b26a0aadd9544e79 /core/fpdfapi | |
parent | dca380ffe0571be4023b11b06b8aecad9934bb06 (diff) | |
download | pdfium-b8d86800487df4021860f08407c323ed82243c79.tar.xz |
Get rid of else after break/continue/return.chromium/3284chromium/3283
Change-Id: I3efc57cd7325d16e3ca8ebdeeaec06012b2c56e3
Reviewed-on: https://pdfium-review.googlesource.com/20110
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/edit/cpdf_creator.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_streamparser.cpp | 12 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_syntax_parser.cpp | 7 | ||||
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_decode.cpp | 4 |
5 files changed, 15 insertions, 16 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp index db5bd681d4..e31da13a4d 100644 --- a/core/fpdfapi/edit/cpdf_creator.cpp +++ b/core/fpdfapi/edit/cpdf_creator.cpp @@ -184,10 +184,7 @@ bool CPDF_Creator::WriteStream(const CPDF_Object* pStream, return false; } - if (!m_Archive->WriteString("\r\nendstream")) - return false; - - return true; + return m_Archive->WriteString("\r\nendstream"); } bool CPDF_Creator::WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj) { diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index aa1d227de0..2c7e0256f5 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -499,7 +499,13 @@ ByteString CPDF_StreamParser::ReadString() { status = 2; break; } - if (ch == 'n') { + if (ch == '\r') { + status = 4; + break; + } + if (ch == '\n') { + // Do nothing. + } else if (ch == 'n') { buf << '\n'; } else if (ch == 'r') { buf << '\r'; @@ -509,10 +515,6 @@ ByteString CPDF_StreamParser::ReadString() { buf << '\b'; } else if (ch == 'f') { buf << '\f'; - } else if (ch == '\r') { - status = 4; - break; - } else if (ch == '\n') { } else { buf << static_cast<char>(ch); } diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 5b57b949ba..4e77773a3b 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -394,9 +394,8 @@ bool CPDF_Parser::VerifyCrossRefV4() { // If the object number read doesn't match the one stored, // something is wrong with the cross reference table. return false; - } else { - return true; } + return true; } return true; } diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp index ddf420b34a..66ce1838f2 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp @@ -208,6 +208,10 @@ ByteString CPDF_SyntaxParser::ReadString() { break; } + if (ch == '\r') { + status = ReadStatus::CarriageReturn; + break; + } if (ch == 'n') { buf << '\n'; } else if (ch == 'r') { @@ -218,9 +222,6 @@ ByteString CPDF_SyntaxParser::ReadString() { buf << '\b'; } else if (ch == 'f') { buf << '\f'; - } else if (ch == '\r') { - status = ReadStatus::CarriageReturn; - break; } else if (ch != '\n') { buf << static_cast<char>(ch); } diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index 9532b8242d..3a8660f0a4 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -361,6 +361,8 @@ bool PDF_DataDecode(const uint8_t* src_buf, uint8_t* new_buf = nullptr; uint32_t new_size = 0xFFFFFFFF; int offset = -1; + if (decoder == "Crypt") + continue; if (decoder == "FlateDecode" || decoder == "Fl") { if (bImageAcc && i == nSize - 1) { *ImageEncoding = "FlateDecode"; @@ -387,8 +389,6 @@ bool PDF_DataDecode(const uint8_t* src_buf, return true; } offset = RunLengthDecode(last_buf, last_size, &new_buf, &new_size); - } else if (decoder == "Crypt") { - continue; } else { // If we get here, assume it's an image decoder. if (decoder == "DCT") |