From 077f1a335560a8014e466c768c1e9d24c8a61ac9 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 6 Aug 2015 15:08:57 -0700 Subject: 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 . --- core/include/fpdfapi/fpdf_objects.h | 8 ++--- .../src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 37 ++++++++++++---------- core/src/fpdfdoc/doc_vt.cpp | 2 +- core/src/fxcrt/extension.h | 21 +++--------- core/src/fxge/agg/src/fx_agg_driver.cpp | 10 +++--- core/src/fxge/dib/fx_dib_engine.cpp | 2 +- core/src/fxge/ge/text_int.h | 6 ++-- core/src/fxge/skia/fx_skia_device.cpp | 6 ++-- 8 files changed, 41 insertions(+), 51 deletions(-) (limited to 'core') diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index d1615b5a31..58fb37c226 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -101,9 +101,7 @@ class CPDF_Object { }; class CPDF_Boolean : public CPDF_Object { public: - static CPDF_Boolean* Create(FX_BOOL value) { - return new CPDF_Boolean(value); - } + static CPDF_Boolean* Create(FX_BOOL value) { return new CPDF_Boolean(value); } CPDF_Boolean() : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(false) {} CPDF_Boolean(FX_BOOL value) : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(value) {} @@ -120,9 +118,7 @@ class CPDF_Number : public CPDF_Object { public: static CPDF_Number* Create(int value) { return new CPDF_Number(value); } - static CPDF_Number* Create(FX_FLOAT value) { - return new CPDF_Number(value); - } + static CPDF_Number* Create(FX_FLOAT value) { return new CPDF_Number(value); } static CPDF_Number* Create(const CFX_ByteStringC& str) { return new CPDF_Number(str); 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; diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp index 77afab81b9..3970523eaf 100644 --- a/core/src/fpdfdoc/doc_vt.cpp +++ b/core/src/fpdfdoc/doc_vt.cpp @@ -817,7 +817,7 @@ void CPDF_VariableText::Initialize() { if (m_bRichText) { secinfo.pSecProps = new CPVT_SecProps(0.0f, 0.0f, 0); secinfo.pWordProps = new CPVT_WordProps(GetDefaultFontIndex(), - PVT_DEFAULT_FONTSIZE, 0, 0, 0); + PVT_DEFAULT_FONTSIZE, 0, 0, 0); } CPVT_WordPlace place; place.nSecIndex = 0; diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index 45355ab4a0..0fdf8ab7bf 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -62,10 +62,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess { }; 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(); @@ -81,13 +78,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 { @@ -150,13 +143,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/agg/src/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp index 993f50afad..2a4d199343 100644 --- a/core/src/fxge/agg/src/fx_agg_driver.cpp +++ b/core/src/fxge/agg/src/fx_agg_driver.cpp @@ -187,7 +187,7 @@ IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver( CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) { return new CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice, - bGroupKnockout); + bGroupKnockout); } CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, @@ -323,7 +323,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill( m_FillFlags = fill_mode; if (m_pClipRgn == NULL) { m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), - GetDeviceCaps(FXDC_PIXEL_HEIGHT)); + GetDeviceCaps(FXDC_PIXEL_HEIGHT)); if (!m_pClipRgn) { return FALSE; } @@ -358,7 +358,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke( const CFX_GraphStateData* pGraphState) { if (m_pClipRgn == NULL) { m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), - GetDeviceCaps(FXDC_PIXEL_HEIGHT)); + GetDeviceCaps(FXDC_PIXEL_HEIGHT)); if (!m_pClipRgn) { return FALSE; } @@ -1800,8 +1800,8 @@ FX_BOOL CFX_FxgeDevice::Create(int width, return FALSE; } SetBitmap(pBitmap); - IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver( - pBitmap, dither_bits, FALSE, pOriDevice, FALSE); + IFX_RenderDeviceDriver* pDriver = + new CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); if (!pDriver) { return FALSE; } diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index 86d495f28e..ce95a6e9ad 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -852,7 +852,7 @@ FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) { FX_BOOL CFX_ImageStretcher::StartStretch() { m_pStretchEngine = new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, - m_ClipRect, m_pSource, m_Flags); + m_ClipRect, m_pSource, m_Flags); if (!m_pStretchEngine) { return FALSE; } diff --git a/core/src/fxge/ge/text_int.h b/core/src/fxge/ge/text_int.h index 3ebd9aef3f..9279969e0a 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), diff --git a/core/src/fxge/skia/fx_skia_device.cpp b/core/src/fxge/skia/fx_skia_device.cpp index a13c21889c..d7f448ebf6 100644 --- a/core/src/fxge/skia/fx_skia_device.cpp +++ b/core/src/fxge/skia/fx_skia_device.cpp @@ -266,7 +266,7 @@ CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) { m_pAggDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, - pOriDevice, bGroupKnockout); + pOriDevice, bGroupKnockout); } CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() { delete m_pAggDriver; @@ -616,8 +616,8 @@ FX_BOOL CFX_SkiaDevice::Create(int width, return FALSE; } SetBitmap(pBitmap); - CFX_SkiaDeviceDriver* pDriver = new CFX_SkiaDeviceDriver( - pBitmap, dither_bits, FALSE, pOriDevice, FALSE); + CFX_SkiaDeviceDriver* pDriver = + new CFX_SkiaDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); SetDeviceDriver(pDriver); return TRUE; } -- cgit v1.2.3