added HCL_IO_WRITE_BYTES
All checks were successful
continuous-integration/drone/push Build is passing

implemented it in the print handler
This commit is contained in:
2023-06-01 00:30:41 +09:00
parent 8514f0e590
commit a5d96cc6eb
5 changed files with 164 additions and 84 deletions

View File

@ -1790,6 +1790,7 @@ static int print_bcs (hcl_fmtout_t* fmtout, const hcl_bch_t* ptr, hcl_oow_t len)
{
hcl_t* hcl = (hcl_t*)fmtout->ctx;
#if 0
#if defined(HCL_OOCH_IS_UCH)
hcl_oow_t ucslen, bcslen;
hcl_ooch_t ucsbuf[64], * ucsptr;
@ -1834,6 +1835,23 @@ static int print_bcs (hcl_fmtout_t* fmtout, const hcl_bch_t* ptr, hcl_oow_t len)
len -= hcl->io.outarg.xlen;
}
#endif
#else
hcl_bch_t* optr;
optr = (hcl_bch_t*)ptr;
while (len > 0)
{
hcl->io.outarg.ptr = optr;
hcl->io.outarg.len = len;
if (hcl->io.printer(hcl, HCL_IO_WRITE_BYTES, &hcl->io.outarg) <= -1) return -1;
if (hcl->io.outarg.xlen <= 0) return 0; /* end of stream. but not failure */
HCL_ASSERT (hcl, hcl->io.outarg.xlen <= len);
optr += hcl->io.outarg.xlen;
len -= hcl->io.outarg.xlen;
}
#endif
return 1; /* success */
}