mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
fix: [imp] fmt issue
This commit is contained in:
parent
1014baf821
commit
19cb391624
@ -131,12 +131,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Custom defined fmt_to method for imp::fmt
|
||||
template <typename... T>
|
||||
bool tag_invoke(decltype(::LIBIMP::fmt_to), fmt_context &f_ctx, context<T...> const &l_ctx) noexcept {
|
||||
return ::LIBIMP::log::context_to_string(f_ctx, l_ctx);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
class printer {
|
||||
|
||||
@ -197,12 +197,14 @@ void fmt_context::expend(std::size_t sz) noexcept {
|
||||
}
|
||||
|
||||
bool fmt_context::append(span<char const> const &str) noexcept {
|
||||
auto sbuf = buffer(str.size());
|
||||
if (sbuf.size() < str.size()) {
|
||||
auto sz = str.size();
|
||||
if (str.back() == '\0') --sz;
|
||||
auto sbuf = buffer(sz);
|
||||
if (sbuf.size() < sz) {
|
||||
return false;
|
||||
}
|
||||
std::memcpy(sbuf.data(), str.data(), str.size());
|
||||
offset_ += str.size();
|
||||
std::memcpy(sbuf.data(), str.data(), sz);
|
||||
offset_ += sz;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user