From 79549aab5b9ca8f0cad4f00bc8ad68b7091ab65f Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 5 Jun 2026 10:12:56 +0200 Subject: magic: implement buffer processing support --- cabinet/magic.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cabinet/magic.cpp') diff --git a/cabinet/magic.cpp b/cabinet/magic.cpp index 96b78a3..3c36881 100644 --- a/cabinet/magic.cpp +++ b/cabinet/magic.cpp @@ -3,8 +3,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -68,6 +70,11 @@ namespace cab return handle_result(::magic_descriptor(m_cookie, file_descriptor)); } + auto magic::process(std::span data) -> std::expected + { + return handle_result(::magic_buffer(m_cookie, data.data(), data.size_bytes())); + } + auto magic::handle_result(char const * result) -> std::expected { auto errno_copy = errno; -- cgit v1.2.3