Lines Matching refs:nbytes
46 static int fmemopen_read(void *cookie, char *buf, int nbytes);
47 static int fmemopen_write(void *cookie, const char *buf, int nbytes);
164 fmemopen_read(void *cookie, char *buf, int nbytes) in fmemopen_read() argument
168 if (nbytes > ck->len - ck->off) in fmemopen_read()
169 nbytes = ck->len - ck->off; in fmemopen_read()
171 if (nbytes == 0) in fmemopen_read()
174 memcpy(buf, ck->buf + ck->off, nbytes); in fmemopen_read()
176 ck->off += nbytes; in fmemopen_read()
178 return (nbytes); in fmemopen_read()
182 fmemopen_write(void *cookie, const char *buf, int nbytes) in fmemopen_write() argument
186 if (nbytes > ck->size - ck->off) in fmemopen_write()
187 nbytes = ck->size - ck->off; in fmemopen_write()
189 if (nbytes == 0) in fmemopen_write()
192 memcpy(ck->buf + ck->off, buf, nbytes); in fmemopen_write()
194 ck->off += nbytes; in fmemopen_write()
208 return (nbytes); in fmemopen_write()