From 58fe4f9d3045bf663fab9e7d48a8dd13814e2faf Mon Sep 17 00:00:00 2001 From: tomo Date: Tue, 17 Aug 1999 06:33:17 +0000 Subject: [PATCH] (determine_real_coding_system): Check by nread instead of 4096. --- src/file-coding.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/file-coding.c b/src/file-coding.c index 9dd0922..9d3afe7 100644 --- a/src/file-coding.c +++ b/src/file-coding.c @@ -1629,25 +1629,25 @@ determine_real_coding_system (Lstream *stream, Lisp_Object *codesys_in_out, { unsigned char *cp = random_buffer; - while (cp < random_buffer + 4096) + while (cp < random_buffer + nread) { - if ((*cp++ == 'c') && (cp < random_buffer + 4096) && - (*cp++ == 'o') && (cp < random_buffer + 4096) && - (*cp++ == 'd') && (cp < random_buffer + 4096) && - (*cp++ == 'i') && (cp < random_buffer + 4096) && - (*cp++ == 'n') && (cp < random_buffer + 4096) && - (*cp++ == 'g') && (cp < random_buffer + 4096) && - (*cp++ == ':') && (cp < random_buffer + 4096)) + if ((*cp++ == 'c') && (cp < random_buffer + nread) && + (*cp++ == 'o') && (cp < random_buffer + nread) && + (*cp++ == 'd') && (cp < random_buffer + nread) && + (*cp++ == 'i') && (cp < random_buffer + nread) && + (*cp++ == 'n') && (cp < random_buffer + nread) && + (*cp++ == 'g') && (cp < random_buffer + nread) && + (*cp++ == ':') && (cp < random_buffer + nread)) { unsigned char coding_system_name[4096 - 6]; unsigned char *np = coding_system_name; - while ( (cp < random_buffer + 4096) + while ( (cp < random_buffer + nread) && ((*cp == ' ') || (*cp == '\t')) ) { cp++; } - while ( (cp < random_buffer + 4096) && + while ( (cp < random_buffer + nread) && (*cp != ' ') && (*cp != '\t') && (*cp != ';') ) { *np++ = *cp++; -- 1.7.10.4