touched up some error message
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
hyung-hwan 2024-02-15 00:27:19 +09:00
parent a4d8d8e2a5
commit bd8bf36485
3 changed files with 23 additions and 12 deletions

View File

@ -1229,7 +1229,12 @@ struct hcl_io_cciarg_t
/** /**
* [OUT] place data here for #HCL_IO_READ * [OUT] place data here for #HCL_IO_READ
*/ */
hcl_ooch_t buf[2048]; /* TODO: resize this if necessary */ hcl_ooch_t buf[2047]; /* TODO: resize this if necessary */
hcl_ooch_t is_bytes;
#if defined(HCL_OOCH_IS_UCH)
hcl_bch_t b_int[10];
hcl_bch_t bbuf[2037];
#endif
/** /**
* [OUT] place the number of characters read here for #HCL_IO_READ * [OUT] place the number of characters read here for #HCL_IO_READ

View File

@ -2915,23 +2915,29 @@ static void feed_update_lx_loc (hcl_t* hcl, hcl_ooci_t ch)
} }
#if 0 #if 0
TODO: support the byte cci stream /*TODO: support the byte cci stream*/
static int read_cci_stream (hcl_t* hcl) static int read_cci_stream (hcl_t* hcl)
{ {
int x; int x;
hcl_io_cciarg_t* arg; hcl_io_cciarg_t* arg;
static hcl_io_cmd_t read_cmd[] =
{
HCL_IO_READ,
HCL_IO_READ_BYTES
};
arg = hcl->c->curinp; arg = hcl->c->curinp;
/*x = hcl->c->cci_rdr(hcl, HCL_IO_READ, hcl->c->curinp);*/ /*x = hcl->c->cci_rdr(hcl, HCL_IO_READ, hcl->c->curinp);*/
x = hcl->c->cci_rdr(hcl, arg->read_cmd, hcl->c->curinp); x = hcl->c->cci_rdr(hcl, read_cmd[!!arg->is_bytes], hcl->c->curinp);
if (x <= -1) return -1; if (x <= -1) return -1;
#if defined(HCL_OOCH_IS_UCH) #if defined(HCL_OOCH_IS_UCH)
if (arg->read_cmd == HCL_IO_READ_BYTES) if (arg->is_bytes)
{ {
hcl_oow_t bcslen, ucslen; hcl_oow_t bcslen, ucslen, remlen;
bcslen = arg->bytes.len; bcslen = arg->bytes.len;
ucslen = HCL_COUNTOF(arg->buf); ucslen = HCL_COUNTOF(arg->buf);
x = hcl_convbtooochars(hcl, arg->bytes.buf, &bcslen, arg->buf, &ucslen); x = hcl_convbtooochars(hcl, arg->bytes.buf, &bcslen, arg->buf, &ucslen);

View File

@ -3502,7 +3502,7 @@ static HCL_INLINE int open_udi_stream (hcl_t* hcl, hcl_io_udiarg_t* arg)
if (!bb->fp) if (!bb->fp)
{ {
hcl_seterrbfmt (hcl, HCL_EIOERR, "unable to open %hs", bb->fn); hcl_seterrbfmtwithsyserr (hcl, 0, errno, "unable to open udi stream '%hs'", xtn->udi_path);
goto oops; goto oops;
} }
@ -3549,7 +3549,7 @@ static HCL_INLINE int read_udi_stream (hcl_t* hcl, hcl_io_udiarg_t* arg)
{ {
if (ferror((FILE*)bb->fp)) if (ferror((FILE*)bb->fp))
{ {
hcl_seterrnum (hcl, HCL_EIOERR); hcl_seterrbfmtwithsyserr (hcl, 0, errno, "unable to read udi stream");
return -1; return -1;
} }
break; break;
@ -3599,7 +3599,7 @@ static HCL_INLINE int read_udi_stream_bytes (hcl_t* hcl, hcl_io_udiarg_t* arg)
{ {
if (ferror((FILE*)bb->fp)) if (ferror((FILE*)bb->fp))
{ {
hcl_seterrnum (hcl, HCL_EIOERR); hcl_seterrbfmtwithsyserr (hcl, 0, errno, "unable to read udi stream");
return -1; return -1;
} }
break; break;
@ -3663,9 +3663,9 @@ static HCL_INLINE int open_udo_stream (hcl_t* hcl, hcl_io_udoarg_t* arg)
if (!fp) if (!fp)
{ {
if (xtn->udo_path) if (xtn->udo_path)
hcl_seterrbfmt (hcl, HCL_EIOERR, "unable to open %hs", xtn->udo_path); hcl_seterrbfmtwithsyserr (hcl, 0, errno, "unable to open udp stream '%hs'", xtn->udo_path);
else else
hcl_seterrnum (hcl, HCL_EIOERR); hcl_seterrbfmtwithsyserr (hcl, 0, errno, "unable to open udo stream", xtn->udo_path);
return -1; return -1;
} }
@ -3713,7 +3713,7 @@ static HCL_INLINE int write_udo_stream (hcl_t* hcl, hcl_io_udoarg_t* arg)
if (fwrite(bcsbuf, HCL_SIZEOF(bcsbuf[0]), bcslen, (FILE*)arg->handle) < bcslen) if (fwrite(bcsbuf, HCL_SIZEOF(bcsbuf[0]), bcslen, (FILE*)arg->handle) < bcslen)
{ {
hcl_seterrnum (hcl, HCL_EIOERR); hcl_seterrbfmtwithsyserr (hcl, 0, errno, "unable to write udo stream");
return -1; return -1;
} }
@ -3734,7 +3734,7 @@ static HCL_INLINE int write_udo_stream_bytes (hcl_t* hcl, hcl_io_udoarg_t* arg)
if (fwrite(ptr, HCL_SIZEOF(*ptr), arg->len, (FILE*)arg->handle) < arg->len) if (fwrite(ptr, HCL_SIZEOF(*ptr), arg->len, (FILE*)arg->handle) < arg->len)
{ {
hcl_seterrnum (hcl, HCL_EIOERR); hcl_seterrbfmtwithsyserr (hcl, 0, errno, "unable to write udo stream");
return -1; return -1;
} }