fixed some bugs in formatting output function
This commit is contained in:
parent
2cc8894570
commit
a7bc6a6eb2
@ -204,7 +204,7 @@ typedef enum qse_bool_t qse_bool_t;
|
|||||||
typedef __uint8_t qse_uint8_t;
|
typedef __uint8_t qse_uint8_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QSE_HAVE_INT8_T
|
#if defined(QSE_HAVE_INT8_T)
|
||||||
# define QSE_SIZEOF_INT8_T 1
|
# define QSE_SIZEOF_INT8_T 1
|
||||||
# define QSE_SIZEOF_UINT8_T 1
|
# define QSE_SIZEOF_UINT8_T 1
|
||||||
# undef QSE_SIZEOF_INTMAX_T
|
# undef QSE_SIZEOF_INTMAX_T
|
||||||
|
@ -361,7 +361,7 @@ reswitch:
|
|||||||
if (flagc & FLAGC_LENMOD)
|
if (flagc & FLAGC_LENMOD)
|
||||||
{
|
{
|
||||||
/* conflict with other length modifier */
|
/* conflict with other length modifier */
|
||||||
save_lm_flag = lm_flag;
|
lm_flag = save_lm_flag;
|
||||||
goto invalid_format;
|
goto invalid_format;
|
||||||
}
|
}
|
||||||
flagc |= FLAGC_LENMOD;
|
flagc |= FLAGC_LENMOD;
|
||||||
@ -841,37 +841,53 @@ reswitch:
|
|||||||
num = (unsigned char)va_arg (ap, int);
|
num = (unsigned char)va_arg (ap, int);
|
||||||
|
|
||||||
else if (lm_flag & LF_I8)
|
else if (lm_flag & LF_I8)
|
||||||
#if (QSE_SIZEOF_UINT8_T < QSE_SIZEOF_UINT)
|
{
|
||||||
|
#if (QSE_SIZEOF_UINT8_T < QSE_SIZEOF_INT)
|
||||||
num = (qse_uint8_t)va_arg (ap, unsigned int);
|
num = (qse_uint8_t)va_arg (ap, unsigned int);
|
||||||
#else
|
#else
|
||||||
num = va_arg (ap, qse_uint8_t);
|
num = va_arg (ap, qse_uint8_t);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
else if (lm_flag & LF_I16)
|
else if (lm_flag & LF_I16)
|
||||||
#if (QSE_SIZEOF_UINT16_T < QSE_SIZEOF_UINT)
|
{
|
||||||
|
#if (QSE_SIZEOF_UINT16_T < QSE_SIZEOF_INT)
|
||||||
num = (qse_uint16_t)va_arg (ap, unsigned int);
|
num = (qse_uint16_t)va_arg (ap, unsigned int);
|
||||||
#else
|
#else
|
||||||
num = va_arg (ap, qse_uint16_t);
|
num = va_arg (ap, qse_uint16_t);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
else if (lm_flag & LF_I32)
|
else if (lm_flag & LF_I32)
|
||||||
#if (QSE_SIZEOF_UINT32_T < QSE_SIZEOF_UINT)
|
{
|
||||||
|
#if (QSE_SIZEOF_UINT32_T < QSE_SIZEOF_INT)
|
||||||
num = (qse_uint32_t)va_arg (ap, unsigned int);
|
num = (qse_uint32_t)va_arg (ap, unsigned int);
|
||||||
#else
|
#else
|
||||||
num = va_arg (ap, qse_uint32_t);
|
num = va_arg (ap, qse_uint32_t);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
#if defined(QSE_HAVE_UINT64_T)
|
||||||
else if (lm_flag & LF_I64)
|
else if (lm_flag & LF_I64)
|
||||||
#if defined(QSE_HAVE_UINT64_T) && (QSE_SIZEOF_UINT64_T < QSE_SIZEOF_UINT)
|
{
|
||||||
|
#if (QSE_SIZEOF_UINT64_T < QSE_SIZEOF_INT)
|
||||||
num = (qse_uint64_t)va_arg (ap, unsigned int);
|
num = (qse_uint64_t)va_arg (ap, unsigned int);
|
||||||
#else
|
#else
|
||||||
num = va_arg (ap, qse_uint64_t);
|
num = va_arg (ap, qse_uint64_t);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(QSE_HAVE_UINT128_T)
|
||||||
else if (lm_flag & LF_I128)
|
else if (lm_flag & LF_I128)
|
||||||
#if defined(QSE_HAVE_UINT128_T) && (QSE_SIZEOF_UINT128_T < QSE_SIZEOF_UINT)
|
{
|
||||||
|
#if (QSE_SIZEOF_UINT128_T < QSE_SIZEOF_INT)
|
||||||
num = (qse_uint128_t)va_arg (ap, unsigned int);
|
num = (qse_uint128_t)va_arg (ap, unsigned int);
|
||||||
#else
|
#else
|
||||||
num = va_arg (ap, qse_uint128_t);
|
num = va_arg (ap, qse_uint128_t);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
|
{
|
||||||
num = va_arg (ap, unsigned int);
|
num = va_arg (ap, unsigned int);
|
||||||
|
}
|
||||||
goto number;
|
goto number;
|
||||||
|
|
||||||
handle_sign:
|
handle_sign:
|
||||||
@ -915,37 +931,53 @@ handle_sign:
|
|||||||
num = (char)va_arg (ap, int);
|
num = (char)va_arg (ap, int);
|
||||||
|
|
||||||
else if (lm_flag & LF_I8)
|
else if (lm_flag & LF_I8)
|
||||||
|
{
|
||||||
#if (QSE_SIZEOF_INT8_T < QSE_SIZEOF_INT)
|
#if (QSE_SIZEOF_INT8_T < QSE_SIZEOF_INT)
|
||||||
num = (qse_int8_t)va_arg (ap, int);
|
num = (qse_int8_t)va_arg (ap, int);
|
||||||
#else
|
#else
|
||||||
num = va_arg (ap, qse_int8_t);
|
num = va_arg (ap, qse_int8_t);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
else if (lm_flag & LF_I16)
|
else if (lm_flag & LF_I16)
|
||||||
|
{
|
||||||
#if (QSE_SIZEOF_INT16_T < QSE_SIZEOF_INT)
|
#if (QSE_SIZEOF_INT16_T < QSE_SIZEOF_INT)
|
||||||
num = (qse_int16_t)va_arg (ap, int);
|
num = (qse_int16_t)va_arg (ap, int);
|
||||||
#else
|
#else
|
||||||
num = va_arg (ap, qse_int16_t);
|
num = va_arg (ap, qse_int16_t);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
else if (lm_flag & LF_I32)
|
else if (lm_flag & LF_I32)
|
||||||
|
{
|
||||||
#if (QSE_SIZEOF_INT32_T < QSE_SIZEOF_INT)
|
#if (QSE_SIZEOF_INT32_T < QSE_SIZEOF_INT)
|
||||||
num = (qse_int32_t)va_arg (ap, int);
|
num = (qse_int32_t)va_arg (ap, int);
|
||||||
#else
|
#else
|
||||||
num = va_arg (ap, qse_int32_t);
|
num = va_arg (ap, qse_int32_t);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
#if defined(QSE_HAVE_INT64_T)
|
||||||
else if (lm_flag & LF_I64)
|
else if (lm_flag & LF_I64)
|
||||||
#if defined(QSE_HAVE_INT64_T) && (QSE_SIZEOF_INT64_T < QSE_SIZEOF_INT)
|
{
|
||||||
|
#if (QSE_SIZEOF_INT64_T < QSE_SIZEOF_INT)
|
||||||
num = (qse_int64_t)va_arg (ap, int);
|
num = (qse_int64_t)va_arg (ap, int);
|
||||||
#else
|
#else
|
||||||
num = va_arg (ap, qse_int64_t);
|
num = va_arg (ap, qse_int64_t);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(QSE_HAVE_INT128_T)
|
||||||
else if (lm_flag & LF_I128)
|
else if (lm_flag & LF_I128)
|
||||||
#if defined(QSE_HAVE_INT128_T) && (QSE_SIZEOF_INT128_T < QSE_SIZEOF_INT)
|
{
|
||||||
|
#if (QSE_SIZEOF_INT128_T < QSE_SIZEOF_INT)
|
||||||
num = (qse_int128_t)va_arg (ap, int);
|
num = (qse_int128_t)va_arg (ap, int);
|
||||||
#else
|
#else
|
||||||
num = va_arg (ap, qse_int128_t);
|
num = va_arg (ap, qse_int128_t);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
|
{
|
||||||
num = va_arg (ap, int);
|
num = va_arg (ap, int);
|
||||||
|
}
|
||||||
|
|
||||||
number:
|
number:
|
||||||
if (sign && (qse_intmax_t)num < 0)
|
if (sign && (qse_intmax_t)num < 0)
|
||||||
|
@ -14,6 +14,7 @@ void t1 (void)
|
|||||||
|
|
||||||
t.file = QSE_T("/tmp/t3.log");
|
t.file = QSE_T("/tmp/t3.log");
|
||||||
/*qse_strtonwad ("127.0.0.1:514", &nwad);*/
|
/*qse_strtonwad ("127.0.0.1:514", &nwad);*/
|
||||||
|
/*qse_strtonwad ("@/var/run/log", &nwad);*/
|
||||||
qse_strtonwad ("@/dev/log", &nwad);
|
qse_strtonwad ("@/dev/log", &nwad);
|
||||||
qse_nwadtoskad (&nwad, &t.syslog_remote);
|
qse_nwadtoskad (&nwad, &t.syslog_remote);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user