From 315bb38444b8e363b4d8f2702d45d42fa585f619 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 21 Jul 2018 16:29:02 +0200 Subject: NBT: create Tags using make_shared() --- src/NBT/Tag.cpp | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/NBT/Tag.cpp b/src/NBT/Tag.cpp index 33dac83..31f1420 100644 --- a/src/NBT/Tag.cpp +++ b/src/NBT/Tag.cpp @@ -50,43 +50,43 @@ namespace NBT { std::shared_ptr Tag::readTag(Type type, Buffer *buffer) { switch (type) { case Type::End: - return std::shared_ptr(new EndTag()); + return std::make_shared(); case Type::Byte: - return std::shared_ptr(new ByteTag(buffer)); + return std::make_shared(buffer); case Type::Short: - return std::shared_ptr(new ShortTag(buffer)); + return std::make_shared(buffer); case Type::Int: - return std::shared_ptr(new IntTag(buffer)); + return std::make_shared(buffer); case Type::Long: - return std::shared_ptr(new LongTag(buffer)); + return std::make_shared(buffer); case Type::Float: - return std::shared_ptr(new FloatTag(buffer)); + return std::make_shared(buffer); case Type::Double: - return std::shared_ptr(new DoubleTag(buffer)); + return std::make_shared(buffer); case Type::ByteArray: - return std::shared_ptr(new ByteArrayTag(buffer)); + return std::make_shared(buffer); case Type::String: - return std::shared_ptr(new StringTag(buffer)); + return std::make_shared(buffer); case Type::List: return readList(buffer); case Type::Compound: - return std::shared_ptr(new CompoundTag(buffer)); + return std::make_shared(buffer); case Type::IntArray: - return std::shared_ptr(new IntArrayTag(buffer)); + return std::make_shared(buffer); case Type::LongArray: - return std::shared_ptr(new LongArrayTag(buffer)); + return std::make_shared(buffer); default: throw std::runtime_error("Tag::readTag: unknown tag type"); @@ -98,43 +98,43 @@ std::shared_ptr Tag::readList(Buffer *buffer) { switch (type) { case Type::End: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::Byte: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::Short: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::Int: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::Long: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::Float: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::Double: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::ByteArray: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::String: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::List: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::Compound: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::IntArray: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); case Type::LongArray: - return std::shared_ptr(new ListTag(type, buffer)); + return std::make_shared>(type, buffer); default: throw std::runtime_error("Tag::readList: unknown tag type"); -- cgit v1.2.3