Summary: Make secfile reading cope with \r\n and \n\r line
endings on all platforms
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Fri Jul 29 00:30:49 2011
                Category: general
                Priority: 5 - Normal
                  Status: Ready For Test
                 Privacy: Public
             Assigned to: jtn
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 



Following on from bug #18396:

Attached patch makes secfile reading treat \r\n and \n\r line endings the
same as \n, if it sees them (e.g., if opening a file with DOS/Windows line
endings on Unix).

Tested on Unix. I haven't checked what happens with a Windows build of
Freeciv opening a Unix file in text mode; it depends if fgets() treats the
lone \n as a line ending.

(I briefly wondered if there might be crazy-but-theoretically-supported
multibyte character encodings where 0x0D might be a valid thing to see at the
start or end of a line. But any such encoding was pretty much doomed anyway if
opened in text mode. Certainly UTF-8 doesn't fall into this category.)

This probably wants some testing...


File Attachments:

Date: Fri Jul 29 00:30:49 2011  Name: trunk-S2_3-secfile-crlf.diff  Size: 1kB
  By: jtn



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to