refactor(Core): apply clang-tidy modernize-use-nullptr (#3819)

This commit is contained in:
Francesco Borzì
2020-12-06 20:55:11 +01:00
committed by GitHub
parent 161302252e
commit cba126fa84
40 changed files with 127 additions and 127 deletions

View File

@@ -34,7 +34,7 @@ bool isHole(int holes, int i, int j)
//
ADT_file::ADT_file()
{
a_grid = 0;
a_grid = nullptr;
}
ADT_file::~ADT_file()
@@ -44,7 +44,7 @@ ADT_file::~ADT_file()
void ADT_file::free()
{
a_grid = 0;
a_grid = nullptr;
FileLoader::free();
}

View File

@@ -126,13 +126,13 @@ public:
{
if (offsMCVT)
return (adt_MCVT*)((uint8*)this + offsMCVT);
return 0;
return nullptr;
}
adt_MCLQ* getMCLQ()
{
if (offsMCLQ)
return (adt_MCLQ*)((uint8*)this + offsMCLQ);
return 0;
return nullptr;
}
};
@@ -162,7 +162,7 @@ public:
{
if (cells[x][y].offsMCNK)
return (adt_MCNK*)((uint8*)this + cells[x][y].offsMCNK - 84);
return 0;
return nullptr;
}
};
@@ -209,42 +209,42 @@ public:
{
if (liquid[x][y].used && liquid[x][y].offsData1)
return (adt_liquid_header*)((uint8*)this + 8 + liquid[x][y].offsData1);
return 0;
return nullptr;
}
float* getLiquidHeightMap(adt_liquid_header* h)
{
if (h->formatFlags & ADT_LIQUID_HEADER_NO_HIGHT)
return 0;
return nullptr;
if (h->offsData2b)
return (float*)((uint8*)this + 8 + h->offsData2b);
return 0;
return nullptr;
}
uint8* getLiquidLightMap(adt_liquid_header* h)
{
if (h->formatFlags & ADT_LIQUID_HEADER_FULL_LIGHT)
return 0;
return nullptr;
if (h->offsData2b)
{
if (h->formatFlags & ADT_LIQUID_HEADER_NO_HIGHT)
return (uint8*)((uint8*)this + 8 + h->offsData2b);
return (uint8*)((uint8*)this + 8 + h->offsData2b + (h->width + 1) * (h->height + 1) * 4);
}
return 0;
return nullptr;
}
uint32* getLiquidFullLightMap(adt_liquid_header* h)
{
if (!(h->formatFlags & ADT_LIQUID_HEADER_FULL_LIGHT))
return 0;
return nullptr;
if (h->offsData2b)
{
if (h->formatFlags & ADT_LIQUID_HEADER_NO_HIGHT)
return (uint32*)((uint8*)this + 8 + h->offsData2b);
return (uint32*)((uint8*)this + 8 + h->offsData2b + (h->width + 1) * (h->height + 1) * 4);
}
return 0;
return nullptr;
}
uint64 getLiquidShowMap(adt_liquid_header* h)

View File

@@ -16,9 +16,9 @@ u_map_fcc MverMagic = { {'R', 'E', 'V', 'M'} };
FileLoader::FileLoader()
{
data = 0;
data = nullptr;
data_size = 0;
version = 0;
version = nullptr;
}
FileLoader::~FileLoader()
@@ -65,7 +65,7 @@ bool FileLoader::prepareLoadedData()
void FileLoader::free()
{
delete[] data;
data = 0;
data = nullptr;
data_size = 0;
version = 0;
version = nullptr;
}

View File

@@ -50,7 +50,7 @@ void MPQArchive::close()
MPQFile::MPQFile(const char* filename):
eof(false),
buffer(0),
buffer(nullptr),
pointer(0),
size(0)
{
@@ -68,7 +68,7 @@ MPQFile::MPQFile(const char* filename):
{
// printf("warning: file %s has size %d; cannot read.\n", filename, size);
eof = true;
buffer = 0;
buffer = nullptr;
return;
}
buffer = new char[size];
@@ -80,7 +80,7 @@ MPQFile::MPQFile(const char* filename):
}
eof = true;
buffer = 0;
buffer = nullptr;
}
size_t MPQFile::read(void* dest, size_t bytes)
@@ -116,6 +116,6 @@ void MPQFile::seekRelative(int offset)
void MPQFile::close()
{
delete[] buffer;
buffer = 0;
buffer = nullptr;
eof = true;
}

View File

@@ -35,9 +35,9 @@ bool wdt_MAIN::prepareLoadedData()
WDT_file::WDT_file()
{
mphd = 0;
main = 0;
wmo = 0;
mphd = nullptr;
main = nullptr;
wmo = nullptr;
}
WDT_file::~WDT_file()
@@ -47,9 +47,9 @@ WDT_file::~WDT_file()
void WDT_file::free()
{
mphd = 0;
main = 0;
wmo = 0;
mphd = nullptr;
main = nullptr;
wmo = nullptr;
FileLoader::free();
}