From: David Levine Date: Tue, 15 Jan 2013 03:05:22 +0000 (-0600) Subject: In m_getfld(), fixed the loop that handles the FLDPLUS case. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/3d52c1a60f8b3e5902f0a3e5a69573a6e589a8fe?hp=--cc In m_getfld(), fixed the loop that handles the FLDPLUS case. In Getc(), removed the increment of the byte count at EOF, it didn't seem correct or necessary. --- 3d52c1a60f8b3e5902f0a3e5a69573a6e589a8fe diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 8c581080..e84e5550 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -341,9 +341,6 @@ Getc (FILE *iob) { if (read_more (&m, iob) == 0) { /* Pretend that we read a character. That's what stdio does. */ ++m.readpos; - /* Don't seem to need the following but maybe because no - caller of m_getfld () looks at it. */ - ++m.bytes_read; return EOF; } } @@ -515,8 +512,9 @@ m_getfld (int state, unsigned char name[NAMESZ], unsigned char *buf, */ cp = buf; i = *bufsz-1; + j = 0; for (;;) { - for (j = 0; c != '\n' && c != EOF && j++ <= i; ) { + while (c != '\n' && c != EOF && j++ < i) { *cp++ = c = Getc (iob); }