summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font/ttgsubtable.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/font/ttgsubtable.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/font/ttgsubtable.cpp')
-rw-r--r--core/fpdfapi/font/ttgsubtable.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/core/fpdfapi/font/ttgsubtable.cpp b/core/fpdfapi/font/ttgsubtable.cpp
index d2a6b9ab52..5b3d4cd4b9 100644
--- a/core/fpdfapi/font/ttgsubtable.cpp
+++ b/core/fpdfapi/font/ttgsubtable.cpp
@@ -6,6 +6,8 @@
#include "core/fpdfapi/font/ttgsubtable.h"
+#include <utility>
+
#include "core/fxge/fx_freetype.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
@@ -298,19 +300,21 @@ void CFX_CTTGSUBTable::ParseLookup(FT_Bytes raw, TLookup* rec) {
ParseSingleSubst(&raw[GetUInt16(sp)], &subTable);
}
-CFX_CTTGSUBTable::TCoverageFormatBase* CFX_CTTGSUBTable::ParseCoverage(
- FT_Bytes raw) {
+std::unique_ptr<CFX_CTTGSUBTable::TCoverageFormatBase>
+CFX_CTTGSUBTable::ParseCoverage(FT_Bytes raw) {
FT_Bytes sp = raw;
uint16_t format = GetUInt16(sp);
- TCoverageFormatBase* rec = nullptr;
if (format == 1) {
- rec = new TCoverageFormat1();
- ParseCoverageFormat1(raw, static_cast<TCoverageFormat1*>(rec));
- } else if (format == 2) {
- rec = new TCoverageFormat2();
- ParseCoverageFormat2(raw, static_cast<TCoverageFormat2*>(rec));
+ auto rec = pdfium::MakeUnique<TCoverageFormat1>();
+ ParseCoverageFormat1(raw, rec.get());
+ return std::move(rec);
+ }
+ if (format == 2) {
+ auto rec = pdfium::MakeUnique<TCoverageFormat2>();
+ ParseCoverageFormat2(raw, rec.get());
+ return std::move(rec);
}
- return rec;
+ return nullptr;
}
void CFX_CTTGSUBTable::ParseCoverageFormat1(FT_Bytes raw,
@@ -357,7 +361,7 @@ void CFX_CTTGSUBTable::ParseSingleSubstFormat1(FT_Bytes raw,
FT_Bytes sp = raw;
GetUInt16(sp);
uint16_t offset = GetUInt16(sp);
- rec->Coverage.reset(ParseCoverage(&raw[offset]));
+ rec->Coverage = ParseCoverage(&raw[offset]);
rec->DeltaGlyphID = GetInt16(sp);
}
@@ -366,7 +370,7 @@ void CFX_CTTGSUBTable::ParseSingleSubstFormat2(FT_Bytes raw,
FT_Bytes sp = raw;
(void)GetUInt16(sp);
uint16_t offset = GetUInt16(sp);
- rec->Coverage.reset(ParseCoverage(&raw[offset]));
+ rec->Coverage = ParseCoverage(&raw[offset]);
rec->Substitutes = std::vector<uint16_t>(GetUInt16(sp));
for (auto& substitute : rec->Substitutes)
substitute = GetUInt16(sp);