changed the number prefix for binary, octal, hexadecimal to follow NNrNNN in logfmtv()

This commit is contained in:
hyunghwan.chung 2018-03-01 08:21:10 +00:00
parent bf09dcd4f4
commit e450402928

View File

@ -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);
}
}