Lameguy64 / PSn00bSDK

The most powerful open source SDK for the PS1 (as far as open source PS1 SDKs go). Not recommended for beginner use.
Other
838 stars 68 forks source link

Add C11 error checking to vsnprintf() #71

Closed saxbophone closed 1 year ago

saxbophone commented 1 year ago

C11 specifies that vsnprintf() is to check for the following conditions:

C11 also specifies "constraint handler functions" that may be set, but that's far more involved, and having at least some error-handling for bad arguments like these is probably quite useful.

Source: https://en.cppreference.com/w/c/io/vfprintf#:~:text=5%2D8),constraint%20handler%20function%3A

I know the C library provided here doesn't specify C99 or C11 (although the former is implied due to the presence of functions like vsnprintf() and friends), but this seems like a useful and important error case to check.

Let me know what you think

spicyjpeg commented 1 year ago

Looks fine. I've been waiting to release v0.23 due to several bugs that made their way into the GPU command queue implementation, but I can just merge this in once I manage to fix those. Thank you.

saxbophone commented 1 year ago

Looks fine. I've been waiting to release v0.23 due to several bugs that made their way into the GPU command queue implementation, but I can just merge this in once I manage to fix those. Thank you.

You're welcome!

I noticed in the libc readme, that invitations for further contributions for missing functions in libc are welcome. When I have the time (I don't currently! 😢), I might make a list of all the C stdlib functions and tick off the ones that the SDK's libc currently includes.

saxbophone commented 1 year ago

Thank you!