summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout/fgas_rtfbreak.cpp
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.cpp
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.cpp')
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index dd3f34c739..fdc9a57038 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -882,11 +882,8 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
if (!pText || pText->iLength < 1)
return 0;
- ASSERT(pText->pStr && pText->pWidths && pText->pFont && pText->pRect);
+ ASSERT(pText->pFont && pText->pRect);
- const FX_WCHAR* pStr = pText->pStr;
- int32_t* pWidths = pText->pWidths;
- int32_t iLength = pText->iLength - 1;
CFX_RetainPtr<CFGAS_GEFont> pFont = pText->pFont;
CFX_RectF rtText(*pText->pRect);
bool bRTLPiece = FX_IsOdd(pText->iBidiLevel);
@@ -920,9 +917,9 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
fY += fAscent;
int32_t iCount = 0;
- for (int32_t i = 0; i <= iLength; i++) {
- wch = *pStr++;
- iWidth = *pWidths++;
+ for (int32_t i = 0; i < pText->iLength; i++) {
+ wch = pText->pStr[i];
+ iWidth = pText->pWidths[i];
dwProps = FX_GetUnicodeProperties(wch);
dwCharType = (dwProps & FX_CHARTYPEBITSMASK);
if (dwCharType == FX_CHARTYPE_ArabicAlef && iWidth == 0) {
@@ -942,10 +939,10 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
iCharWidth /= iFontSize;
wForm = wch;
if (dwCharType >= FX_CHARTYPE_ArabicAlef) {
- if (i < iLength) {
- wNext = *pStr;
- if (*pWidths < 0 && i + 1 < iLength)
- wNext = pStr[1];
+ if (i + 1 < pText->iLength) {
+ wNext = pText->pStr[i + 1];
+ if (pText->pWidths[i + 1] < 0 && i + 2 < pText->iLength)
+ wNext = pText->pStr[i + 2];
} else {
wNext = 0xFEFF;
}
@@ -1040,14 +1037,12 @@ CFX_RTFLine::~CFX_RTFLine() {
}
FX_RTFTEXTOBJ::FX_RTFTEXTOBJ()
- : pStr(nullptr),
- pWidths(nullptr),
- iLength(0),
- pFont(nullptr),
- fFontSize(12.0f),
- iBidiLevel(0),
+ : pFont(nullptr),
pRect(nullptr),
wLineBreakChar(L'\n'),
+ fFontSize(12.0f),
+ iLength(0),
+ iBidiLevel(0),
iHorizontalScale(100),
iVerticalScale(100) {}