enhanced write_num() in sed

This commit is contained in:
hyung-hwan 2009-05-13 21:51:05 +00:00
parent 392d88ab7a
commit a512a77bba

View File

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