Misc: Fix a slew of less-than-important warnings

This commit is contained in:
Vicki Pfau 2024-04-25 01:03:08 -07:00
parent 87653b7b19
commit aae9c502f0
7 changed files with 22 additions and 16 deletions

View File

@ -282,14 +282,14 @@ bool mCheatParseFile(struct mCheatDevice* device, struct VFile* vf) {
StringListDeinit(&directives); StringListDeinit(&directives);
return false; return false;
} }
while (isspace((int) cheat[i])) { while (isspace((unsigned) cheat[i])) {
++i; ++i;
} }
switch (cheat[i]) { switch (cheat[i]) {
case '#': case '#':
do { do {
++i; ++i;
} while (isspace((int) cheat[i])); } while (isspace((unsigned) cheat[i]));
newSet = device->createSet(device, &cheat[i]); newSet = device->createSet(device, &cheat[i]);
newSet->enabled = !nextDisabled; newSet->enabled = !nextDisabled;
nextDisabled = false; nextDisabled = false;
@ -305,7 +305,7 @@ bool mCheatParseFile(struct mCheatDevice* device, struct VFile* vf) {
case '!': case '!':
do { do {
++i; ++i;
} while (isspace((int) cheat[i])); } while (isspace((unsigned) cheat[i]));
if (strcasecmp(&cheat[i], "disabled") == 0) { if (strcasecmp(&cheat[i], "disabled") == 0) {
nextDisabled = true; nextDisabled = true;
break; break;
@ -384,7 +384,7 @@ bool mCheatParseLibretroFile(struct mCheatDevice* device, struct VFile* vf) {
return false; return false;
} }
++eq; ++eq;
while (isspace((int) eq[0])) { while (isspace((unsigned) eq[0])) {
if (eq[0] == '\0') { if (eq[0] == '\0') {
return false; return false;
} }
@ -393,7 +393,7 @@ bool mCheatParseLibretroFile(struct mCheatDevice* device, struct VFile* vf) {
char* end; char* end;
unsigned long nCheats = strtoul(eq, &end, 10); unsigned long nCheats = strtoul(eq, &end, 10);
if (end[0] != '\0' && !isspace(end[0])) { if (end[0] != '\0' && !isspace((unsigned) end[0])) {
return false; return false;
} }
@ -423,7 +423,7 @@ bool mCheatParseLibretroFile(struct mCheatDevice* device, struct VFile* vf) {
return false; return false;
} }
++eq; ++eq;
while (isspace((int) eq[0])) { while (isspace((unsigned) eq[0])) {
if (eq[0] == '\0') { if (eq[0] == '\0') {
return false; return false;
} }

View File

@ -217,9 +217,12 @@ void mArgumentsApply(const struct mArguments* args, struct mSubParser* subparser
} }
bool mArgumentsApplyDebugger(const struct mArguments* args, struct mCore* core, struct mDebugger* debugger) { bool mArgumentsApplyDebugger(const struct mArguments* args, struct mCore* core, struct mDebugger* debugger) {
UNUSED(args);
UNUSED(core);
UNUSED(debugger);
bool hasDebugger = false; bool hasDebugger = false;
#ifdef USE_EDITLINE #ifdef USE_EDITLINE
if (args->debugCli) { if (args->debugCli) {
struct mDebuggerModule* module = mDebuggerCreateModule(DEBUGGER_CLI, core); struct mDebuggerModule* module = mDebuggerCreateModule(DEBUGGER_CLI, core);
if (module) { if (module) {

View File

@ -602,7 +602,7 @@ void GBAudioRun(struct GBAudio* audio, int32_t timestamp, int channels) {
int32_t last = 0; int32_t last = 0;
int samples = 0; int samples = 0;
int positiveSamples = 0; int positiveSamples = 0;
int lsb; int lsb = 0;
int coeff; int coeff;
if (audio->ch4.power) { if (audio->ch4.power) {
// TODO: Can this be batched too? // TODO: Can this be batched too?

View File

@ -371,7 +371,7 @@ void GBACartEReaderScan(struct GBACartEReader* ereader, const void* data, size_t
memset(ereader->dots, 0, EREADER_DOTCODE_SIZE); memset(ereader->dots, 0, EREADER_DOTCODE_SIZE);
uint8_t blockRS[44][0x10]; uint8_t blockRS[44][0x10];
uint8_t block0[0x30]; uint8_t block0[0x30] = {0};
bool parsed = false; bool parsed = false;
bool bitmap = false; bool bitmap = false;
bool reducedHeader = false; bool reducedHeader = false;

View File

@ -202,7 +202,7 @@ bool GBASavedataExportSharkPort(const struct GBA* gba, struct VFile* vf) {
char c[0x1C]; char c[0x1C];
int32_t i; int32_t i;
} buffer; } buffer;
uint32_t size = strlen(SHARKPORT_HEADER); int32_t size = strlen(SHARKPORT_HEADER);
STORE_32(size, 0, &buffer.i); STORE_32(size, 0, &buffer.i);
if (vf->write(vf, &buffer.i, 4) < 4) { if (vf->write(vf, &buffer.i, 4) < 4) {
return false; return false;
@ -271,7 +271,7 @@ bool GBASavedataExportSharkPort(const struct GBA* gba, struct VFile* vf) {
} }
uint32_t checksum = 0; uint32_t checksum = 0;
size_t i; ssize_t i;
for (i = 0; i < 0x1C; ++i) { for (i = 0; i < 0x1C; ++i) {
checksum += buffer.c[i] << (checksum % 24); checksum += buffer.c[i] << (checksum % 24);
} }

View File

@ -904,9 +904,9 @@ uint32_t mColorConvert(uint32_t color, enum mColorFormat from, enum mColorFormat
return color; return color;
} }
int r; int r = 0;
int g; int g = 0;
int b; int b = 0;
int a = 0xFF; int a = 0xFF;
switch (from) { switch (from) {

View File

@ -62,7 +62,7 @@ static png_infop _pngWriteHeader(png_structp png, unsigned width, unsigned heigh
} }
png_infop PNGWriteHeader(png_structp png, unsigned width, unsigned height, enum mColorFormat fmt) { png_infop PNGWriteHeader(png_structp png, unsigned width, unsigned height, enum mColorFormat fmt) {
int type; int type = -1;
switch (fmt) { switch (fmt) {
case mCOLOR_XBGR8: case mCOLOR_XBGR8:
case mCOLOR_XRGB8: case mCOLOR_XRGB8:
@ -94,6 +94,9 @@ png_infop PNGWriteHeader(png_structp png, unsigned width, unsigned height, enum
type = PNG_COLOR_TYPE_PALETTE; type = PNG_COLOR_TYPE_PALETTE;
break; break;
} }
if (type < 0) {
return NULL;
}
return _pngWriteHeader(png, width, height, NULL, 0, type); return _pngWriteHeader(png, width, height, NULL, 0, type);
} }
@ -373,6 +376,7 @@ bool PNGWritePixels(png_structp png, unsigned width, unsigned height, unsigned s
} else { } else {
depth = 3; depth = 3;
} }
stride *= mColorFormatBytes(fmt);
png_bytep row = malloc(sizeof(png_byte) * width * depth); png_bytep row = malloc(sizeof(png_byte) * width * depth);
if (!row) { if (!row) {
return false; return false;
@ -383,7 +387,6 @@ bool PNGWritePixels(png_structp png, unsigned width, unsigned height, unsigned s
return false; return false;
} }
const png_byte* pixelRow = pixelData; const png_byte* pixelRow = pixelData;
stride *= mColorFormatBytes(fmt);
unsigned i; unsigned i;
for (i = 0; i < height; ++i, pixelRow += stride) { for (i = 0; i < height; ++i, pixelRow += stride) {
switch (fmt) { switch (fmt) {