Changeset 3db78b89 for libcfa


Ignore:
Timestamp:
Jan 24, 2024, 12:11:48 PM (3 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
64c4b4d
Parents:
8a33777
Message:

Fix string reading bug: Manipulator ignore should not write to its output argument.

The prior test expectation was wrong.
The test was not following its rule that it should expect
the CFA library to show scanf-analogous behaviour.

Note, the corresponding expectation in collections/string-istream-manip was already correct.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r8a33777 r3db78b89  
    10761076                        } // if
    10771077                        // FIX ME: CFA strings need to be modified to NOT change the argument for this case, then this can be removed.
    1078                         if ( rwd > 0 && args == 0 ) f.s[0]= '\0';       // read failed => no pattern match => set string to null
     1078                        if ( ! f.flags.ignore && rwd > 0 && args == 0 ) f.s[0]= '\0';   // read failed => no pattern match => set string to null
    10791079                } else {
    10801080                        if ( f.flags.delimiter ) {                                      // getline
     
    11141114                                } // if
    11151115                        } // if
    1116                         if ( rwd > 0 && args == 0 ) f.s[0]= '\0';       // read failed => no pattern match => set string to null
     1116                        if ( ! f.flags.ignore && rwd > 0 && args == 0 ) f.s[0]= '\0';   // read failed => no pattern match => set string to null
    11171117                } // if
    11181118                if ( args == 1 && eof( is ) ) {                                 // data but scan ended at EOF
Note: See TracChangeset for help on using the changeset viewer.