« Return to Thread: [brlcad-tracker] [ brlcad-Bugs-3475562 ] bu_vls_printf doesn't handle complex formats properly

[brlcad-tracker] [ brlcad-Bugs-3475562 ] bu_vls_printf doesn't handle complex formats properly

by SourceForge.net :: Rate this Message:

| View in Thread

Bugs item #3475562, was opened at 2012-01-18 08:15
Message generated for change (Comment added) made by tbrowder2
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=640802&aid=3475562&group_id=105292

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Tom Browder (tbrowder2)
Assigned to: Nobody/Anonymous (nobody)
Summary: bu_vls_printf doesn't handle complex formats properly

Initial Comment:
This was fixed for a simple case in bug no. 3163487, but this format string doesn't work:

        bu_vls_printf(gedp->ged_result_str, "%-*.*s| %-*.*s = %*.*s |\n",
                      indent, indent, " ",
                      maxwidth[0], maxwidth[0], fname.rows[i].fields[0].buf,
                      maxwidth[1], maxwidth[1], table->rows[i].fields[0].buf);

The result works for the first and second '%*.*s' fields but the last field width is ignored (with or without the '-').  I can work around it by building the string with sprintf and feeding that to bu_vls_printf.  I'll add a test case later today.

----------------------------------------------------------------------

>Comment By: Tom Browder (tbrowder2)
Date: 2012-01-19 09:46

Message:
The correct file name is ""./src/libbu/vls.c".

----------------------------------------------------------------------

Comment By: Tom Browder (tbrowder2)
Date: 2012-01-19 09:45

Message:
The actual problem function seems to be "bu_vls_vprintf" in file
"./src/lubbu/vls.c".  There is now a regression test for the problem.  In
the build directory use "make vls-regress" to run the tests.

----------------------------------------------------------------------

Comment By: Tom Browder (tbrowder2)
Date: 2012-01-19 05:08

Message:
The bug actually exists with a simpler format string as may be seen in the
attached test case.  It seems that right justification in a
wider-than-strlen field doesn't work in second or later fields.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=640802&aid=3475562&group_id=105292

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
BRL-CAD Tracker mailing list
brlcad-tracker@...
https://lists.sourceforge.net/lists/listinfo/brlcad-tracker

 « Return to Thread: [brlcad-tracker] [ brlcad-Bugs-3475562 ] bu_vls_printf doesn't handle complex formats properly