initialize return param subr_num in popSubrNum

also snake_cased popSubrtNum and other surrounding function names
This commit is contained in:
Michiharu Ariza 2019-05-08 13:44:03 -07:00
parent 503748d8a8
commit 02ae2591d9
3 changed files with 12 additions and 11 deletions

View File

@ -147,8 +147,9 @@ struct cs_interp_env_t : interp_env_t<ARG>
return callStack.in_error () || SUPER::in_error ();
}
bool popSubrNum (const biased_subrs_t<SUBRS>& biasedSubrs, unsigned int &subr_num)
bool pop_subr_num (const biased_subrs_t<SUBRS>& biasedSubrs, unsigned int &subr_num)
{
subr_num = 0;
int n = SUPER::argStack.pop_int ();
n += biasedSubrs.get_bias ();
if (unlikely ((n < 0) || ((unsigned int)n >= biasedSubrs.get_count ())))
@ -158,11 +159,11 @@ struct cs_interp_env_t : interp_env_t<ARG>
return true;
}
void callSubr (const biased_subrs_t<SUBRS>& biasedSubrs, cs_type_t type)
void call_subr (const biased_subrs_t<SUBRS>& biasedSubrs, cs_type_t type)
{
unsigned int subr_num = 0;
if (unlikely (!popSubrNum (biasedSubrs, subr_num)
if (unlikely (!pop_subr_num (biasedSubrs, subr_num)
|| callStack.get_count () >= kMaxCallLimit))
{
SUPER::set_error ();
@ -175,7 +176,7 @@ struct cs_interp_env_t : interp_env_t<ARG>
SUPER::str_ref = context.str_ref;
}
void returnFromSubr ()
void return_from_subr ()
{
if (unlikely (SUPER::str_ref.in_error ()))
SUPER::set_error ();
@ -254,7 +255,7 @@ struct cs_opset_t : opset_t<ARG>
switch (op) {
case OpCode_return:
env.returnFromSubr ();
env.return_from_subr ();
break;
case OpCode_endchar:
OPSET::check_width (op, env, param);
@ -267,11 +268,11 @@ struct cs_opset_t : opset_t<ARG>
break;
case OpCode_callsubr:
env.callSubr (env.localSubrs, CSType_LocalSubr);
env.call_subr (env.localSubrs, CSType_LocalSubr);
break;
case OpCode_callgsubr:
env.callSubr (env.globalSubrs, CSType_GlobalSubr);
env.call_subr (env.globalSubrs, CSType_GlobalSubr);
break;
case OpCode_hstem:

View File

@ -351,7 +351,7 @@ struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t<cff1_cs_opset_subr_subset_t
case OpCode_return:
param.current_parsed_str->add_op (op, env.str_ref);
param.current_parsed_str->set_parsed ();
env.returnFromSubr ();
env.return_from_subr ();
param.set_current_str (env, false);
break;
@ -382,7 +382,7 @@ struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t<cff1_cs_opset_subr_subset_t
cff1_biased_subrs_t& subrs, hb_set_t *closure)
{
byte_str_ref_t str_ref = env.str_ref;
env.callSubr (subrs, type);
env.call_subr (subrs, type);
param.current_parsed_str->add_call_op (op, str_ref, env.context.subr_num);
hb_set_add (closure, env.context.subr_num);
param.set_current_str (env, true);

View File

@ -183,7 +183,7 @@ struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_t<cff2_cs_opset_subr_subset_t
case OpCode_return:
param.current_parsed_str->set_parsed ();
env.returnFromSubr ();
env.return_from_subr ();
param.set_current_str (env, false);
break;
@ -213,7 +213,7 @@ struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_t<cff2_cs_opset_subr_subset_t
cff2_biased_subrs_t& subrs, hb_set_t *closure)
{
byte_str_ref_t str_ref = env.str_ref;
env.callSubr (subrs, type);
env.call_subr (subrs, type);
param.current_parsed_str->add_call_op (op, str_ref, env.context.subr_num);
hb_set_add (closure, env.context.subr_num);
param.set_current_str (env, true);