From 3ebd121d45ceb08918a3dcb5b3b7ac29448c862f Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 9 Mar 2016 09:59:23 -0500 Subject: Review and cleanup lint warnings. This CL goes through the remaining list of list warnings and records why they are currently blacklisted, or fixes and enables them. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1773733002 . --- core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 8 +++++--- core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp | 6 +++--- core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 2 ++ core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 2 ++ core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 2 ++ core/src/fpdfapi/fpdf_parser/fpdf_parser_objects_unittest.cpp | 1 + core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp | 3 +++ 7 files changed, 18 insertions(+), 6 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 8b1571a496..df9c13714d 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -771,10 +771,12 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, pFontDesc->SetAtInteger("CapHeight", capheight); CGFloat fStemV = 0; int16_t min_width = SHRT_MAX; + static const UniChar stem_chars[] = {'i', 'I', '!', '1'}; - const size_t count = sizeof(stem_chars) / sizeof(stem_chars[0]); - CGGlyph glyphs[count]; - CGRect boundingRects[count]; + CGGlyph glyphs[FX_ArraySize(stem_chars)]; + CGRect boundingRects[FX_ArraySize(stem_chars)]; + + const size_t count = FX_ArraySize(stem_chars); if (CTFontGetGlyphsForCharacters(font, stem_chars, glyphs, count)) { CTFontGetBoundingRectsForGlyphs(font, kCTFontHorizontalOrientation, glyphs, boundingRects, count); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index a8ae866f81..f428bf89a1 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -120,7 +120,7 @@ class CPDF_PSEngine { CPDF_PSEngine(); ~CPDF_PSEngine(); - FX_BOOL Parse(const FX_CHAR* string, int size); + FX_BOOL Parse(const FX_CHAR* str, int size); FX_BOOL Execute() { return m_MainProc.Execute(this); } FX_BOOL DoOperator(PDF_PSOP op); void Reset() { m_StackCount = 0; } @@ -207,8 +207,8 @@ const struct PDF_PSOpName { {"dup", PSOP_DUP}, {"copy", PSOP_COPY}, {"index", PSOP_INDEX}, {"roll", PSOP_ROLL}}; -FX_BOOL CPDF_PSEngine::Parse(const FX_CHAR* string, int size) { - CPDF_SimpleParser parser((uint8_t*)string, size); +FX_BOOL CPDF_PSEngine::Parse(const FX_CHAR* str, int size) { + CPDF_SimpleParser parser((uint8_t*)str, size); CFX_ByteStringC word = parser.GetWord(); if (word != "{") { return FALSE; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 7114f764ac..2dffc09f9f 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -6,6 +6,8 @@ #include "core/src/fpdfapi/fpdf_page/pageint.h" +#include + #include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfapi/fpdf_module.h" #include "core/include/fpdfapi/fpdf_page.h" diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index 0287b4fed3..f7c3f7d8d3 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -6,6 +6,8 @@ #include "core/src/fpdfapi/fpdf_page/pageint.h" +#include + #include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfapi/fpdf_page.h" diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index 0b7a841cd4..4fb471713b 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -6,6 +6,8 @@ #include +#include + #include "core/include/fpdfapi/fpdf_module.h" #include "core/include/fpdfapi/fpdf_parser.h" #include "core/include/fxcodec/fx_codec.h" diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects_unittest.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects_unittest.cpp index d2c30fa6ae..a377a92e44 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects_unittest.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects_unittest.cpp @@ -5,6 +5,7 @@ #include "core/include/fpdfapi/fpdf_objects.h" #include +#include #include #include "core/include/fxcrt/fx_basic.h" diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp index 294a99675d..68068cb522 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include +#include + #include "core/include/fpdfapi/fpdf_parser.h" #include "core/include/fxcrt/fx_stream.h" #include "core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" -- cgit v1.2.3