Backport Fix uninitialized warning and aliased pointers.

This commit is contained in:
bladeoner 2018-12-06 10:38:11 +01:00
parent d92174f82b
commit d8b901a7e1
2 changed files with 20 additions and 17 deletions

View File

@ -2724,7 +2724,7 @@ static void do_polling (int mp)
{ {
case MAP_BUTTON: case MAP_BUTTON:
{ {
bool pressed; bool pressed = false;
if (S9xPollButton(*itr, &pressed)) if (S9xPollButton(*itr, &pressed))
S9xReportButton(*itr, pressed); S9xReportButton(*itr, pressed);
break; break;
@ -2732,7 +2732,7 @@ static void do_polling (int mp)
case MAP_AXIS: case MAP_AXIS:
{ {
int16 value; int16 value = 0;
if (S9xPollAxis(*itr, &value)) if (S9xPollAxis(*itr, &value))
S9xReportAxis(*itr, value); S9xReportAxis(*itr, value);
break; break;
@ -2740,7 +2740,7 @@ static void do_polling (int mp)
case MAP_POINTER: case MAP_POINTER:
{ {
int16 x, y; int16 x = 0, y = 0;
if (S9xPollPointer(*itr, &x, &y)) if (S9xPollPointer(*itr, &x, &y))
S9xReportPointer(*itr, x, y); S9xReportPointer(*itr, x, y);
break; break;

View File

@ -1902,10 +1902,11 @@ static void DisplayPressedKeys (void)
{ {
case CTL_MOUSE: case CTL_MOUSE:
{ {
uint8 buf[5], *p = buf; uint8 buf[5];
MovieGetMouse(port, buf); if (!MovieGetMouse(port, buf))
int16 x = READ_WORD(p); break;
int16 y = READ_WORD(p + 2); int16 x = READ_WORD(buf);
int16 y = READ_WORD(buf + 2);
uint8 buttons = buf[4]; uint8 buttons = buf[4];
sprintf(string, "#%d %d: (%03d,%03d) %c%c", port, ids[0], x, y, sprintf(string, "#%d %d: (%03d,%03d) %c%c", port, ids[0], x, y,
(buttons & 0x40) ? 'L' : ' ', (buttons & 0x80) ? 'R' : ' '); (buttons & 0x40) ? 'L' : ' ', (buttons & 0x80) ? 'R' : ' ');
@ -1915,10 +1916,11 @@ static void DisplayPressedKeys (void)
case CTL_SUPERSCOPE: case CTL_SUPERSCOPE:
{ {
uint8 buf[6], *p = buf; uint8 buf[6];
MovieGetScope(port, buf); if (!MovieGetScope(port, buf))
int16 x = READ_WORD(p); break;
int16 y = READ_WORD(p + 2); int16 x = READ_WORD(buf);
int16 y = READ_WORD(buf + 2);
uint8 buttons = buf[4]; uint8 buttons = buf[4];
sprintf(string, "#%d %d: (%03d,%03d) %c%c%c%c", port, ids[0], x, y, sprintf(string, "#%d %d: (%03d,%03d) %c%c%c%c", port, ids[0], x, y,
(buttons & 0x80) ? 'F' : ' ', (buttons & 0x40) ? 'C' : ' ', (buttons & 0x80) ? 'F' : ' ', (buttons & 0x40) ? 'C' : ' ',
@ -1929,12 +1931,13 @@ static void DisplayPressedKeys (void)
case CTL_JUSTIFIER: case CTL_JUSTIFIER:
{ {
uint8 buf[11], *p = buf; uint8 buf[11];
MovieGetJustifier(port, buf); if (!MovieGetJustifier(port, buf))
int16 x1 = READ_WORD(p); break;
int16 x2 = READ_WORD(p + 2); int16 x1 = READ_WORD(buf);
int16 y1 = READ_WORD(p + 4); int16 x2 = READ_WORD(buf + 2);
int16 y2 = READ_WORD(p + 6); int16 y1 = READ_WORD(buf + 4);
int16 y2 = READ_WORD(buf + 6);
uint8 buttons = buf[8]; uint8 buttons = buf[8];
bool8 offscreen1 = buf[9]; bool8 offscreen1 = buf[9];
bool8 offscreen2 = buf[10]; bool8 offscreen2 = buf[10];