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

Bitmap::valid() reversed in 3.0 #190

Closed
Randalphwa opened this issue Oct 28, 2024 · 2 comments
Closed

Bitmap::valid() reversed in 3.0 #190

Randalphwa opened this issue Oct 28, 2024 · 2 comments
Labels
bug Something isn't working question Further information is requested

Comments

@Randalphwa
Copy link

Previously, I used:

if ( bmp.valid() )

to verify that Document->render...() created a valid bitmap. With 3.0, Bitmap::valid() returns false if the bitmap exists whereas previously it returned true. It took me a while to find the problem, and I see that valid() is documented as deprecated but not marked as such. It certainly should not be used in it's current form since the correct check would now be:

if ( !bmp.valid() )

I.e., if valid returns false then the bitmap is valid.

Could this be either reversed back to it's original meaning so it doesn't break existing code, or marked as deprecated so that at least there is a compiler warning when using it?

@sammycage
Copy link
Owner

sammycage commented Oct 28, 2024

Could this be either reversed back to it's original meaning so it doesn't break existing code

I addressed this issue last week in this commit. I will release the patch when the time is right.

It took me a while to find the problem, and I see that valid() is documented as deprecated but not marked as such.

Since the API header is using C++11, I don’t see an easy way to mark the valid() function as [[deprecated]]. Instead, I’ve opted to use Doxygen comment style to indicate its deprecated status.

@Randalphwa
Copy link
Author

Having valid() return the same boolean value solves the issue for me, allowing me to switch back and forth between 3.0 and older version of lunasvg while I update all my code using the updated lunasvg. Thanks!

@sammycage sammycage added bug Something isn't working question Further information is requested labels Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants