Exemple #1
0
static ut64 __lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) {
	switch (whence) {
	case SEEK_SET: return offset;
	case SEEK_CUR: return io->off + offset;
	case SEEK_END: return RIOHTTP_SZ (fd);
	}
	return offset;
}
Exemple #2
0
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;
}
Exemple #3
0
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;
}
Exemple #4
0
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;
}
Exemple #5
0
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;
}