summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-06 14:38:03 -0700
committerNico Weber <thakis@chromium.org>2015-08-06 14:38:03 -0700
commit4684c83a4e9114a63c64744064dd190e4d459c6f (patch)
treee34d3d36735db7d1692d1da95aa732f3241d9906 /core
parent905cc10ecd06bcacfefb747cc3370c72772f0e15 (diff)
downloadpdfium-4684c83a4e9114a63c64744064dd190e4d459c6f.tar.xz
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' | \ xargs ../../buildtools/mac/clang-format -i BUG=none R=thestig@chromium.org Review URL: https://codereview.chromium.org/1272653005 .
Diffstat (limited to 'core')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp37
-rw-r--r--core/src/fxcrt/extension.h21
-rw-r--r--core/src/fxge/ge/text_int.h6
3 files changed, 29 insertions, 35 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index f14d7d5c37..23efb52596 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -2434,7 +2434,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;
@@ -2454,7 +2454,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;
@@ -2463,7 +2463,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;
@@ -2483,27 +2484,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;
}
}
@@ -2514,26 +2516,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;
@@ -2578,8 +2581,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;
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index 1750c5aae9..7d14cb0b9a 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -32,10 +32,7 @@ class IFXCRT_FileAccess {
IFXCRT_FileAccess* FXCRT_FileAccess_Create();
class CFX_CRTFileStream final : public IFX_FileStream {
public:
- CFX_CRTFileStream(IFXCRT_FileAccess* pFA)
- : m_pFile(pFA),
- m_dwCount(1) {
- }
+ CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1) {}
~CFX_CRTFileStream() {
if (m_pFile) {
m_pFile->Release();
@@ -51,13 +48,9 @@ class CFX_CRTFileStream final : public IFX_FileStream {
delete this;
}
}
- virtual FX_FILESIZE GetSize() override {
- return m_pFile->GetSize();
- }
+ virtual FX_FILESIZE GetSize() override { return m_pFile->GetSize(); }
virtual FX_BOOL IsEOF() override { return GetPosition() >= GetSize(); }
- virtual FX_FILESIZE GetPosition() override {
- return m_pFile->GetPosition();
- }
+ virtual FX_FILESIZE GetPosition() override { return m_pFile->GetPosition(); }
virtual FX_BOOL ReadBlock(void* buffer,
FX_FILESIZE offset,
size_t size) override {
@@ -120,13 +113,9 @@ class CFX_MemoryStream final : public IFX_MemoryStream {
}
delete this;
}
- virtual FX_FILESIZE GetSize() override {
- return (FX_FILESIZE)m_nCurSize;
- }
+ virtual FX_FILESIZE GetSize() override { return (FX_FILESIZE)m_nCurSize; }
virtual FX_BOOL IsEOF() override { return m_nCurPos >= (size_t)GetSize(); }
- virtual FX_FILESIZE GetPosition() override {
- return (FX_FILESIZE)m_nCurPos;
- }
+ virtual FX_FILESIZE GetPosition() override { return (FX_FILESIZE)m_nCurPos; }
virtual FX_BOOL ReadBlock(void* buffer,
FX_FILESIZE offset,
size_t size) override {
diff --git a/core/src/fxge/ge/text_int.h b/core/src/fxge/ge/text_int.h
index efa134d5de..e9f81b3ca7 100644
--- a/core/src/fxge/ge/text_int.h
+++ b/core/src/fxge/ge/text_int.h
@@ -67,8 +67,10 @@ class CFX_UnicodeEncoding : public IFX_FontEncoding {
class CFX_FontFaceInfo {
public:
- CFX_FontFaceInfo(CFX_ByteString filePath, CFX_ByteString faceName,
- CFX_ByteString fontTables, FX_DWORD fontOffset,
+ CFX_FontFaceInfo(CFX_ByteString filePath,
+ CFX_ByteString faceName,
+ CFX_ByteString fontTables,
+ FX_DWORD fontOffset,
FX_DWORD fileSize)
: m_FilePath(filePath),
m_FaceName(faceName),