Merge #6254 'vim-patch:7.4.2135,7.4.2144,7.4.2151'

This commit is contained in:
Justin M. Keyes
2017-03-15 14:10:56 +01:00
6 changed files with 16 additions and 26 deletions

View File

@@ -564,11 +564,8 @@ static int qf_get_next_file_line(qfstate_T *state)
bool discard = false;
state->linelen = STRLEN(IObuff);
if (state->linelen == IOSIZE - 1 && !(IObuff[state->linelen - 1] == '\n'
#ifdef USE_CRNL
|| IObuff[state->linelen - 1] == '\r'
#endif
)) { // NOLINT(whitespace/parens)
if (state->linelen == IOSIZE - 1
&& !(IObuff[state->linelen - 1] == '\n')) {
// The current line exceeds IObuff, continue reading using growbuf
// until EOL or LINE_MAXLEN bytes is read.
if (state->growbuf == NULL) {
@@ -587,11 +584,7 @@ static int qf_get_next_file_line(qfstate_T *state)
}
state->linelen = STRLEN(state->growbuf + growbuflen);
growbuflen += state->linelen;
if (state->growbuf[growbuflen - 1] == '\n'
#ifdef USE_CRNL
|| state->growbuf[growbuflen - 1] == '\r'
#endif
) {
if (state->growbuf[growbuflen - 1] == '\n') {
break;
}
if (state->growbufsiz == LINE_MAXLEN) {
@@ -609,11 +602,7 @@ static int qf_get_next_file_line(qfstate_T *state)
// discard everything until EOL or EOF is reached.
if (fgets((char *)IObuff, IOSIZE, state->fd) == NULL
|| STRLEN(IObuff) < IOSIZE - 1
|| IObuff[IOSIZE - 1] == '\n'
#ifdef USE_CRNL
|| IObuff[IOSIZE - 1] == '\r'
#endif
) {
|| IObuff[IOSIZE - 1] == '\n') {
break;
}
}
@@ -655,12 +644,12 @@ static int qf_get_nextline(qfstate_T *state)
if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\n') {
state->linebuf[state->linelen - 1] = NUL;
}
#ifdef USE_CRNL
if (state->linelen > 0 && state->linebuf[state->linelen - 1] == '\r') {
state->linebuf[state->linelen - 1] = NUL;
}
if (state->linelen > 1 && state->linebuf[state->linelen - 2] == '\r') {
state->linebuf[state->linelen - 2] = NUL;
}
#endif
}
remove_bom(state->linebuf);