renamed inconsistent function names
This commit is contained in:
parent
1a6aaf1831
commit
02c468bd1f
@ -441,7 +441,7 @@ hcl_oow_t hcl_byte_to_bcstr (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
HCL_EXPORT int hcl_conv_bcs_to_ucs_with_cmgr (
|
HCL_EXPORT int hcl_conv_bcstr_to_ucstr_with_cmgr (
|
||||||
const hcl_bch_t* bcs,
|
const hcl_bch_t* bcs,
|
||||||
hcl_oow_t* bcslen,
|
hcl_oow_t* bcslen,
|
||||||
hcl_uch_t* ucs,
|
hcl_uch_t* ucs,
|
||||||
@ -459,7 +459,7 @@ HCL_EXPORT int hcl_conv_bchars_to_uchars_with_cmgr (
|
|||||||
int all
|
int all
|
||||||
);
|
);
|
||||||
|
|
||||||
HCL_EXPORT int hcl_conv_ucs_to_bcs_with_cmgr (
|
HCL_EXPORT int hcl_conv_ucstr_to_bcstr_with_cmgr (
|
||||||
const hcl_uch_t* ucs,
|
const hcl_uch_t* ucs,
|
||||||
hcl_oow_t* ucslen,
|
hcl_oow_t* ucslen,
|
||||||
hcl_bch_t* bcs,
|
hcl_bch_t* bcs,
|
||||||
@ -476,10 +476,10 @@ HCL_EXPORT int hcl_conv_uchars_to_bchars_with_cmgr (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#if defined(HCL_OOCH_IS_UCH)
|
#if defined(HCL_OOCH_IS_UCH)
|
||||||
# define hcl_conv_oocs_to_bcs_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) hcl_conv_ucs_to_bcs_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr)
|
# define hcl_conv_oocstr_to_bcstr_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) hcl_conv_ucstr_to_bcstr_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr)
|
||||||
# define hcl_conv_oochars_to_bchars_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) hcl_conv_uchars_to_bchars_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr)
|
# define hcl_conv_oochars_to_bchars_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) hcl_conv_uchars_to_bchars_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr)
|
||||||
#else
|
#else
|
||||||
# define hcl_conv_oocs_to_ucs_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) hcl_conv_bcs_to_ucs_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0)
|
# define hcl_conv_oocstr_to_ucstr_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) hcl_conv_bcstr_to_ucstr_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0)
|
||||||
# define hcl_conv_oochars_to_uchars_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) hcl_conv_bchars_to_uchars_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0)
|
# define hcl_conv_oochars_to_uchars_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) hcl_conv_bchars_to_uchars_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -69,6 +69,8 @@
|
|||||||
|
|
||||||
#undef PUT_OOCH
|
#undef PUT_OOCH
|
||||||
#undef PUT_OOCS
|
#undef PUT_OOCS
|
||||||
|
#undef PUT_BYTE_IN_HEX
|
||||||
|
#undef BYTE_PRINTABLE
|
||||||
|
|
||||||
#define PUT_OOCH(c,n) do { \
|
#define PUT_OOCH(c,n) do { \
|
||||||
if (n > 0) { \
|
if (n > 0) { \
|
||||||
@ -96,7 +98,7 @@
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* TODO: redefine this */
|
/* 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 logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_list ap, hcl_outbfmt_t outbfmt)
|
static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_list ap, hcl_outbfmt_t outbfmt)
|
||||||
{
|
{
|
||||||
@ -745,34 +747,20 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
|
|||||||
else if (!(lm_flag & LF_L) && *usp <= 0xFFFF)
|
else if (!(lm_flag & LF_L) && *usp <= 0xFFFF)
|
||||||
{
|
{
|
||||||
hcl_uint16_t u16 = *usp;
|
hcl_uint16_t u16 = *usp;
|
||||||
hcl_uint8_t* bsp = (hcl_uint8_t*)&u16;
|
|
||||||
PUT_OOCH('\\', 1);
|
PUT_OOCH('\\', 1);
|
||||||
PUT_OOCH('u', 1);
|
PUT_OOCH('u', 1);
|
||||||
#if defined(HCL_ENDIAN_BIG)
|
PUT_BYTE_IN_HEX((u16 >> 8) & 0xFF);
|
||||||
PUT_BYTE_IN_HEX(bsp[0]);
|
PUT_BYTE_IN_HEX(u16 & 0xFF);
|
||||||
PUT_BYTE_IN_HEX(bsp[1]);
|
|
||||||
#else
|
|
||||||
PUT_BYTE_IN_HEX(bsp[1]);
|
|
||||||
PUT_BYTE_IN_HEX(bsp[0]);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hcl_uint32_t u32 = *usp;
|
hcl_uint32_t u32 = *usp;
|
||||||
hcl_uint8_t* bsp = (hcl_uint8_t*)&u32;
|
|
||||||
PUT_OOCH('\\', 1);
|
PUT_OOCH('\\', 1);
|
||||||
PUT_OOCH('U', 1);
|
PUT_OOCH('U', 1);
|
||||||
#if defined(HCL_ENDIAN_BIG)
|
PUT_BYTE_IN_HEX((u32 >> 24) & 0xFF);
|
||||||
PUT_BYTE_IN_HEX(bsp[0]);
|
PUT_BYTE_IN_HEX((u32 >> 16) & 0xFF);
|
||||||
PUT_BYTE_IN_HEX(bsp[1]);
|
PUT_BYTE_IN_HEX((u32 >> 8) & 0xFF);
|
||||||
PUT_BYTE_IN_HEX(bsp[2]);
|
PUT_BYTE_IN_HEX(u32 & 0xFF);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
usp++;
|
usp++;
|
||||||
}
|
}
|
||||||
|
@ -701,7 +701,7 @@ static int handle_request (hcl_client_t* client, const char* ipaddr, const char*
|
|||||||
hcl_oow_t ucslen, bcslen;
|
hcl_oow_t ucslen, bcslen;
|
||||||
|
|
||||||
bcslen = HCL_COUNTOF(errbuf);
|
bcslen = HCL_COUNTOF(errbuf);
|
||||||
hcl_conv_ucs_to_bcs_with_cmgr (errmsg, &ucslen, errbuf, &bcslen, hcl_client_getcmgr(client));
|
hcl_conv_ucstr_to_bcstr_with_cmgr (errmsg, &ucslen, errbuf, &bcslen, hcl_client_getcmgr(client));
|
||||||
fprintf (stderr, "Client error [%d] - %s\n", (int)errnum, errbuf);
|
fprintf (stderr, "Client error [%d] - %s\n", (int)errnum, errbuf);
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "Client error [%d] - %s\n", (int)hcl_client_geterrnum(client), hcl_client_geterrmsg(client));
|
fprintf (stderr, "Client error [%d] - %s\n", (int)hcl_client_geterrnum(client), hcl_client_geterrmsg(client));
|
||||||
|
15
lib/main-s.c
15
lib/main-s.c
@ -130,10 +130,7 @@ static int write_all (int fd, const hcl_bch_t* ptr, hcl_oow_t len)
|
|||||||
|
|
||||||
static int write_log (hcl_server_t* server, int fd, const hcl_bch_t* ptr, hcl_oow_t len)
|
static int write_log (hcl_server_t* server, int fd, const hcl_bch_t* ptr, hcl_oow_t len)
|
||||||
{
|
{
|
||||||
server_xtn_t* xtn;
|
server_xtn_t* xtn = (server_xtn_t*)hcl_server_getxtn(server);
|
||||||
|
|
||||||
|
|
||||||
xtn = hcl_server_getxtn(server);
|
|
||||||
|
|
||||||
while (len > 0)
|
while (len > 0)
|
||||||
{
|
{
|
||||||
@ -182,8 +179,8 @@ static int write_log (hcl_server_t* server, int fd, const hcl_bch_t* ptr, hcl_oo
|
|||||||
|
|
||||||
static void flush_log (hcl_server_t* server, int fd)
|
static void flush_log (hcl_server_t* server, int fd)
|
||||||
{
|
{
|
||||||
server_xtn_t* xtn;
|
server_xtn_t* xtn = (server_xtn_t*)hcl_server_getxtn(server);
|
||||||
xtn = hcl_server_getxtn(server);
|
|
||||||
if (xtn->logbuf.len > 0)
|
if (xtn->logbuf.len > 0)
|
||||||
{
|
{
|
||||||
write_all (fd, xtn->logbuf.buf, xtn->logbuf.len);
|
write_all (fd, xtn->logbuf.buf, xtn->logbuf.len);
|
||||||
@ -193,14 +190,12 @@ static void flush_log (hcl_server_t* server, int fd)
|
|||||||
|
|
||||||
static void log_write (hcl_server_t* server, hcl_oow_t wid, hcl_bitmask_t mask, const hcl_ooch_t* msg, hcl_oow_t len)
|
static void log_write (hcl_server_t* server, hcl_oow_t wid, hcl_bitmask_t mask, const hcl_ooch_t* msg, hcl_oow_t len)
|
||||||
{
|
{
|
||||||
|
server_xtn_t* xtn = (server_xtn_t*)hcl_server_getxtn(server);
|
||||||
hcl_bch_t buf[256];
|
hcl_bch_t buf[256];
|
||||||
hcl_oow_t ucslen, bcslen;
|
hcl_oow_t ucslen, bcslen;
|
||||||
server_xtn_t* xtn;
|
|
||||||
hcl_oow_t msgidx;
|
hcl_oow_t msgidx;
|
||||||
int n, logfd;
|
int n, logfd;
|
||||||
|
|
||||||
xtn = hcl_server_getxtn(server);
|
|
||||||
|
|
||||||
if (mask & HCL_LOG_STDERR)
|
if (mask & HCL_LOG_STDERR)
|
||||||
{
|
{
|
||||||
/* the messages that go to STDERR don't get masked out */
|
/* the messages that go to STDERR don't get masked out */
|
||||||
@ -491,7 +486,7 @@ static int handle_incpath (hcl_server_t* server, const char* str)
|
|||||||
hcl_oow_t bcslen, ucslen;
|
hcl_oow_t bcslen, ucslen;
|
||||||
|
|
||||||
ucslen = HCL_COUNTOF(incpath);
|
ucslen = HCL_COUNTOF(incpath);
|
||||||
if (hcl_conv_bcs_to_ucs_with_cmgr(str, &bcslen, incpath, &ucslen, hcl_server_getcmgr(server), 1) <= -1) return -1;
|
if (hcl_conv_bcstr_to_ucstr_with_cmgr(str, &bcslen, incpath, &ucslen, hcl_server_getcmgr(server), 1) <= -1) return -1;
|
||||||
return hcl_server_setoption(server, HCL_SERVER_SCRIPT_INCLUDE_PATH, incpath);
|
return hcl_server_setoption(server, HCL_SERVER_SCRIPT_INCLUDE_PATH, incpath);
|
||||||
#else
|
#else
|
||||||
return hcl_server_setoption(server, HCL_SERVER_SCRIPT_INCLUDE_PATH, str);
|
return hcl_server_setoption(server, HCL_SERVER_SCRIPT_INCLUDE_PATH, str);
|
||||||
|
12
lib/utl.c
12
lib/utl.c
@ -516,7 +516,7 @@ HCL_INLINE int hcl_conv_bchars_to_uchars_with_cmgr (
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
HCL_INLINE int hcl_conv_bcs_to_ucs_with_cmgr (
|
HCL_INLINE int hcl_conv_bcstr_to_ucstr_with_cmgr (
|
||||||
const hcl_bch_t* bcs, hcl_oow_t* bcslen,
|
const hcl_bch_t* bcs, hcl_oow_t* bcslen,
|
||||||
hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_cmgr_t* cmgr, int all)
|
hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_cmgr_t* cmgr, int all)
|
||||||
{
|
{
|
||||||
@ -608,7 +608,7 @@ HCL_INLINE int hcl_conv_uchars_to_bchars_with_cmgr (
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
HCL_INLINE int hcl_conv_ucs_to_bcs_with_cmgr (
|
HCL_INLINE int hcl_conv_ucstr_to_bcstr_with_cmgr (
|
||||||
const hcl_uch_t* ucs, hcl_oow_t* ucslen,
|
const hcl_uch_t* ucs, hcl_oow_t* ucslen,
|
||||||
hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_cmgr_t* cmgr)
|
hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_cmgr_t* cmgr)
|
||||||
{
|
{
|
||||||
@ -717,13 +717,13 @@ int hcl_conv_uchars_to_utf8 (const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_bch_t*
|
|||||||
int hcl_conv_utf8_to_ucstr (const hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_uch_t* ucs, hcl_oow_t* ucslen)
|
int hcl_conv_utf8_to_ucstr (const hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_uch_t* ucs, hcl_oow_t* ucslen)
|
||||||
{
|
{
|
||||||
/* null-terminated. */
|
/* null-terminated. */
|
||||||
return hcl_conv_bcs_to_ucs_with_cmgr(bcs, bcslen, ucs, ucslen, &utf8_cmgr, 0);
|
return hcl_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, &utf8_cmgr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int hcl_conv_ucstr_to_utf8 (const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_bch_t* bcs, hcl_oow_t* bcslen)
|
int hcl_conv_ucstr_to_utf8 (const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_bch_t* bcs, hcl_oow_t* bcslen)
|
||||||
{
|
{
|
||||||
/* null-terminated */
|
/* null-terminated */
|
||||||
return hcl_conv_ucs_to_bcs_with_cmgr(ucs, ucslen, bcs, bcslen, &utf8_cmgr);
|
return hcl_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, &utf8_cmgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
@ -764,7 +764,7 @@ int hcl_convbtoucstr (hcl_t* hcl, const hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_u
|
|||||||
/* null-terminated. */
|
/* null-terminated. */
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = hcl_conv_bcs_to_ucs_with_cmgr(bcs, bcslen, ucs, ucslen, hcl->cmgr, 0);
|
n = hcl_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, hcl->cmgr, 0);
|
||||||
|
|
||||||
if (n <= -1)
|
if (n <= -1)
|
||||||
{
|
{
|
||||||
@ -779,7 +779,7 @@ int hcl_convutobcstr (hcl_t* hcl, const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_b
|
|||||||
/* null-terminated */
|
/* null-terminated */
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = hcl_conv_ucs_to_bcs_with_cmgr(ucs, ucslen, bcs, bcslen, hcl->cmgr);
|
n = hcl_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, hcl->cmgr);
|
||||||
|
|
||||||
if (n <= -1)
|
if (n <= -1)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user