]> granicus.if.org Git - php/commitdiff
When doing automatic line end detection, pick the line end that is found
authorIlia Alshanetsky <iliaa@php.net>
Tue, 22 Oct 2002 15:34:50 +0000 (15:34 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 22 Oct 2002 15:34:50 +0000 (15:34 +0000)
first.

main/streams.c

index e288445b3b9ff094832134e365edf385af9fe927..d5e3123052210ebbe45e786646606e54116494ce 100755 (executable)
@@ -644,8 +644,8 @@ PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len
        if (stream->flags & PHP_STREAM_FLAG_DETECT_EOL) {
                cr = memchr(readptr, '\r', avail);
                lf = memchr(readptr, '\n', avail);
-
-               if (cr && lf != cr + 1) {
+       
+               if (cr && lf != cr + 1 && !(lf && lf < cr)) {
                        /* mac */
                        stream->flags ^= PHP_STREAM_FLAG_DETECT_EOL;
                        stream->flags |= PHP_STREAM_FLAG_EOL_MAC;