Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AGOS: Fix wrong condition in adlib implementation #3942

Closed
wants to merge 1 commit into from

Conversation

orgads
Copy link
Contributor

@orgads orgads commented Jun 2, 2022

Reported by GCC 12:

../scummvm/engines/agos/drivers/accolade/adlib.cpp: In member function 'virtual void AGOS::MidiDriver_Accolade_AdLib::deinitSource(uint8)':
../scummvm/engines/agos/drivers/accolade/adlib.cpp:150:29: warning: the address of 'AGOS::MidiDriver_Accolade_AdLib::_instrumentRemapping' will never be NULL [-Waddress]
  150 |                         if (_instrumentRemapping)
      |                             ^~~~~~~~~~~~~~~~~~~~
In file included from ../scummvm/engines/agos/drivers/accolade/adlib.cpp:22:
../scummvm/engines/agos/drivers/accolade/adlib.h:86:14: note: 'AGOS::MidiDriver_Accolade_AdLib::_instrumentRemapping' declared here
   86 |         byte _instrumentRemapping[128];
      |              ^~~~~~~~~~~~~~~~~~~~

Reported by GCC 12:

../scummvm/engines/agos/drivers/accolade/adlib.cpp: In member function 'virtual void AGOS::MidiDriver_Accolade_AdLib::deinitSource(uint8)':
../scummvm/engines/agos/drivers/accolade/adlib.cpp:150:29: warning: the address of 'AGOS::MidiDriver_Accolade_AdLib::_instrumentRemapping' will never be NULL [-Waddress]
  150 |                         if (_instrumentRemapping)
      |                             ^~~~~~~~~~~~~~~~~~~~
In file included from ../scummvm/engines/agos/drivers/accolade/adlib.cpp:22:
../scummvm/engines/agos/drivers/accolade/adlib.h:86:14: note: 'AGOS::MidiDriver_Accolade_AdLib::_instrumentRemapping' declared here
   86 |         byte _instrumentRemapping[128];
      |              ^~~~~~~~~~~~~~~~~~~~
@orgads orgads requested a review from NMIError Jun 2, 2022
@orgads
Copy link
Contributor Author

@orgads orgads commented Jun 2, 2022

I'm unsure if this fix is right, or the condition should be just removed.

@NMIError
Copy link
Contributor

@NMIError NMIError commented Jun 2, 2022

Hi orgads,
I've just pushed a fix that removes the check. _instrumentRemapping is always set in readDriverData, so the check is unnecessary. I think _instrumentRemapping was a pointer at some stage in development...
Thanks for noticing!

@NMIError NMIError closed this Jun 2, 2022
@orgads orgads deleted the agos-adlib branch Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants