Lines Matching refs:nbytes
47 static int fmemopen_read(void *cookie, char *buf, int nbytes);
48 static int fmemopen_write(void *cookie, const char *buf, int nbytes);
161 fmemopen_read(void *cookie, char *buf, int nbytes)
165 if (nbytes > ck->len - ck->off)
166 nbytes = ck->len - ck->off;
168 if (nbytes == 0)
171 memcpy(buf, ck->buf + ck->off, nbytes);
173 ck->off += nbytes;
175 return (nbytes);
179 fmemopen_write(void *cookie, const char *buf, int nbytes)
183 if (nbytes > ck->size - ck->off)
184 nbytes = ck->size - ck->off;
186 if (nbytes == 0)
189 memcpy(ck->buf + ck->off, buf, nbytes);
191 ck->off += nbytes;
205 return (nbytes);