diff --git a/include/PRinternal/macros.h b/include/PRinternal/macros.h index 23d2b7d..1bdfc58 100644 --- a/include/PRinternal/macros.h +++ b/include/PRinternal/macros.h @@ -9,6 +9,8 @@ #define UNUSED __attribute__((unused)) +#define FALLTHROUGH __attribute__((fallthrough)) + #ifndef __GNUC__ #define __attribute__(x) #endif diff --git a/src/audio/cseq.c b/src/audio/cseq.c index 13f72eb..0209d7d 100644 --- a/src/audio/cseq.c +++ b/src/audio/cseq.c @@ -59,7 +59,7 @@ void alCSeqNew(ALCSeq* seq, u8* ptr) { void alCSeqNextEvent(ALCSeq* seq, ALEvent* evt) { u32 i; u32 firstTime = 0xFFFFFFFF; - u32 firstTrack; + u32 firstTrack = 0; u32 lastTicks = seq->lastDeltaTicks; #ifdef _DEBUG diff --git a/src/audio/csplayer.c b/src/audio/csplayer.c index 0f267a7..3b20674 100644 --- a/src/audio/csplayer.c +++ b/src/audio/csplayer.c @@ -43,6 +43,7 @@ #include "seqp.h" #include "cseqp.h" #include "cseq.h" +#include // TODO: this comes from a header #ident "$Revision: 1.17 $" static ALMicroTime __CSPVoiceHandler(void* node); @@ -534,7 +535,7 @@ static void __CSPHandleMIDIMsg(ALCSPlayer* seqp, ALEvent* event) { * velocity (Should never happen with compact midi sequence, * but could happen with real time midi.) */ - + FALLTHROUGH; case (AL_MIDI_NoteOff): vstate = __lookupVoice((ALSeqPlayer*)seqp, key, chan); ALFlagFailIf(!vstate, seqp->debugFlags & NOTE_OFF_ERR_MASK, ERR_ALSEQP_OFF_VOICE); diff --git a/src/audio/env.c b/src/audio/env.c index b3e39b5..fe1ce1d 100644 --- a/src/audio/env.c +++ b/src/audio/env.c @@ -482,7 +482,7 @@ static s16 _getRate(f64 vol, f64 tgt, s32 count, u16* ratel) { } } - a *= (a *= (a *= a)); + a = (a * a * a * a * a * a * a * a); s = (s16)a; *ratel = (s16)(0xffff * (a - (f32)s)); diff --git a/src/audio/load.c b/src/audio/load.c index 9ae078e..1ece2d5 100644 --- a/src/audio/load.c +++ b/src/audio/load.c @@ -64,7 +64,7 @@ Acmd* alAdpcmPull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd* inp = AL_DECODER_IN; 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 @@ -121,13 +121,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 != 0xFFFFFFFF) && (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; @@ -220,7 +220,7 @@ Acmd* alRaw16Pull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd* 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; @@ -254,13 +254,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 != 0xFFFFFFFF) && (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; /* @@ -418,6 +418,8 @@ s32 alLoadParam(void* filter, s32 paramID, void* param) { default: break; } + + return 0; } Acmd* _decodeChunk(Acmd* ptr, ALLoadFilter* f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags) { diff --git a/src/audio/seq.c b/src/audio/seq.c index 0e5b02f..3dfb7aa 100644 --- a/src/audio/seq.c +++ b/src/audio/seq.c @@ -240,8 +240,7 @@ void alSeqNewMarker(ALSeq* seq, ALSeqMarker* m, u32 ticks) { lastTicks = seq->lastTicks; break; } - - } while (seq->lastTicks < ticks); + } while ((u32)seq->lastTicks < ticks); m->curPtr = lastPtr; m->lastStatus = lastStatus; diff --git a/src/audio/seqplayer.c b/src/audio/seqplayer.c index 22f58fb..dd39434 100644 --- a/src/audio/seqplayer.c +++ b/src/audio/seqplayer.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "seqp.h" #include "seq.h" @@ -539,7 +540,7 @@ void __handleMIDIMsg(ALSeqPlayer* seqp, ALEvent* event) { * NOTE: intentional fall-through for note on with zero * velocity */ - + FALLTHROUGH; case (AL_MIDI_NoteOff): vstate = __lookupVoice(seqp, key, chan); ALFlagFailIf(!vstate, (seqp->debugFlags & NOTE_OFF_ERR_MASK), ERR_ALSEQP_OFF_VOICE); diff --git a/src/audio/sndplayer.c b/src/audio/sndplayer.c index c54d90d..276d4ef 100644 --- a/src/audio/sndplayer.c +++ b/src/audio/sndplayer.c @@ -39,7 +39,7 @@ void alSndpNew(ALSndPlayer* sndp, ALSndpConfig* c) { sState = (ALSoundState*)alHeapAlloc(c->heap, 1, c->maxSounds * sizeof(ALSoundState)); sndp->sndState = sState; - for (i = 0; i < c->maxSounds; i++) + for (i = 0; i < (u32)c->maxSounds; i++) sState[i].sound = 0; /* diff --git a/src/audio/synthesizer.c b/src/audio/synthesizer.c index 65c868d..bc6714e 100644 --- a/src/audio/synthesizer.c +++ b/src/audio/synthesizer.c @@ -250,11 +250,8 @@ void __freeParam(ALParam* param) { void _collectPVoices(ALSynth* drvr) { ALLink* dl; - PVoice* pv; while ((dl = drvr->pLameList.next) != 0) { - pv = (PVoice*)dl; - /* ### remove from mixer */ alUnlink(dl); diff --git a/src/error/kmcprintf.c b/src/error/kmcprintf.c index 3d9f536..efe165f 100644 --- a/src/error/kmcprintf.c +++ b/src/error/kmcprintf.c @@ -227,17 +227,16 @@ static void kmcErrorHandler(s16 code, s16 numArgs, ...); OSErrorHandler __kmcErrorHandler = kmcErrorHandler; static void kmcErrorHandler(s16 code, s16 numArgs, ...) { - int ans; va_list ap; - char* fmt; + const char* fmt; fmt = __os_error_message[code]; va_start(ap, numArgs); if (__kmc_pt_mode) { - ans = _Printf(kmc_proutSyncPrintf, NULL, fmt, ap); + _Printf(kmc_proutSyncPrintf, NULL, fmt, ap); } else { - ans = _Printf(proutSyncPrintf, NULL, fmt, ap); + _Printf(proutSyncPrintf, NULL, fmt, ap); } osSyncPrintf("\n"); diff --git a/src/gt/dumpturbo.c b/src/gt/dumpturbo.c index 3fcfbe7..08893f1 100644 --- a/src/gt/dumpturbo.c +++ b/src/gt/dumpturbo.c @@ -28,7 +28,7 @@ static u32 textures[TX_MAX] ALIGNED(0x8); static u32 numtextures; #define UNSEG_ADDR(sa) \ - ((u32*)(((globp) ? (((int)(sa) & 0x00ffffff) + globp->sp.segBases[(int)(sa) >> 24]) : (int)(sa)) | 0x80000000)) + ((u32*)(((globp) ? (((u32)(sa) & 0x00ffffff) + globp->sp.segBases[(u32)(sa) >> 24]) : (u32)(sa)) | 0x80000000)) #define PHYS(a) ((int)((int)(a) & 0x7fffffff)) #define UNPHYS(a) ((u32*)((int)(a) | 0x80000000)) @@ -38,7 +38,7 @@ static u32 numtextures; #define UCODE_SIZE_MAX (4096 * 1) void gtDumpTurbo(OSTask* tp, u8 flags) { - int i; + u32 i; gtGfx* gtlistp; gtGlobState* globp = 0; gtState* statep; @@ -53,17 +53,17 @@ void gtDumpTurbo(OSTask* tp, u8 flags) { #if 1 PRINTF("? %08x\n", PHYS(tp->t.ucode_boot)); - for (i = (int)tp->t.ucode_boot; i < (int)tp->t.ucode_boot + tp->t.ucode_boot_size; i += 4) { + for (i = (u32)tp->t.ucode_boot; i < (u32)(tp->t.ucode_boot + tp->t.ucode_boot_size); i += 4) { PRINTF("|%08x\n", (int)*((u32*)i)); } PRINTF("? %08x\n", PHYS(tp->t.ucode)); - for (i = (int)tp->t.ucode; i < (int)tp->t.ucode + UCODE_SIZE_MAX; i += 4) { + for (i = (u32)tp->t.ucode; i < (u32)(tp->t.ucode + UCODE_SIZE_MAX); i += 4) { PRINTF("|%08x\n", (int)*((u32*)i)); } PRINTF("? %08x\n", PHYS(tp->t.ucode_data)); - for (i = (int)tp->t.ucode_data; i < (int)tp->t.ucode_data + tp->t.ucode_data_size; i += 4) { + for (i = (u32)tp->t.ucode_data; i < (u32)(tp->t.ucode_data + tp->t.ucode_data_size); i += 4) { PRINTF("|%08x\n", (int)*((u32*)i)); } diff --git a/src/gt/gt.c b/src/gt/gt.c index fc32ae6..b992a84 100644 --- a/src/gt/gt.c +++ b/src/gt/gt.c @@ -36,7 +36,7 @@ * Set the cached RDP othermode word in the gt state structure. */ void gtStateSetOthermode(Gfx* om, gtStateOthermode_t mode, int data) { - int shift, length; + int shift = 0, length = 0; u32 mask; if (mode == GT_CLEAR) { /* special case */ diff --git a/src/gu/cosf.c b/src/gu/cosf.c index 2ee6ba4..0538c7e 100644 --- a/src/gu/cosf.c +++ b/src/gu/cosf.c @@ -37,15 +37,15 @@ /* coefficients for polynomial approximation of cos on +/- pi/2 */ static const du P[] = { - { 0x3ff00000, 0x00000000 }, { 0xbfc55554, 0xbc83656d }, { 0x3f8110ed, 0x3804c2a0 }, - { 0xbf29f6ff, 0xeea56814 }, { 0x3ec5dbdf, 0x0e314bfe }, + { { 0x3ff00000, 0x00000000 } }, { { 0xbfc55554, 0xbc83656d } }, { { 0x3f8110ed, 0x3804c2a0 } }, + { { 0xbf29f6ff, 0xeea56814 } }, { { 0x3ec5dbdf, 0x0e314bfe } }, }; -static const du rpi = { 0x3fd45f30, 0x6dc9c883 }; +static const du rpi = { { 0x3fd45f30, 0x6dc9c883 } }; -static const du pihi = { 0x400921fb, 0x50000000 }; +static const du pihi = { { 0x400921fb, 0x50000000 } }; -static const du pilo = { 0x3e6110b4, 0x611a6263 }; +static const du pilo = { { 0x3e6110b4, 0x611a6263 } }; static const fu zero = { 0x00000000 }; diff --git a/src/gu/guloadtile_bug.c b/src/gu/guloadtile_bug.c index eb12375..44ed627 100644 --- a/src/gu/guloadtile_bug.c +++ b/src/gu/guloadtile_bug.c @@ -30,12 +30,11 @@ void guDPLoadTextureTile(Gfx* temp, void* timg, int texl_fmt, int texl_size, int int shiftt) { int line; int tile_width, tile_height; /* - - * in texels - */ + * in texels + */ int dxt; - int sizeb; - int lineb; + int sizeb = 0; + int lineb = 0; int line_size; /* * in 64-bit words @@ -140,7 +139,6 @@ void guDPLoadTextureTile_4b(Gfx* temp, void* timg, int texl_fmt, int img_width, int line; int tile_width, tile_height; int dxt; - int sizeb; int lineb; int line_size; int count; @@ -150,7 +148,6 @@ void guDPLoadTextureTile_4b(Gfx* temp, void* timg, int texl_fmt, int img_width, tile_width = (lrs - uls + 1) >> 1; tile_height = lrt - ult + 1; - sizeb = G_IM_SIZ_8b_BYTES; lineb = G_IM_SIZ_8b_LINE_BYTES; line_size = ((tile_width * lineb) + 7) >> 3; dxt = CALC_DXT_4b(tile_width); diff --git a/src/gu/loadtextureblockmipmap.c b/src/gu/loadtextureblockmipmap.c index c6215f3..11bbdba 100644 --- a/src/gu/loadtextureblockmipmap.c +++ b/src/gu/loadtextureblockmipmap.c @@ -43,7 +43,7 @@ struct Tile { /* tram mipmaps */ static struct Tile mipmap[MM_MAX_LEVEL + 1] ALIGNED(0x8); -static struct texelSizeParams sizeParams[4] = { 16, 3, 1, 0, 8, 2, 2, 1, 4, 1, 4, 2, 2, 0, 8, 3 }; +static struct texelSizeParams sizeParams[4] = { { 16, 3, 1, 0 }, { 8, 2, 2, 1 }, { 4, 1, 4, 2 }, { 2, 0, 8, 3 } }; static int max_mipmap; static unsigned char* tram; @@ -493,7 +493,7 @@ int guLoadTextureBlockMipMap(Gfx** glistp, unsigned char* tbuf, Image* im, unsig /* * Add entries for texture loading and rendering in DL */ - stuffDisplayList(glistp, im, tbuf, startTile, pal, cms, cmt, masks, maskt, shifts, shiftt); + stuffDisplayList(glistp, im, (char*)tbuf, startTile, pal, cms, cmt, masks, maskt, shifts, shiftt); return errNo; } /* end guLoadTextureBlockMipMap */ @@ -532,7 +532,7 @@ static void stuffDisplayList(Gfx** glistp, Image* im, char* tbuf, unsigned char unsigned char shifts, unsigned char shiftt) { int tile; int Smask, Tmask; - int Sshift, Tshift; + int Sshift = 0, Tshift = 0; /* * set LOADTILE for loading texture diff --git a/src/gu/sinf.c b/src/gu/sinf.c index e127821..910db00 100644 --- a/src/gu/sinf.c +++ b/src/gu/sinf.c @@ -37,15 +37,15 @@ /* coefficients for polynomial approximation of sin on +/- pi/2 */ static const du P[] = { - { 0x3ff00000, 0x00000000 }, { 0xbfc55554, 0xbc83656d }, { 0x3f8110ed, 0x3804c2a0 }, - { 0xbf29f6ff, 0xeea56814 }, { 0x3ec5dbdf, 0x0e314bfe }, + { { 0x3ff00000, 0x00000000 } }, { { 0xbfc55554, 0xbc83656d } }, { { 0x3f8110ed, 0x3804c2a0 } }, + { { 0xbf29f6ff, 0xeea56814 } }, { { 0x3ec5dbdf, 0x0e314bfe } }, }; -static const du rpi = { 0x3fd45f30, 0x6dc9c883 }; +static const du rpi = { { 0x3fd45f30, 0x6dc9c883 } }; -static const du pihi = { 0x400921fb, 0x50000000 }; +static const du pihi = { { 0x400921fb, 0x50000000 } }; -static const du pilo = { 0x3e6110b4, 0x611a6263 }; +static const du pilo = { { 0x3e6110b4, 0x611a6263 } }; static const fu zero = { 0x00000000 }; diff --git a/src/gu/us2dex_emu.c b/src/gu/us2dex_emu.c index 34e701e..89e3156 100644 --- a/src/gu/us2dex_emu.c +++ b/src/gu/us2dex_emu.c @@ -62,9 +62,9 @@ static void tmemLoad_B(Gfx** pkt, u32 imagePtr, s16 loadLines, s16 tmemSH) { (*pkt)->words.w0 = (G_LOADTILE << 24) | 0x000000; /* addition 99/5/31(Y) */ if (bgflg == 3) - (*pkt)->words.w1 = 0x07000000 | (tmemSH - 1) << 16; + (*pkt)->words.w1 = 0x07000000 | ((tmemSH - 1) << 16); else - (*pkt)->words.w1 = 0x07000000 | (tmemSH - 1) << 16 | (loadLines << 2) - 1; + (*pkt)->words.w1 = 0x07000000 | ((tmemSH - 1) << 16) | ((loadLines << 2) - 1); (*pkt)++; } @@ -123,7 +123,7 @@ static void tmemLoad(Gfx** pkt, u32* imagePtr, s16* imageRemain, s16 drawLines, imagePtr1A = (*imagePtr) + iLoadable * imageSrcWsize; imagePtr1B = imageTop; SubSliceY1 = iLoadable; - if (SubSliceL1 = iLoadable & 1) { + if ((SubSliceL1 = iLoadable & 1)) { imagePtr1A -= imageSrcWsize; imagePtr1B -= imageSrcWsize; imagePtr1B = imageTopSeg | (imagePtr1B & 0x00ffffff); /*Segment countermeasure */ @@ -477,10 +477,10 @@ void guS2DEmuBgRect1Cyc(Gfx** pkt, uObjBg* bg) { (*pkt)->words.w0 = (imageS<<16) | imageT; (*pkt)->words.w1 = (scaleW<<16) | scaleH; #else /* At RSP command creation time */ - (*pkt)->words.w0 = (G_RDPHALF_1 << 24); + (*pkt)->words.w0 = ((u8)G_RDPHALF_1 << 24); (*pkt)->words.w1 = (imageS << 16) | imageT; (*pkt)++; - (*pkt)->words.w0 = (G_RDPHALF_2 << 24); + (*pkt)->words.w0 = ((u8)G_RDPHALF_2 << 24); (*pkt)->words.w1 = (scaleW << 16) | scaleH; #endif (*pkt)++; diff --git a/src/io/aisetnextbuf.c b/src/io/aisetnextbuf.c index 9ef8a26..3aa7f3d 100644 --- a/src/io/aisetnextbuf.c +++ b/src/io/aisetnextbuf.c @@ -19,7 +19,7 @@ */ s32 osAiSetNextBuffer(void* bufPtr, u32 size) { static u8 hdwrBugFlag = FALSE; - char* bptr; + u8* bptr; if (__osAiDeviceBusy()) { return -1; diff --git a/src/io/conteepread.c b/src/io/conteepread.c index a7d6296..d48b436 100644 --- a/src/io/conteepread.c +++ b/src/io/conteepread.c @@ -28,12 +28,7 @@ s32 osEepromRead(OSMesgQueue* mq, u8 address, u8* buffer) { } break; case CONT_EEPROM | CONT_EEP16K: - if (address >= EEP16K_MAXBLOCKS) { - // not technically possible - ret = CONT_RANGE_ERROR; - } else { - __osEepromRead16K = 1; - } + __osEepromRead16K = 1; break; default: ret = CONT_NO_RESPONSE_ERROR; diff --git a/src/io/conteepwrite.c b/src/io/conteepwrite.c index b75fae0..73086e7 100644 --- a/src/io/conteepwrite.c +++ b/src/io/conteepwrite.c @@ -26,10 +26,7 @@ s32 osEepromWrite(OSMesgQueue* mq, u8 address, u8* buffer) { } break; case CONT_EEPROM | CONT_EEP16K: - if (address >= EEP16K_MAXBLOCKS) { - // not technically possible - ret = CONT_RANGE_ERROR; - } else if (__osEepromRead16K) { + if (__osEepromRead16K) { __osEepromRead16K = 0; __osSiRelAccess(); osEepromRead(mq, (address ^ 1), temp); @@ -99,7 +96,7 @@ s32 __osEepStatus(OSMesgQueue* mq, OSContStatus* data) { u8* ptr = (u8*)__osEepPifRam.ramarray; __OSContRequesFormat requestformat; - for (i = 0; i < ARRLEN(__osEepPifRam.ramarray) + 1; i++) { + for (i = 0; i < ARRLEN(__osEepPifRam.ramarray); i++) { __osEepPifRam.ramarray[i] = 0; } diff --git a/src/io/contramread.c b/src/io/contramread.c index dbefd03..b603a8c 100644 --- a/src/io/contramread.c +++ b/src/io/contramread.c @@ -19,7 +19,7 @@ s32 __osContRamRead(OSMesgQueue* mq, int channel, u16 address, u8* buffer) { do { ptr = (u8*)&__osPfsPifRam; - if (__osContLastCmd != CONT_CMD_READ_PAK || (u32)__osPfsLastChannel != channel) { + if (__osContLastCmd != CONT_CMD_READ_PAK || __osPfsLastChannel != channel) { __osContLastCmd = CONT_CMD_READ_PAK; __osPfsLastChannel = channel; diff --git a/src/io/contramwrite.c b/src/io/contramwrite.c index 8a86126..3e9442a 100644 --- a/src/io/contramwrite.c +++ b/src/io/contramwrite.c @@ -24,7 +24,7 @@ s32 __osContRamWrite(OSMesgQueue* mq, int channel, u16 address, u8* buffer, int do { ptr = (u8*)__osPfsPifRam.ramarray; - if (__osContLastCmd != CONT_CMD_WRITE_PAK || (u32)__osPfsLastChannel != channel) { + if (__osContLastCmd != CONT_CMD_WRITE_PAK || __osPfsLastChannel != channel) { __osContLastCmd = CONT_CMD_WRITE_PAK; __osPfsLastChannel = channel; diff --git a/src/libc/xldtob.c b/src/libc/xldtob.c index c2703db..6fd292e 100644 --- a/src/libc/xldtob.c +++ b/src/libc/xldtob.c @@ -10,7 +10,7 @@ #define BUFF_LEN 0x20 static short _Ldunscale(short* pex, ldouble* px); -static void _Genld(_Pft* px, char code, unsigned char* p, short nsig, short xexp); +static void _Genld(_Pft* px, char code, char* p, short nsig, short xexp); static const ldouble pows[] = { 10e0L, 10e1L, 10e3L, 10e7L, 10e15L, 10e31L, 10e63L, 10e127L, 10e255L }; @@ -179,14 +179,14 @@ short _Ldunscale(short* pex, ldouble* px) { } } -void _Genld(_Pft* px, char code, unsigned char* p, short nsig, short xexp) { +void _Genld(_Pft* px, char code, char* p, short nsig, short xexp) { const unsigned char point = '.'; if (nsig <= 0) { nsig = 1, p = "0"; } - if (code == 'f' || (code == 'g' || code == 'G') && xexp >= -4 && xexp < px->prec) { + if (code == 'f' || ((code == 'g' || code == 'G') && xexp >= -4 && xexp < px->prec)) { xexp++; if (code != 'f') { if (((px->flags & 8) == 0) && nsig < px->prec) { diff --git a/src/libc/xprintf.c b/src/libc/xprintf.c index 219fc68..b074ce9 100644 --- a/src/libc/xprintf.c +++ b/src/libc/xprintf.c @@ -105,7 +105,7 @@ int _Printf(void* pfn(void*, const char*, size_t), void* arg, const char* fmt, v if (!(x.flags & FLAGS_MINUS)) { int i, j; if (0 < (x.width)) { - i, j = x.width; + j = x.width; for (; 0 < j; j -= i) { i = MAX_PAD < (unsigned int)j ? (int)MAX_PAD : j; PUT(spaces, i); diff --git a/src/libc/xstdio.h b/src/libc/xstdio.h index b9f5e83..3b0ac13 100644 --- a/src/libc/xstdio.h +++ b/src/libc/xstdio.h @@ -15,7 +15,7 @@ typedef struct { /* 0x0 */ long long ll; /* 0x0 */ ldouble ld; } v; - /* 0x8 */ unsigned char* s; + /* 0x8 */ char* s; /* 0xC */ int n0; /* 0x10 */ int nz0; /* 0x14 */ int n1; diff --git a/src/os/settimer.c b/src/os/settimer.c index da186cd..d1fbf99 100644 --- a/src/os/settimer.c +++ b/src/os/settimer.c @@ -39,7 +39,7 @@ int osSetTimer(OSTimer* t, OSTime countdown, OSTime interval, OSMesgQueue* mq, O } } - time = __osInsertTimer(t); + __osInsertTimer(t); __osSetTimerIntr(__osTimerList->next->value); __osRestoreInt(saveMask); diff --git a/src/os/timerintr.c b/src/os/timerintr.c index 9c08f6a..3b7adeb 100644 --- a/src/os/timerintr.c +++ b/src/os/timerintr.c @@ -87,9 +87,8 @@ void __osTimerInterrupt(void) { __osProfileOverflowBin++; } } -#endif - __ProfDone: +#endif if (t->interval != 0) { t->value = t->interval; diff --git a/src/rg/malloc.c b/src/rg/malloc.c index e397420..3201ab4 100644 --- a/src/rg/malloc.c +++ b/src/rg/malloc.c @@ -8,7 +8,7 @@ void* osMalloc(void* region) { register OSRegion* rp = region; - char* addr; + u8* addr; #ifdef _DEBUG assert(rp != NULL); diff --git a/src/rg/region.c b/src/rg/region.c index 7d08c8d..9801567 100644 --- a/src/rg/region.c +++ b/src/rg/region.c @@ -9,7 +9,7 @@ void* osCreateRegion(void* startAddress, u32 length, u32 bufferSize, u32 alignSize) { register OSRegion* rp; register int i; - register char* addr; + register u8* addr; assert(startAddress != NULL); diff --git a/src/sched/sched.c b/src/sched/sched.c index 53b3032..a3a5e01 100644 --- a/src/sched/sched.c +++ b/src/sched/sched.c @@ -351,7 +351,6 @@ OSScTask* __scTaskReady(OSScTask* t) { * client if it is. */ s32 __scTaskComplete(OSSched* sc, OSScTask* t) { - int rv; static int firsttime = 1; if ((t->state & OS_SC_RCP_MASK) == 0) { /* none of the needs bits set */ @@ -365,7 +364,7 @@ s32 __scTaskComplete(OSSched* sc, OSScTask* t) { #ifdef SC_LOGGING osLogEvent(l, 504, 1, t); #endif - rv = osSendMesg(t->msgQ, t->msg, OS_MESG_BLOCK); + osSendMesg(t->msgQ, t->msg, OS_MESG_BLOCK); if (t->list.t.type == M_GFXTASK) { if ((t->flags & OS_SC_SWAPBUFFER) && (t->flags & OS_SC_LAST_TASK)) { @@ -424,8 +423,6 @@ void __scAppendList(OSSched* sc, OSScTask* t) { * */ void __scExec(OSSched* sc, OSScTask* sp, OSScTask* dp) { - int rv; - #ifdef SC_LOGGING osLogEvent(l, 511, 2, sp, dp); #endif @@ -454,13 +451,11 @@ void __scExec(OSSched* sc, OSScTask* sp, OSScTask* dp) { #ifdef SC_LOGGING osLogEvent(l, 523, 3, dp, dp->list.t.output_buff, (u32)*dp->list.t.output_buff_size); #endif - rv = osDpSetNextBuffer(dp->list.t.output_buff, *dp->list.t.output_buff_size); + assert(osDpSetNextBuffer(dp->list.t.output_buff, *dp->list.t.output_buff_size) == 0); dp_busy = 1; dpCount = 0; - assert(rv == 0); - sc->curRDPTask = dp; } } @@ -539,7 +534,7 @@ s32 __scSchedule(OSSched* sc, OSScTask** sp, OSScTask** dp, s32 availRCP) { *dp = gfx; avail &= ~OS_SC_DP; - if (avail & OS_SC_DP == 0) + if ((avail & OS_SC_DP) == 0) assert(sc->curRDPTask == gfx); } diff --git a/src/voice/voicecheckword.c b/src/voice/voicecheckword.c index 298bd24..017c98e 100644 --- a/src/voice/voicecheckword.c +++ b/src/voice/voicecheckword.c @@ -11,7 +11,7 @@ s32 osVoiceCheckWord(u8* word) { s32 k; s32 ret = 0; - u16 sjis; + u16 sjis = '\0'; u16 old = '\0'; for (k = 0; word[k] != 0; k += 2) { diff --git a/src/voice/voicecontread2.c b/src/voice/voicecontread2.c index 66ef5a4..b6da2ff 100644 --- a/src/voice/voicecontread2.c +++ b/src/voice/voicecontread2.c @@ -25,7 +25,7 @@ s32 __osVoiceContRead2(OSMesgQueue* mq, int channel, u16 address, u8* buffer) { ptr = (u8*)&__osPfsPifRam.ramarray; - if ((__osContLastCmd != CONT_CMD_READ2_VOICE) || ((u32)__osPfsLastChannel != channel)) { + if ((__osContLastCmd != CONT_CMD_READ2_VOICE) || (__osPfsLastChannel != channel)) { __osContLastCmd = CONT_CMD_READ2_VOICE; __osPfsLastChannel = channel; diff --git a/src/voice/voicecontread36.c b/src/voice/voicecontread36.c index 4be3c48..cef5c91 100644 --- a/src/voice/voicecontread36.c +++ b/src/voice/voicecontread36.c @@ -25,7 +25,7 @@ s32 __osVoiceContRead36(OSMesgQueue* mq, int channel, u16 address, u8* buffer) { ptr = (u8*)&__osPfsPifRam.ramarray; - if ((__osContLastCmd != CONT_CMD_READ36_VOICE) || ((u32)__osPfsLastChannel != channel)) { + if ((__osContLastCmd != CONT_CMD_READ36_VOICE) || (__osPfsLastChannel != channel)) { __osContLastCmd = CONT_CMD_READ36_VOICE; __osPfsLastChannel = channel; diff --git a/src/voice/voicecontwrite20.c b/src/voice/voicecontwrite20.c index 7b96382..e814cf5 100644 --- a/src/voice/voicecontwrite20.c +++ b/src/voice/voicecontwrite20.c @@ -26,7 +26,7 @@ s32 __osVoiceContWrite20(OSMesgQueue* mq, int channel, u16 address, u8* buffer) ptr = (u8*)&__osPfsPifRam; - if ((__osContLastCmd != CONT_CMD_WRITE20_VOICE) || ((u32)__osPfsLastChannel != channel)) { + if ((__osContLastCmd != CONT_CMD_WRITE20_VOICE) || (__osPfsLastChannel != channel)) { __osContLastCmd = CONT_CMD_WRITE20_VOICE; __osPfsLastChannel = channel; diff --git a/src/voice/voicecontwrite4.c b/src/voice/voicecontwrite4.c index 8d212fc..710c337 100644 --- a/src/voice/voicecontwrite4.c +++ b/src/voice/voicecontwrite4.c @@ -26,7 +26,7 @@ s32 __osVoiceContWrite4(OSMesgQueue* mq, int channel, u16 address, u8* buffer) { ptr = (u8*)&__osPfsPifRam; - if ((__osContLastCmd != CONT_CMD_WRITE4_VOICE) || ((u32)__osPfsLastChannel != channel)) { + if ((__osContLastCmd != CONT_CMD_WRITE4_VOICE) || (__osPfsLastChannel != channel)) { __osContLastCmd = CONT_CMD_WRITE4_VOICE; __osPfsLastChannel = channel; diff --git a/src/voice/voicegetreaddata.c b/src/voice/voicegetreaddata.c index c4f8f1b..15efae3 100644 --- a/src/voice/voicegetreaddata.c +++ b/src/voice/voicegetreaddata.c @@ -6,6 +6,7 @@ #include "PR/os_internal.h" #include "PRinternal/controller.h" +#include "PRinternal/macros.h" #include "PR/os_voice.h" #include "voiceinternal.h" @@ -32,6 +33,7 @@ s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* micdata) { if ((c != 0) && (c != 7)) { return CONT_ERR_NOT_READY; } + FALLTHROUGH; case 2: hd->__mode = 2; @@ -43,7 +45,7 @@ s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* micdata) { *(u32*)temp = 0x600; ERRCK(__osVoiceContWrite4(hd->__mq, hd->__channel, 0, temp)); - + FALLTHROUGH; case 3: hd->__mode = 3; @@ -75,6 +77,7 @@ s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* micdata) { if ((c == 0) || (hd->cmd_status == 0)) { break; } + FALLTHROUGH; case 4: hd->__mode = 4; diff --git a/src/voice/voicestopreaddata.c b/src/voice/voicestopreaddata.c index 53f5061..1b137a4 100644 --- a/src/voice/voicestopreaddata.c +++ b/src/voice/voicestopreaddata.c @@ -12,7 +12,7 @@ s32 osVoiceStopReadData(OSVoiceHandle* hd) { s32 ret; - s32 i; + s32 i = 0; u8 stat; u8 temp[4]; @@ -48,7 +48,7 @@ s32 osVoiceStopReadData(OSVoiceHandle* hd) { } while ((ret == CONT_ERR_VOICE_NO_RESPONSE) && (i < 20)); } if (i >= 20) { - ret == CONT_ERR_VOICE_NO_RESPONSE; + ret = CONT_ERR_VOICE_NO_RESPONSE; } return ret;