removed typecasgint to int for length to %.*js

This commit is contained in:
hyung-hwan 2019-12-14 16:25:11 +00:00
parent cf2f249ba9
commit 73e059d458
6 changed files with 13 additions and 20 deletions

View File

@ -314,9 +314,7 @@ static hawk_htb_walk_t print_awk_value (hawk_htb_t* map, hawk_htb_pair_t* pair,
{
if (hawk_rtx_geterrnum(rtx) == HAWK_EVALTOSTR)
{
dprint (HAWK_T("%.*s = [not printable]\n"),
(int)HAWK_HTB_KLEN(pair), HAWK_HTB_KPTR(pair));
dprint (HAWK_T("%.*s = [not printable]\n"), HAWK_HTB_KLEN(pair), HAWK_HTB_KPTR(pair));
hawk_rtx_seterrinf (rtx, &oerrinf);
}
else
@ -326,9 +324,7 @@ static hawk_htb_walk_t print_awk_value (hawk_htb_t* map, hawk_htb_pair_t* pair,
}
else
{
dprint (HAWK_T("%.*s = %.*s\n"),
(int)HAWK_HTB_KLEN(pair), HAWK_HTB_KPTR(pair),
(int)len, str);
dprint (HAWK_T("%.*s = %.*s\n"), HAWK_HTB_KLEN(pair), HAWK_HTB_KPTR(pair), len, str);
hawk_rtx_freemem (rtx, str);
}

View File

@ -484,8 +484,8 @@ HAWK_EXPORT hawk_htb_pair_t* hawk_htb_update (
* hawk_htb_walk_t print_map_pair (hawk_htb_t* map, hawk_htb_pair_t* pair, void* ctx)
* {
* hawk_printf (HAWK_T("%.*s[%d] => %.*s[%d]\n"),
* (int)HAWK_HTB_KLEN(pair), HAWK_HTB_KPTR(pair), (int)HAWK_HTB_KLEN(pair),
* (int)HAWK_HTB_VLEN(pair), HAWK_HTB_VPTR(pair), (int)HAWK_HTB_VLEN(pair));
* HAWK_HTB_KLEN(pair), HAWK_HTB_KPTR(pair), (int)HAWK_HTB_KLEN(pair),
* HAWK_HTB_VLEN(pair), HAWK_HTB_VPTR(pair), (int)HAWK_HTB_VLEN(pair));
* return HAWK_HTB_WALK_FORWARD;
* }
*

View File

@ -438,8 +438,8 @@ HAWK_EXPORT hawk_rbt_pair_t* hawk_rbt_update (
* hawk_rbt_walk_t print_map_pair (hawk_rbt_t* map, hawk_rbt_pair_t* pair, void* ctx)
* {
* hawk_printf (HAWK_T("%.*s[%d] => %.*s[%d]\n"),
* (int)HAWK_RBT_KLEN(pair), HAWK_RBT_KPTR(pair), (int)HAWK_RBT_KLEN(pair),
* (int)HAWK_RBT_VLEN(pair), HAWK_RBT_VPTR(pair), (int)HAWK_RBT_VLEN(pair));
* HAWK_RBT_KLEN(pair), HAWK_RBT_KPTR(pair), (int)HAWK_RBT_KLEN(pair),
* HAWK_RBT_VLEN(pair), HAWK_RBT_VPTR(pair), (int)HAWK_RBT_VLEN(pair));
* return HAWK_RBT_WALK_FORWARD;
* }
*

View File

@ -2863,7 +2863,7 @@ HAWK_EXPORT int hawk_rtx_valtobool (
* out.u.cplcpy.ptr = buf;
* out.u.cplcpy.len = HAWK_COUNTOF(buf);
* if (hawk_rtx_valtostr (rtx, v, &out) <= -1) goto oops;
* hawk_printf (HAWK_T("%.*s\n"), (int)out.u.cplcpy.len, out.u.cplcpy.ptr);
* hawk_printf (HAWK_T("%.*s\n"), out.u.cplcpy.len, out.u.cplcpy.ptr);
* \endcode
*
* #HAWK_RTX_VALTOSTR_CPL is different from #HAWK_RTX_VALTOSTR_CPLCPY
@ -2877,7 +2877,7 @@ HAWK_EXPORT int hawk_rtx_valtobool (
* out.u.cpl.ptr = buf;
* out.u.cpl.len = HAWK_COUNTOF(buf);
* if (hawk_rtx_valtostr (rtx, v, &out) <= -1) goto oops;
* hawk_printf (HAWK_T("%.*s\n"), (int)out.u.cpl.len, out.u.cpl.ptr);
* hawk_printf (HAWK_T("%.*s\n"), ut.u.cpl.len, out.u.cpl.ptr);
* \endcode
*
* When unsure of the size of the string after conversion, you can use
@ -2887,7 +2887,7 @@ HAWK_EXPORT int hawk_rtx_valtobool (
* hawk_rtx_valtostr_out_t out;
* out.type = HAWK_RTX_VALTOSTR_CPLDUP;
* if (hawk_rtx_valtostr (rtx, v, &out) <= -1) goto oops;
* hawk_printf (HAWK_T("%.*s\n"), (int)out.u.cpldup.len, out.u.cpldup.ptr);
* hawk_printf (HAWK_T("%.*s\n"), out.u.cpldup.len, out.u.cpldup.ptr);
* hawk_rtx_free (rtx, out.u.cpldup.ptr);
* \endcode
*
@ -2900,8 +2900,7 @@ HAWK_EXPORT int hawk_rtx_valtobool (
* out.type = HAWK_RTX_VALTOSTR_STRP;
* out.u.strp = str;
* if (hawk_rtx_valtostr (rtx, v, &out) <= -1) goto oops;
* hawk_printf (HAWK_T("%.*s\n"),
* (int)HAWK_STR_LEN(out.u.strp), HAWK_STR_PTR(out.u.strp));
* hawk_printf (HAWK_T("%.*s\n"), HAWK_STR_LEN(out.u.strp), HAWK_STR_PTR(out.u.strp));
* hawk_str_fini (&str);
* \endcode
*

View File

@ -100,8 +100,7 @@ int main (int argc, char* argv[])
for (i = 0; i < 10; i++)
{
if (mat[i].rm_so == -1) break;
printf ("SUBMATCH[%u] = [%.*s]\n", i,
(int)(mat[i].rm_eo - mat[i].rm_so), &argv[2][mat[i].rm_so]);
printf ("SUBMATCH[%u] = [%.*s]\n", i,(mat[i].rm_eo - mat[i].rm_so), &argv[2][mat[i].rm_so]);
}
regfree (&tre);
return 0;

View File

@ -2023,8 +2023,7 @@ static hawk_htb_walk_t print_pair (hawk_htb_t* map, hawk_htb_pair_t* pair, void*
HAWK_ASSERT (hawk_rtx_gethawk(rtx), run == *(hawk_rtx_t**)hawk_htb_getxtn(map));
hawk_errputstrf (HAWK_T(" %.*s=>"),
(int)HAWK_HTB_KLEN(pair), HAWK_HTB_KPTR(pair));
hawk_errputstrf (HAWK_T(" %.*s=>"), HAWK_HTB_KLEN(pair), HAWK_HTB_KPTR(pair));
hawk_dprintval ((hawk_rtx_t*)arg, HAWK_HTB_VPTR(pair));
hawk_errputstrf (HAWK_T(" "));
@ -2064,7 +2063,7 @@ void hawk_dprintval (hawk_rtx_t* run, hawk_val_t* val)
break;
case HAWK_VAL_FUN:
hawk_errputstrf (HAWK_T("%.*s"), (int)((hawk_val_fun_t*)val)->fun->name.len, ((hawk_val_fun_t*)val)->fun->name.ptr);
hawk_errputstrf (HAWK_T("%.*s"), ((hawk_val_fun_t*)val)->fun->name.len, ((hawk_val_fun_t*)val)->fun->name.ptr);
break;
case HAWK_VAL_MAP: