Fix ar naming and io read/write api (#3419)
This commit is contained in:
parent
125f0333aa
commit
c7dfbbcdcd
3 changed files with 14 additions and 5 deletions
|
|
@ -113,14 +113,22 @@ static int rz_io_ar_read(RzIO *io, RzIODesc *fd, ut8 *buf, int count) {
|
|||
if (!fd || !fd->data || !buf) {
|
||||
return -1;
|
||||
}
|
||||
return ar_read_at((RzArFp *)fd->data, io->off, buf, count);
|
||||
int res = ar_read_at((RzArFp *)fd->data, io->off, buf, count);
|
||||
if (res > 0) {
|
||||
io->off += res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static int rz_io_ar_write(RzIO *io, RzIODesc *fd, const ut8 *buf, int count) {
|
||||
if (!fd || !fd->data || !buf) {
|
||||
return -1;
|
||||
}
|
||||
return ar_write_at((RzArFp *)fd->data, io->off, (void *)buf, count);
|
||||
int res = ar_write_at((RzArFp *)fd->data, io->off, (void *)buf, count);
|
||||
if (res > 0) {
|
||||
io->off += res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static int rz_io_ar_close(RzIODesc *fd) {
|
||||
|
|
|
|||
|
|
@ -177,8 +177,9 @@ static void ar_sanitize_name(RzArFp *arf) {
|
|||
// thus the path needs to be unix only
|
||||
arf->name[i] = '/';
|
||||
} else if (!IS_PATH(arf->name[i])) {
|
||||
trim_end = false;
|
||||
arf->name[i] = '_';
|
||||
} else {
|
||||
trim_end = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,11 +319,11 @@ EOF
|
|||
RUN
|
||||
|
||||
NAME=Open only one object in the win archive file.
|
||||
FILE=ar://bins/ar/ucrtd.osmode.lib//d_/os/obj/x86fre/minkernel/crts/ucrt/src/appcrt/dll/osmode_debug_public/../not_callable_by_os_objfre_i386_clog10l.obj
|
||||
FILE=ar://bins/ar/ucrtd.osmode.lib//d_/os/obj/x86fre/minkernel/crts/ucrt/src/appcrt/dll/osmode_debug_public/../not_callable_by_os/objfre/i386/clog10l.obj
|
||||
CMDS=<<EOF
|
||||
ol
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
3 * r-x 0x000000b4 d_/os/obj/x86fre/minkernel/crts/ucrt/src/appcrt/dll/osmode_debug_public/../not_callable_by_os_objfre_i386_clog10l.obj
|
||||
3 * r-x 0x000000b4 d_/os/obj/x86fre/minkernel/crts/ucrt/src/appcrt/dll/osmode_debug_public/../not_callable_by_os/objfre/i386/clog10l.obj
|
||||
EOF
|
||||
RUN
|
||||
|
|
|
|||
Loading…
Reference in a new issue