PDA

View Full Version : Fix in printf, update for sprintf (need gsc code update)



kung foo man
7th January 2015, 05:36
Hey all,

IzNoGoD fixed a bug in printf() and made sprintf() - finally :D - compatible to printf(). That means no %s/%d/%f etc., but only a %, since we can ask for the type of the parameter nonetheless to print it correctly.

https://github.com/kungfooman/libcod/commit/457588e956f70458753d68227f711ef0e5d50a86

It's not 100% compatible, the printf() would also print the type of an unknown parameter, like:



printf("player=%", player); // would print: player=(ENTITY)


Since this is kinda a "convention break", you gotta fix your sprintf-calls. To find all of them:



find . -name '*.gsc' | xargs grep -n sprintf


Kinda annoying, but I rather have compatible functions than mixed shit, so it's quite worth some effort.