All: Fix several warnings

This commit is contained in:
Vicki Pfau 2020-01-16 19:43:28 -08:00
parent 8a6cf8dc9c
commit dab12cf5c6
10 changed files with 40 additions and 27 deletions

View File

@ -86,7 +86,7 @@ static void _disassembleMode(struct CLIDebugger* debugger, struct CLIDebugVector
size = 1;
} else {
size = dv->intValue;
dv = dv->next; // TODO: Check for excess args
// TODO: Check for excess args
}
int i;

View File

@ -883,6 +883,7 @@ static int _tryCommands(struct CLIDebugger* debugger, struct CLIDebuggerCommandS
if (dvNext->type == CLIDV_ERROR_TYPE) {
debugger->backend->printf(debugger->backend, "Parse error\n");
_DVFree(dv);
_DVFree(dvNext);
return 0;
}

View File

@ -64,7 +64,7 @@ static void _init(struct GBVideoProxyRenderer* proxyRenderer) {
}
}
static void _reset(struct GBVideoProxyRenderer* proxyRenderer, enum GBModel model) {
static void _reset(struct GBVideoProxyRenderer* proxyRenderer) {
memcpy(proxyRenderer->logger->oam, &proxyRenderer->d.oam->raw, GB_SIZE_OAM);
memcpy(proxyRenderer->logger->vram, proxyRenderer->d.vram, GB_SIZE_VRAM);
@ -83,7 +83,7 @@ void GBVideoProxyRendererShim(struct GBVideo* video, struct GBVideoProxyRenderer
renderer->d.vram = video->vram;
renderer->d.oam = &video->oam;
_init(renderer);
_reset(renderer, video->p->model);
_reset(renderer);
}
void GBVideoProxyRendererUnshim(struct GBVideo* video, struct GBVideoProxyRenderer* renderer) {

View File

@ -354,6 +354,7 @@ static void _GBACoreDesiredVideoDimensions(struct mCore* core, unsigned* width,
struct GBACore* gbacore = (struct GBACore*) core;
int scale = gbacore->glRenderer.scale;
#else
UNUSED(core);
int scale = 1;
#endif
@ -507,7 +508,7 @@ static void _GBACoreReset(struct mCore* core) {
|| gbacore->glRenderer.outputTex != (unsigned) -1
#endif
) {
struct GBAVideoRenderer* renderer;
struct GBAVideoRenderer* renderer = NULL;
if (gbacore->renderer.outputBuffer) {
renderer = &gbacore->renderer.d;
}
@ -526,13 +527,15 @@ static void _GBACoreReset(struct mCore* core) {
}
#endif
#ifndef MINIMAL_CORE
if (core->videoLogger) {
if (renderer && core->videoLogger) {
gbacore->proxyRenderer.logger = core->videoLogger;
GBAVideoProxyRendererCreate(&gbacore->proxyRenderer, renderer);
renderer = &gbacore->proxyRenderer.d;
}
#endif
GBAVideoAssociateRenderer(&gba->video, renderer);
if (renderer) {
GBAVideoAssociateRenderer(&gba->video, renderer);
}
}
#ifndef MINIMAL_CORE
@ -584,7 +587,7 @@ static void _GBACoreReset(struct mCore* core) {
bios = NULL;
}
}
if (bios) {
if (found && bios) {
GBALoadBIOS(gba, bios);
}
}

View File

@ -1161,7 +1161,6 @@ void _cleanRegister(struct GBAVideoGLRenderer* glRenderer, int address, uint16_t
break;
case REG_BLDCNT:
GBAVideoGLRendererWriteBLDCNT(glRenderer, value);
value &= 0x3FFF;
break;
case REG_BLDALPHA:
glRenderer->blda = value & 0x1F;
@ -1172,7 +1171,6 @@ void _cleanRegister(struct GBAVideoGLRenderer* glRenderer, int address, uint16_t
if (glRenderer->bldb > 0x10) {
glRenderer->bldb = 0x10;
}
value &= 0x1F1F;
break;
case REG_BLDY:
glRenderer->bldy = value;
@ -1505,7 +1503,10 @@ void GBAVideoGLRendererGetPixels(struct GBAVideoRenderer* renderer, size_t* stri
}
void GBAVideoGLRendererPutPixels(struct GBAVideoRenderer* renderer, size_t stride, const void* pixels) {
// TODO
UNUSED(renderer);
UNUSED(stride);
UNUSED(pixels);
}
static void _enableBg(struct GBAVideoGLRenderer* renderer, int bg, bool active) {

View File

@ -46,7 +46,7 @@ static void _disassemble(struct CLIDebuggerSystem* debugger, struct CLIDebugVect
size = 1;
} else {
size = dv->intValue;
dv = dv->next; // TODO: Check for excess args
// TODO: Check for excess args
}
size_t i;
@ -57,7 +57,7 @@ static void _disassemble(struct CLIDebuggerSystem* debugger, struct CLIDebugVect
static inline uint16_t _printLine(struct CLIDebugger* debugger, uint16_t address, int segment) {
struct CLIDebuggerBackend* be = debugger->backend;
struct SM83InstructionInfo info = {0};
struct SM83InstructionInfo info = {{0}, 0};
char disassembly[48];
char* disPtr = disassembly;
if (segment >= 0) {

View File

@ -16,7 +16,8 @@ void GUIInit(struct GUIParams* params) {
void GUIPollInput(struct GUIParams* params, uint32_t* newInputOut, uint32_t* heldInput) {
uint32_t input = params->pollInput(&params->keyMap);
uint32_t newInput = 0;
for (int i = 0; i < GUI_INPUT_MAX; ++i) {
int i;
for (i = 0; i < GUI_INPUT_MAX; ++i) {
if (input & (1 << i)) {
++params->inputHistory[i];
} else {
@ -66,7 +67,8 @@ enum GUICursorState GUIPollCursor(struct GUIParams* params, unsigned* x, unsigne
}
void GUIInvalidateKeys(struct GUIParams* params) {
for (int i = 0; i < GUI_INPUT_MAX; ++i) {
int i;
for (i = 0; i < GUI_INPUT_MAX; ++i) {
params->inputHistory[i] = 0;
}
}

View File

@ -60,7 +60,8 @@ uint32_t hash32(const void* key, int len, uint32_t seed) {
const uint32_t * blocks = (const uint32_t *)(data + nblocks*4);
for(int i = -nblocks; i; i++)
int i;
for(i = -nblocks; i; i++)
{
uint32_t k1 = getblock32(blocks,i);
@ -82,10 +83,15 @@ uint32_t hash32(const void* key, int len, uint32_t seed) {
switch(len & 3)
{
case 3: k1 ^= tail[2] << 16;
case 2: k1 ^= tail[1] << 8;
case 1: k1 ^= tail[0];
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
case 3:
k1 ^= tail[2] << 16;
// Fall through
case 2:
k1 ^= tail[1] << 8;
// Fall through
case 1:
k1 ^= tail[0];
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
};
//----------

View File

@ -234,8 +234,8 @@ char* utf16to8(const uint16_t* utf16, size_t length) {
extern const uint16_t gbkUnicodeTable[];
char* gbkToUtf8(const char* gbk, size_t length) {
char* utf8 = 0;
char* utf8Offset;
char* utf8 = NULL;
char* utf8Offset = NULL;
size_t offset;
uint8_t gbk1 = 0;
char buffer[4];
@ -266,17 +266,17 @@ char* gbkToUtf8(const char* gbk, size_t length) {
size_t bytes = toUtf8(unichar, buffer);
utf8Length += bytes;
if (utf8Length < utf8TotalBytes) {
memcpy(utf8Offset, buffer, bytes);
utf8Offset += bytes;
} else if (!utf8) {
if (!utf8) {
utf8 = malloc(length);
if (!utf8) {
return 0;
return NULL;
}
utf8TotalBytes = length;
memcpy(utf8, buffer, bytes);
utf8Offset = utf8 + bytes;
} else if (utf8Length < utf8TotalBytes) {
memcpy(utf8Offset, buffer, bytes);
utf8Offset += bytes;
} else if (utf8Length >= utf8TotalBytes) {
ptrdiff_t o = utf8Offset - utf8;
char* newUTF8 = realloc(utf8, utf8TotalBytes * 2);

View File

@ -199,7 +199,7 @@ void separatePath(const char* path, char* dirname, char* basename, char* extensi
if (PATH_MAX <= len) {
len = PATH_MAX - 1;
}
strncpy(extension, dotPoint, len);
strncpy(extension, dotPoint, PATH_MAX - 1);
extension[len] = '\0';
} else {
extension[0] = '\0';