diff --git a/libr/io/p/io_dsc.c b/libr/io/p/io_dsc.c index 85d74af9d2a390..a85bed0460aebe 100644 --- a/libr/io/p/io_dsc.c +++ b/libr/io/p/io_dsc.c @@ -976,14 +976,14 @@ static ut64 r_io_dsc_object_seek(RIO *io, RIODscObject *dsc, ut64 offset, int wh ut64 off_global; switch (whence) { - case SEEK_SET: - off_global = offset; + case R_IO_SEEK_SET: + off_global = offset; //XXX break; - case SEEK_CUR: - off_global = io->off + offset; + case R_IO_SEEK_CUR: + off_global = io->off + offset; //XXX break; - case SEEK_END: - off_global = dsc->total_size + offset; + case R_IO_SEEK_END: + off_global = dsc->total_size + offset; //XXX break; default: return UT64_MAX; diff --git a/libr/io/p/io_gprobe.c b/libr/io/p/io_gprobe.c index b59e31a745b8c5..7ff5da21fe22ff 100644 --- a/libr/io/p/io_gprobe.c +++ b/libr/io/p/io_gprobe.c @@ -1388,17 +1388,17 @@ static ut64 __lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) { } gprobe = (RIOGprobe *)fd->data; switch (whence) { - case SEEK_SET: + case R_IO_SEEK_SET: if (offset >= GPROBE_SIZE) { return gprobe->offset = GPROBE_SIZE - 1; } return gprobe->offset = offset; - case SEEK_CUR: + case R_IO_SEEK_CUR: if ((gprobe->offset + offset) >= GPROBE_SIZE) { return gprobe->offset = GPROBE_SIZE - 1; } return gprobe->offset += offset; - case SEEK_END: + case R_IO_SEEK_END: return gprobe->offset = GPROBE_SIZE - 1; } return offset; diff --git a/libr/io/p/io_gzip.c b/libr/io/p/io_gzip.c index d09e92bf1877ec..397ea035d17384 100644 --- a/libr/io/p/io_gzip.c +++ b/libr/io/p/io_gzip.c @@ -139,13 +139,13 @@ static ut64 __lseek(RIO* io, RIODesc *fd, ut64 offset, int whence) { } ut32 mallocsz = _io_malloc_sz (fd); switch (whence) { - case SEEK_SET: + case R_IO_SEEK_SET: r_offset = (offset <= mallocsz) ? offset : mallocsz; break; - case SEEK_CUR: + case R_IO_SEEK_CUR: r_offset = (_io_malloc_off (fd) + offset <= mallocsz ) ? _io_malloc_off (fd) + offset : mallocsz; break; - case SEEK_END: + case R_IO_SEEK_END: r_offset = _io_malloc_sz (fd); break; } diff --git a/libr/io/p/io_mmap.c b/libr/io/p/io_mmap.c index 73a7106431db03..9653e8067c6fd5 100644 --- a/libr/io/p/io_mmap.c +++ b/libr/io/p/io_mmap.c @@ -18,15 +18,16 @@ typedef struct r_io_mmo_t { static ut64 r_io_mmap_seek(RIO *io, RIOMMapFileObj *mmo, ut64 offset, int whence) { ut64 seek_val = r_buf_tell (mmo->buf); switch (whence) { - case SEEK_SET: + case R_IO_SEEK_SET: seek_val = (r_buf_size (mmo->buf) < offset)? r_buf_size (mmo->buf): offset; r_buf_seek (mmo->buf, io->off = seek_val, R_BUF_SET); return seek_val; - case SEEK_CUR: - seek_val = (r_buf_size (mmo->buf) < (offset + r_buf_tell (mmo->buf)))? r_buf_size (mmo->buf): offset + r_buf_tell (mmo->buf); + case R_IO_SEEK_CUR: + seek_val = (r_buf_size (mmo->buf) < (offset + r_buf_tell (mmo->buf)))? r_buf_size (mmo->buf): + offset + r_buf_tell (mmo->buf); r_buf_seek (mmo->buf, io->off = seek_val, R_BUF_SET); return seek_val; - case SEEK_END: + case R_IO_SEEK_END: seek_val = r_buf_size (mmo->buf); r_buf_seek (mmo->buf, io->off = seek_val, R_BUF_SET); return seek_val; diff --git a/libr/io/p/io_r2pipe.c b/libr/io/p/io_r2pipe.c index 2f1eac76cf3fe2..128695882ef83b 100644 --- a/libr/io/p/io_r2pipe.c +++ b/libr/io/p/io_r2pipe.c @@ -126,9 +126,9 @@ static bool __close(RIODesc *fd) { 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 UT64_MAX - 1; + case R_IO_SEEK_SET: return offset; + case R_IO_SEEK_CUR: return io->off + offset; + case R_IO_SEEK_END: return UT64_MAX - 1; } return offset; } diff --git a/libr/io/p/io_reg.c b/libr/io/p/io_reg.c index 41936083a470b6..f9df2fb60560fe 100644 --- a/libr/io/p/io_reg.c +++ b/libr/io/p/io_reg.c @@ -73,15 +73,15 @@ static ut64 __lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) { } const int size = arena->size; switch (whence) { - case SEEK_SET: + case R_IO_SEEK_SET: if (offset >= size) { return size; } else { return offset; } - case SEEK_CUR: + case R_IO_SEEK_CUR: return io->off + offset; - case SEEK_END: + case R_IO_SEEK_END: return size; } return io->off; diff --git a/libr/io/p/io_self.c b/libr/io/p/io_self.c index d92d2ec7b013cb..fdbabb85e9da55 100644 --- a/libr/io/p/io_self.c +++ b/libr/io/p/io_self.c @@ -413,13 +413,13 @@ static int __write(RIO *io, RIODesc *fd, const ut8 *buf, int len) { static ut64 __lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) { switch (whence) { - case SEEK_SET: + case R_IO_SEEK_SET: io->off = offset; return offset; - case SEEK_CUR: + case R_IO_SEEK_CUR: io->off += offset; return io->off; - case SEEK_END: + case R_IO_SEEK_END: if (sizeof (void*) == 8) { io->off = UT64_MAX; } else { diff --git a/libr/io/p/io_shm.c b/libr/io/p/io_shm.c index 6cb71d32e79964..a8616c2e132d9c 100644 --- a/libr/io/p/io_shm.c +++ b/libr/io/p/io_shm.c @@ -69,22 +69,22 @@ static ut64 shm__lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) { R_RETURN_VAL_IF_FAIL (fd && fd->data, -1); RIOShm *shm = fd->data; switch (whence) { - case SEEK_SET: + case R_IO_SEEK_SET: io->off = offset; break; - case SEEK_CUR: + case R_IO_SEEK_CUR: if (io->off + offset > shm->size) { - io->off = shm->size; + io->off = shm->size; //XXX } else { - io->off += offset; + io->off += offset; //XXX } break; - case SEEK_END: + case R_IO_SEEK_END: if ((int)shm->size > 0) { - io->off = shm->size + (int)offset; + io->off = shm->size + (int)offset; //XXX } else { // UT64_MAX means error - io->off = UT64_MAX - 1; + io->off = UT64_MAX - 1; //XXX } break; } diff --git a/libr/io/p/io_zip.c b/libr/io/p/io_zip.c index d2c9d027278245..edc8583a7d3594 100644 --- a/libr/io/p/io_zip.c +++ b/libr/io/p/io_zip.c @@ -514,15 +514,16 @@ static ut64 r_io_zip_lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) { seek_val = r_buf_tell (zfo->b); switch (whence) { - case SEEK_SET: + case R_IO_SEEK_SET: seek_val = (r_buf_size (zfo->b) < offset)? r_buf_size (zfo->b): offset; r_buf_seek (zfo->b, seek_val, R_BUF_SET); return seek_val; - case SEEK_CUR: - seek_val = (r_buf_size (zfo->b) < (offset + r_buf_tell (zfo->b)))? r_buf_size (zfo->b): offset + r_buf_tell (zfo->b); + case R_IO_SEEK_CUR: + seek_val = (r_buf_size (zfo->b) < (offset + r_buf_tell (zfo->b)))? + r_buf_size (zfo->b): offset + r_buf_tell (zfo->b); r_buf_seek (zfo->b, seek_val, R_BUF_SET); return seek_val; - case SEEK_END: + case R_IO_SEEK_END: seek_val = r_buf_size (zfo->b); r_buf_seek (zfo->b, seek_val, R_BUF_SET); return seek_val;