mirror of
https://github.com/AxioDL/nod.git
synced 2025-12-09 05:28:00 +00:00
General: Use std::make_unique where applicable
Makes for a little less reading in certain cases.
This commit is contained in:
@@ -110,11 +110,12 @@ std::unique_ptr<IPartReadStream> Node::beginReadStream(uint64_t offset) const {
|
||||
std::unique_ptr<uint8_t[]> Node::getBuf() const {
|
||||
if (m_kind != Kind::File) {
|
||||
LogModule.report(logvisor::Error, fmt("unable to buffer a non-file {}"), m_name);
|
||||
return std::unique_ptr<uint8_t[]>();
|
||||
return nullptr;
|
||||
}
|
||||
uint8_t* buf = new uint8_t[m_discLength];
|
||||
beginReadStream()->read(buf, m_discLength);
|
||||
return std::unique_ptr<uint8_t[]>(buf);
|
||||
|
||||
auto buf = std::unique_ptr<uint8_t[]>(new uint8_t[m_discLength]);
|
||||
beginReadStream()->read(buf.get(), m_discLength);
|
||||
return buf;
|
||||
}
|
||||
|
||||
bool Node::extractToDirectory(SystemStringView basePath, const ExtractionContext& ctx) const {
|
||||
|
||||
Reference in New Issue
Block a user