From: tomo Date: Tue, 17 Aug 1999 06:33:17 +0000 (+0000) Subject: (determine_real_coding_system): Check by nread instead of 4096. X-Git-Tag: r21-2-19-tomo-3 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=58fe4f9d3045bf663fab9e7d48a8dd13814e2faf;p=chise%2Fxemacs-chise.git.1 (determine_real_coding_system): Check by nread instead of 4096. --- 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++;