changed hcl_seterrxxx() functions not to set the errnum field again for failures in internal operations, especially in hcl_convxxx()
This commit is contained in:
parent
8726768be2
commit
69a5ef94bd
@ -85,6 +85,7 @@ static char* synerrstr[] =
|
||||
{
|
||||
"no error",
|
||||
"illegal character",
|
||||
"illegal token",
|
||||
"comment not closed",
|
||||
"string/character not closed",
|
||||
"invalid hashed literal",
|
||||
|
@ -96,6 +96,7 @@ enum hcl_synerrnum_t
|
||||
{
|
||||
HCL_SYNERR_NOERR,
|
||||
HCL_SYNERR_ILCHR, /* illegal character */
|
||||
HCL_SYNERR_ILTOK, /* invalid token */
|
||||
HCL_SYNERR_CMTNC, /* comment not closed */
|
||||
HCL_SYNERR_STRCHRNC, /* string/character not closed */
|
||||
HCL_SYNERR_HASHLIT, /* wrong hashed literal */
|
||||
|
@ -165,7 +165,8 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
|
||||
/* fmtchar is uch. ooch is bch. convert uch to bch */
|
||||
ucslen = 1;
|
||||
bcslen = HCL_COUNTOF(bcsbuf);
|
||||
if (hcl_convutooochars(hcl, &fch, &ucslen, bcsbuf, &bcslen) <= -1) goto oops;
|
||||
/*if (hcl_convutooochars(hcl, &fch, &ucslen, bcsbuf, &bcslen) <= -1) goto oops;*/
|
||||
if (hcl_conv_ucsn_to_bcsn_with_cmgr( &fch, &ucslen, bcsbuf, &bcslen, hcl->cmgr) <= -1) goto oops;
|
||||
PUT_OOCS (bcsbuf, bcslen);
|
||||
}
|
||||
#endif
|
||||
@ -467,7 +468,8 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
|
||||
/* get the length */
|
||||
for (bslen = 0; bsp[bslen]; bslen++);
|
||||
|
||||
if (hcl_convbtooochars(hcl, bsp, &bslen, HCL_NULL, &slen) <= -1) goto oops;
|
||||
/*if (hcl_convbtooochars(hcl, bsp, &bslen, HCL_NULL, &slen) <= -1) goto oops;*/
|
||||
if (hcl_conv_bcsn_to_ucsn_with_cmgr(bsp, &bslen, HCL_NULL, &slen, hcl->cmgr, 0) <= -1) goto oops;
|
||||
|
||||
/* slen holds the length after conversion */
|
||||
n = slen;
|
||||
@ -487,7 +489,8 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
|
||||
conv_len = HCL_COUNTOF(conv_buf);
|
||||
|
||||
/* this must not fail since the dry-run above was successful */
|
||||
hcl_convbtooochars (hcl, &bsp[tot_len], &src_len, conv_buf, &conv_len);
|
||||
/*hcl_convbtooochars (hcl, &bsp[tot_len], &src_len, conv_buf, &conv_len);*/
|
||||
hcl_conv_bcsn_to_ucsn_with_cmgr (&bsp[tot_len], &src_len, conv_buf, &conv_len, hcl->cmgr, 0);
|
||||
tot_len += src_len;
|
||||
|
||||
if (conv_len > n) conv_len = n;
|
||||
@ -536,7 +539,8 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
|
||||
/* get the length */
|
||||
for (uslen = 0; usp[uslen]; uslen++);
|
||||
|
||||
if (hcl_convutooochars(hcl, usp, &uslen, HCL_NULL, &slen) <= -1) goto oops;
|
||||
/*if (hcl_convutooochars(hcl, usp, &uslen, HCL_NULL, &slen) <= -1) goto oops;*/
|
||||
if (hcl_conv_ucsn_to_bcsn_with_cmgr(usp, &uslen, HCL_NULL, &slen, hcl->cmgr) <= -1) goto oops;
|
||||
|
||||
/* slen holds the length after conversion */
|
||||
n = slen;
|
||||
@ -555,7 +559,8 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
|
||||
conv_len = HCL_COUNTOF(conv_buf);
|
||||
|
||||
/* this must not fail since the dry-run above was successful */
|
||||
hcl_convutooochars (hcl, &usp[tot_len], &src_len, conv_buf, &conv_len);
|
||||
/*hcl_convutooochars (hcl, &usp[tot_len], &src_len, conv_buf, &conv_len);*/
|
||||
hcl_conv_ucsn_to_bcsn_with_cmgr (hcl, &usp[tot_len], &src_len, conv_buf, &conv_len, hcl->cmgr);
|
||||
tot_len += src_len;
|
||||
|
||||
if (conv_len > n) conv_len = n;
|
||||
|
@ -1810,8 +1810,7 @@ static int read_object (hcl_t* hcl)
|
||||
switch (TOKEN_TYPE(hcl))
|
||||
{
|
||||
default:
|
||||
hcl_seterrbfmt (hcl, HCL_EINTERN, "invalid token(type %d) encountered - %.*js",
|
||||
TOKEN_TYPE(hcl), TOKEN_NAME_LEN(hcl), TOKEN_NAME_PTR(hcl));
|
||||
hcl_setsynerr (hcl, HCL_SYNERR_ILTOK, TOKEN_LOC(hcl), TOKEN_NAME(hcl));
|
||||
return -1;
|
||||
|
||||
case HCL_IOTOK_EOF:
|
||||
|
Loading…
Reference in New Issue
Block a user