mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
fix: result error
This commit is contained in:
parent
c07471b7ff
commit
1f5dd46339
1
3rdparty/fmtlib-src
vendored
Submodule
1
3rdparty/fmtlib-src
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a33701196adfad74917046096bf5a2aa0ab0bb50
|
||||
1
3rdparty/googlebenchmark-src
vendored
Submodule
1
3rdparty/googlebenchmark-src
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 361e8d1cfe0c6c36d30b39f1b61302ece5507320
|
||||
1
3rdparty/googletest-src
vendored
Submodule
1
3rdparty/googletest-src
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 15460959cbbfa20e66ef0b5ab497367e47fc0a04
|
||||
@ -132,8 +132,6 @@ class result : public TypeTraits {
|
||||
public:
|
||||
using type_traits_t = TypeTraits;
|
||||
|
||||
result() noexcept = default;
|
||||
|
||||
template <typename... A,
|
||||
typename = is_not_match<result, A...>,
|
||||
typename = decltype(type_traits_t::init_code(std::declval<result_code &>()
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include <cstring> // std::memcpy
|
||||
#include <algorithm> // std::min
|
||||
#include <initializer_list>
|
||||
#include <cstdint>
|
||||
|
||||
#include "libimp/codecvt.h"
|
||||
|
||||
@ -116,16 +117,16 @@ span<char> fmt_of_float(span<char const> fstr, span<char const> const &l) {
|
||||
|
||||
template <typename A /*a fundamental or pointer type*/>
|
||||
int sprintf(fmt_context &ctx, span<char const> const &sfmt, A a) {
|
||||
for (int sz = -1;;) {
|
||||
for (std::int32_t sz = -1;;) {
|
||||
auto sbuf = ctx.buffer(sz + 1);
|
||||
if (sbuf.size() < (sz + 1)) {
|
||||
if (sbuf.size() < std::size_t(sz + 1)) {
|
||||
return -1;
|
||||
}
|
||||
sz = std::snprintf(sbuf.data(), sbuf.size(), sfmt.data(), a);
|
||||
if (sz <= 0) {
|
||||
return sz;
|
||||
}
|
||||
if (sz < sbuf.size()) {
|
||||
if (std::size_t(sz) < sbuf.size()) {
|
||||
ctx.expend(sz);
|
||||
return sz;
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ TEST(span, span) {
|
||||
auto test_proc = [](auto &&buf, auto &&sp) {
|
||||
EXPECT_EQ(imp::countof(buf), sp.size());
|
||||
EXPECT_EQ(sizeof(buf[0]) * imp::countof(buf), sp.size_bytes());
|
||||
for (int i = 0; i < sp.size(); ++i) {
|
||||
for (std::size_t i = 0; i < sp.size(); ++i) {
|
||||
EXPECT_EQ(buf[i], sp[i]);
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user