Skip to content

Commit 7cb9ee0

Browse files
committed
use R_IO_SEEK instead of SEEK
1 parent d2a03c5 commit 7cb9ee0

File tree

9 files changed

+38
-36
lines changed

9 files changed

+38
-36
lines changed

libr/io/p/io_dsc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -976,14 +976,14 @@ static ut64 r_io_dsc_object_seek(RIO *io, RIODscObject *dsc, ut64 offset, int wh
976976
ut64 off_global;
977977

978978
switch (whence) {
979-
case SEEK_SET:
980-
off_global = offset;
979+
case R_IO_SEEK_SET:
980+
off_global = offset; //XXX
981981
break;
982-
case SEEK_CUR:
983-
off_global = io->off + offset;
982+
case R_IO_SEEK_CUR:
983+
off_global = io->off + offset; //XXX
984984
break;
985-
case SEEK_END:
986-
off_global = dsc->total_size + offset;
985+
case R_IO_SEEK_END:
986+
off_global = dsc->total_size + offset; //XXX
987987
break;
988988
default:
989989
return UT64_MAX;

libr/io/p/io_gprobe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,17 +1388,17 @@ static ut64 __lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) {
13881388
}
13891389
gprobe = (RIOGprobe *)fd->data;
13901390
switch (whence) {
1391-
case SEEK_SET:
1391+
case R_IO_SEEK_SET:
13921392
if (offset >= GPROBE_SIZE) {
13931393
return gprobe->offset = GPROBE_SIZE - 1;
13941394
}
13951395
return gprobe->offset = offset;
1396-
case SEEK_CUR:
1396+
case R_IO_SEEK_CUR:
13971397
if ((gprobe->offset + offset) >= GPROBE_SIZE) {
13981398
return gprobe->offset = GPROBE_SIZE - 1;
13991399
}
14001400
return gprobe->offset += offset;
1401-
case SEEK_END:
1401+
case R_IO_SEEK_END:
14021402
return gprobe->offset = GPROBE_SIZE - 1;
14031403
}
14041404
return offset;

libr/io/p/io_gzip.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ static ut64 __lseek(RIO* io, RIODesc *fd, ut64 offset, int whence) {
139139
}
140140
ut32 mallocsz = _io_malloc_sz (fd);
141141
switch (whence) {
142-
case SEEK_SET:
142+
case R_IO_SEEK_SET:
143143
r_offset = (offset <= mallocsz) ? offset : mallocsz;
144144
break;
145-
case SEEK_CUR:
145+
case R_IO_SEEK_CUR:
146146
r_offset = (_io_malloc_off (fd) + offset <= mallocsz ) ? _io_malloc_off (fd) + offset : mallocsz;
147147
break;
148-
case SEEK_END:
148+
case R_IO_SEEK_END:
149149
r_offset = _io_malloc_sz (fd);
150150
break;
151151
}

libr/io/p/io_mmap.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ typedef struct r_io_mmo_t {
1818
static ut64 r_io_mmap_seek(RIO *io, RIOMMapFileObj *mmo, ut64 offset, int whence) {
1919
ut64 seek_val = r_buf_tell (mmo->buf);
2020
switch (whence) {
21-
case SEEK_SET:
21+
case R_IO_SEEK_SET:
2222
seek_val = (r_buf_size (mmo->buf) < offset)? r_buf_size (mmo->buf): offset;
2323
r_buf_seek (mmo->buf, io->off = seek_val, R_BUF_SET);
2424
return seek_val;
25-
case SEEK_CUR:
26-
seek_val = (r_buf_size (mmo->buf) < (offset + r_buf_tell (mmo->buf)))? r_buf_size (mmo->buf): offset + r_buf_tell (mmo->buf);
25+
case R_IO_SEEK_CUR:
26+
seek_val = (r_buf_size (mmo->buf) < (offset + r_buf_tell (mmo->buf)))? r_buf_size (mmo->buf):
27+
offset + r_buf_tell (mmo->buf);
2728
r_buf_seek (mmo->buf, io->off = seek_val, R_BUF_SET);
2829
return seek_val;
29-
case SEEK_END:
30+
case R_IO_SEEK_END:
3031
seek_val = r_buf_size (mmo->buf);
3132
r_buf_seek (mmo->buf, io->off = seek_val, R_BUF_SET);
3233
return seek_val;

libr/io/p/io_r2pipe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ static bool __close(RIODesc *fd) {
126126

127127
static ut64 __lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) {
128128
switch (whence) {
129-
case SEEK_SET: return offset;
130-
case SEEK_CUR: return io->off + offset;
131-
case SEEK_END: return UT64_MAX - 1;
129+
case R_IO_SEEK_SET: return offset;
130+
case R_IO_SEEK_CUR: return io->off + offset;
131+
case R_IO_SEEK_END: return UT64_MAX - 1;
132132
}
133133
return offset;
134134
}

libr/io/p/io_reg.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ static ut64 __lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) {
7373
}
7474
const int size = arena->size;
7575
switch (whence) {
76-
case SEEK_SET:
76+
case R_IO_SEEK_SET:
7777
if (offset >= size) {
7878
return size;
7979
} else {
8080
return offset;
8181
}
82-
case SEEK_CUR:
82+
case R_IO_SEEK_CUR:
8383
return io->off + offset;
84-
case SEEK_END:
84+
case R_IO_SEEK_END:
8585
return size;
8686
}
8787
return io->off;

libr/io/p/io_self.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,13 @@ static int __write(RIO *io, RIODesc *fd, const ut8 *buf, int len) {
413413

414414
static ut64 __lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) {
415415
switch (whence) {
416-
case SEEK_SET:
416+
case R_IO_SEEK_SET:
417417
io->off = offset;
418418
return offset;
419-
case SEEK_CUR:
419+
case R_IO_SEEK_CUR:
420420
io->off += offset;
421421
return io->off;
422-
case SEEK_END:
422+
case R_IO_SEEK_END:
423423
if (sizeof (void*) == 8) {
424424
io->off = UT64_MAX;
425425
} else {

libr/io/p/io_shm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,22 @@ static ut64 shm__lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) {
6969
R_RETURN_VAL_IF_FAIL (fd && fd->data, -1);
7070
RIOShm *shm = fd->data;
7171
switch (whence) {
72-
case SEEK_SET:
72+
case R_IO_SEEK_SET:
7373
io->off = offset;
7474
break;
75-
case SEEK_CUR:
75+
case R_IO_SEEK_CUR:
7676
if (io->off + offset > shm->size) {
77-
io->off = shm->size;
77+
io->off = shm->size; //XXX
7878
} else {
79-
io->off += offset;
79+
io->off += offset; //XXX
8080
}
8181
break;
82-
case SEEK_END:
82+
case R_IO_SEEK_END:
8383
if ((int)shm->size > 0) {
84-
io->off = shm->size + (int)offset;
84+
io->off = shm->size + (int)offset; //XXX
8585
} else {
8686
// UT64_MAX means error
87-
io->off = UT64_MAX - 1;
87+
io->off = UT64_MAX - 1; //XXX
8888
}
8989
break;
9090
}

libr/io/p/io_zip.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,16 @@ static ut64 r_io_zip_lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) {
514514
seek_val = r_buf_tell (zfo->b);
515515

516516
switch (whence) {
517-
case SEEK_SET:
517+
case R_IO_SEEK_SET:
518518
seek_val = (r_buf_size (zfo->b) < offset)? r_buf_size (zfo->b): offset;
519519
r_buf_seek (zfo->b, seek_val, R_BUF_SET);
520520
return seek_val;
521-
case SEEK_CUR:
522-
seek_val = (r_buf_size (zfo->b) < (offset + r_buf_tell (zfo->b)))? r_buf_size (zfo->b): offset + r_buf_tell (zfo->b);
521+
case R_IO_SEEK_CUR:
522+
seek_val = (r_buf_size (zfo->b) < (offset + r_buf_tell (zfo->b)))?
523+
r_buf_size (zfo->b): offset + r_buf_tell (zfo->b);
523524
r_buf_seek (zfo->b, seek_val, R_BUF_SET);
524525
return seek_val;
525-
case SEEK_END:
526+
case R_IO_SEEK_END:
526527
seek_val = r_buf_size (zfo->b);
527528
r_buf_seek (zfo->b, seek_val, R_BUF_SET);
528529
return seek_val;

0 commit comments

Comments
 (0)