-
Notifications
You must be signed in to change notification settings - Fork 182
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
Regression: snprintf emulation function calls snprintf, causing recursion problem #67
Comments
I see this in config.h, but no notes about what the breaking behaviour is: What (if any) versions of Windows or Visual Studio are targeted now? Today's MS is not my father's son's MS. ; - ) I noticed this in the docs for snprintf:
A small victory after so many years, I know, but things are changing:
|
@sicklittlemonkey I did some digging but wasn't able to find the original reason this was added. I suspect there was, at some point, some difference in behavior between the MSVC runtime and POSIX/C99, but I didn't bother to include that information in the comment or any of the various commit messages. In my HTMLDOC project, I just use _snprintf, so maybe that is the solution here vs. using the emulation functions... 🤷♂️ |
Reading through the documentation, I think the issue was the return value - the old MS snprintf didn't support passing a NULL buffer or returning the total formatted length (vs. the length of the string), which is used in the cupsd logging functions to format an arbitrarily long line. But since cupsd isn't something that can be compiled with Visual Studio, that doesn't seem particularly important... Also, it looks like the new, more standard snprintf implementation doesn't have this problem anyways so... |
[master af4fae4f8] Fix snprintf emulation function (Issue #67) |
I was a little too eager to replace the sprintf calls with sprintf in cups/snprintf.c, need to make them sprintf again and add a comment so we don't do this again.
Also investigate options for not using snprintf emulation on Windows... :/
The text was updated successfully, but these errors were encountered: