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

Fix for psi-Wsign-compare #156

Merged
merged 1 commit into from
Feb 26, 2023
Merged

Conversation

mywave82
Copy link
Contributor

Fix these warnings:

src/psi.cpp: In member function ‘virtual bool CxadpsiPlayer::xadplayer_load()’: src/psi.cpp:60:44: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
   60 |   if (header.instr_ptr + psi.nchannels * 2 >= tune_size ||
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
src/psi.cpp:61:42: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
   61 |       header.seq_ptr + psi.nchannels * 4 >= tune_size)
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
src/psi.cpp:70:40: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
   70 |     if (le16(&psi.instr_table[i]) + 11 >= tune_size)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

src/psi.cpp: In member function ‘virtual bool CxadpsiPlayer::xadplayer_load()’:
src/psi.cpp:60:44: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
   60 |   if (header.instr_ptr + psi.nchannels * 2 >= tune_size ||
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
src/psi.cpp:61:42: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
   61 |       header.seq_ptr + psi.nchannels * 4 >= tune_size)
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
src/psi.cpp:70:40: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
   70 |     if (le16(&psi.instr_table[i]) + 11 >= tune_size)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
@mywave82
Copy link
Contributor Author

Challenge is that psi.nchannels is an enum, and it is used to define the member-sizes in the same structure. It will always be 8, unless the struct is made into a class. Perhaps a better solution is to make a define instead:

#define PSI_NCHANNELS 8

@mywave82 mywave82 merged commit 700b1a7 into adplug:master Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant