Lines Matching refs:buf
40 char* buf; member
48 static int fmemopen_read(void* cookie, char* buf, int n) { in fmemopen_read() argument
54 memmove(buf, ck->buf + ck->offset, n); in fmemopen_read()
60 static int fmemopen_write(void* cookie, const char* buf, int n) { in fmemopen_write() argument
65 size_t space_for_null = (n > 0 && buf[n - 1] != '\0') ? 1 : 0; in fmemopen_write()
81 memmove(ck->buf + ck->offset, buf, n); in fmemopen_write()
85 if (buf[n - 1] != '\0') ck->buf[ck->offset] = '\0'; in fmemopen_write()
113 FILE* fmemopen(void* buf, size_t capacity, const char* mode) { in fmemopen() argument
123 ck->buf = static_cast<char*>(buf); in fmemopen()
126 if (ck->buf == nullptr) ck->buf = ck->allocation = static_cast<char*>(calloc(capacity, 1)); in fmemopen()
127 if (ck->buf == nullptr) { in fmemopen()
143 ck->size = strnlen(ck->buf, ck->capacity); in fmemopen()
153 ck->buf[0] = '\0'; in fmemopen()