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

View File

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