Lines Matching full:if
22 starts writing at the first NUL byte. If <[buf]> is NULL, then
23 <[size]> bytes are automatically provided as if by <<malloc>>, with
30 than <[size]>. If <[mode]> starts with <<r>>, the position starts at
31 <<0>>, and file size starts at <[size]> if <[buf]> was provided. If
33 and if <[buf]> was provided, the first byte is set to NUL. If
35 location of the first NUL byte, or else <[size]> if <[buf]> was
44 if there is still room; if the stream is not also open for reading, a
54 <<NULL>> is returned, and <<errno>> will be set to EINVAL if <[size]>
55 is zero or <[mode]> is invalid, ENOMEM if <[buf]> was NULL and memory
56 could not be allocated, or EMFILE if too many streams are already
79 char append; /* nonzero if appending */
80 char writeonly; /* 1 if write-only */
94 if (c->pos > c->eof) in fmemreader()
96 if (n >= c->eof - c->pos) in fmemreader()
112 int adjust = 0; /* true if at EOF, but still need to write NUL. */ in fmemwriter()
114 /* Append always seeks to eof; otherwise, if we have previously done in fmemwriter()
116 if (c->append) in fmemwriter()
118 else if (c->pos > c->eof) in fmemwriter()
121 if (c->pos + n > c->max - c->writeonly) in fmemwriter()
126 /* Now n is the number of bytes being modified, and adjust is 1 if in fmemwriter()
127 the last byte is NUL instead of from buf. Write a NUL if in fmemwriter()
128 write-only; or if read-write, eof changed, and there is still in fmemwriter()
130 overwrite so we can restore it if we seek elsewhere later. */ in fmemwriter()
131 if (c->pos + n > c->eof) in fmemwriter()
134 if (c->eof - adjust < c->max) in fmemwriter()
137 else if (c->writeonly) in fmemwriter()
139 if (n) in fmemwriter()
148 if (n - adjust) in fmemwriter()
173 if (whence == SEEK_CUR) in fmemseeker()
175 else if (whence == SEEK_END) in fmemseeker()
177 if (offset < 0) in fmemseeker()
182 else if (offset > (off_t) c->max) in fmemseeker()
188 else if ((_fpos_t) offset != offset) in fmemseeker()
196 if (c->writeonly && c->pos < c->eof) in fmemseeker()
202 if (c->writeonly && c->pos < c->eof) in fmemseeker()
222 if (whence == SEEK_CUR) in fmemseeker64()
224 else if (whence == SEEK_END) in fmemseeker64()
226 if (offset < 0) in fmemseeker64()
231 else if (offset > (_off64_t) c->max) in fmemseeker64()
238 if (c->writeonly && c->pos < c->eof) in fmemseeker64()
244 if (c->writeonly && c->pos < c->eof) in fmemseeker64()
277 if ((flags = __sflags (mode, &dummy)) == 0) in fmemopen()
279 if (!size || !(buf || flags & __SRW)) in fmemopen()
284 if ((fp = __sfp ()) == NULL) in fmemopen()
286 if ((c = (fmemcookie *) malloc (sizeof *c + (buf ? 0 : size))) in fmemopen()
304 if (!buf) in fmemopen()
321 if (!buf && c->writeonly) in fmemopen()
322 /* a: guarantee a NUL within size even if no writes. */ in fmemopen()