fread.c (92986) | fread.c (101776) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 24 unchanged lines hidden (view full) --- 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)fread.c 8.2 (Berkeley) 12/11/93"; 39#endif /* LIBC_SCCS and not lint */ 40#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 24 unchanged lines hidden (view full) --- 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)fread.c 8.2 (Berkeley) 12/11/93"; 39#endif /* LIBC_SCCS and not lint */ 40#include <sys/cdefs.h> |
41__FBSDID("$FreeBSD: head/lib/libc/stdio/fread.c 92986 2002-03-22 21:53:29Z obrien $"); | 41__FBSDID("$FreeBSD: head/lib/libc/stdio/fread.c 101776 2002-08-13 09:30:41Z tjr $"); |
42 43#include "namespace.h" 44#include <stdio.h> 45#include <string.h> 46#include "un-namespace.h" 47#include "local.h" 48#include "libc_private.h" 49 --- 11 unchanged lines hidden (view full) --- 61 /* 62 * The ANSI standard requires a return value of 0 for a count 63 * or a size of 0. Peculiarily, it imposes no such requirements 64 * on fwrite; it only requires fread to be broken. 65 */ 66 if ((resid = count * size) == 0) 67 return (0); 68 FLOCKFILE(fp); | 42 43#include "namespace.h" 44#include <stdio.h> 45#include <string.h> 46#include "un-namespace.h" 47#include "local.h" 48#include "libc_private.h" 49 --- 11 unchanged lines hidden (view full) --- 61 /* 62 * The ANSI standard requires a return value of 0 for a count 63 * or a size of 0. Peculiarily, it imposes no such requirements 64 * on fwrite; it only requires fread to be broken. 65 */ 66 if ((resid = count * size) == 0) 67 return (0); 68 FLOCKFILE(fp); |
69 ORIENT(fp, -1); |
|
69 if (fp->_r < 0) 70 fp->_r = 0; 71 total = resid; 72 p = buf; 73 while (resid > (r = fp->_r)) { 74 (void)memcpy((void *)p, (void *)fp->_p, (size_t)r); 75 fp->_p += r; 76 /* fp->_r = 0 ... done in __srefill */ --- 14 unchanged lines hidden --- | 70 if (fp->_r < 0) 71 fp->_r = 0; 72 total = resid; 73 p = buf; 74 while (resid > (r = fp->_r)) { 75 (void)memcpy((void *)p, (void *)fp->_p, (size_t)r); 76 fp->_p += r; 77 /* fp->_r = 0 ... done in __srefill */ --- 14 unchanged lines hidden --- |