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 enum compare warning in GuiPanel #456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SollyBunny
Copy link

warning: enumerated mismatch in conditional expression: ‘GuiControlProperty’ vs ‘GuiDefaultProperty’ [-Wenum-compare]
 1722 |                      GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BASE_COLOR_DISABLED : BACKGROUND_COLOR)));
      |                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@raysan5
Copy link
Owner

raysan5 commented Feb 5, 2025

@SollyBunny I'm afraid this fix is not correct, GetColor() expects unsigned int.

@raysan5 raysan5 closed this Feb 5, 2025
@SollyBunny
Copy link
Author

GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BASE_COLOR_DISABLED : BACKGROUND_COLOR)));
calls
GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BASE_COLOR_DISABLED : BACKGROUND_COLOR));
where GuiGetStyle is defined as
RAYGUIAPI int GuiGetStyle(int control, int property);
where property is (state == STATE_DISABLED)? BASE_COLOR_DISABLED : BACKGROUND_COLOR which should be an int, both BASE_COLOR_DISABLED (10) and BACKGROUND_COLOR (19) are > 0 in their respective enums and the enums don't contain < 0 elements
static Color GetColor(int hexValue) expects an int but either way I didn't change what type GuiGetStyle returns

I think this is correct

@raysan5 raysan5 reopened this Feb 5, 2025
@raysan5
Copy link
Owner

raysan5 commented Feb 5, 2025

Reopening for further review...

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.

2 participants