static int __write(struct r_io_t *io, RIODesc *fd, const ut8 *buf, int count) { if (fd == NULL || fd->data == NULL) return -1; if (io->off+count >= RIOHTTP_SZ (fd)) return -1; memcpy (RIOHTTP_BUF (fd)+io->off, buf, count); return count; }
static int __write(RIO *io, RIODesc *fd, const ut8 *buf, int count) { if (!fd || !fd->data) { return -1; } if (io->off + count > RIOHTTP_SZ (fd)) { return -1; } memcpy (RIOHTTP_BUF (fd)+io->off, buf, count); return count; }
static int __read(struct r_io_t *io, RIODesc *fd, ut8 *buf, int count) { int sz = RIOHTTP_SZ (fd); if (fd == NULL || fd->data == NULL) return -1; if (io->off >= sz) return -1; if (io->off+count >= sz) count = sz-io->off; memcpy (buf, RIOHTTP_BUF (fd)+io->off, count); return count; }
static int __read(RIO *io, RIODesc *fd, ut8 *buf, int count) { unsigned int sz; if (!fd || !fd->data) { return -1; } sz = RIOHTTP_SZ (fd); if (io->off >= sz) { return -1; } if (io->off + count >= sz) { count = sz - io->off; } memcpy (buf, RIOHTTP_BUF (fd) + io->off, count); return count; }