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: use snprintf instead of sprintf #1619

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

Conversation

ismagilli
Copy link

Modern compilers warn that the sprintf function is deprecated. I have added a call to snprintf function.

Note. Function snprintf appeared only in C99, so I added a check that the program compiles to the C99 standard and above. The gcc and clang compilers define the constant __STDC_VERSION__. The defined(__STDC_VERSION__) check is necessary because the __STDC_VERSION__ constant may not defined.

From man snprintf:

the snprintf() and vsnprintf() functions conform to ISO/IEC 9899:1999 (“ISO C99”)

@ismagilli
Copy link
Author

Update commit text:

- FIX: use snprintf instead of sprintf
+ FIX: image_writer: use snprintf instead of sprintf

cocoa-xu added a commit to elixir-nx/stb_image that referenced this pull request Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants