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

Preventing non-return on non-void; changing printf format #178

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Zacharyprime
Copy link
Member

Preventing non-return on non-void function:

/home/zachary/libwallaby/module/graphics/src/graphics.cpp: In function ‘PixelToaster::Pixel fromTrueColor(Encoding, int, int, int)’:
/home/zachary/libwallaby/module/graphics/src/graphics.cpp:139:1: warning: control reaches end of non-void function [-Wreturn-type]
  139 | }
      | ^

The compiler is unaware that there are only two valid inputs for the definition Encoding.
Changing the bottom case to default shouldn't change anything functionally since BGR and RGB are the only valid encodings.

Changing printf %d to %lu for long unsigned int:
This throws a warning because %d is not the correct printf syntax for long unsigned ints.
%lu matches the C++ docs and removes the warning.

@Zacharyprime Zacharyprime changed the title Warning Preventing non-return on non-void; changing printf format Sep 19, 2022
@Zacharyprime
Copy link
Member Author

Zacharyprime commented Sep 26, 2022

The two most recent commits remove 2 warnings:
-Switching char to const char: Removes the warning of converting string to uint8_t (char*). It seems this is always used in the form of passing a constant expression and not an actual char pointer.

-Specify narrowing conversion: The compiler warns that the conversion is narrowing, this conversion's intention is to narrow into a lower bit representation so we add an explicit cast to tell the compiler that it is intentional.

@Zacharyprime Zacharyprime linked an issue Nov 4, 2022 that may be closed by this pull request
Base automatically changed from refactor to master January 19, 2024 07:25
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.

Fix all compilation warnings
1 participant