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 SDL_memcmp argument mismatch in SDL_ttf.c #434

Merged
merged 1 commit into from
Dec 24, 2024

Conversation

stjepano
Copy link
Contributor

Corrected the SDL_memcmp function to compare the 'string' argument instead of 'text', ensuring proper string comparison logic. This resolves potential functional issues caused by the incorrect argument usage.

Before the fix:

// init code
TTF_Text* Txt = TTF_CreateText(SomeTextEngine, SomeFont, "0", 1);
// ... change the text
TTF_SetTextString(Txt, "1", 1)
Assert( StrCmp(Txt->text, "1") == 0 ) // <-- this fails, Txt->text remains "0" 

After the fix:

// init code
TTF_Text* Txt = TTF_CreateText(SomeTextEngine, SomeFont, "0", 1);
// ... change the text
TTF_SetTextString(Txt, "1", 1)
Assert( StrCmp(Txt->text, "1") == 0 ) // <-- OK, Txt->text is "1"

Corrected the SDL_memcmp function to compare the 'string' argument instead of 'text', ensuring proper string comparison logic. This resolves potential functional issues caused by the incorrect argument usage.
@sezero sezero requested a review from slouken December 24, 2024 14:28
@slouken slouken merged commit 40219a6 into libsdl-org:main Dec 24, 2024
5 checks passed
@slouken
Copy link
Collaborator

slouken commented Dec 24, 2024

Good fix, thanks!

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