renamed inconsistent function names
This commit is contained in:
		| @ -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, | ||||
| 	hcl_oow_t*       bcslen, | ||||
| 	hcl_uch_t*       ucs, | ||||
| @ -459,7 +459,7 @@ HCL_EXPORT int hcl_conv_bchars_to_uchars_with_cmgr ( | ||||
| 	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, | ||||
| 	hcl_oow_t*       ucslen, | ||||
| 	hcl_bch_t*       bcs, | ||||
| @ -476,10 +476,10 @@ HCL_EXPORT int hcl_conv_uchars_to_bchars_with_cmgr ( | ||||
| ); | ||||
|  | ||||
| #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) | ||||
| #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) | ||||
| #endif | ||||
|  | ||||
|  | ||||
| @ -69,6 +69,8 @@ | ||||
|  | ||||
| #undef PUT_OOCH | ||||
| #undef PUT_OOCS | ||||
| #undef PUT_BYTE_IN_HEX | ||||
| #undef BYTE_PRINTABLE | ||||
|  | ||||
| #define PUT_OOCH(c,n) do { \ | ||||
| 	if (n > 0) { \ | ||||
| @ -96,7 +98,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 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)  | ||||
| 				{ | ||||
| 					hcl_uint16_t u16 = *usp; | ||||
| 					hcl_uint8_t* bsp = (hcl_uint8_t*)&u16; | ||||
| 					PUT_OOCH('\\', 1); | ||||
| 					PUT_OOCH('u', 1); | ||||
| 				#if defined(HCL_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 | ||||
| 				{ | ||||
| 					hcl_uint32_t u32 = *usp; | ||||
| 					hcl_uint8_t* bsp = (hcl_uint8_t*)&u32; | ||||
| 					PUT_OOCH('\\', 1); | ||||
| 					PUT_OOCH('U', 1); | ||||
| 				#if defined(HCL_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++; | ||||
| 			} | ||||
|  | ||||
| @ -701,7 +701,7 @@ static int handle_request (hcl_client_t* client, const char* ipaddr, const char* | ||||
| 			hcl_oow_t ucslen, bcslen; | ||||
|  | ||||
| 			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); | ||||
| 		#else | ||||
| 			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) | ||||
| { | ||||
| 	server_xtn_t* xtn; | ||||
|  | ||||
|  | ||||
| 	xtn = hcl_server_getxtn(server); | ||||
| 	server_xtn_t* xtn = (server_xtn_t*)hcl_server_getxtn(server); | ||||
|  | ||||
| 	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) | ||||
| { | ||||
| 	server_xtn_t* xtn; | ||||
| 	xtn = hcl_server_getxtn(server); | ||||
| 	server_xtn_t* xtn = (server_xtn_t*)hcl_server_getxtn(server); | ||||
|  | ||||
| 	if (xtn->logbuf.len > 0) | ||||
| 	{ | ||||
| 		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) | ||||
| { | ||||
| 	server_xtn_t* xtn = (server_xtn_t*)hcl_server_getxtn(server); | ||||
| 	hcl_bch_t buf[256]; | ||||
| 	hcl_oow_t ucslen, bcslen; | ||||
| 	server_xtn_t* xtn; | ||||
| 	hcl_oow_t msgidx; | ||||
| 	int n, logfd; | ||||
|  | ||||
| 	xtn = hcl_server_getxtn(server); | ||||
|  | ||||
| 	if (mask & HCL_LOG_STDERR) | ||||
| 	{ | ||||
| 		/* 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; | ||||
|  | ||||
| 	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); | ||||
| #else | ||||
| 	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; | ||||
| } | ||||
|  | ||||
| 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, | ||||
| 	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; | ||||
| } | ||||
|  | ||||
| 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, | ||||
| 	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) | ||||
| { | ||||
| 	/* 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) | ||||
| { | ||||
| 	/* 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. */ | ||||
| 	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) | ||||
| 	{ | ||||
| @ -779,7 +779,7 @@ int hcl_convutobcstr (hcl_t* hcl, const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_b | ||||
| 	/* null-terminated */ | ||||
| 	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) | ||||
| 	{ | ||||
|  | ||||
		Reference in New Issue
	
	Block a user