mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-11 13:35:27 +00:00
vfs_rump: use dynamic_cast for safe downcasts
As it stands, the implementation requires minimal reflection measures to implement correct cleanup procedure. static_cast<> cannot be used as it does not implement runtime type casting as dynamic_cast<> does.
This commit is contained in:
parent
8a4f4fcea9
commit
d21464399f
@ -667,7 +667,7 @@ class Vfs::Rump_file_system : public File_system
|
|||||||
void close(Vfs_handle *vfs_handle) override
|
void close(Vfs_handle *vfs_handle) override
|
||||||
{
|
{
|
||||||
if (Rump_vfs_file_handle *handle =
|
if (Rump_vfs_file_handle *handle =
|
||||||
static_cast<Rump_vfs_file_handle *>(vfs_handle))
|
dynamic_cast<Rump_vfs_file_handle *>(vfs_handle))
|
||||||
{
|
{
|
||||||
_file_handles.remove(handle);
|
_file_handles.remove(handle);
|
||||||
if (handle->modifying())
|
if (handle->modifying())
|
||||||
@ -676,13 +676,13 @@ class Vfs::Rump_file_system : public File_system
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (Rump_vfs_dir_handle *handle =
|
if (Rump_vfs_dir_handle *handle =
|
||||||
static_cast<Rump_vfs_dir_handle *>(vfs_handle))
|
dynamic_cast<Rump_vfs_dir_handle *>(vfs_handle))
|
||||||
{
|
{
|
||||||
destroy(vfs_handle->alloc(), handle);
|
destroy(vfs_handle->alloc(), handle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (Rump_vfs_symlink_handle *handle =
|
if (Rump_vfs_symlink_handle *handle =
|
||||||
static_cast<Rump_vfs_symlink_handle *>(vfs_handle))
|
dynamic_cast<Rump_vfs_symlink_handle *>(vfs_handle))
|
||||||
{
|
{
|
||||||
destroy(vfs_handle->alloc(), handle);
|
destroy(vfs_handle->alloc(), handle);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user