Open XVilka opened 2 years ago
Please let's create actionable issues though, otherwise we just leave issues hanging around without anyone ever knowing when something is done or what needs to be done exactly.
I recommend using an abstraction like memory view , which also includes
buffer, buffer size, and offset. Maybe also include the functionality of rz_io_read_at
.
https://docs.python.org/3/library/stdtypes.html#memoryview
@imbillow RzBuffer offers such an abstraction - it works with different backends:
typedef enum {
RZ_BUFFER_FILE,
RZ_BUFFER_IO_FD,
RZ_BUFFER_IO,
RZ_BUFFER_BYTES,
RZ_BUFFER_MMAP,
RZ_BUFFER_SPARSE,
RZ_BUFFER_REF,
} RzBufferType;
https://github.com/rizinorg/rizin/blob/dev/librz/util/buf.c#L9
It also tracks the state of seek
and has a notion of start and end.
Also my opinion that most Rizin functions which force caller to temporary change seek is bad API and indicator that those functions should probably have offset argument.
_Originally posted by @karliss in https://github.com/rizinorg/cutter/pull/3005#discussion_r943141253_