All: Partial warnings burndown

This commit is contained in:
Vicki Pfau 2018-10-17 09:21:16 -07:00
parent 29675e354f
commit a748e0c795
8 changed files with 15 additions and 15 deletions

View File

@ -128,13 +128,13 @@ void mLogFilterSet(struct mLogFilter* filter, const char* category, int levels)
}
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;

View File

@ -198,7 +198,7 @@ static inline color_t* _tileLookup(struct mTileCache* cache, unsigned tileId, un
if (tileId >= tiles) {
abort();
}
if (paletteId >= 1 << mTileCacheSystemInfoGetPaletteCount(cache->sysConfig)) {
if (paletteId >= 1U << mTileCacheSystemInfoGetPaletteCount(cache->sysConfig)) {
abort();
}
#endif

View File

@ -178,6 +178,7 @@ void GBMemoryReset(struct GB* gb) {
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 @@ void GBMemoryReset(struct GB* gb) {
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;

View File

@ -30,7 +30,7 @@ static void _GBTimerDivIncrement(struct GBTimer* timer, uint32_t cyclesLate) {
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 @@ void GBTimerDivReset(struct GBTimer* timer) {
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);
}

View File

@ -512,7 +512,7 @@ void GBADebug(struct GBA* gba, uint16_t flags) {
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);

View File

@ -158,10 +158,10 @@ void GBAVideoCacheWriteVideoRegister(struct mCacheSet* cache, uint32_t address,
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);

View File

@ -65,7 +65,6 @@ bool mPythonScriptEngineInit(struct mScriptEngine* se, struct mScriptBridge* sb)
}
void mPythonScriptEngineDeinit(struct mScriptEngine* se) {
struct mPythonScriptEngine* engine = (struct mPythonScriptEngine*) se;
free(se);
}
@ -76,7 +75,7 @@ bool mPythonScriptEngineIsScript(struct mScriptEngine* se, const char* name, str
}
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 @@ void mPythonScriptEngineRun(struct mScriptEngine* se) {
}
bool mPythonScriptEngineLookupSymbol(struct mScriptEngine* se, const char* name, int32_t* out) {
struct mPythonScriptEngine* engine = (struct mPythonScriptEngine*) se;
UNUSED(se);
return mPythonLookupSymbol(name, out);
}

View File

@ -304,7 +304,7 @@ void mSDLPlayerSaveConfig(const struct mSDLPlayer* context, struct Configuration
#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);