summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout/fgas_rtfbreak.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-01 11:23:14 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-03-01 20:44:33 +0000
commitbef73893d919514110cf3b724fad88965d9399e7 (patch)
tree9075f0562dd31886bc8409b3e7de25887d690a00 /xfa/fgas/layout/fgas_rtfbreak.h
parentb4a261855b34b4c8d938118762ae609a34a3ae99 (diff)
downloadpdfium-bef73893d919514110cf3b724fad88965d9399e7.tar.xz
Return values instead of out params
This Cl converts CFX_RTFPiece::GetString and CFX_RTFPiece::GetWidths to return CFX_WideString and std::vector<int32_t> respectively instead of taking pointers out parameters. Change-Id: Ie153caa0336861b3efa9b8ce26f75f0e019526e9 Reviewed-on: https://pdfium-review.googlesource.com/2882 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fgas/layout/fgas_rtfbreak.h')
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h32
1 files changed, 17 insertions, 15 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index 81ec60ee48..55b99ae298 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -33,14 +33,14 @@ struct FX_RTFTEXTOBJ {
FX_RTFTEXTOBJ();
~FX_RTFTEXTOBJ();
- const FX_WCHAR* pStr;
- int32_t* pWidths;
- int32_t iLength;
+ CFX_WideString pStr;
+ std::vector<int32_t> pWidths;
CFX_RetainPtr<CFGAS_GEFont> pFont;
- FX_FLOAT fFontSize;
- int32_t iBidiLevel;
const CFX_RectF* pRect;
FX_WCHAR wLineBreakChar;
+ FX_FLOAT fFontSize;
+ int32_t iLength;
+ int32_t iBidiLevel;
int32_t iHorizontalScale;
int32_t iVerticalScale;
};
@@ -59,18 +59,20 @@ class CFX_RTFPiece {
return (*m_pChars)[m_iStartChar + index];
}
- void GetString(FX_WCHAR* pText) const {
- ASSERT(pText);
- int32_t iEndChar = m_iStartChar + m_iChars;
- for (int32_t i = m_iStartChar; i < iEndChar; i++)
- *pText++ = static_cast<FX_WCHAR>((*m_pChars)[i].m_wCharCode);
+ CFX_WideString GetString() const {
+ CFX_WideString ret;
+ ret.Reserve(m_iChars);
+ for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++)
+ ret += static_cast<FX_WCHAR>((*m_pChars)[i].m_wCharCode);
+ return ret;
}
- void GetWidths(int32_t* pWidths) const {
- ASSERT(pWidths);
- int32_t iEndChar = m_iStartChar + m_iChars;
- for (int32_t i = m_iStartChar; i < iEndChar; i++)
- *pWidths++ = (*m_pChars)[i].m_iCharWidth;
+ std::vector<int32_t> GetWidths() const {
+ std::vector<int32_t> ret;
+ ret.reserve(m_iChars);
+ for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++)
+ ret.push_back((*m_pChars)[i].m_iCharWidth);
+ return ret;
}
void Reset() {