Opened 10 years ago

Closed 10 years ago

#184 closed defect (fixed)

CSV File Support Halts on Empty LInes

Reported by: Norm Olsen Owned by: Norm Olsen
Priority: minor Milestone: 3.0
Component: Library Version:
Keywords: CSV Cc:

Description

The CSV File Support module and, by inference, the NameMapper, stop abruptly when an empty line is encountered. Also, the BOM marker is handled as real data. Also, it would be nice if a comment feature could be supported.

Change History (1)

comment:1 by Norm Olsen, 10 years ago

Resolution: fixed
Status: newclosed

Corrected at Revision 2596.

This submission includes a minor overhaul to the CS_csvFileSupport.cpp module and related features. It adds the ability to ignore empty lines and support comment lines. Most importantly, it removes the use of std::istream::peek() which does not work per the specification on Microsoft products (going back to VC++ 2005. The peek function actually does a read of one character and leaves it in a place where it will be returned on the next read. The stream position, however, is advanced on each peek. Thus, multiple peeks on a stream will actually advance the file position of the stream, and will replace the next character to be read. Linux (or more precisely, the STL which gcc uses) does not have this problem.

We also fix, in the submission, an omission in a previous maintenance fix. When we added the new projection named "Lambert Conformal Conic - Michigan Variation), we neglected to add the new projection name, and the name of the new "Ellipsoid Scale" parameter to the NameMapper; thus WKT of the new Michigan systems would not work correctly. This is also corrected in this submission.

Finally, in addressing the blank line in a CSV problem, we found that the error reporting mechanism of the CSV File Support feature was in need of fixing. This is also accomplished with this version.

Code to skip over BOM markers was added to the CS_getCsvRecord function, but testing indicated that this slowed down loading of the NameMapper to a non-trivial degree; so that code has been commented out.

Note: See TracTickets for help on using tickets.