fixed the wrong case issue in moo_inttostr()

This commit is contained in:
hyunghwan.chung 2018-02-28 15:56:10 +00:00
parent 051fa970e0
commit e66f8481e3

View File

@ -4021,6 +4021,7 @@ moo_oop_t moo_inttostr (moo_t* moo, moo_oop_t num, int radix)
moo_oow_t xlen = 0, seglen, reqcapa; moo_oow_t xlen = 0, seglen, reqcapa;
const char* _digitc; const char* _digitc;
int orgradix = radix;
if (radix < 0) if (radix < 0)
{ {
@ -4056,7 +4057,7 @@ moo_oop_t moo_inttostr (moo_t* moo, moo_oop_t num, int radix)
xbuf = moo->inttostr.xbuf.ptr; xbuf = moo->inttostr.xbuf.ptr;
} }
xlen = oow_to_text(moo, w, radix, xbuf); xlen = oow_to_text(moo, w, orgradix, xbuf);
if (v < 0) xbuf[xlen++] = '-'; if (v < 0) xbuf[xlen++] = '-';
reverse_string (xbuf, xlen); reverse_string (xbuf, xlen);
@ -4207,7 +4208,7 @@ moo_oop_t moo_inttostr (moo_t* moo, moo_oop_t num, int radix)
#else #else
# error UNSUPPORTED LIW BIT SIZE # error UNSUPPORTED LIW BIT SIZE
#endif #endif
seglen = oow_to_text (moo, w, radix, &xbuf[xlen]); seglen = oow_to_text (moo, w, orgradix, &xbuf[xlen]);
xlen += seglen; xlen += seglen;
if (r == a) break; /* reached the last block */ if (r == a) break; /* reached the last block */