From e450402928f3bee2c690c1e75249249a51d3d14c Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Thu, 1 Mar 2018 08:21:10 +0000 Subject: [PATCH] changed the number prefix for binary, octal, hexadecimal to follow NNrNNN in logfmtv() --- moo/lib/logfmtv.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/moo/lib/logfmtv.h b/moo/lib/logfmtv.h index 4ab7b02..03d1b6b 100644 --- a/moo/lib/logfmtv.h +++ b/moo/lib/logfmtv.h @@ -899,8 +899,8 @@ static int logfmtv (moo_t* moo, const fmtchar_t* fmt, moo_fmtout_t* data, va_lis nbufp = sprintn (nbuf, num, base, &tmp); if ((flagc & FLAGC_SHARP) && num != 0) { - if (base == 8) tmp++; - else if (base == 16) tmp += 2; + if (base == 2 || base == 8) tmp += 2; + else if (base == 16) tmp += 3; } if (neg) tmp++; else if (flagc & FLAGC_SIGN) tmp++; @@ -927,17 +927,19 @@ static int logfmtv (moo_t* moo, const fmtchar_t* fmt, moo_fmtout_t* data, va_lis { if (base == 2) { - PUT_OOCH ('0', 1); - PUT_OOCH ('b', 1); + PUT_OOCH ('2', 1); + PUT_OOCH ('r', 1); } if (base == 8) { - PUT_OOCH ('0', 1); + PUT_OOCH ('8', 1); + PUT_OOCH ('r', 1); } else if (base == 16) { - PUT_OOCH ('0', 1); - PUT_OOCH ('x', 1); + PUT_OOCH ('1', 1); + PUT_OOCH ('6', 1); + PUT_OOCH ('r', 1); } }