enhanced write_num() in sed
This commit is contained in:
parent
392d88ab7a
commit
a512a77bba
@ -1408,13 +1408,15 @@ static int write_str (qse_sed_t* sed, const qse_char_t* str, qse_size_t len)
|
|||||||
static int write_num (qse_sed_t* sed, qse_size_t x, int base, int width)
|
static int write_num (qse_sed_t* sed, qse_size_t x, int base, int width)
|
||||||
{
|
{
|
||||||
qse_size_t last = x % base;
|
qse_size_t last = x % base;
|
||||||
qse_size_t y = 0, dig = 0;
|
qse_size_t y = 0;
|
||||||
|
int dig = 0;
|
||||||
|
|
||||||
QSE_ASSERT (base >= 2 && base <= 10);
|
QSE_ASSERT (base >= 2 && base <= 10);
|
||||||
|
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
{
|
{
|
||||||
if (write_char (sed, QSE_T('-')) <= -1) return -1;
|
if (write_char (sed, QSE_T('-')) <= -1) return -1;
|
||||||
|
if (width > 0) width--;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = x / base;
|
x = x / base;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user