Codechange: Use unique_ptr instead of raw pointer for string layouts. (#13128)

This commit is contained in:
Peter Nelson
2024-11-27 23:38:57 +00:00
committed by GitHub
parent cf7710fb61
commit fe0afef36f
9 changed files with 15 additions and 15 deletions

View File

@@ -353,7 +353,7 @@ std::vector<ICURun> ItemizeStyle(std::vector<ICURun> &runs_current, FontMap &fon
return runs;
}
/* static */ ParagraphLayouter *ICUParagraphLayoutFactory::GetParagraphLayout(UChar *buff, UChar *buff_end, FontMap &font_mapping)
/* static */ std::unique_ptr<ParagraphLayouter> ICUParagraphLayoutFactory::GetParagraphLayout(UChar *buff, UChar *buff_end, FontMap &font_mapping)
{
size_t length = buff_end - buff;
/* Can't layout an empty string. */
@@ -374,7 +374,7 @@ std::vector<ICURun> ItemizeStyle(std::vector<ICURun> &runs_current, FontMap &fon
run.Shape(buff, length);
}
return new ICUParagraphLayout(std::move(runs), buff, length);
return std::make_unique<ICUParagraphLayout>(std::move(runs), buff, length);
}
/* static */ std::unique_ptr<icu::BreakIterator> ICUParagraphLayoutFactory::break_iterator;