Skip to content

Fix for psi-Wsign-compare #156

Merged
mywave82 merged 1 commit into
adplug:masterfrom
mywave82:psi-Wsign-compare
Feb 26, 2023
Merged

Fix for psi-Wsign-compare #156
mywave82 merged 1 commit into
adplug:masterfrom
mywave82:psi-Wsign-compare

Conversation

@mywave82

Copy link
Copy Markdown
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
Copy Markdown
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