renamed inconsistent function names

This commit is contained in:
hyung-hwan 2019-03-19 13:30:09 +00:00
parent 7e0ee486a5
commit d859fe00d0
3 changed files with 19 additions and 31 deletions

View File

@ -70,6 +70,8 @@
#undef PUT_OOCH
#undef PUT_OOCS
#undef PUT_BYTE_IN_HEX
#undef BYTE_PRINTABLE
#define PUT_OOCH(c,n) do { \
if (n > 0) { \
@ -97,7 +99,7 @@
} while (0)
/* TODO: redefine this */
#define BYTE_PRINTABLE(x) ((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z') || (x == ' '))
#define BYTE_PRINTABLE(x) ((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z') || (x >= '0' && x <= '9') || (x == ' '))
static int fmtoutv (mio_t* mio, const fmtchar_t* fmt, mio_fmtout_data_t* data, va_list ap)
{
@ -739,34 +741,20 @@ static int fmtoutv (mio_t* mio, const fmtchar_t* fmt, mio_fmtout_data_t* data, v
else if (!(lm_flag & LF_L) && *usp <= 0xFFFF)
{
mio_uint16_t u16 = *usp;
mio_uint8_t* bsp = (mio_uint8_t*)&u16;
PUT_OOCH('\\', 1);
PUT_OOCH('u', 1);
#if defined(MIO_ENDIAN_BIG)
PUT_BYTE_IN_HEX(bsp[0]);
PUT_BYTE_IN_HEX(bsp[1]);
#else
PUT_BYTE_IN_HEX(bsp[1]);
PUT_BYTE_IN_HEX(bsp[0]);
#endif
PUT_BYTE_IN_HEX((u16 >> 8) & 0xFF);
PUT_BYTE_IN_HEX(u16 & 0xFF);
}
else
{
mio_uint32_t u32 = *usp;
mio_uint8_t* bsp = (mio_uint8_t*)&u32;
PUT_OOCH('\\', 1);
PUT_OOCH('U', 1);
#if defined(MIO_ENDIAN_BIG)
PUT_BYTE_IN_HEX(bsp[0]);
PUT_BYTE_IN_HEX(bsp[1]);
PUT_BYTE_IN_HEX(bsp[2]);
PUT_BYTE_IN_HEX(bsp[3]);
#else
PUT_BYTE_IN_HEX(bsp[3]);
PUT_BYTE_IN_HEX(bsp[2]);
PUT_BYTE_IN_HEX(bsp[1]);
PUT_BYTE_IN_HEX(bsp[0]);
#endif
PUT_BYTE_IN_HEX((u32 >> 24) & 0xFF);
PUT_BYTE_IN_HEX((u32 >> 16) & 0xFF);
PUT_BYTE_IN_HEX((u32 >> 8) & 0xFF);
PUT_BYTE_IN_HEX(u32 & 0xFF);
}
usp++;
}

View File

@ -265,15 +265,15 @@ MIO_EXPORT int mio_ucwidth (
/* ------------------------------------------------------------------------- */
#if defined(MIO_OOCH_IS_UCH)
# define mio_conv_oocs_to_bcs_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) mio_conv_ucs_to_bcs_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr)
# define mio_conv_oocstr_to_bcstr_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) mio_conv_ucstr_to_bcstr_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr)
# define mio_conv_oochars_to_bchars_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) mio_conv_uchars_to_bchars_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr)
#else
# define mio_conv_oocs_to_ucs_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) mio_conv_bcs_to_ucs_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0)
# define mio_conv_oocstr_to_ucstr_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) mio_conv_bcstr_to_ucstr_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0)
# define mio_conv_oochars_to_uchars_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) mio_conv_bchars_to_uchars_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0)
#endif
MIO_EXPORT int mio_conv_bcs_to_ucs_with_cmgr (
MIO_EXPORT int mio_conv_bcstr_to_ucstr_with_cmgr (
const mio_bch_t* bcs,
mio_oow_t* bcslen,
mio_uch_t* ucs,
@ -291,7 +291,7 @@ MIO_EXPORT int mio_conv_bchars_to_uchars_with_cmgr (
int all
);
MIO_EXPORT int mio_conv_ucs_to_bcs_with_cmgr (
MIO_EXPORT int mio_conv_ucstr_to_bcstr_with_cmgr (
const mio_uch_t* ucs,
mio_oow_t* ucslen,
mio_bch_t* bcs,

View File

@ -813,7 +813,7 @@ MIO_INLINE int mio_conv_bchars_to_uchars_with_cmgr (
return ret;
}
MIO_INLINE int mio_conv_bcs_to_ucs_with_cmgr (
MIO_INLINE int mio_conv_bcstr_to_ucstr_with_cmgr (
const mio_bch_t* bcs, mio_oow_t* bcslen,
mio_uch_t* ucs, mio_oow_t* ucslen, mio_cmgr_t* cmgr, int all)
{
@ -905,7 +905,7 @@ MIO_INLINE int mio_conv_uchars_to_bchars_with_cmgr (
return ret;
}
MIO_INLINE int mio_conv_ucs_to_bcs_with_cmgr (
MIO_INLINE int mio_conv_ucstr_to_bcstr_with_cmgr (
const mio_uch_t* ucs, mio_oow_t* ucslen,
mio_bch_t* bcs, mio_oow_t* bcslen, mio_cmgr_t* cmgr)
{
@ -1014,13 +1014,13 @@ int mio_conv_uchars_to_utf8 (const mio_uch_t* ucs, mio_oow_t* ucslen, mio_bch_t*
int mio_conv_utf8_to_ucstr (const mio_bch_t* bcs, mio_oow_t* bcslen, mio_uch_t* ucs, mio_oow_t* ucslen)
{
/* null-terminated. */
return mio_conv_bcs_to_ucs_with_cmgr(bcs, bcslen, ucs, ucslen, &utf8_cmgr, 0);
return mio_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, &utf8_cmgr, 0);
}
int mio_conv_ucstr_to_utf8 (const mio_uch_t* ucs, mio_oow_t* ucslen, mio_bch_t* bcs, mio_oow_t* bcslen)
{
/* null-terminated */
return mio_conv_ucs_to_bcs_with_cmgr(ucs, ucslen, bcs, bcslen, &utf8_cmgr);
return mio_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, &utf8_cmgr);
}
/* ----------------------------------------------------------------------- */
@ -1061,7 +1061,7 @@ int mio_convbtoucstr (mio_t* mio, const mio_bch_t* bcs, mio_oow_t* bcslen, mio_u
/* null-terminated. */
int n;
n = mio_conv_bcs_to_ucs_with_cmgr(bcs, bcslen, ucs, ucslen, mio->cmgr, 0);
n = mio_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, mio->cmgr, 0);
if (n <= -1)
{
@ -1076,7 +1076,7 @@ int mio_convutobcstr (mio_t* mio, const mio_uch_t* ucs, mio_oow_t* ucslen, mio_b
/* null-terminated */
int n;
n = mio_conv_ucs_to_bcs_with_cmgr(ucs, ucslen, bcs, bcslen, mio->cmgr);
n = mio_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, mio->cmgr);
if (n <= -1)
{