CRUISE: Use nullptr

Using clang-tidy modernize-use-nullptr
This commit is contained in:
Orgad Shaneh 2021-11-13 23:40:20 +02:00 committed by Filippos Karapetis
parent 6a59febd46
commit 52e1aa78a0
25 changed files with 233 additions and 233 deletions

View file

@ -188,7 +188,7 @@ static void syncFilesDatabase(Common::Serializer &s) {
tmp = (fe.subData.ptr) ? 1 : 0;
s.syncAsUint32LE(tmp);
if (s.isLoading()) {
fe.subData.ptr = tmp ? (uint8 *)1 : 0;
fe.subData.ptr = tmp ? (uint8 *)1 : nullptr;
}
s.syncAsSint16LE(fe.subData.index);
@ -201,7 +201,7 @@ static void syncFilesDatabase(Common::Serializer &s) {
tmp = (fe.subData.ptrMask) ? 1 : 0;
s.syncAsUint32LE(tmp);
if (s.isLoading()) {
fe.subData.ptrMask = tmp ? (uint8 *)1 : 0;
fe.subData.ptrMask = tmp ? (uint8 *)1 : nullptr;
}
s.syncAsUint16LE(fe.subData.resourceType);
@ -276,8 +276,8 @@ static void syncOverlays2(Common::Serializer &s) {
} else {
// Loading code
ovlRestoreData[i]._sBssSize = ovlRestoreData[i]._sNumObj = 0;
ovlRestoreData[i]._pBss = NULL;
ovlRestoreData[i]._pObj = NULL;
ovlRestoreData[i]._pBss = nullptr;
ovlRestoreData[i]._pObj = nullptr;
if (overlayTable[i].alreadyLoaded) {
s.syncAsSint16LE(ovlRestoreData[i]._sBssSize);
@ -352,7 +352,7 @@ void syncScript(Common::Serializer &s, scriptInstanceStruct *entry) {
}
if (s.isLoading()) {
ptr->nextScriptPtr = NULL;
ptr->nextScriptPtr = nullptr;
entry->nextScriptPtr = ptr;
entry = ptr;
} else {
@ -374,7 +374,7 @@ static void syncCell(Common::Serializer &s) {
t = t->next;
}
} else {
cellHead.next = NULL; // Not in ASM code, but I guess the variable is defaulted in the EXE
cellHead.next = nullptr; // Not in ASM code, but I guess the variable is defaulted in the EXE
}
s.syncAsSint16LE(chunkCount);
@ -413,7 +413,7 @@ static void syncCell(Common::Serializer &s) {
if (s.isSaving())
t = t->next;
else {
p->next = NULL;
p->next = nullptr;
t->next = p;
p->prev = cellHead.prev;
cellHead.prev = p;
@ -479,7 +479,7 @@ static void syncIncrust(Common::Serializer &s) {
if (s.isSaving())
pl = pl->next;
else {
t->next = NULL;
t->next = nullptr;
pl->next = t;
t->prev = pl1->prev;
pl1->prev = t;
@ -530,7 +530,7 @@ static void syncActors(Common::Serializer &s) {
if (s.isSaving())
ptr = ptr->next;
else {
p->next = NULL;
p->next = nullptr;
ptr->next = p;
p->prev = actorHead.prev;
actorHead.prev = p;
@ -580,7 +580,7 @@ static void syncCT(Common::Serializer &s) {
int v = (_vm->_polyStruct) ? 1 : 0;
s.syncAsSint32LE(v);
if (s.isLoading())
_vm->_polyStruct = (v != 0) ? &_vm->_polyStructNorm : NULL;
_vm->_polyStruct = (v != 0) ? &_vm->_polyStructNorm : nullptr;
if (v == 0)
// There is no further data to load or save
@ -602,7 +602,7 @@ static void syncCT(Common::Serializer &s) {
if (s.isLoading())
// Set up the pointer for the next structure
persoTable[i] = (v == 0) ? NULL : (persoStruct *)mallocAndZero(sizeof(persoStruct));
persoTable[i] = (v == 0) ? nullptr : (persoStruct *)mallocAndZero(sizeof(persoStruct));
if (v != 0)
syncPerso(s, *persoTable[i]);
@ -644,7 +644,7 @@ void resetPreload() {
if (strlen(preloadData[i].name)) {
if (preloadData[i].ptr) {
MemFree(preloadData[i].ptr);
preloadData[i].ptr = NULL;
preloadData[i].ptr = nullptr;
}
strcpy(preloadData[i].name, "");
preloadData[i].nofree = 0;
@ -656,7 +656,7 @@ void unloadOverlay(const char*name, int overlayNumber) {
releaseOverlay(name);
strcpy(overlayTable[overlayNumber].overlayName, "");
overlayTable[overlayNumber].ovlData = NULL;
overlayTable[overlayNumber].ovlData = nullptr;
overlayTable[overlayNumber].alreadyLoaded = 0;
}
@ -708,7 +708,7 @@ void initVars() {
soundList[3].frameNum = -1;
for (unsigned long int i = 0; i < 8; i++) {
menuTable[i] = NULL;
menuTable[i] = nullptr;
}
for (unsigned long int i = 0; i < 2000; i++) {
@ -720,8 +720,8 @@ void initVars() {
}
for (unsigned long int i = 0; i < NUM_FILE_ENTRIES; i++) {
filesDatabase[i].subData.ptr = NULL;
filesDatabase[i].subData.ptrMask = NULL;
filesDatabase[i].subData.ptr = nullptr;
filesDatabase[i].subData.ptrMask = nullptr;
}
initBigVar3();
@ -784,7 +784,7 @@ Common::Error saveSavegameData(int saveGameIdx, const Common::String &saveName)
const char *filename = _vm->getSavegameFile(saveGameIdx);
Common::SaveFileManager *saveMan = g_system->getSavefileManager();
Common::OutSaveFile *f = saveMan->openForSaving(filename);
if (f == NULL)
if (f == nullptr)
return Common::kNoGameDataFoundError;
// Save the savegame header
@ -798,7 +798,7 @@ Common::Error saveSavegameData(int saveGameIdx, const Common::String &saveName)
return Common::kWritingFailed;
} else {
// Create the remainder of the savegame
Common::Serializer s(NULL, f);
Common::Serializer s(nullptr, f);
DoSync(s);
f->finalize();
@ -814,7 +814,7 @@ Common::Error loadSavegameData(int saveGameIdx) {
Common::SaveFileManager *saveMan = g_system->getSavefileManager();
Common::InSaveFile *f = saveMan->openForLoading(_vm->getSavegameFile(saveGameIdx));
if (f == NULL) {
if (f == nullptr) {
printInfoBlackBox("Savegame not found...");
waitForPlayerInput();
return Common::kNoGameDataFoundError;
@ -833,7 +833,7 @@ Common::Error loadSavegameData(int saveGameIdx) {
}
// Synchronise the remaining data of the savegame
Common::Serializer s(f, NULL);
Common::Serializer s(f, nullptr);
DoSync(s);
delete f;
@ -841,7 +841,7 @@ Common::Error loadSavegameData(int saveGameIdx) {
// Post processing
for (int j = 0; j < 64; j++)
preloadData[j].ptr = NULL;
preloadData[j].ptr = nullptr;
for (int j = 1; j < numOfLoadedOverlay; j++) {
if (overlayTable[j].alreadyLoaded) {
@ -892,8 +892,8 @@ Common::Error loadSavegameData(int saveGameIdx) {
;
for (int k = i; k < j; k++) {
filesDatabase[k].subData.ptr = NULL;
filesDatabase[k].subData.ptrMask = NULL;
filesDatabase[k].subData.ptr = nullptr;
filesDatabase[k].subData.ptrMask = nullptr;
}
/*if (j < 2) {
@ -903,8 +903,8 @@ Common::Error loadSavegameData(int saveGameIdx) {
if (strlen(filesDatabase[i].subData.name) > 0) {
loadFileRange(filesDatabase[i].subData.name, filesDatabase[i].subData.index, i, j - i);
} else {
filesDatabase[i].subData.ptr = NULL;
filesDatabase[i].subData.ptrMask = NULL;
filesDatabase[i].subData.ptr = nullptr;
filesDatabase[i].subData.ptrMask = nullptr;
}
i = j - 1;