You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to compile on MSVC 2015 with SDL checking enabled: This function or variable may be unsafe. #149
When this library is compiled under MSVC 2015 with SDL checking on, compilation fails with this error:
C4996 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
The error occurs here at line 4694:
edit: This occurs with the latest release available from the releases list.
heh - i messed up trying to rewrite a character ^^
@nlohmann can you take a look at this and if you're ok with it I can do a pull request, think its perhaps less shitty than alternatives. we can also probably take out include on cstdio but not positive on that.
Activity
whackashoe commentedon Nov 19, 2015
snprintf could work. Otherwise, to disable you could do:
whackashoe commentedon Nov 19, 2015
From a bit of reading looks like snprintf is a bit variable between os... might it be useful to just skip sprintf altogether and do it manually?
Replace sprintf with hex function, this fixes nlohmann#149
Replace sprintf with hex function, this fixes nlohmann#149
Replace sprintf with hex function, this fixes nlohmann#149
whackashoe commentedon Nov 19, 2015
heh - i messed up trying to rewrite a character ^^
@nlohmann can you take a look at this and if you're ok with it I can do a pull request, think its perhaps less shitty than alternatives. we can also probably take out include on cstdio but not positive on that.
nlohmann commentedon Dec 6, 2015
Hi @whackashoe, thanks for looking into the issue. I would love to see a pull request with your replacement!
Merge pull request #153 from whackashoe/remove_sprintf
Stateford commentedon Mar 4, 2021
https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp#L7658
I'm running into this issue again. Looks like there's another call to snprintf here.
Looks like it was added 7.25.2020