From 3a2fa13e5c59ccc392cf5e4a454698996997b620 Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Tue, 9 Aug 2022 13:13:33 -0400 Subject: [PATCH] Fixed all lib file warnings (#240) --- lib/src/al/alHeapDBAlloc.c | 3 ++- lib/src/al/alSynSetFXMix.c | 4 ++++ lib/src/al/load.c | 17 ++++++++--------- lib/src/al/resample.c | 2 ++ lib/src/libc/rmonPrintf.c | 7 +++---- lib/src/libc/xprintf.c | 2 +- lib/src/os/contpfs.c | 5 ++--- 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/src/al/alHeapDBAlloc.c b/lib/src/al/alHeapDBAlloc.c index b842ff64..a3824a60 100644 --- a/lib/src/al/alHeapDBAlloc.c +++ b/lib/src/al/alHeapDBAlloc.c @@ -2,8 +2,9 @@ /* RAM_POS: 0x800C77F0 */ #include "audio_internal.h" +#include "macros.h" -void *alHeapDBAlloc(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size) { +void *alHeapDBAlloc(UNUSED u8 *file, UNUSED s32 line, ALHeap *hp, s32 num, s32 size) { s32 bytes; u8 *ptr = 0; diff --git a/lib/src/al/alSynSetFXMix.c b/lib/src/al/alSynSetFXMix.c index cb9b32f4..11a4859f 100644 --- a/lib/src/al/alSynSetFXMix.c +++ b/lib/src/al/alSynSetFXMix.c @@ -45,11 +45,15 @@ void alSynSetFXMix(ALSynth *synth, ALVoice *v, u8 fxmix) update->delta = synth->paramSamples + v->pvoice->offset; update->type = AL_FILTER_SET_FXAMT; +//Ignore GCC warnings for this line, as there's no other way to match this. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" //Differs from ultralib if (fxmix < 0) update->data.i = -fxmix; else update->data.i = fxmix; +#pragma GCC diagnostic pop update->next = 0; diff --git a/lib/src/al/load.c b/lib/src/al/load.c index 479760a0..782f0ea5 100644 --- a/lib/src/al/load.c +++ b/lib/src/al/load.c @@ -40,7 +40,7 @@ extern u32 cnt_index, adpcm_num, adpcm_cnt, adpcm_max, adpcm_min, lastCnt[]; static Acmd *_decodeChunk(Acmd *ptr, ALLoadFilter *f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags); -Acmd *alAdpcmPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p) +Acmd *alAdpcmPull(void *filter, s16 *outp, s32 outCount, UNUSED s32 sampleOffset, Acmd *p) { Acmd *ptr = p; s16 inp; @@ -70,7 +70,7 @@ Acmd *alAdpcmPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd aLoadADPCM(ptr++, f->bookSize, K0_TO_PHYS(f->table->waveInfo.adpcmWave.book->book)); - looped = (outCount + f->sample > f->loop.end) && (f->loop.count != 0); + looped = ((u32)(outCount + f->sample) > f->loop.end) && (f->loop.count != 0); if (looped) nSam = f->loop.end - f->sample; else @@ -127,13 +127,13 @@ Acmd *alAdpcmPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd * -1 is loop forever - the loop count is not exact now * for small loops! */ - if ((f->loop.count != -1) && (f->loop.count != 0)) + if ((f->loop.count != -1U) && (f->loop.count != 0)) f->loop.count--; /* * What's left to compute. */ - nSam = MIN(outCount, f->loop.end - f->loop.start); + nSam = MIN((u32)outCount, f->loop.end - f->loop.start); tsam = nSam - ADPCMFSIZE + f->lastsam; if (tsam<0) tsam = 0; nframes = (tsam+ADPCMFSIZE-1)>>LFSAMPLES; @@ -209,7 +209,7 @@ Acmd *alAdpcmPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd return ptr; } -Acmd *alRaw16Pull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p) +Acmd *alRaw16Pull(void *filter, s16 *outp, s32 outCount, UNUSED s32 sampleOffset, Acmd *p) { Acmd *ptr = p; s32 nbytes; @@ -222,12 +222,11 @@ Acmd *alRaw16Pull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd s32 op; ALLoadFilter *f = (ALLoadFilter *)filter; - ALFilter *a = (ALFilter *) filter; if (outCount == 0) return ptr; - if ((outCount + f->sample > f->loop.end) && (f->loop.count != 0)){ + if (((u32)(outCount + f->sample) > f->loop.end) && (f->loop.count != 0)){ nSam = f->loop.end - f->sample; nbytes = nSam<<1; @@ -261,13 +260,13 @@ Acmd *alRaw16Pull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset, Acmd /* * -1 is loop forever */ - if ((f->loop.count != -1) && (f->loop.count != 0)) + if ((f->loop.count != -1U) && (f->loop.count != 0)) f->loop.count--; /* * What to compute. */ - nSam = MIN(outCount, f->loop.end - f->loop.start); + nSam = MIN((u32)outCount, f->loop.end - f->loop.start); nbytes = nSam<<1; /* diff --git a/lib/src/al/resample.c b/lib/src/al/resample.c index 2ecf046a..9f1b9ac6 100644 --- a/lib/src/al/resample.c +++ b/lib/src/al/resample.c @@ -24,6 +24,8 @@ #include "types.h" #include "macros.h" #include "audio_internal.h" +#include "PR/os.h" +#include "PR/abi.h" // TODO: this comes from a header #ident "$Revision: 1.49 $" diff --git a/lib/src/libc/rmonPrintf.c b/lib/src/libc/rmonPrintf.c index 0ef8a92b..6c23cd91 100644 --- a/lib/src/libc/rmonPrintf.c +++ b/lib/src/libc/rmonPrintf.c @@ -10,8 +10,8 @@ /** * This gets called inside of _PrintF, but it is just a fake pointer returned */ -static void *is_proutSyncPrintf(void *str, const char *buf, size_t n) { - return ((void *) 1); /* return a fake pointer so that it's not NULL */ +static char *is_proutSyncPrintf(UNUSED char *str, UNUSED const char *buf, UNUSED size_t n) { + return ((char *) 1); /* return a fake pointer so that it's not NULL */ } /** @@ -20,9 +20,8 @@ static void *is_proutSyncPrintf(void *str, const char *buf, size_t n) { * Could still be an earlier version of osSyncPrintf */ void rmonPrintf(const char *format, ...) { - s32 written; va_list args; va_start(args, format); - written = _Printf(is_proutSyncPrintf, NULL, format, args); + _Printf(is_proutSyncPrintf, NULL, format, args); va_end(args); } diff --git a/lib/src/libc/xprintf.c b/lib/src/libc/xprintf.c index d8d99026..bef41edc 100644 --- a/lib/src/libc/xprintf.c +++ b/lib/src/libc/xprintf.c @@ -70,7 +70,7 @@ s32 _Printf(outfun prout, char *dst, const char *fmt, va_list args) { x.length = 'L'; fmt_ptr++; } - _Putfld(&x, &args, *fmt_ptr, ac); + _Putfld(&x, (va_list *)&args, *fmt_ptr, ac); x.width -= x.n0 + x.num_leading_zeros + x.part2_len + x.num_mid_zeros + x.part3_len + x.num_trailing_zeros; if (!(x.flags & FLAGS_MINUS)) diff --git a/lib/src/os/contpfs.c b/lib/src/os/contpfs.c index 592e5ab8..c0360d78 100644 --- a/lib/src/os/contpfs.c +++ b/lib/src/os/contpfs.c @@ -208,10 +208,9 @@ s32 __osCheckId(OSPfs *pfs) ret = __osContRamRead(pfs->queue, pfs->channel, 1, (u8*)temp); if (ret != 0) { - if (ret != 2) + if (ret != PFS_ERR_NEW_PACK) return ret; - else - ERRCK(__osContRamRead(pfs->queue, pfs->channel, 1, (u8*)temp)); + ERRCK(__osContRamRead(pfs->queue, pfs->channel, 1, (u8*)temp)); } for (k = 0; k < ARRLEN(temp); k++)