fixed the bug of handling the pack specifier I as 16 bits. it should have been a 32-bit specificer

This commit is contained in:
2025-07-15 12:50:19 +09:00
parent d8457359c4
commit d1408b7dbf

View File

@ -5174,7 +5174,7 @@ static hawk_int_t pack_data (hawk_rtx_t* rtx, const hawk_oocs_t* fmt, const hawk
for (rc = 0; rc < rep_cnt; rc++) for (rc = 0; rc < rep_cnt; rc++)
{ {
if (hawk_rtx_valtoint(rtx, hawk_rtx_getarg(rtx, arg_idx++), &v) <= -1) goto oops_internal; if (hawk_rtx_valtoint(rtx, hawk_rtx_getarg(rtx, arg_idx++), &v) <= -1) goto oops_internal;
rdp->pack.len += pack_uint16_t(&rdp->pack.ptr[rdp->pack.len], (hawk_uint32_t)v, endian); rdp->pack.len += pack_uint32_t(&rdp->pack.ptr[rdp->pack.len], (hawk_uint32_t)v, endian);
} }
break; break;
} }
@ -5330,7 +5330,11 @@ static hawk_int_t pack_data (hawk_rtx_t* rtx, const hawk_oocs_t* fmt, const hawk
hawk_rtx_freevalbcstr(rtx, a, tmp.ptr); hawk_rtx_freevalbcstr(rtx, a, tmp.ptr);
return set_error_on_sys_list(rtx, &rdp->sys_list, HAWK_EINVAL, HAWK_T("data too short for '%jc'"), *fmtp); return set_error_on_sys_list(rtx, &rdp->sys_list, HAWK_EINVAL, HAWK_T("data too short for '%jc'"), *fmtp);
} }
for (rc = 0; rc < rep_cnt; rc++) rdp->pack.ptr[rdp->pack.len++] = tmp.ptr[rc];
for (rc = 0; rc < rep_cnt; rc++)
{
rdp->pack.ptr[rdp->pack.len++] = (hawk_uint8_t)tmp.ptr[rc];
}
hawk_rtx_freevalbcstr(rtx, a, tmp.ptr); hawk_rtx_freevalbcstr(rtx, a, tmp.ptr);
break; break;
} }