diff --git a/moo/lib/fmtoutv.h b/moo/lib/fmtoutv.h index 86b641c..a0d3979 100644 --- a/moo/lib/fmtoutv.h +++ b/moo/lib/fmtoutv.h @@ -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 (moo_t* moo, const fmtchar_t* fmt, moo_fmtout_data_t* data, va_list ap, moo_outbfmt_t outbfmt) { diff --git a/moo/lib/moo-utl.h b/moo/lib/moo-utl.h index ad20243..83c6b7c 100644 --- a/moo/lib/moo-utl.h +++ b/moo/lib/moo-utl.h @@ -448,15 +448,15 @@ MOO_EXPORT int moo_ucwidth ( /* ------------------------------------------------------------------------- */ #if defined(MOO_OOCH_IS_UCH) -# define moo_conv_oocs_to_bcs_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) moo_conv_ucs_to_bcs_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) +# define moo_conv_oocstr_to_bcstr_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) moo_conv_ucstr_to_bcstr_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) # define moo_conv_oochars_to_bchars_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) moo_conv_uchars_to_bchars_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) #else -# define moo_conv_oocs_to_ucs_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) moo_conv_bcs_to_ucs_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0) +# define moo_conv_oocstr_to_ucstr_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) moo_conv_bcstr_to_ucstr_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0) # define moo_conv_oochars_to_uchars_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) moo_conv_bchars_to_uchars_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0) #endif -MOO_EXPORT int moo_conv_bcs_to_ucs_with_cmgr ( +MOO_EXPORT int moo_conv_bcstr_to_ucstr_with_cmgr ( const moo_bch_t* bcs, moo_oow_t* bcslen, moo_uch_t* ucs, @@ -474,7 +474,7 @@ MOO_EXPORT int moo_conv_bchars_to_uchars_with_cmgr ( int all ); -MOO_EXPORT int moo_conv_ucs_to_bcs_with_cmgr ( +MOO_EXPORT int moo_conv_ucstr_to_bcstr_with_cmgr ( const moo_uch_t* ucs, moo_oow_t* ucslen, moo_bch_t* bcs, diff --git a/moo/lib/utl.c b/moo/lib/utl.c index 20d0f49..774e549 100644 --- a/moo/lib/utl.c +++ b/moo/lib/utl.c @@ -698,7 +698,7 @@ MOO_INLINE int moo_conv_bchars_to_uchars_with_cmgr ( return ret; } -MOO_INLINE int moo_conv_bcs_to_ucs_with_cmgr ( +MOO_INLINE int moo_conv_bcstr_to_ucstr_with_cmgr ( const moo_bch_t* bcs, moo_oow_t* bcslen, moo_uch_t* ucs, moo_oow_t* ucslen, moo_cmgr_t* cmgr, int all) { @@ -790,7 +790,7 @@ MOO_INLINE int moo_conv_uchars_to_bchars_with_cmgr ( return ret; } -MOO_INLINE int moo_conv_ucs_to_bcs_with_cmgr ( +MOO_INLINE int moo_conv_ucstr_to_bcstr_with_cmgr ( const moo_uch_t* ucs, moo_oow_t* ucslen, moo_bch_t* bcs, moo_oow_t* bcslen, moo_cmgr_t* cmgr) { @@ -899,13 +899,13 @@ int moo_conv_uchars_to_utf8 (const moo_uch_t* ucs, moo_oow_t* ucslen, moo_bch_t* int moo_conv_utf8_to_ucstr (const moo_bch_t* bcs, moo_oow_t* bcslen, moo_uch_t* ucs, moo_oow_t* ucslen) { /* null-terminated. */ - return moo_conv_bcs_to_ucs_with_cmgr(bcs, bcslen, ucs, ucslen, &utf8_cmgr, 0); + return moo_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, &utf8_cmgr, 0); } int moo_conv_ucstr_to_utf8 (const moo_uch_t* ucs, moo_oow_t* ucslen, moo_bch_t* bcs, moo_oow_t* bcslen) { /* null-terminated */ - return moo_conv_ucs_to_bcs_with_cmgr(ucs, ucslen, bcs, bcslen, &utf8_cmgr); + return moo_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, &utf8_cmgr); } /* ----------------------------------------------------------------------- */ @@ -936,13 +936,13 @@ int moo_conv_uchars_to_utf16 (const moo_uch_t* ucs, moo_oow_t* ucslen, moo_bch_t int moo_conv_utf16_to_ucstr (const moo_bch_t* bcs, moo_oow_t* bcslen, moo_uch_t* ucs, moo_oow_t* ucslen) { /* null-terminated. */ - return moo_conv_bcs_to_ucs_with_cmgr(bcs, bcslen, ucs, ucslen, &utf16_cmgr, 0); + return moo_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, &utf16_cmgr, 0); } int moo_conv_ucstr_to_utf16 (const moo_uch_t* ucs, moo_oow_t* ucslen, moo_bch_t* bcs, moo_oow_t* bcslen) { /* null-terminated */ - return moo_conv_ucs_to_bcs_with_cmgr(ucs, ucslen, bcs, bcslen, &utf16_cmgr); + return moo_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, &utf16_cmgr); } /* ----------------------------------------------------------------------- */ @@ -983,7 +983,7 @@ int moo_convbtoucstr (moo_t* moo, const moo_bch_t* bcs, moo_oow_t* bcslen, moo_u /* null-terminated. */ int n; - n = moo_conv_bcs_to_ucs_with_cmgr(bcs, bcslen, ucs, ucslen, moo->cmgr, 0); + n = moo_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, moo->cmgr, 0); if (n <= -1) { @@ -998,7 +998,7 @@ int moo_convutobcstr (moo_t* moo, const moo_uch_t* ucs, moo_oow_t* ucslen, moo_b /* null-terminated */ int n; - n = moo_conv_ucs_to_bcs_with_cmgr(ucs, ucslen, bcs, bcslen, moo->cmgr); + n = moo_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, moo->cmgr); if (n <= -1) {