mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 10:05:32 +01:00
Core/Misc: Replace Trinity::make_unique with std (#24869)
This commit is contained in:
committed by
GitHub
parent
01c8d03e2e
commit
bab5fd87a3
@@ -348,7 +348,7 @@ bool DB2FileLoaderRegularImpl::LoadTableData(DB2FileSource* source, uint32 secti
|
||||
{
|
||||
if (!_data)
|
||||
{
|
||||
_data = Trinity::make_unique<uint8[]>(_header->RecordSize * _header->RecordCount + _header->StringTableSize + 8);
|
||||
_data = std::make_unique<uint8[]>(_header->RecordSize * _header->RecordCount + _header->StringTableSize + 8);
|
||||
_stringTable = &_data[_header->RecordSize * _header->RecordCount];
|
||||
}
|
||||
|
||||
@@ -1002,7 +1002,7 @@ DB2FileLoaderSparseImpl::DB2FileLoaderSparseImpl(char const* fileName, DB2FileLo
|
||||
_source(source),
|
||||
_totalRecordSize(0),
|
||||
_maxRecordSize(0),
|
||||
_fieldAndArrayOffsets(loadInfo ? (Trinity::make_unique<std::size_t[]>(loadInfo->Meta->FieldCount + loadInfo->FieldCount - (!loadInfo->Meta->HasIndexFieldInData() ? 1 : 0))) : nullptr)
|
||||
_fieldAndArrayOffsets(loadInfo ? (std::make_unique<std::size_t[]>(loadInfo->Meta->FieldCount + loadInfo->FieldCount - (!loadInfo->Meta->HasIndexFieldInData() ? 1 : 0))) : nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1057,7 +1057,7 @@ bool DB2FileLoaderSparseImpl::LoadCatalogData(DB2FileSource* source, uint32 sect
|
||||
void DB2FileLoaderSparseImpl::SetAdditionalData(std::vector<uint32> /*idTable*/, std::vector<DB2RecordCopy> /*copyTable*/, std::vector<std::vector<DB2IndexData>> parentIndexes)
|
||||
{
|
||||
_parentIndexes = std::move(parentIndexes);
|
||||
_recordBuffer = Trinity::make_unique<uint8[]>(_maxRecordSize);
|
||||
_recordBuffer = std::make_unique<uint8[]>(_maxRecordSize);
|
||||
}
|
||||
|
||||
char* DB2FileLoaderSparseImpl::AutoProduceData(uint32& maxId, char**& indexTable, std::vector<char*>& stringPool)
|
||||
@@ -1777,7 +1777,7 @@ bool DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo
|
||||
if (loadInfo && (_header.ParentLookupCount && loadInfo->Meta->ParentIndexField == -1))
|
||||
return false;
|
||||
|
||||
std::unique_ptr<DB2SectionHeader[]> sections = Trinity::make_unique<DB2SectionHeader[]>(_header.SectionCount);
|
||||
std::unique_ptr<DB2SectionHeader[]> sections = std::make_unique<DB2SectionHeader[]>(_header.SectionCount);
|
||||
if (_header.SectionCount && !source->Read(sections.get(), sizeof(DB2SectionHeader) * _header.SectionCount))
|
||||
return false;
|
||||
|
||||
@@ -1808,7 +1808,7 @@ bool DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<DB2FieldEntry[]> fieldData = Trinity::make_unique<DB2FieldEntry[]>(_header.FieldCount);
|
||||
std::unique_ptr<DB2FieldEntry[]> fieldData = std::make_unique<DB2FieldEntry[]>(_header.FieldCount);
|
||||
if (!source->Read(fieldData.get(), sizeof(DB2FieldEntry) * _header.FieldCount))
|
||||
return false;
|
||||
|
||||
@@ -1818,7 +1818,7 @@ bool DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo
|
||||
std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues;
|
||||
if (_header.ColumnMetaSize)
|
||||
{
|
||||
columnMeta = Trinity::make_unique<DB2ColumnMeta[]>(_header.TotalFieldCount);
|
||||
columnMeta = std::make_unique<DB2ColumnMeta[]>(_header.TotalFieldCount);
|
||||
if (!source->Read(columnMeta.get(), _header.ColumnMetaSize))
|
||||
return false;
|
||||
|
||||
@@ -1830,30 +1830,30 @@ bool DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo
|
||||
columnMeta[loadInfo->Meta->IndexField].CompressionType == DB2ColumnCompression::SignedImmediate);
|
||||
}
|
||||
|
||||
palletValues = Trinity::make_unique<std::unique_ptr<DB2PalletValue[]>[]>(_header.TotalFieldCount);
|
||||
palletValues = std::make_unique<std::unique_ptr<DB2PalletValue[]>[]>(_header.TotalFieldCount);
|
||||
for (uint32 i = 0; i < _header.TotalFieldCount; ++i)
|
||||
{
|
||||
if (columnMeta[i].CompressionType != DB2ColumnCompression::Pallet)
|
||||
continue;
|
||||
|
||||
palletValues[i] = Trinity::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2PalletValue));
|
||||
palletValues[i] = std::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2PalletValue));
|
||||
if (!source->Read(palletValues[i].get(), columnMeta[i].AdditionalDataSize))
|
||||
return false;
|
||||
}
|
||||
|
||||
palletArrayValues = Trinity::make_unique<std::unique_ptr<DB2PalletValue[]>[]>(_header.TotalFieldCount);
|
||||
palletArrayValues = std::make_unique<std::unique_ptr<DB2PalletValue[]>[]>(_header.TotalFieldCount);
|
||||
for (uint32 i = 0; i < _header.TotalFieldCount; ++i)
|
||||
{
|
||||
if (columnMeta[i].CompressionType != DB2ColumnCompression::PalletArray)
|
||||
continue;
|
||||
|
||||
palletArrayValues[i] = Trinity::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2PalletValue));
|
||||
palletArrayValues[i] = std::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2PalletValue));
|
||||
if (!source->Read(palletArrayValues[i].get(), columnMeta[i].AdditionalDataSize))
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<std::unique_ptr<DB2CommonValue[]>[]> commonData = Trinity::make_unique<std::unique_ptr<DB2CommonValue[]>[]>(_header.TotalFieldCount);
|
||||
commonValues = Trinity::make_unique<std::unordered_map<uint32, uint32>[]>(_header.TotalFieldCount);
|
||||
std::unique_ptr<std::unique_ptr<DB2CommonValue[]>[]> commonData = std::make_unique<std::unique_ptr<DB2CommonValue[]>[]>(_header.TotalFieldCount);
|
||||
commonValues = std::make_unique<std::unordered_map<uint32, uint32>[]>(_header.TotalFieldCount);
|
||||
for (uint32 i = 0; i < _header.TotalFieldCount; ++i)
|
||||
{
|
||||
if (columnMeta[i].CompressionType != DB2ColumnCompression::CommonData)
|
||||
@@ -1862,7 +1862,7 @@ bool DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo
|
||||
if (!columnMeta[i].AdditionalDataSize)
|
||||
continue;
|
||||
|
||||
commonData[i] = Trinity::make_unique<DB2CommonValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2CommonValue));
|
||||
commonData[i] = std::make_unique<DB2CommonValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2CommonValue));
|
||||
if (!source->Read(commonData[i].get(), columnMeta[i].AdditionalDataSize))
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user