all repos — mgba @ a748e0c795a4ab7117eaac78349cecb303873ddf

mGBA Game Boy Advance Emulator

All: Partial warnings burndown
Vicki Pfau vi@endrift.com
Wed, 17 Oct 2018 09:21:16 -0700
commit

a748e0c795a4ab7117eaac78349cecb303873ddf

parent

29675e354f0e6001403bcd7d12141f9599f4356e

M src/core/log.csrc/core/log.c

@@ -128,13 +128,13 @@ }

} bool mLogFilterTest(struct mLogFilter* filter, int category, enum mLogLevel level) { - int value = (int) TableLookup(&filter->levels, category); + int value = (intptr_t) TableLookup(&filter->levels, category); if (value) { return value & level; } const char* cat = mLogCategoryId(category); if (cat) { - value = (int) HashTableLookup(&filter->categories, cat); + value = (intptr_t) HashTableLookup(&filter->categories, cat); if (value) { TableInsert(&filter->levels, category, (void*)(intptr_t) value); return value & level;
M src/core/tile-cache.csrc/core/tile-cache.c

@@ -198,7 +198,7 @@ #ifndef NDEBUG

if (tileId >= tiles) { abort(); } - if (paletteId >= 1 << mTileCacheSystemInfoGetPaletteCount(cache->sysConfig)) { + if (paletteId >= 1U << mTileCacheSystemInfoGetPaletteCount(cache->sysConfig)) { abort(); } #endif
M src/gb/memory.csrc/gb/memory.c

@@ -178,6 +178,7 @@

memset(&gb->memory.hram, 0, sizeof(gb->memory.hram)); GBMBCInit(gb); + memset(&gb->memory.mbcState, 0, sizeof(gb->memory.mbcState)); switch (gb->memory.mbcType) { case GB_MBC1: gb->memory.mbcState.mbc1.mode = 0;

@@ -192,8 +193,9 @@ break;

case GB_MMM01: GBMBCSwitchBank0(gb, gb->memory.romSize / GB_SIZE_CART_BANK0 - 2); GBMBCSwitchBank(gb, gb->memory.romSize / GB_SIZE_CART_BANK0 - 1); + break; default: - memset(&gb->memory.mbcState, 0, sizeof(gb->memory.mbcState)); + break; } gb->memory.sramBank = gb->memory.sram;
M src/gb/timer.csrc/gb/timer.c

@@ -30,7 +30,7 @@ if (!timer->p->memory.io[REG_TIMA]) {

mTimingSchedule(&timer->p->timing, &timer->irq, 7 - ((timer->p->cpu->executionState - cyclesLate) & 3)); } } - int timingFactor = 0x3FF >> !timer->p->doubleSpeed; + unsigned timingFactor = 0x3FF >> !timer->p->doubleSpeed; if ((timer->internalDiv & timingFactor) == timingFactor) { GBAudioUpdateFrame(&timer->p->audio, &timer->p->timing); }

@@ -80,7 +80,6 @@ if (!timer->p->memory.io[REG_TIMA]) {

mTimingSchedule(&timer->p->timing, &timer->irq, 7 - (timer->p->cpu->executionState & 3)); } } - int timingFactor = 0x200 >> !timer->p->doubleSpeed; if (timer->internalDiv & 0x200) { GBAudioUpdateFrame(&timer->p->audio, &timer->p->timing); }
M src/gba/gba.csrc/gba/gba.c

@@ -512,7 +512,7 @@ if (GBADebugFlagsIsSend(gba->debugFlags)) {

int level = 1 << GBADebugFlagsGetLevel(gba->debugFlags); level &= 0x1F; char oolBuf[0x101]; - strncpy(oolBuf, gba->debugString, sizeof(gba->debugString)); + strncpy(oolBuf, gba->debugString, sizeof(oolBuf) - 1); memset(gba->debugString, 0, sizeof(gba->debugString)); oolBuf[0x100] = '\0'; mLog(_mLOG_CAT_GBA_DEBUG(), level, "%s", oolBuf);
M src/gba/renderers/cache-set.csrc/gba/renderers/cache-set.c

@@ -158,10 +158,10 @@ void GBAVideoCacheWriteVideoRegister(struct mCacheSet* cache, uint32_t address, uint16_t value) {

switch (address) { case REG_DISPCNT: GBAVideoCacheWriteDISPCNT(cache, value); - GBAVideoCacheWriteBGCNT(cache, 0, (uint16_t) mMapCacheSetGetPointer(&cache->maps, 0)->context); - GBAVideoCacheWriteBGCNT(cache, 1, (uint16_t) mMapCacheSetGetPointer(&cache->maps, 1)->context); - GBAVideoCacheWriteBGCNT(cache, 2, (uint16_t) mMapCacheSetGetPointer(&cache->maps, 2)->context); - GBAVideoCacheWriteBGCNT(cache, 3, (uint16_t) mMapCacheSetGetPointer(&cache->maps, 3)->context); + GBAVideoCacheWriteBGCNT(cache, 0, (uintptr_t) mMapCacheSetGetPointer(&cache->maps, 0)->context); + GBAVideoCacheWriteBGCNT(cache, 1, (uintptr_t) mMapCacheSetGetPointer(&cache->maps, 1)->context); + GBAVideoCacheWriteBGCNT(cache, 2, (uintptr_t) mMapCacheSetGetPointer(&cache->maps, 2)->context); + GBAVideoCacheWriteBGCNT(cache, 3, (uintptr_t) mMapCacheSetGetPointer(&cache->maps, 3)->context); break; case REG_BG0CNT: GBAVideoCacheWriteBGCNT(cache, 0, value);
M src/platform/python/engine.csrc/platform/python/engine.c

@@ -65,7 +65,6 @@ return true;

} void mPythonScriptEngineDeinit(struct mScriptEngine* se) { - struct mPythonScriptEngine* engine = (struct mPythonScriptEngine*) se; free(se); }

@@ -76,7 +75,7 @@ return endswith(name, ".py");

} bool mPythonScriptEngineLoadScript(struct mScriptEngine* se, const char* name, struct VFile* vf) { - struct mPythonScriptEngine* engine = (struct mPythonScriptEngine*) se; + UNUSED(se); return mPythonLoadScript(name, vf); }

@@ -94,7 +93,7 @@ mPythonRunPending();

} bool mPythonScriptEngineLookupSymbol(struct mScriptEngine* se, const char* name, int32_t* out) { - struct mPythonScriptEngine* engine = (struct mPythonScriptEngine*) se; + UNUSED(se); return mPythonLookupSymbol(name, out); }
M src/platform/sdl/sdl-events.csrc/platform/sdl/sdl-events.c

@@ -304,7 +304,7 @@ const char* name = SDL_JoystickName(context->joystick->joystick);

#else const char* name = SDL_JoystickName(SDL_JoystickIndex(context->joystick->joystick)); #endif - char value[12]; + char value[16]; snprintf(value, sizeof(value), "%i", context->rotation.axisX); mInputSetCustomValue(config, "gba", SDL_BINDING_BUTTON, "tiltAxisX", value, name); snprintf(value, sizeof(value), "%i", context->rotation.axisY);