Lines Matching refs:offset
44 size_t offset; member
51 if (static_cast<size_t>(n) > ck->size - ck->offset) n = ck->size - ck->offset; in fmemopen_read()
54 memmove(buf, ck->buf + ck->offset, n); in fmemopen_read()
55 ck->offset += n; in fmemopen_read()
68 if (ck->append) ck->offset = ck->size; in fmemopen_write()
71 if (static_cast<size_t>(n) + space_for_null > ck->capacity - ck->offset) { in fmemopen_write()
72 n = ck->capacity - ck->offset - space_for_null; in fmemopen_write()
81 memmove(ck->buf + ck->offset, buf, n); in fmemopen_write()
82 ck->offset += n; in fmemopen_write()
84 if (ck->offset >= ck->size) { in fmemopen_write()
85 if (buf[n - 1] != '\0') ck->buf[ck->offset] = '\0'; in fmemopen_write()
86 ck->size = ck->offset; in fmemopen_write()
92 static fpos_t fmemopen_seek(void* cookie, fpos_t offset, int whence) { in fmemopen_seek() argument
95 if (whence == SEEK_SET && (offset >= 0 && static_cast<size_t>(offset) <= ck->capacity)) { in fmemopen_seek()
96 return (ck->offset = offset); in fmemopen_seek()
97 } else if (whence == SEEK_CUR && (ck->offset + offset <= ck->capacity)) { in fmemopen_seek()
98 return (ck->offset += offset); in fmemopen_seek()
99 } else if (whence == SEEK_END && (offset <= 0 && static_cast<size_t>(-offset) <= ck->size)) { in fmemopen_seek()
100 return (ck->offset = ck->size + offset); in fmemopen_seek()
144 ck->offset = ck->size; in fmemopen()
148 ck->offset = 0; in fmemopen()
151 ck->offset = 0; in fmemopen()