From 738b08ce6b9f80d93b815411b47c2b11c2f090f6 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 1 Mar 2016 14:45:20 -0500 Subject: Fix and enable lint checks. This CL fixes and enables: * readability/namespace * readability/multiline_string * readability/multiline_comment * readability/inheritance * readability/function * readability/braces R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1747123002 . --- core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 2 +- core/src/fpdfapi/fpdf_font/font_int.h | 2 +- core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 25 +++++++++++----------- core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 5 ++--- core/src/fpdfapi/fpdf_page/pageint.h | 6 +++--- core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp | 10 +++++---- core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp | 21 +++++++++--------- core/src/fpdfapi/fpdf_render/render_int.h | 2 +- 8 files changed, 36 insertions(+), 37 deletions(-) (limited to 'core/src/fpdfapi') diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index bcac9d87d4..bc3de20857 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -472,7 +472,7 @@ static FX_WORD FX_GetCsFromLangCode(uint32_t uCode) { } else { iStart = iMid + 1; } - }; + } return 0; } static FX_WORD FX_GetCharsetFromLang(const FX_CHAR* pLang, int32_t iLength) { diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h index 1d1f006115..dc28010de3 100644 --- a/core/src/fpdfapi/fpdf_font/font_int.h +++ b/core/src/fpdfapi/fpdf_font/font_int.h @@ -89,7 +89,7 @@ class CPDF_CMapParser { public: CPDF_CMapParser(); ~CPDF_CMapParser() {} - FX_BOOL Initialize(CPDF_CMap*); + FX_BOOL Initialize(CPDF_CMap* pMap); void ParseWord(const CFX_ByteStringC& str); CFX_BinaryBuf m_AddMaps; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index 411f77254b..a9deba665c 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -966,22 +966,21 @@ FX_BOOL CPDF_Type1Font::Load() { m_Base14Font = PDF_GetStandardFontName(&m_BaseFont); if (m_Base14Font >= 0) { CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); - if (pFontDesc && pFontDesc->KeyExist("Flags")) { + if (pFontDesc && pFontDesc->KeyExist("Flags")) m_Flags = pFontDesc->GetIntegerBy("Flags"); - } else { + else m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC; - } - if (m_Base14Font < 4) - for (int i = 0; i < 256; i++) { + + if (m_Base14Font < 4) { + for (int i = 0; i < 256; i++) m_CharWidth[i] = 600; - } - if (m_Base14Font == 12) { + } + if (m_Base14Font == 12) m_BaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL; - } else if (m_Base14Font == 13) { + else if (m_Base14Font == 13) m_BaseEncoding = PDFFONT_ENCODING_ZAPFDINGBATS; - } else if (m_Flags & PDFFONT_NONSYMBOLIC) { + else if (m_Flags & PDFFONT_NONSYMBOLIC) m_BaseEncoding = PDFFONT_ENCODING_STANDARD; - } } return LoadCommon(); } @@ -1302,10 +1301,10 @@ CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) { const FX_WORD* pSrc = PDF_UnicodesForPredefinedCharSet(PredefinedEncoding); if (!pSrc) { FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); - } else - for (int i = 0; i < 256; i++) { + } else { + for (int i = 0; i < 256; i++) m_Unicodes[i] = pSrc[i]; - } + } } FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const { diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 1a78b1f93c..3cbd67633f 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -1545,12 +1545,11 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { if (m_Charset == CIDSET_JAPAN1) { if (unicode == '\\') { unicode = '/'; - } #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ - else if (unicode == 0xa5) { + } else if (unicode == 0xa5) { unicode = 0x5c; - } #endif + } } if (!face) return unicode; diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index ec06187b6c..e8d155b656 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -138,13 +138,13 @@ class CPDF_StreamContentParser { CPDF_Image* pImage, FX_BOOL bInline); void AddDuplicateImage(); - void AddForm(CPDF_Stream*); + void AddForm(CPDF_Stream* pStream); void SetGraphicStates(CPDF_PageObject* pObj, FX_BOOL bColor, FX_BOOL bText, FX_BOOL bGraph); - void SaveStates(CPDF_AllStates*); - void RestoreStates(CPDF_AllStates*); + void SaveStates(CPDF_AllStates* pState); + void RestoreStates(CPDF_AllStates* pState); CPDF_Font* FindFont(const CFX_ByteString& name); CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name); CPDF_Pattern* FindPattern(const CFX_ByteString& name, FX_BOOL bShading); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 954d3886b5..b91f258371 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -247,12 +247,11 @@ void CPDF_DIBTransferFunc::TranslateScanline(uint8_t* dest_buf, *dest_buf++ = m_RampR[*(src_buf++)]; if (!bSkip) { *dest_buf++ = *src_buf; - } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - else { + } else { dest_buf++; - } #endif + } src_buf++; } break; @@ -284,7 +283,7 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, dest_buf++; src_buf++; } - } else + } else { #endif for (int i = 0; i < pixels; i++) { *dest_buf++ = m_RampB[*(src_buf++)]; @@ -292,6 +291,9 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, *dest_buf++ = m_RampR[*(src_buf++)]; *dest_buf++ = *(src_buf++); } +#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ + } +#endif } } CPDF_ImageRenderer::CPDF_ImageRenderer() { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index 215b104162..42c378666e 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -74,25 +74,24 @@ void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top, top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue); bottom_line = _AdjustBlue(bottom, m_BottomBlueCount, m_BottomBlue); } + static FX_BOOL _IsScanLine1bpp(uint8_t* pBuf, int width) { int size = width / 8; - for (int i = 0; i < size; i++) - if (pBuf[i]) { - return TRUE; - } - if (width % 8) - if (pBuf[width / 8] & (0xff << (8 - width % 8))) { + for (int i = 0; i < size; i++) { + if (pBuf[i]) return TRUE; - } - return FALSE; + } + return (width % 8) && (pBuf[width / 8] & (0xff << (8 - width % 8))); } + static FX_BOOL _IsScanLine8bpp(uint8_t* pBuf, int width) { - for (int i = 0; i < width; i++) - if (pBuf[i] > 0x40) { + for (int i = 0; i < width; i++) { + if (pBuf[i] > 0x40) return TRUE; - } + } return FALSE; } + static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) { int height = pBitmap->GetHeight(), pitch = pBitmap->GetPitch(), width = pBitmap->GetWidth(); diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index b7f007dd5d..d691f7dc52 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -498,7 +498,7 @@ class CPDF_DIBSource : public CFX_DIBSource { void SetDownSampleSize(int dest_width, int dest_height) override; CFX_DIBitmap* GetBitmap() const; - void ReleaseBitmap(CFX_DIBitmap*) const; + void ReleaseBitmap(CFX_DIBitmap* pBitmap) const; void ClearImageData(); FX_DWORD GetMatteColor() const { return m_MatteColor; } -- cgit v1.2.3