Fix return error of wide::to_string

This commit is contained in:
Zach41
2024-04-22 12:11:58 +00:00
committed by ob-robot
parent a72e2a51ae
commit ba657257a9

View File

@ -126,8 +126,10 @@ int to_string(const ObWideInteger<Bits, Signed> &self, char *buf, const int64_t
{
static const uint64_t constexpr DIGITS10_BASE = 10000000000000000000ULL; // 10^19
int ret = OB_SUCCESS;
if (OB_ISNULL(buf) || buf_len <= 0) {
if (OB_ISNULL(buf)) {
ret = OB_INVALID_ARGUMENT;
} else if (OB_UNLIKELY(buf_len <= 0)) {
ret = OB_SIZE_OVERFLOW;
} else {
if (ObWideInteger<Bits, Signed>::_impl::is_negative(self)
&& OB_FAIL(databuff_printf(buf, buf_len, pos, "-"))) {