io: ensure we only write views that look like bytes
This commit is contained in:
parent
b8fd18f1cc
commit
e2f0d23a6d
17
io.hpp
17
io.hpp
@ -48,8 +48,15 @@ namespace util {
|
|||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
inline void
|
template <
|
||||||
write (const posix::fd &dst, util::view<const uint8_t*> data)
|
typename ValueT,
|
||||||
|
typename = std::enable_if_t<
|
||||||
|
sizeof (util::view<const ValueT*>) == 1,
|
||||||
|
void
|
||||||
|
>
|
||||||
|
>
|
||||||
|
void
|
||||||
|
write (const posix::fd &dst, util::view<const ValueT*> data)
|
||||||
{
|
{
|
||||||
write (dst, std::data (data), std::size (data));
|
write (dst, std::data (data), std::size (data));
|
||||||
}
|
}
|
||||||
@ -76,11 +83,7 @@ namespace util {
|
|||||||
template <
|
template <
|
||||||
typename DstT,
|
typename DstT,
|
||||||
typename IteratorA,
|
typename IteratorA,
|
||||||
typename IteratorB,
|
typename IteratorB
|
||||||
typename = std::enable_if_t<
|
|
||||||
sizeof (util::view<IteratorA,IteratorB>::value_type) == 1,
|
|
||||||
void
|
|
||||||
>
|
|
||||||
>
|
>
|
||||||
util::view<IteratorA,IteratorB>
|
util::view<IteratorA,IteratorB>
|
||||||
write (DstT &dst, const util::view<IteratorA, IteratorB> src)
|
write (DstT &dst, const util::view<IteratorA, IteratorB> src)
|
||||||
|
Loading…
Reference in New Issue
Block a user