=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/diff_internals.c,v retrieving revision 1.10 retrieving revision 1.11 diff -c -r1.10 -r1.11 *** src/usr.bin/cvs/diff_internals.c 2007/05/29 08:02:59 1.10 --- src/usr.bin/cvs/diff_internals.c 2007/05/30 02:21:20 1.11 *************** *** 1,4 **** ! /* $OpenBSD: diff_internals.c,v 1.10 2007/05/29 08:02:59 ray Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: diff_internals.c,v 1.11 2007/05/30 02:21:20 ray Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. *************** *** 126,131 **** --- 126,132 ---- * 6n words for files of length n. */ + #include #include #include *************** *** 318,328 **** goto closem; } ! if (stat(file1, &stb1) < 0) { cvs_log(LP_ERR, "%s", file1); goto closem; } ! if (stat(file2, &stb2) < 0) { cvs_log(LP_ERR, "%s", file2); goto closem; } --- 319,329 ---- goto closem; } ! if (fstat(fileno(f1), &stb1) < 0) { cvs_log(LP_ERR, "%s", file1); goto closem; } ! if (fstat(fileno(f2), &stb2) < 0) { cvs_log(LP_ERR, "%s", file2); goto closem; } *************** *** 405,412 **** if (stb1.st_size != stb2.st_size) return (1); for (;;) { ! i = fread(buf1, (size_t)1, sizeof(buf1), f1); ! j = fread(buf2, (size_t)1, sizeof(buf2), f2); if (i != j) return (1); if (i == 0 && j == 0) { --- 406,413 ---- if (stb1.st_size != stb2.st_size) return (1); for (;;) { ! i = fread(buf1, 1, sizeof(buf1), f1); ! j = fread(buf2, 1, sizeof(buf2), f2); if (i != j) return (1); if (i == 0 && j == 0) { *************** *** 428,434 **** rewind(fd); ! sz = ((size_t)filesize <= SIZE_MAX ? (size_t)filesize : SIZE_MAX) / 25; if (sz < 100) sz = 100; --- 429,435 ---- rewind(fd); ! sz = (filesize <= SIZE_MAX ? filesize : SIZE_MAX) / 25; if (sz < 100) sz = 100; *************** *** 820,826 **** } } ! static __inline void range(int a, int b, char *separator) { diff_output("%d", a > b ? b : a); --- 821,827 ---- } } ! static void range(int a, int b, char *separator) { diff_output("%d", a > b ? b : a); *************** *** 828,834 **** diff_output("%s%d", separator, b); } ! static __inline void uni_range(int a, int b) { if (a < b) --- 829,835 ---- diff_output("%s%d", separator, b); } ! static void uni_range(int a, int b) { if (a < b) *************** *** 848,853 **** --- 849,855 ---- line = xmalloc(rlen + 1); if ((nr = pread(fd, line, rlen, off)) < 0) { cvs_log(LP_ERR, "preadline failed"); + xfree(line); return (NULL); } line[nr] = '\0'; *************** *** 859,865 **** { int ret; ! ret = regexec(&ignore_re, line, (size_t)0, NULL, 0); xfree(line); return (ret == 0); /* if it matched, it should be ignored. */ } --- 861,867 ---- { int ret; ! ret = regexec(&ignore_re, line, 0, NULL, 0); xfree(line); return (ret == 0); /* if it matched, it should be ignored. */ } *************** *** 923,929 **** /* * Print the context/unidiff header first time through. */ ! t = localtime(&stb1.st_mtime); (void)strftime(buf, sizeof(buf), "%d %b %G %H:%M:%S", t); --- 925,931 ---- /* * Print the context/unidiff header first time through. */ ! t = localtime(&stb1.st_mtime); (void)strftime(buf, sizeof(buf), "%d %b %G %H:%M:%S", t); *************** *** 1144,1150 **** return (1); rewind(f); ! cnt = fread(buf, (size_t)1, sizeof(buf), f); for (i = 0; i < cnt; i++) if (!isprint(buf[i]) && !isspace(buf[i])) return (0); --- 1146,1152 ---- return (1); rewind(f); ! cnt = fread(buf, 1, sizeof(buf), f); for (i = 0; i < cnt; i++) if (!isprint(buf[i]) && !isspace(buf[i])) return (0); *************** *** 1168,1174 **** nc = f[pos] - f[pos - 1]; if (nc >= sizeof(buf)) nc = sizeof(buf) - 1; ! nc = fread(buf, (size_t)1, nc, fp); if (nc > 0) { buf[nc] = '\0'; p = strchr((const char *)buf, '\n'); --- 1170,1176 ---- nc = f[pos] - f[pos - 1]; if (nc >= sizeof(buf)) nc = sizeof(buf) - 1; ! nc = fread(buf, 1, nc, fp); if (nc > 0) { buf[nc] = '\0'; p = strchr((const char *)buf, '\n');