Re: [AD] textprintf %n bug

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


ShadySlimGrady@xxxxxxxxxx wrote:

-            if (slen >= 0) {
+            if (slen > 0) {
                if (slen < info.field_width) {
                   if (info.flags & SPRINT_FLAG_LEFT_JUSTIFY) {
                      /* left align the result */

I'm not sure, but I think that this breaks justification. That is, printf("-%4s-", "") would output "--" instead of "- -", because the empty string, for which slen is 0, would never be justified...

A safer and equaly simple solution might be to set slen to -1 when dealing with the %n format. But I did not run any test, this is all off the top of my head :-)

--
Julien Cugnière




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/