mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-11 05:04:40 -04:00
Fix JUT_ASSERT and several other macros (#2711)
* Fix JUT_ASSERT to be a nested define * Switch names that appear in asserts to be constants instead of defines * Replace `0` in asserts with `NULL` or `FALSE` * Fix fpclassify * Fix ARRAY_SIZE * Use G_CM3D_F_INF * More fixes for fpclassify * Remove FLOAT_LABEL * Remove incorrect FLAG_ON macro * Remove UNK_BSS macro * Silence clangd unused header warning for PCH
This commit is contained in:
@@ -186,7 +186,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
TInst* tinst = header->mOffsets.mInstOffset[i].ptr(header);
|
||||
if (tinst != NULL) {
|
||||
JASBasicInst* instp = new (heap, 0) JASBasicInst();
|
||||
JUT_ASSERT(368, instp != 0);
|
||||
JUT_ASSERT(368, instp != NULL);
|
||||
instp->setVolume(tinst->mVolume);
|
||||
instp->setPitch(tinst->mPitch);
|
||||
|
||||
@@ -199,7 +199,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
instp->setOsc(osc_idx, osc);
|
||||
} else {
|
||||
osc = new (heap, 0) JASOscillator::Data();
|
||||
JUT_ASSERT(386, osc != 0);
|
||||
JUT_ASSERT(386, osc != NULL);
|
||||
osc->mTarget = tosc->mTarget;
|
||||
osc->_04 = tosc->field_0x4;
|
||||
|
||||
@@ -208,7 +208,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
const JASOscillator::Point* endPtr = getOscTableEndPtr(points);
|
||||
int size = endPtr - points;
|
||||
JASOscillator::Point* table = new (heap, 0) JASOscillator::Point[size];
|
||||
JUT_ASSERT(396, table != 0);
|
||||
JUT_ASSERT(396, table != NULL);
|
||||
JASCalc::bcopy(points, table, size * sizeof(JASOscillator::Point));
|
||||
osc->mTable = table;
|
||||
} else {
|
||||
@@ -220,7 +220,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
const JASOscillator::Point* endPtr = getOscTableEndPtr(points);
|
||||
int size = endPtr - points;
|
||||
JASOscillator::Point* table = new (heap, 0) JASOscillator::Point[size];
|
||||
JUT_ASSERT(409, table != 0);
|
||||
JUT_ASSERT(409, table != NULL);
|
||||
JASCalc::bcopy(points, table, size * sizeof(JASOscillator::Point));
|
||||
osc->_0C = table;
|
||||
} else {
|
||||
@@ -255,7 +255,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
TPerc* tperc = header->mOffsets.mPercOffset[i].ptr(header);
|
||||
if (tperc != NULL) {
|
||||
JASDrumSet* setp = new (heap, 0) JASDrumSet();
|
||||
JUT_ASSERT(509, setp != 0);
|
||||
JUT_ASSERT(509, setp != NULL);
|
||||
setp->newPercArray(0x80, heap);
|
||||
|
||||
for (int j = 0; j < 0x80; j++) {
|
||||
|
||||
@@ -40,7 +40,7 @@ void JASBasicWaveBank::setGroupCount(u32 param_0, JKRHeap* param_1) {
|
||||
delete[] mWaveGroupArray;
|
||||
mGroupCount = param_0;
|
||||
mWaveGroupArray = new(param_1, 0) TWaveGroup[param_0];
|
||||
JUT_ASSERT(62, mWaveGroupArray != 0);
|
||||
JUT_ASSERT(62, mWaveGroupArray != NULL);
|
||||
for (int i = 0; i < mGroupCount; i++) {
|
||||
mWaveGroupArray[i].mBank = this;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ void JASBasicWaveBank::setGroupCount(u32 param_0, JKRHeap* param_1) {
|
||||
void JASBasicWaveBank::setWaveTableSize(u32 param_0, JKRHeap* param_1) {
|
||||
delete[] mWaveTable;
|
||||
mWaveTable = new(param_1, 0) TWaveHandle[param_0];
|
||||
JUT_ASSERT(92, mWaveTable != 0);
|
||||
JUT_ASSERT(92, mWaveTable != NULL);
|
||||
mHandleCount = param_0;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ void JASBasicWaveBank::TWaveGroup::setWaveCount(u32 param_0, JKRHeap* param_1) {
|
||||
delete[] mCtrlWaveArray;
|
||||
mWaveCount = param_0;
|
||||
mCtrlWaveArray = new(param_1, 0) TGroupWaveInfo[param_0];
|
||||
JUT_ASSERT(255, mCtrlWaveArray != 0);
|
||||
JUT_ASSERT(255, mCtrlWaveArray != NULL);
|
||||
}
|
||||
|
||||
/* 80298B04-80298B2C 293444 0028+00 1/0 0/0 0/0 .text
|
||||
|
||||
@@ -32,7 +32,7 @@ void JASHeap::initRootHeap(void* param_0, u32 param_1) {
|
||||
|
||||
/* 8029021C-802903F4 28AB5C 01D8+00 0/0 2/2 0/0 .text alloc__7JASHeapFP7JASHeapUl */
|
||||
bool JASHeap::alloc(JASHeap* mother, u32 param_1) {
|
||||
JUT_ASSERT(120, mother != 0);
|
||||
JUT_ASSERT(120, mother != NULL);
|
||||
JASMutexLock lock(&mMutex);
|
||||
if (isAllocated()) {
|
||||
#ifdef DEBUG
|
||||
@@ -147,8 +147,8 @@ bool JASHeap::free() {
|
||||
* insertChild__7JASHeapFP7JASHeapP7JASHeapPvUlb */
|
||||
// NONMATCHING regalloc
|
||||
void JASHeap::insertChild(JASHeap* heap, JASHeap* next, void* param_2, u32 param_3, bool param_4) {
|
||||
JUT_ASSERT(537, heap != 0);
|
||||
JUT_ASSERT(538, next == 0 || &mTree == next->mTree.getParent());
|
||||
JUT_ASSERT(537, heap != NULL);
|
||||
JUT_ASSERT(538, next == NULL || &mTree == next->mTree.getParent());
|
||||
JASMutexLock lock(&mMutex);
|
||||
if (!param_4) {
|
||||
JSUTreeIterator<JASHeap> it;
|
||||
|
||||
@@ -138,7 +138,7 @@ JAUSoundTable* JAUSection::newSoundTable(void const* bst, u32 param_1, bool para
|
||||
JUT_ASSERT(286, isBuilding());
|
||||
JUT_ASSERT(287, bst);
|
||||
JUT_ASSERT(288, asSectionHeap() == this);
|
||||
JUT_ASSERT(289, sectionHeap_->sectionHeapData_.soundTable == 0);
|
||||
JUT_ASSERT(289, sectionHeap_->sectionHeapData_.soundTable == NULL);
|
||||
{
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
void const* bstDst = bst;
|
||||
@@ -161,7 +161,7 @@ JAUSoundNameTable* JAUSection::newSoundNameTable(void const* bstn, u32 param_1,
|
||||
JUT_ASSERT(316, isBuilding());
|
||||
JUT_ASSERT(317, bstn);
|
||||
JUT_ASSERT(318, asSectionHeap() == this);
|
||||
JUT_ASSERT(319, sectionHeap_->sectionHeapData_.soundNameTable == 0);
|
||||
JUT_ASSERT(319, sectionHeap_->sectionHeapData_.soundNameTable == NULL);
|
||||
{
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
void const* bstnDst = bstn;
|
||||
@@ -183,7 +183,7 @@ JAIStreamDataMgr* JAUSection::newStreamFileTable(void const* param_0, bool param
|
||||
JUT_ASSERT(345, asSectionHeap() == this);
|
||||
JUT_ASSERT(346, isOpen());
|
||||
JUT_ASSERT(347, isBuilding());
|
||||
JUT_ASSERT(348, sectionHeap_->sectionHeapData_.streamDataMgr_ == 0);
|
||||
JUT_ASSERT(348, sectionHeap_->sectionHeapData_.streamDataMgr_ == NULL);
|
||||
{
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
JAIStreamDataMgr* r28 = NULL;
|
||||
@@ -207,7 +207,7 @@ JAIStreamDataMgr* JAUSection::newStreamFileTable(void const* param_0, bool param
|
||||
/* 802A5500-802A5598 29FE40 0098+00 0/0 1/1 0/0 .text newSeSeqCollection__10JAUSectionFPCvUl */
|
||||
JAISeqDataMgr* JAUSection::newSeSeqCollection(void const* bsc, u32 param_1) {
|
||||
// JUT_ASSERT(398, asSectionHeap() == this);
|
||||
JUT_ASSERT(399, sectionHeap_->sectionHeapData_.seSeqDataMgr_ == 0);
|
||||
JUT_ASSERT(399, sectionHeap_->sectionHeapData_.seSeqDataMgr_ == NULL);
|
||||
if (param_1) {
|
||||
bsc = newCopy(bsc, param_1, 4);
|
||||
}
|
||||
@@ -340,7 +340,7 @@ JASBank* JAUSection::newBank(void const* param_0, u32 param_1) {
|
||||
JUT_ASSERT(647, isOpen());
|
||||
JUT_ASSERT(648, isBuilding());
|
||||
JASWaveBank* waveBank = sectionHeap_->getWaveBankTable().getWaveBank(param_1);
|
||||
JUT_ASSERT(650, waveBank != 0);
|
||||
JUT_ASSERT(650, waveBank != NULL);
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
u32 bank_no = JASBNKParser::getBankNumber(param_0);
|
||||
s32 r25 = getHeap_()->getFreeSize();
|
||||
@@ -368,7 +368,7 @@ JASVoiceBank* JAUSection::newVoiceBank(u32 bank_no, u32 param_1) {
|
||||
JUT_ASSERT(685, isOpen());
|
||||
JUT_ASSERT(686, isBuilding());
|
||||
JASWaveBank* waveBank = sectionHeap_->getWaveBankTable().getWaveBank(param_1);
|
||||
JUT_ASSERT(688, waveBank != 0);
|
||||
JUT_ASSERT(688, waveBank != NULL);
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
JASBank* voiceBank = new JASVoiceBank();
|
||||
JASVoiceBank* voiceBank2 = (JASVoiceBank*)voiceBank;
|
||||
@@ -392,7 +392,7 @@ JASVoiceBank* JAUSection::newVoiceBank(u32 bank_no, u32 param_1) {
|
||||
bool JAUSection::beginNewBankTable(u32 param_0, u32 param_1) {
|
||||
JUT_ASSERT(714, isOpen());
|
||||
JUT_ASSERT(715, isBuilding());
|
||||
JUT_ASSERT(716, buildingBankTable_ == 0);
|
||||
JUT_ASSERT(716, buildingBankTable_ == NULL);
|
||||
JAUBankTableLink* bankTableLink = NULL;
|
||||
{
|
||||
TPushCurrentHeap push(getHeap_());
|
||||
|
||||
Reference in New Issue
Block a user