summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_streamcontentparser.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-26 13:50:33 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-26 21:25:42 +0000
commit827db14d7f3d0085253b686587717361ffbcad1b (patch)
treedd2039623b87ba0c40b48f9a0344a463b1f3fb53 /core/fpdfapi/page/cpdf_streamcontentparser.cpp
parente47e0c96009b8633294eebbb9eb0e84caf525c57 (diff)
downloadpdfium-827db14d7f3d0085253b686587717361ffbcad1b.tar.xz
Remove a few more |new|s.
Change-Id: I8a50ed680c1e101f855644fca8d282dd21470577 Reviewed-on: https://pdfium-review.googlesource.com/4533 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_streamcontentparser.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index d9f12f121b..3e6e75a53e 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -1319,31 +1319,27 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
}
return;
}
- CFX_ByteString* pStrs = new CFX_ByteString[nsegs];
- float* pKerning = FX_Alloc(float, nsegs);
+ std::vector<CFX_ByteString> strs(nsegs);
+ std::vector<float> kernings(nsegs);
size_t iSegment = 0;
float fInitKerning = 0;
for (size_t i = 0; i < n; i++) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (pObj->IsString()) {
CFX_ByteString str = pObj->GetString();
- if (str.IsEmpty()) {
+ if (str.IsEmpty())
continue;
- }
- pStrs[iSegment] = str;
- pKerning[iSegment++] = 0;
+ strs[iSegment] = str;
+ kernings[iSegment++] = 0;
} else {
- float num = pObj ? pObj->GetNumber() : 0;
- if (iSegment == 0) {
+ float num = pObj->GetNumber();
+ if (iSegment == 0)
fInitKerning += num;
- } else {
- pKerning[iSegment - 1] += num;
- }
+ else
+ kernings[iSegment - 1] += num;
}
}
- AddTextObject(pStrs, fInitKerning, pKerning, iSegment);
- delete[] pStrs;
- FX_Free(pKerning);
+ AddTextObject(strs.data(), fInitKerning, kernings.data(), iSegment);
}
void CPDF_StreamContentParser::Handle_SetTextLeading() {