Fix bugs found by compiler warnings

This commit is contained in:
Cameron Gutman
2019-04-30 19:50:22 -07:00
parent 115966ce0f
commit f305e235f9
2 changed files with 4 additions and 3 deletions

View File

@@ -76,14 +76,15 @@ void loop_remove_fd(int fd) {
int fdindex;
for (int i=0;i<numFds;i++) {
if (fds[i].fd = fd)
if (fds[i].fd == fd) {
fdindex = i;
break;
}
}
if (fdindex != numFds && numFds > 0) {
memcpy(&fds[fdindex], &fds[numFds], sizeof(struct pollfd));
memcpy(&fdHandlers[fdindex], &fdHandlers[numFds], sizeof(FdHandler*));
memcpy(&fdHandlers[fdindex], &fdHandlers[numFds], sizeof(FdHandler));
}
}

View File

@@ -95,7 +95,7 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys
#ifdef HAVE_SDL
gamepads += sdl_gamepads;
#endif
int gamepad_mask;
int gamepad_mask = 0;
for (int i = 0; i < gamepads && i < 4; i++)
gamepad_mask = (gamepad_mask << 1) + 1;