* Fix for r_io_resize -- needs merge with refactor

This commit is contained in:
pancake 2011-01-17 15:28:40 +01:00
parent 4bc2043d78
commit 74ff5af871
2 changed files with 6 additions and 13 deletions

View File

@ -193,6 +193,7 @@ R_API ut64 r_io_seek(RIO *io, ut64 offset, int whence);
R_API int r_io_system(RIO *io, const char *cmd);
R_API int r_io_close(RIO *io, int fd);
R_API ut64 r_io_size(RIO *io, int fd);
R_API int r_io_resize(struct r_io_t *io, ut64 newsize);
/* io/cache.c */
R_API void r_io_cache_commit(RIO *io);

View File

@ -189,19 +189,11 @@ R_API ut64 r_io_read_i(struct r_io_t *io, ut64 addr, int sz, int endian) {
return ret;
}
R_API int r_io_resize(struct r_io_t *io, const char *file, int flags, int mode) {
// XXX not implemented
#if 0
/* TODO */
struct r_io_plugin_t *plugin = r_io_plugin_resolve(file);
if (plugin && io->plugin->resize) {
int fd = plugin->resize(file, flags, mode);
if (fd != -1)
r_io_plugin_open(fd, plugin);
return fd;
}
#endif
return -1;
R_API int r_io_resize(struct r_io_t *io, ut64 newsize) {
if (io->plugin && io->plugin->resize)
return io->plugin->resize (io, io->fd, newsize);
else ftruncate (io->fd, newsize);
return R_FALSE;
}
R_API int r_io_set_write_mask(struct r_io_t *io, const ut8 *buf, int len) {