Commit 88f80be7 authored by Paul's avatar Paul
Browse files

Fix compile errors

parent 631c1b52
...@@ -23,44 +23,45 @@ ...@@ -23,44 +23,45 @@
*/ */
#include <migraphx/msgpack.hpp> #include <migraphx/msgpack.hpp>
#include <migraphx/serialize.hpp> #include <migraphx/serialize.hpp>
#include <migraphx/functional.hpp>
#include <msgpack.hpp> #include <msgpack.hpp>
#include <variant> #include <variant>
namespace migraphx { // namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { // inline namespace MIGRAPHX_INLINE_NS {
struct msgpack_chunk // struct msgpack_chunk
{ // {
std::vector<value> chunks; // std::vector<value> chunks;
value as_value() const // value as_value() const
{ // {
if(chunks.empty()) // if(chunks.empty())
return {}; // return {};
const value& v = chunks.front(); // const value& v = chunks.front();
if(v.is_array() or v.is_object()) // if(v.is_array() or v.is_object())
{ // {
std::vector<value> values = v.is_array() ? v.get_array() : v.get_object(); // std::vector<value> values = v.is_array() ? v.get_array() : v.get_object();
std::for_each(chunks.begin() + 1, chunks.end(), [&](const auto& chunk) { // std::for_each(chunks.begin() + 1, chunks.end(), [&](const auto& chunk) {
values.insert(values.end(), chunk.begin(), chunk.end()); // values.insert(values.end(), chunk.begin(), chunk.end());
}); // });
return values; // return values;
} // }
else if(v.is_binary()) // else if(v.is_binary())
{ // {
value::binary data = v.get_binary(); // value::binary data = v.get_binary();
std::for_each(chunks.begin() + 1, chunks.end(), [&](const auto& chunk) { // std::for_each(chunks.begin() + 1, chunks.end(), [&](const auto& chunk) {
const value::binary& b = chunk.get_binary(); // const value::binary& b = chunk.get_binary();
data.insert(data.end(), b.begin(), b.end()); // data.insert(data.end(), b.begin(), b.end());
}); // });
return data; // return data;
} // }
MIGRAPHX_THROW("Incorrect chunking"); // MIGRAPHX_THROW("Incorrect chunking");
} // }
}; // };
} // namespace MIGRAPHX_INLINE_NS // } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx // } // namespace migraphx
namespace msgpack { namespace msgpack {
MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
...@@ -125,13 +126,12 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) ...@@ -125,13 +126,12 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
} }
default: MIGRAPHX_THROW("Incorrect chunking"); default: MIGRAPHX_THROW("Incorrect chunking");
} }
}
std::for_each( std::for_each(
o.via.array.ptr, o.via.array.ptr,
o.via.array.ptr + o.via.array.size, o.via.array.ptr + o.via.array.size,
[&](const msgpack::object& sa) { [&](const msgpack::object& sa) {
std::visit( std::visit(
overload( migraphx::overload(
[&](migraphx::value::binary& bin) { [&](migraphx::value::binary& bin) {
bin.insert( bin.insert(
bin.end(), o.via.bin.ptr, o.via.bin.ptr + o.via.bin.size); bin.end(), o.via.bin.ptr, o.via.bin.ptr + o.via.bin.size);
...@@ -164,9 +164,9 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) ...@@ -164,9 +164,9 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
case msgpack::type::EXT: { case msgpack::type::EXT: {
MIGRAPHX_THROW("msgpack EXT type not supported."); MIGRAPHX_THROW("msgpack EXT type not supported.");
} }
}
return o; return o;
} }
}
}; };
template <> template <>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment