Hi,

On Tue, 06 Jan 2015 02:09:04 -0500: Christopher Sean Morrison <brl...@mac.com> 
wrote:
  > Peter,

  > I’m not understanding the below change.  Can you explain it?

  > The if check is making sure the scanf succeeded before allowing the
  > loop to continue.  Per the preceding comment, this is to make sure
  > that a delimiter is present.  Your change ensures that a delimiter
  > is NOT present, no?  Just wondering if the problem is actually a
  > caller was missing a delimiter that was expected, or the delimiter
  > checking logic is wrong.

The delim_fmt is mostly created from a constant string passed into the
function, but it does have a '%n' at the end of the string, used to make
sure that it did, in fact, read in the delimiter (by checking that len
== delim_len).  Since the spec says that %n shouldn't increment the
return value of scanf, this means that the return value will always be 0
--- so trying to check that part_n == 1 always fails, making
bu_scan_fastf_t return after only scanning one input.

  > Cheers!
  > Sean

Regards,

    ---Peter

On Dec 26, 2014, at 10:06 AM, peter...@users.sourceforge.net wrote:

  >> Revision: 63845
  >> http://sourceforge.net/p/brlcad/code/63845
  >> Author:   peter-sa
  >> Date:     2014-12-26 15:06:37 +0000 (Fri, 26 Dec 2014)
  >> Log Message:
  >> -----------
  >> Apply GCI task 
http://www.google-melange.com/gci/task/view/google/gci2014/4967862338846720 
that fixes bu_scan_fastf_t by updating the value that it checks return value of 
scanf() against when scanning the delimiter.
  >> 
  >> Modified Paths:
  >> --------------
  >> brlcad/trunk/src/libbu/scan.c
  >> 
  >> Modified: brlcad/trunk/src/libbu/scan.c
  >> ===================================================================
  >> --- brlcad/trunk/src/libbu/scan.c  2014-12-24 22:06:22 UTC (rev 63844)
  >> +++ brlcad/trunk/src/libbu/scan.c  2014-12-26 15:06:37 UTC (rev 63845)
  >> @@ -77,7 +77,7 @@
  >> part_n = scanf(delim_fmt, &len);
  >> 
  >> offset += len;
  >> -  if (part_n != 1 || len != delim_len) { break; }
  >> +  if (part_n != 0 || len != delim_len) { break; }
  >> }
  >> 
  >> va_end(ap);

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to