summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-06 15:08:57 -0700
committerNico Weber <thakis@chromium.org>2015-08-06 15:08:57 -0700
commit077f1a335560a8014e466c768c1e9d24c8a61ac9 (patch)
tree8d080d5e2fbef32e5d945129eb19ff9909b192f5 /core/src/fpdfapi
parent792d55cfe3cf046125fd69d8914ae459216a68ab (diff)
downloadpdfium-077f1a335560a8014e466c768c1e9d24c8a61ac9.tar.xz
XFA: clang-format all pdfium code, again.
Also add a presubmit that checks for this so I don't have to keep doing it. No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \ xargs ../../buildtools/mac/clang-format -i Then manually merged https://codereview.chromium.org/1269223002/ See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none R=thestig@chromium.org Review URL: https://codereview.chromium.org/1277043002 .
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 55fba8df98..f057ce7d90 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -2443,7 +2443,7 @@ unsigned int CPDF_SyntaxParser::ReadEOLMarkers(FX_FILESIZE pos) {
unsigned char byte1 = 0;
unsigned char byte2 = 0;
GetCharAt(pos, byte1);
- GetCharAt(pos+1, byte2);
+ GetCharAt(pos + 1, byte2);
unsigned int markers = 0;
if (byte1 == '\r' && byte2 == '\n') {
markers = 2;
@@ -2463,7 +2463,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
((CPDF_Reference*)pLenObj)->GetRefObjNum() != objnum))) {
len = pLenObj->GetInteger();
}
- //Check whether end of line markers follow the keyword 'stream'.
+ // Check whether end of line markers follow the keyword 'stream'.
unsigned int numMarkers = ReadEOLMarkers(m_Pos);
m_Pos += numMarkers;
FX_FILESIZE streamStartPos = m_Pos;
@@ -2472,7 +2472,8 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
}
const unsigned int ENDSTREAM_LEN = sizeof("endstream") - 1;
const unsigned int ENDOBJ_LEN = sizeof("endobj") - 1;
- CPDF_CryptoHandler* pCryptoHandler = objnum == (FX_DWORD)m_MetadataObjnum ? nullptr : m_pCryptoHandler;
+ CPDF_CryptoHandler* pCryptoHandler =
+ objnum == (FX_DWORD)m_MetadataObjnum ? nullptr : m_pCryptoHandler;
if (!pCryptoHandler) {
FX_BOOL bSearchForKeyword = TRUE;
unsigned int prevMarkers = 0;
@@ -2492,27 +2493,28 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
}
}
if (bSearchForKeyword) {
- //If len is not available, len needs to be calculated
- //by searching the keywords "endstream" or "endobj".
+ // If len is not available, len needs to be calculated
+ // by searching the keywords "endstream" or "endobj".
m_Pos = streamStartPos;
FX_FILESIZE endStreamOffset = 0;
while (endStreamOffset >= 0) {
endStreamOffset = FindTag(FX_BSTRC("endstream"), 0);
if (endStreamOffset < 0) {
- //Can't find any "endstream".
+ // Can't find any "endstream".
break;
}
prevMarkers = ReadEOLMarkers(streamStartPos + endStreamOffset - 1);
- nextMarkers = ReadEOLMarkers(streamStartPos + endStreamOffset + ENDSTREAM_LEN);
+ nextMarkers =
+ ReadEOLMarkers(streamStartPos + endStreamOffset + ENDSTREAM_LEN);
if (prevMarkers != 0 && nextMarkers != 0) {
- //Stop searching when the keyword "endstream" is found.
+ // Stop searching when the keyword "endstream" is found.
break;
} else {
unsigned char ch = 0x00;
GetCharAt(streamStartPos + endStreamOffset + ENDSTREAM_LEN, ch);
if (ch == 0x09 || ch == 0x20) {
//"endstream" is treated as a keyword
- //when it is followed by a tab or whitespace
+ // when it is followed by a tab or whitespace
break;
}
}
@@ -2523,26 +2525,27 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
while (endObjOffset >= 0) {
endObjOffset = FindTag(FX_BSTRC("endobj"), 0);
if (endObjOffset < 0) {
- //Can't find any "endobj".
+ // Can't find any "endobj".
break;
}
prevMarkers = ReadEOLMarkers(streamStartPos + endObjOffset - 1);
- nextMarkers = ReadEOLMarkers(streamStartPos + endObjOffset + ENDOBJ_LEN);
+ nextMarkers =
+ ReadEOLMarkers(streamStartPos + endObjOffset + ENDOBJ_LEN);
if (prevMarkers != 0 && nextMarkers != 0) {
- //Stop searching when the keyword "endobj" is found.
+ // Stop searching when the keyword "endobj" is found.
break;
}
m_Pos += ENDOBJ_LEN;
}
if (endStreamOffset < 0 && endObjOffset < 0) {
- //Can't find "endstream" or "endobj".
+ // Can't find "endstream" or "endobj".
return nullptr;
}
if (endStreamOffset < 0 && endObjOffset >= 0) {
- //Correct the position of end stream.
+ // Correct the position of end stream.
endStreamOffset = endObjOffset;
} else if (endStreamOffset >= 0 && endObjOffset < 0) {
- //Correct the position of end obj.
+ // Correct the position of end obj.
endObjOffset = endStreamOffset;
} else if (endStreamOffset > endObjOffset) {
endStreamOffset = endObjOffset;
@@ -2587,8 +2590,8 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
streamStartPos = m_Pos;
GetNextWord();
numMarkers = ReadEOLMarkers(m_Pos);
- if (m_WordSize == ENDOBJ_LEN && numMarkers != 0 &&
- FXSYS_memcmp(m_WordBuffer, "endobj", ENDOBJ_LEN) == 0) {
+ if (m_WordSize == ENDOBJ_LEN && numMarkers != 0 &&
+ FXSYS_memcmp(m_WordBuffer, "endobj", ENDOBJ_LEN) == 0) {
m_Pos = streamStartPos;
}
return pStream;