summaryrefslogtreecommitdiff
path: root/src/JSystem/JKernel
diff options
context:
space:
mode:
authorLuke Street <luke@street.dev>2026-02-28 21:19:17 -0700
committerGitHub <noreply@github.com>2026-02-28 20:19:17 -0800
commit6a48380461bc9baabe1706ba57ca0cedfa2d0c51 (patch)
tree593e054cfcb0250e63917c58b445a7e1f025a023 /src/JSystem/JKernel
parentb5d3b8c059c10711370437f7db7539cd90f1cb29 (diff)
More GCC compatibility/warning fixes (#3118)
* Wrap >4-char literals in a MULTI_CHAR macro Modern compilers do not support CW's non-standard behavior with >4 char literals. We can, however, use a constexpr function to compute the u64 values directly. This leaves <=4 char literals unchanged. * Replace non-pointer usages of NULL with 0 * Define NULL to nullptr on C++11 and above * Fix more -Wpointer-arith and -Woverflow warnings * Replace u32/s32 with uintptr_t/intptr_t where appropriate * JSUOutputStream: Overload all standard int types
Diffstat (limited to 'src/JSystem/JKernel')
-rw-r--r--src/JSystem/JKernel/JKRAram.cpp2
-rw-r--r--src/JSystem/JKernel/JKRAramArchive.cpp4
-rw-r--r--src/JSystem/JKernel/JKRDvdFile.cpp2
-rw-r--r--src/JSystem/JKernel/JKRFileCache.cpp2
-rw-r--r--src/JSystem/JKernel/JKRHeap.cpp2
-rw-r--r--src/JSystem/JKernel/JKRThread.cpp2
6 files changed, 7 insertions, 7 deletions
diff --git a/src/JSystem/JKernel/JKRAram.cpp b/src/JSystem/JKernel/JKRAram.cpp
index d6bcec7f6b..64f14da1a7 100644
--- a/src/JSystem/JKernel/JKRAram.cpp
+++ b/src/JSystem/JKernel/JKRAram.cpp
@@ -69,7 +69,7 @@ JKRAram::JKRAram(u32 audio_buffer_size, u32 audio_graph_size, s32 priority)
if (mAramMemorySize) {
mAramMemoryPtr = ARAlloc(mAramMemorySize);
} else {
- mAramMemoryPtr = NULL;
+ mAramMemoryPtr = 0;
}
OS_REPORT("ARAM audio area %08x: %08x\n", mAudioMemoryPtr, mAudioMemorySize);
diff --git a/src/JSystem/JKernel/JKRAramArchive.cpp b/src/JSystem/JKernel/JKRAramArchive.cpp
index 235fb07515..41a88bac90 100644
--- a/src/JSystem/JKernel/JKRAramArchive.cpp
+++ b/src/JSystem/JKernel/JKRAramArchive.cpp
@@ -205,7 +205,7 @@ void* JKRAramArchive::fetchResource(SDIFileEntry* pEntry, u32* pOutSize) {
&outBuf);
*pOutSize = size;
- if (size == NULL) {
+ if (size == 0) {
return NULL;
}
@@ -240,7 +240,7 @@ void* JKRAramArchive::fetchResource(void* buffer, u32 bufferSize, SDIFileEntry*
} else {
if (compression == COMPRESSION_YAZ0) {
u32 expandSize = this->getExpandSize(pEntry);
- if (expandSize != NULL) {
+ if (expandSize != 0) {
size = expandSize;
}
}
diff --git a/src/JSystem/JKernel/JKRDvdFile.cpp b/src/JSystem/JKernel/JKRDvdFile.cpp
index 07bd9505a5..c56141f900 100644
--- a/src/JSystem/JKernel/JKRDvdFile.cpp
+++ b/src/JSystem/JKernel/JKRDvdFile.cpp
@@ -125,7 +125,7 @@ s32 JKRDvdFile::sync(void) {
void JKRDvdFile::doneProcess(s32 id, DVDFileInfo* fileInfo) {
// fileInfo->field_0x3c looks like some kind of user pointer?
JKRDvdFile* dvdFile = *(JKRDvdFile**)((u8*)fileInfo + 0x3c);
- OSSendMessage(&dvdFile->mMessageQueue2, (OSMessage)id, OS_MESSAGE_NOBLOCK);
+ OSSendMessage(&dvdFile->mMessageQueue2, (OSMessage)(intptr_t)id, OS_MESSAGE_NOBLOCK);
}
s32 JKRDvdFile::getFileSize(void) const {
diff --git a/src/JSystem/JKernel/JKRFileCache.cpp b/src/JSystem/JKernel/JKRFileCache.cpp
index d0162d95e5..4579a9ee88 100644
--- a/src/JSystem/JKernel/JKRFileCache.cpp
+++ b/src/JSystem/JKernel/JKRFileCache.cpp
@@ -192,7 +192,7 @@ u32 JKRFileCache::readResource(void* dst, u32 dstLength, u32, const char* path)
if (findFile(finalPath, path)) {
return readResource(dst, dstLength, filePath);
}
- return NULL;
+ return 0;
}
void JKRFileCache::removeResourceAll(void) {
diff --git a/src/JSystem/JKernel/JKRHeap.cpp b/src/JSystem/JKernel/JKRHeap.cpp
index 8655a80ae3..eb4d7083c6 100644
--- a/src/JSystem/JKernel/JKRHeap.cpp
+++ b/src/JSystem/JKernel/JKRHeap.cpp
@@ -349,7 +349,7 @@ JKRHeap* JKRHeap::findAllHeap(void* ptr) const {
return NULL;
}
-void JKRHeap::dispose_subroutine(u32 begin, u32 end) {
+void JKRHeap::dispose_subroutine(uintptr_t begin, uintptr_t end) {
JSUListIterator<JKRDisposer> next_iterator((JSULink<JKRDisposer>*)NULL);
JSUListIterator<JKRDisposer> it = mDisposerList.getFirst();
while (it != mDisposerList.getEnd()) {
diff --git a/src/JSystem/JKernel/JKRThread.cpp b/src/JSystem/JKernel/JKRThread.cpp
index 918f1012fc..cb5055012a 100644
--- a/src/JSystem/JKernel/JKRThread.cpp
+++ b/src/JSystem/JKernel/JKRThread.cpp
@@ -73,7 +73,7 @@ void JKRThread::setCommon_mesgQueue(JKRHeap* heap, int message_count) {
sThreadList.append(&mThreadListLink);
mCurrentHeap = NULL;
- mCurrentHeapError = NULL;
+ mCurrentHeapError = 0;
}
void JKRThread::setCommon_heapSpecified(JKRHeap* heap, u32 stack_size, int param_3) {