diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-27 18:44:36 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-27 18:44:36 +0000 |
commit | 2d3655a22edbabd8539578f69b9c6ea9691413ab (patch) | |
tree | 58d289c234bf995c537be04d5251da631745cbee /core/fpdfapi/render | |
parent | a257eb4a40302db5463f650b3cb1b611bb5cb7de (diff) | |
download | pdfium-2d3655a22edbabd8539578f69b9c6ea9691413ab.tar.xz |
Remove CollectionSize from CPDF_CharPosList
Bug: pdfium:774
Change-Id: I7ebbcb17374b4117f92b94edbd8bcba18efe6313
Reviewed-on: https://pdfium-review.googlesource.com/19470
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r-- | core/fpdfapi/render/cpdf_charposlist.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp index 5739c8af02..c0c700c0ca 100644 --- a/core/fpdfapi/render/cpdf_charposlist.cpp +++ b/core/fpdfapi/render/cpdf_charposlist.cpp @@ -8,7 +8,6 @@ #include "core/fpdfapi/font/cpdf_cidfont.h" #include "core/fpdfapi/font/cpdf_font.h" -#include "third_party/base/stl_util.h" CPDF_CharPosList::CPDF_CharPosList() { m_pCharPos = nullptr; @@ -23,12 +22,11 @@ void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes, const std::vector<float>& charPos, CPDF_Font* pFont, float FontSize) { - int nChars = pdfium::CollectionSize<int>(charCodes); - m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars); + m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, charCodes.size()); m_nChars = 0; CPDF_CIDFont* pCIDFont = pFont->AsCIDFont(); bool bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); - for (int iChar = 0; iChar < nChars; iChar++) { + for (size_t iChar = 0; iChar < charCodes.size(); ++iChar) { uint32_t CharCode = charCodes[iChar]; if (CharCode == static_cast<uint32_t>(-1)) continue; @@ -65,7 +63,7 @@ void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes, else charpos.m_FontCharWidth = 0; - charpos.m_Origin = CFX_PointF(iChar ? charPos[iChar - 1] : 0, 0); + charpos.m_Origin = CFX_PointF(iChar > 0 ? charPos[iChar - 1] : 0, 0); charpos.m_bGlyphAdjust = false; float scalingFactor = 1.0f; |