@@ -651,11 +651,7 @@ qf_get_next_file_line(qfstate_T *state)
651651
652652 discard = FALSE;
653653 state -> linelen = (int )STRLEN (IObuff );
654- if (state -> linelen == IOSIZE - 1 && !(IObuff [state -> linelen - 1 ] == '\n'
655- #ifdef USE_CRNL
656- || IObuff [state -> linelen - 1 ] == '\r'
657- #endif
658- ))
654+ if (state -> linelen == IOSIZE - 1 && !(IObuff [state -> linelen - 1 ] == '\n' ))
659655 {
660656 /*
661657 * The current line exceeds IObuff, continue reading using
@@ -680,11 +676,7 @@ qf_get_next_file_line(qfstate_T *state)
680676 break ;
681677 state -> linelen = (int )STRLEN (state -> growbuf + growbuflen );
682678 growbuflen += state -> linelen ;
683- if ((state -> growbuf )[growbuflen - 1 ] == '\n'
684- #ifdef USE_CRNL
685- || (state -> growbuf )[growbuflen - 1 ] == '\r'
686- #endif
687- )
679+ if ((state -> growbuf )[growbuflen - 1 ] == '\n' )
688680 break ;
689681 if (state -> growbufsiz == LINE_MAXLEN )
690682 {
@@ -708,11 +700,7 @@ qf_get_next_file_line(qfstate_T *state)
708700 */
709701 if (fgets ((char * )IObuff , IOSIZE , state -> fd ) == NULL
710702 || (int )STRLEN (IObuff ) < IOSIZE - 1
711- || IObuff [IOSIZE - 1 ] == '\n'
712- #ifdef USE_CRNL
713- || IObuff [IOSIZE - 1 ] == '\r'
714- #endif
715- )
703+ || IObuff [IOSIZE - 1 ] == '\n' )
716704 break ;
717705 }
718706
@@ -757,11 +745,13 @@ qf_get_nextline(qfstate_T *state)
757745
758746 /* remove newline/CR from the line */
759747 if (state -> linelen > 0 && state -> linebuf [state -> linelen - 1 ] == '\n' )
748+ {
760749 state -> linebuf [state -> linelen - 1 ] = NUL ;
761750#ifdef USE_CRNL
762- if (state -> linelen > 0 && state -> linebuf [state -> linelen - 1 ] == '\r' )
763- state -> linebuf [state -> linelen - 1 ] = NUL ;
751+ if (state -> linelen > 1 && state -> linebuf [state -> linelen - 2 ] == '\r' )
752+ state -> linebuf [state -> linelen - 2 ] = NUL ;
764753#endif
754+ }
765755
766756#ifdef FEAT_MBYTE
767757 remove_bom (state -> linebuf );
0 commit comments