Fix pointer-integer comparisons & conversions

/root/cemu/src/Cafe/OS/libs/coreinit/coreinit_Callbacks.cpp:1:9:
warning: #pragma once in main file [-Wpragma-once-outside-header]
 #pragma once

/root/cemu/src/Cafe/OS/libs/coreinit/coreinit_MemoryMapping.cpp:37:12:
warning: implicit conversion of NULL constant to 'MPTR' (aka 'unsigned
 int') [-Wnull-conversion]
                  return NULL;
                  ~~~~~~ ^~~~
                         0

/root/cemu/src/Cafe/OS/libs/coreinit/coreinit_MEM_BlockHeap.cpp:473:45:
warning: comparison between NULL and non-pointer ('uint32' (aka 'unsigned
int') and NULL) [-Wnull-arithmetic]
            if (_swapEndianU32(block->previousBlock) != NULL)
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~

/root/cemu/src/Cafe/OS/libs/snd_core/ax_ist.cpp:102:36: warning: implicit
conversion of NULL constant to 'MPTR' (aka 'unsigned int')
[-Wnull-conversion]
        __AXDeviceFinalMixCallback[i] = NULL;
                                      ~ ^~~~
                                        0
This commit is contained in:
bitscher 2022-09-03 18:05:36 -07:00
parent fb551ffd0d
commit 062cfaf325
4 changed files with 5 additions and 7 deletions

View file

@ -1,5 +1,3 @@
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
#include "util/helpers/fspinlock.h"

View file

@ -470,7 +470,7 @@ namespace coreinit
// mark current block as free
block->isFree = _swapEndianU32(1);
// attempt to merge with previous block
if (_swapEndianU32(block->previousBlock) != NULL)
if (_swapEndianU32(block->previousBlock) != MPTR_NULL)
{
MPTR previousBlockMPTR = _swapEndianU32(block->previousBlock);
MEMBlockHeapTrackDEPR* previousBlock = (MEMBlockHeapTrackDEPR*)memory_getPointerFromVirtualOffset(previousBlockMPTR);
@ -494,7 +494,7 @@ namespace coreinit
}
}
// attempt to merge with next block
if (_swapEndianU32(block->nextBlock) != NULL)
if (_swapEndianU32(block->nextBlock) != MPTR_NULL)
{
MPTR nextBlockMPTR = _swapEndianU32(block->nextBlock);
MEMBlockHeapTrackDEPR* nextBlock = (MEMBlockHeapTrackDEPR*)memory_getPointerFromVirtualOffset(nextBlockMPTR);

View file

@ -34,7 +34,7 @@ namespace coreinit
{
debug_printf("coreinitVirtualMemory_alloc(): Unable to allocate memory\n");
debugBreakpoint();
return NULL;
return MPTR_NULL;
}
// check for overlapping regions
OSVirtMemory* virtMemItr = virtualMemoryList;
@ -66,7 +66,7 @@ namespace coreinit
return currentAddress;
}
}
return NULL;
return MPTR_NULL;
}
void coreinitExport_OSGetAvailPhysAddrRange(PPCInterpreter_t* hCPU)

View file

@ -99,7 +99,7 @@ namespace snd_core
}
coreinit::OSInitMutexEx(__AXAppFrameCallbackMutex.GetPtr(), NULL);
for (sint32 i = 0; i < AX_DEV_COUNT; i++)
__AXDeviceFinalMixCallback[i] = NULL;
__AXDeviceFinalMixCallback[i] = MPTR_NULL;
}
sint32 AXRegisterAppFrameCallback(MPTR funcAddr)