diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2026-06-05 08:55:54 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2026-06-05 08:55:54 +0200 |
| commit | 81fa478a642b25715adecf27c283e6f15334d705 (patch) | |
| tree | 6e0bb3c889cfb9d38bac6b735512459cbbce064b /cabinet/magic.cpp | |
| parent | 1ca48e3790e69e63c3789a32d541e4086e849030 (diff) | |
| download | cabinet-81fa478a642b25715adecf27c283e6f15334d705.tar.xz cabinet-81fa478a642b25715adecf27c283e6f15334d705.zip | |
magic: implement file descriptor support
Diffstat (limited to 'cabinet/magic.cpp')
| -rw-r--r-- | cabinet/magic.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cabinet/magic.cpp b/cabinet/magic.cpp index b5c1aaa..08b3046 100644 --- a/cabinet/magic.cpp +++ b/cabinet/magic.cpp @@ -63,6 +63,16 @@ namespace cab return result; } + auto magic::process(int file_descriptor) -> std::expected<std::string, std::string> + { + auto result = ::magic_descriptor(m_cookie, file_descriptor); + if (!result) + { + return std::unexpected{std::string{::magic_error(m_cookie)}}; + } + return result; + } + auto swap(magic & lhs, magic & rhs) noexcept -> void { auto temp = std::move(lhs); |
