Skip to content

Commit

Permalink
Fix #5: Do not use uint for command id (#6)
Browse files Browse the repository at this point in the history
Since gcc 10, comparing this variable with -1 in a switch produces a
narrowing conversion error, breaking the build. Since `find_command`
returns an int, better to just store it as such as well.

This also makes some other casts unneeded, so remove those as well.
  • Loading branch information
matthijskooijman committed Oct 30, 2020
1 parent 5f9c321 commit bb692b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/command.cpp
Expand Up @@ -300,8 +300,9 @@ bool parse_comment(const string&line){
break;
case BEAUTIFY:{
commandstream>>command_part;
uint val=find_command(command_part,beaut),togglebit;
if(val!=(uint)-1&&val!=OFF)_commandState.beautifier=true;
int val=find_command(command_part,beaut);
uint togglebit;
if(val!=-1&&val!=OFF)_commandState.beautifier=true;
switch(val){
case -1:
IssueMessage(0,COMMAND_INVALID_ARG,gen[BEAUTIFY].name);
Expand Down Expand Up @@ -372,7 +373,7 @@ bool parse_comment(const string&line){
dotoggle:
commandstream>>command_part;
val=find_command(command_part,beaut);
if(!commandstream||val==(uint)-1){
if(!commandstream||val==-1){
IssueMessage(0,COMMAND_INVALID_ARG,gen[BEAUTIFY].name);
return true;
}
Expand Down

0 comments on commit bb692b2

Please sign in to comment.