diff options
Diffstat (limited to 'core/src')
24 files changed, 75 insertions, 44 deletions
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 <vector> + #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 <algorithm> + #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 <limits.h> +#include <vector> + #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 <memory> +#include <string> #include <vector> #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 <limits> +#include <string> + #include "core/include/fpdfapi/fpdf_parser.h" #include "core/include/fxcrt/fx_stream.h" #include "core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp index 9a0ba57951..12ec4c1907 100644 --- a/core/src/fpdfdoc/doc_action.cpp +++ b/core/src/fpdfdoc/doc_action.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <vector> + #include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfdoc/fpdf_doc.h" diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index 8080dc7597..7469cfd28f 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <vector> + #include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfdoc/fpdf_doc.h" #include "core/src/fpdfdoc/doc_utils.h" @@ -385,6 +387,7 @@ static FX_BOOL RetrieveSpecificFont(uint8_t charSet, lf.lfCharSet = charSet; lf.lfPitchAndFamily = pitchAndFamily; if (pcsFontName) { + // TODO(dsinclair): Should this be strncpy? strcpy(lf.lfFaceName, pcsFontName); } return RetrieveSpecificFont(lf); diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp index 7da29e0954..d2fe67df43 100644 --- a/core/src/fpdfdoc/doc_link.cpp +++ b/core/src/fpdfdoc/doc_link.cpp @@ -6,6 +6,8 @@ #include "core/include/fpdfdoc/fpdf_doc.h" +#include <vector> + CPDF_LinkList::CPDF_LinkList() { } diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp index d4ce4a4b31..6eb1c98592 100644 --- a/core/src/fpdfdoc/doc_tagged.cpp +++ b/core/src/fpdfdoc/doc_tagged.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <map> + #include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_parser.h" diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index bc09c9a2c4..11359c9129 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -5,6 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include <algorithm> +#include <vector> #include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfdoc/fpdf_doc.h" diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index 4a0aae501c..75677332ec 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -10,6 +10,7 @@ #include <cctype> #include <cwctype> #include <memory> +#include <utility> #include <vector> #include "core/include/fpdfapi/fpdf_module.h" diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index 707088e1a9..bde3daeaea 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -12,6 +12,7 @@ #include <list> #include <map> #include <memory> +#include <vector> #include "core/include/fxcodec/fx_codec.h" #include "core/src/fxcodec/jbig2/JBig2_Context.h" diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index 0e39e19bc9..44e30aa953 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <list> + #include "core/include/fxcodec/fx_codec.h" #include "core/src/fxcodec/codec/codec_int.h" diff --git a/core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp index b3f9911141..2fac8df5a9 100644 --- a/core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp +++ b/core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp @@ -6,6 +6,8 @@ #include "core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.h" +#include <vector> + #include "core/include/fxcrt/fx_basic.h" namespace { diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 8b4442e823..5d38d57757 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -4,7 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include <stddef.h> // For offsetof(). +#include <stddef.h> + #include <cctype> #include "core/include/fxcrt/fx_basic.h" @@ -22,15 +23,15 @@ static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) { u = -i; } int base = 10; - const FX_CHAR* string = "0123456789abcdef"; + const FX_CHAR* str = "0123456789abcdef"; if (flags & FXFORMAT_HEX) { base = 16; if (flags & FXFORMAT_CAPITAL) { - string = "0123456789ABCDEF"; + str = "0123456789ABCDEF"; } } while (u != 0) { - buf1[buf_pos--] = string[u % base]; + buf1[buf_pos--] = str[u % base]; u = u / base; } if ((flags & FXFORMAT_SIGNED) && i < 0) { @@ -202,19 +203,18 @@ const CFX_ByteString& CFX_ByteString::operator+=(char ch) { ConcatInPlace(1, &ch); return *this; } -const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteString& string) { - if (!string.m_pData) { +const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteString& str) { + if (!str.m_pData) { return *this; } - ConcatInPlace(string.m_pData->m_nDataLength, string.m_pData->m_String); + ConcatInPlace(str.m_pData->m_nDataLength, str.m_pData->m_String); return *this; } -const CFX_ByteString& CFX_ByteString::operator+=( - const CFX_ByteStringC& string) { - if (string.IsEmpty()) { +const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& str) { + if (str.IsEmpty()) { return *this; } - ConcatInPlace(string.GetLength(), string.GetCStr()); + ConcatInPlace(str.GetLength(), str.GetCStr()); return *this; } bool CFX_ByteString::Equal(const char* ptr) const { diff --git a/core/src/fxcrt/fx_basic_gcc.cpp b/core/src/fxcrt/fx_basic_gcc.cpp index e2ec939e7d..2c9c54c8b6 100644 --- a/core/src/fxcrt/fx_basic_gcc.cpp +++ b/core/src/fxcrt/fx_basic_gcc.cpp @@ -33,20 +33,20 @@ IntType FXSYS_StrToInt(const CharType* str) { } template <typename T, typename UT, typename STR_T> -STR_T FXSYS_IntToStr(T value, STR_T string, int radix) { +STR_T FXSYS_IntToStr(T value, STR_T str, int radix) { if (radix < 2 || radix > 16) { - string[0] = 0; - return string; + str[0] = 0; + return str; } if (value == 0) { - string[0] = '0'; - string[1] = 0; - return string; + str[0] = '0'; + str[1] = 0; + return str; } int i = 0; UT uvalue; if (value < 0) { - string[i++] = '-'; + str[i++] = '-'; // Standard trick to avoid undefined behaviour when negating INT_MIN. uvalue = static_cast<UT>(-(value + 1)) + 1; } else { @@ -59,11 +59,11 @@ STR_T FXSYS_IntToStr(T value, STR_T string, int radix) { order = order / radix; } for (int d = digits - 1; d > -1; d--) { - string[d + i] = "0123456789abcdef"[uvalue % radix]; + str[d + i] = "0123456789abcdef"[uvalue % radix]; uvalue /= radix; } - string[digits + i] = 0; - return string; + str[digits + i] = 0; + return str; } #ifdef __cplusplus @@ -191,8 +191,8 @@ int FXSYS_wcsicmp(const FX_WCHAR* dst, const FX_WCHAR* src) { } while (f && (f == l)); return (f - l); } -char* FXSYS_itoa(int value, char* string, int radix) { - return FXSYS_IntToStr<int32_t, uint32_t, FX_CHAR*>(value, string, radix); +char* FXSYS_itoa(int value, char* str, int radix) { + return FXSYS_IntToStr<int32_t, uint32_t, FX_CHAR*>(value, str, radix); } #ifdef __cplusplus } diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index 8df72466e8..11a840a806 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include <stddef.h> // For offsetof(). +#include <stddef.h> #include <algorithm> #include <cctype> @@ -184,19 +184,18 @@ const CFX_WideString& CFX_WideString::operator+=(const FX_WCHAR* lpsz) { } return *this; } -const CFX_WideString& CFX_WideString::operator+=(const CFX_WideString& string) { - if (!string.m_pData) { +const CFX_WideString& CFX_WideString::operator+=(const CFX_WideString& str) { + if (!str.m_pData) { return *this; } - ConcatInPlace(string.m_pData->m_nDataLength, string.m_pData->m_String); + ConcatInPlace(str.m_pData->m_nDataLength, str.m_pData->m_String); return *this; } -const CFX_WideString& CFX_WideString::operator+=( - const CFX_WideStringC& string) { - if (string.IsEmpty()) { +const CFX_WideString& CFX_WideString::operator+=(const CFX_WideStringC& str) { + if (str.IsEmpty()) { return *this; } - ConcatInPlace(string.GetLength(), string.GetPtr()); + ConcatInPlace(str.GetLength(), str.GetPtr()); return *this; } bool CFX_WideString::Equal(const wchar_t* ptr) const { diff --git a/core/src/fxcrt/fx_system_unittest.cpp b/core/src/fxcrt/fx_system_unittest.cpp index 4a07a77ad2..f877eb2aa5 100644 --- a/core/src/fxcrt/fx_system_unittest.cpp +++ b/core/src/fxcrt/fx_system_unittest.cpp @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <limits> #include <string> #include "core/include/fxcrt/fx_system.h" diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp index 59c3de444e..da2b26b5b8 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -6,6 +6,8 @@ #include "core/src/fxcrt/xml_int.h" +#include <vector> + #include "core/include/fxcrt/fx_ext.h" #include "core/include/fxcrt/fx_xml.h" #include "third_party/base/stl_util.h" diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index 629f3235ed..aba67dacfe 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -16,11 +16,12 @@ using std::max; } // namespace Gdiplus #include <gdiplus.h> + #include "core/include/fxge/fx_ge_win32.h" #include "core/src/fxge/win32/win32_int.h" -using namespace Gdiplus; -using namespace Gdiplus::DllExports; +using namespace Gdiplus; // NOLINT +using namespace Gdiplus::DllExports; // NOLINT #define GdiFillType2Gdip(fill_type) \ (fill_type == ALTERNATE ? FillModeAlternate : FillModeWinding) @@ -420,7 +421,7 @@ typedef GpStatus(WINGDIPAPI* FuncType_GdipDrawImageRectI)(GpGraphics* graphics, INT height); typedef GpStatus(WINGDIPAPI* FuncType_GdipDrawString)( GpGraphics* graphics, - GDIPCONST WCHAR* string, + GDIPCONST WCHAR* str, INT length, GDIPCONST GpFont* font, GDIPCONST RectF* layoutRect, diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index 6c262d83dc..acd73d1427 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -287,15 +287,15 @@ CPSOutput::~CPSOutput() { void CPSOutput::Init() { m_pBuf = FX_Alloc(FX_CHAR, 1026); } -void CPSOutput::OutputPS(const FX_CHAR* string, int len) { +void CPSOutput::OutputPS(const FX_CHAR* str, int len) { if (len < 0) { - len = (int)FXSYS_strlen(string); + len = (int)FXSYS_strlen(str); } int sent_len = 0; while (len > 0) { int send_len = len > 1024 ? 1024 : len; *(FX_WORD*)m_pBuf = send_len; - FXSYS_memcpy(m_pBuf + 2, string + sent_len, send_len); + FXSYS_memcpy(m_pBuf + 2, str + sent_len, send_len); ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, m_pBuf, 0, NULL); sent_len += send_len; len -= send_len; diff --git a/core/src/fxge/win32/win32_int.h b/core/src/fxge/win32/win32_int.h index 97da0ac15c..233fe367f5 100644 --- a/core/src/fxge/win32/win32_int.h +++ b/core/src/fxge/win32/win32_int.h @@ -277,7 +277,7 @@ class CPSOutput : public IFX_PSOutput { // IFX_PSOutput void Release() override { delete this; } - void OutputPS(const FX_CHAR* string, int len) override; + void OutputPS(const FX_CHAR* str, int len) override; void Init(); |