mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
Change: Use std::make_unique instead of passing new() (#12539)
This commit is contained in:
parent
fc7f184dbd
commit
a1a01e21cf
@ -218,7 +218,7 @@ std::unique_ptr<const ParagraphLayouter::Line> FallbackParagraphLayout::NextLine
|
||||
*/
|
||||
if (this->buffer == nullptr) return nullptr;
|
||||
|
||||
std::unique_ptr<FallbackLine> l(new FallbackLine());
|
||||
std::unique_ptr<FallbackLine> l = std::make_unique<FallbackLine>();
|
||||
|
||||
if (*this->buffer == '\0') {
|
||||
/* Only a newline. */
|
||||
|
@ -489,7 +489,7 @@ std::unique_ptr<const ICUParagraphLayout::Line> ICUParagraphLayout::NextLine(int
|
||||
ubidi_reorderVisual(bidi_level.data(), bidi_level.size(), vis_to_log.data());
|
||||
|
||||
/* Create line. */
|
||||
std::unique_ptr<ICULine> line(new ICULine());
|
||||
std::unique_ptr<ICULine> line = std::make_unique<ICULine>();
|
||||
|
||||
int cur_pos = 0;
|
||||
for (auto &i : vis_to_log) {
|
||||
|
@ -517,7 +517,7 @@ int openttd_main(std::span<char * const> arguments)
|
||||
std::string sounds_set;
|
||||
std::string music_set;
|
||||
Dimension resolution = {0, 0};
|
||||
std::unique_ptr<AfterNewGRFScan> scanner(new AfterNewGRFScan());
|
||||
std::unique_ptr<AfterNewGRFScan> scanner = std::make_unique<AfterNewGRFScan>();
|
||||
bool dedicated = false;
|
||||
bool only_local_path = false;
|
||||
|
||||
|
@ -224,7 +224,8 @@ static CTRunDelegateCallbacks _sprite_font_callback = {
|
||||
CFAutoRelease<CTLineRef> line(CTTypesetterCreateLine(this->typesetter.get(), CFRangeMake(this->cur_offset, len)));
|
||||
this->cur_offset += len;
|
||||
|
||||
return std::unique_ptr<const Line>(line ? new CoreTextLine(std::move(line), this->font_map, this->text_buffer) : nullptr);
|
||||
if (!line) return nullptr;
|
||||
return std::make_unique<CoreTextLine>(std::move(line), this->font_map, this->text_buffer);
|
||||
}
|
||||
|
||||
CoreTextParagraphLayout::CoreTextVisualRun::CoreTextVisualRun(CTRunRef run, Font *font, const CoreTextParagraphLayoutFactory::CharType *buff) : font(font)
|
||||
|
@ -405,7 +405,7 @@ static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutF
|
||||
if (FAILED(ScriptLayout((int)bidi_level.size(), &bidi_level[0], &vis_to_log[0], nullptr))) return nullptr;
|
||||
|
||||
/* Create line. */
|
||||
std::unique_ptr<UniscribeLine> line(new UniscribeLine());
|
||||
std::unique_ptr<UniscribeLine> line = std::make_unique<UniscribeLine>();
|
||||
|
||||
int cur_pos = 0;
|
||||
for (std::vector<INT>::iterator l = vis_to_log.begin(); l != vis_to_log.end(); l++) {
|
||||
|
@ -68,7 +68,7 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f
|
||||
*/
|
||||
if (num < 0 || num > 64 * 1024 * 1024) return WarnCorruptSprite(file, file_pos, __LINE__);
|
||||
|
||||
std::unique_ptr<uint8_t[]> dest_orig(new uint8_t[num]);
|
||||
std::unique_ptr<uint8_t[]> dest_orig = std::make_unique<uint8_t[]>(num);
|
||||
uint8_t *dest = dest_orig.get();
|
||||
const int64_t dest_size = num;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user