From abebca26907b0c54ec52dd8c09a03d2b143628b7 Mon Sep 17 00:00:00 2001 From: Michiharu Ariza Date: Thu, 20 Dec 2018 14:54:33 -0800 Subject: [PATCH] substr renamed to str_ref in line with its type byte_str_ref_t --- src/hb-cff-interp-common.hh | 56 ++++++++++++++++---------------- src/hb-cff-interp-cs-common.hh | 18 +++++----- src/hb-cff-interp-dict-common.hh | 24 +++++++------- src/hb-cff2-interp-cs.hh | 2 +- src/hb-ot-cff1-table.hh | 10 +++--- src/hb-ot-cff2-table.hh | 10 +++--- src/hb-subset-cff-common.hh | 8 ++--- src/hb-subset-cff1.cc | 12 +++---- src/hb-subset-cff2.cc | 6 ++-- 9 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh index df1592a94..e04d94ecb 100644 --- a/src/hb-cff-interp-common.hh +++ b/src/hb-cff-interp-common.hh @@ -522,18 +522,18 @@ struct ArgStack : Stack return (unsigned)i; } - void push_longint_from_substr (byte_str_ref_t& substr) + void push_longint_from_substr (byte_str_ref_t& str_ref) { - push_int ((substr[0] << 24) | (substr[1] << 16) | (substr[2] << 8) | (substr[3])); - substr.inc (4); + push_int ((str_ref[0] << 24) | (str_ref[1] << 16) | (str_ref[2] << 8) | (str_ref[3])); + str_ref.inc (4); } - bool push_fixed_from_substr (byte_str_ref_t& substr) + bool push_fixed_from_substr (byte_str_ref_t& str_ref) { - if (unlikely (!substr.avail (4))) + if (unlikely (!str_ref.avail (4))) return false; - push_fixed ((int32_t)*(const HBUINT32*)&substr[0]); - substr.inc (4); + push_fixed ((int32_t)*(const HBUINT32*)&str_ref[0]); + str_ref.inc (4); return true; } @@ -581,20 +581,20 @@ struct ParsedValues } void fini () { values.fini_deep (); } - void add_op (OpCode op, const byte_str_ref_t& substr = byte_str_ref_t ()) + void add_op (OpCode op, const byte_str_ref_t& str_ref = byte_str_ref_t ()) { VAL *val = values.push (); val->op = op; - val->str = substr.str.sub_str (opStart, substr.offset - opStart); - opStart = substr.offset; + val->str = str_ref.str.sub_str (opStart, str_ref.offset - opStart); + opStart = str_ref.offset; } - void add_op (OpCode op, const byte_str_ref_t& substr, const VAL &v) + void add_op (OpCode op, const byte_str_ref_t& str_ref, const VAL &v) { VAL *val = values.push (v); val->op = op; - val->str = substr.sub_str ( opStart, substr.offset - opStart); - opStart = substr.offset; + val->str = str_ref.sub_str ( opStart, str_ref.offset - opStart); + opStart = str_ref.offset; } bool has_op (OpCode op) const @@ -617,30 +617,30 @@ struct InterpEnv { void init (const byte_str_t &str_) { - substr.reset (str_); + str_ref.reset (str_); argStack.init (); error = false; } void fini () { argStack.fini (); } bool in_error () const - { return error || substr.in_error () || argStack.in_error (); } + { return error || str_ref.in_error () || argStack.in_error (); } void set_error () { error = true; } OpCode fetch_op () { OpCode op = OpCode_Invalid; - if (unlikely (!substr.avail ())) + if (unlikely (!str_ref.avail ())) return OpCode_Invalid; - op = (OpCode)(unsigned char)substr[0]; + op = (OpCode)(unsigned char)str_ref[0]; if (op == OpCode_escape) { - if (unlikely (!substr.avail ())) + if (unlikely (!str_ref.avail ())) return OpCode_Invalid; - op = Make_OpCode_ESC(substr[1]); - substr.inc (); + op = Make_OpCode_ESC(str_ref[1]); + str_ref.inc (); } - substr.inc (); + str_ref.inc (); return op; } @@ -664,7 +664,7 @@ struct InterpEnv pop_n_args (argStack.get_count ()); } - byte_str_ref_t substr; + byte_str_ref_t str_ref; ArgStack argStack; protected: bool error; @@ -679,20 +679,20 @@ struct OpSet { switch (op) { case OpCode_shortint: - env.argStack.push_int ((int16_t)((env.substr[0] << 8) | env.substr[1])); - env.substr.inc (2); + env.argStack.push_int ((int16_t)((env.str_ref[0] << 8) | env.str_ref[1])); + env.str_ref.inc (2); break; case OpCode_TwoBytePosInt0: case OpCode_TwoBytePosInt1: case OpCode_TwoBytePosInt2: case OpCode_TwoBytePosInt3: - env.argStack.push_int ((int16_t)((op - OpCode_TwoBytePosInt0) * 256 + env.substr[0] + 108)); - env.substr.inc (); + env.argStack.push_int ((int16_t)((op - OpCode_TwoBytePosInt0) * 256 + env.str_ref[0] + 108)); + env.str_ref.inc (); break; case OpCode_TwoByteNegInt0: case OpCode_TwoByteNegInt1: case OpCode_TwoByteNegInt2: case OpCode_TwoByteNegInt3: - env.argStack.push_int ((int16_t)(-(op - OpCode_TwoByteNegInt0) * 256 - env.substr[0] - 108)); - env.substr.inc (); + env.argStack.push_int ((int16_t)(-(op - OpCode_TwoByteNegInt0) * 256 - env.str_ref[0] - 108)); + env.str_ref.inc (); break; default: diff --git a/src/hb-cff-interp-cs-common.hh b/src/hb-cff-interp-cs-common.hh index 49ba0570f..861cd8a32 100644 --- a/src/hb-cff-interp-cs-common.hh +++ b/src/hb-cff-interp-cs-common.hh @@ -43,14 +43,14 @@ struct CallContext { void init (const byte_str_ref_t substr_=byte_str_ref_t (), CSType type_=CSType_CharString, unsigned int subr_num_=0) { - substr = substr_; + str_ref = substr_; type = type_; subr_num = subr_num_; } void fini () {} - byte_str_ref_t substr; + byte_str_ref_t str_ref; CSType type; unsigned int subr_num; }; @@ -167,19 +167,19 @@ struct CSInterpEnv : InterpEnv SUPER::set_error (); return; } - context.substr = SUPER::substr; + context.str_ref = SUPER::str_ref; callStack.push (context); context.init ( biasedSubrs[subr_num], type, subr_num); - SUPER::substr = context.substr; + SUPER::str_ref = context.str_ref; } void returnFromSubr () { - if (unlikely (SUPER::substr.in_error ())) + if (unlikely (SUPER::str_ref.in_error ())) SUPER::set_error (); context = callStack.pop (); - SUPER::substr = context.substr; + SUPER::str_ref = context.str_ref; } void determine_hintmask_size () @@ -262,7 +262,7 @@ struct CSOpSet : OpSet break; case OpCode_fixedcs: - env.argStack.push_fixed_from_substr (env.substr); + env.argStack.push_fixed_from_substr (env.str_ref); break; case OpCode_callsubr: @@ -385,10 +385,10 @@ struct CSOpSet : OpSet static void process_hintmask (OpCode op, ENV &env, PARAM& param) { env.determine_hintmask_size (); - if (likely (env.substr.avail (env.hintmask_size))) + if (likely (env.str_ref.avail (env.hintmask_size))) { OPSET::flush_hintmask (op, env, param); - env.substr.inc (env.hintmask_size); + env.str_ref.inc (env.hintmask_size); } } diff --git a/src/hb-cff-interp-dict-common.hh b/src/hb-cff-interp-dict-common.hh index c34898132..63dafeeb9 100644 --- a/src/hb-cff-interp-dict-common.hh +++ b/src/hb-cff-interp-dict-common.hh @@ -81,11 +81,11 @@ struct DictOpSet : OpSet { switch (op) { case OpCode_longintdict: /* 5-byte integer */ - env.argStack.push_longint_from_substr (env.substr); + env.argStack.push_longint_from_substr (env.str_ref); break; case OpCode_BCD: /* real number */ - env.argStack.push_real (parse_bcd (env.substr)); + env.argStack.push_real (parse_bcd (env.str_ref)); break; default: @@ -94,7 +94,7 @@ struct DictOpSet : OpSet } } - static double parse_bcd (byte_str_ref_t& substr) + static double parse_bcd (byte_str_ref_t& str_ref) { bool neg = false; double int_part = 0; @@ -115,13 +115,13 @@ struct DictOpSet : OpSet char d; if ((i & 1) == 0) { - if (!substr.avail ()) + if (!str_ref.avail ()) { - substr.set_error (); + str_ref.set_error (); return 0.0; } - byte = substr[0]; - substr.inc (); + byte = str_ref[0]; + str_ref.inc (); d = byte >> 4; } else @@ -130,7 +130,7 @@ struct DictOpSet : OpSet switch (d) { case RESERVED: - substr.set_error (); + str_ref.set_error (); return value; case END: @@ -162,7 +162,7 @@ struct DictOpSet : OpSet case NEG: if (i != 0) { - substr.set_error (); + str_ref.set_error (); return 0.0; } neg = true; @@ -171,7 +171,7 @@ struct DictOpSet : OpSet case DECIMAL: if (part != INT_PART) { - substr.set_error (); + str_ref.set_error (); return value; } part = FRAC_PART; @@ -184,7 +184,7 @@ struct DictOpSet : OpSet case EXP_POS: if (part == EXP_PART) { - substr.set_error (); + str_ref.set_error (); return value; } part = EXP_PART; @@ -275,7 +275,7 @@ struct DictInterpreter : Interpreter bool interpret (PARAM& param) { param.init (); - while (SUPER::env.substr.avail ()) + while (SUPER::env.str_ref.avail ()) { OPSET::process_op (SUPER::env.fetch_op (), SUPER::env, param); if (unlikely (SUPER::env.in_error ())) diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh index 72bfa7b5f..5c6881033 100644 --- a/src/hb-cff2-interp-cs.hh +++ b/src/hb-cff2-interp-cs.hh @@ -102,7 +102,7 @@ struct CFF2CSInterpEnv : CSInterpEnv OpCode fetch_op () { - if (this->substr.avail ()) + if (this->str_ref.avail ()) return SUPER::fetch_op (); /* make up return or endchar op */ diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index 2d664f1d9..a3ab3630d 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -794,7 +794,7 @@ struct CFF1TopDictOpSet : TopDictOpSet break; default: - env.last_offset = env.substr.offset; + env.last_offset = env.str_ref.offset; TopDictOpSet::process_op (op, env, dictval); /* Record this operand below if stack is empty, otherwise done */ if (!env.argStack.is_empty ()) return; @@ -803,7 +803,7 @@ struct CFF1TopDictOpSet : TopDictOpSet if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr, val); + dictval.add_op (op, env.str_ref, val); } }; @@ -848,7 +848,7 @@ struct CFF1FontDictOpSet : DictOpSet if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); } }; @@ -924,7 +924,7 @@ struct CFF1PrivateDictOpSet : DictOpSet if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr, val); + dictval.add_op (op, env.str_ref, val); } }; @@ -966,7 +966,7 @@ struct CFF1PrivateDictOpSet_Subset : DictOpSet if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); } }; diff --git a/src/hb-ot-cff2-table.hh b/src/hb-ot-cff2-table.hh index 6da5b6b9d..342018987 100644 --- a/src/hb-ot-cff2-table.hh +++ b/src/hb-ot-cff2-table.hh @@ -179,7 +179,7 @@ struct CFF2TopDictOpSet : TopDictOpSet<> { DictVal val; val.init (); - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); env.clear_args (); } break; @@ -201,7 +201,7 @@ struct CFF2TopDictOpSet : TopDictOpSet<> if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); } typedef TopDictOpSet<> SUPER; @@ -238,7 +238,7 @@ struct CFF2FontDictOpSet : DictOpSet if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); } private: @@ -348,7 +348,7 @@ struct CFF2PrivateDictOpSet : DictOpSet if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr, val); + dictval.add_op (op, env.str_ref, val); } }; @@ -390,7 +390,7 @@ struct CFF2PrivateDictOpSet_Subset : DictOpSet if (unlikely (env.in_error ())) return; - dictval.add_op (op, env.substr); + dictval.add_op (op, env.str_ref); } private: diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh index 06095c5d9..0680ba266 100644 --- a/src/hb-subset-cff-common.hh +++ b/src/hb-subset-cff-common.hh @@ -403,13 +403,13 @@ struct ParsedCStr : ParsedValues has_prefix_ = false; } - void add_op (OpCode op, const byte_str_ref_t& substr) + void add_op (OpCode op, const byte_str_ref_t& str_ref) { if (!is_parsed ()) - SUPER::add_op (op, substr); + SUPER::add_op (op, str_ref); } - void add_call_op (OpCode op, const byte_str_ref_t& substr, unsigned int subr_num) + void add_call_op (OpCode op, const byte_str_ref_t& str_ref, unsigned int subr_num) { if (!is_parsed ()) { @@ -419,7 +419,7 @@ struct ParsedCStr : ParsedValues ParsedCSOp val; val.init (subr_num); - SUPER::add_op (op, substr, val); + SUPER::add_op (op, str_ref, val); } } diff --git a/src/hb-subset-cff1.cc b/src/hb-subset-cff1.cc index 767b6f90b..6bce5ce22 100644 --- a/src/hb-subset-cff1.cc +++ b/src/hb-subset-cff1.cc @@ -315,7 +315,7 @@ struct CFF1CSOpSet_Flatten : CFF1CSOpSet { StrEncoder encoder (param.flatStr); for (unsigned int i = 0; i < env.hintmask_size; i++) - encoder.encode_byte (env.substr[i]); + encoder.encode_byte (env.str_ref[i]); } } @@ -349,14 +349,14 @@ struct CFF1CSOpSet_SubrSubset : CFF1CSOpSetadd_op (op, env.substr); + param.current_parsed_str->add_op (op, env.str_ref); param.current_parsed_str->set_parsed (); env.returnFromSubr (); param.set_current_str (env, false); break; case OpCode_endchar: - param.current_parsed_str->add_op (op, env.substr); + param.current_parsed_str->add_op (op, env.str_ref); param.current_parsed_str->set_parsed (); SUPER::process_op (op, env, param); break; @@ -371,7 +371,7 @@ struct CFF1CSOpSet_SubrSubset : CFF1CSOpSetadd_op (op, env.substr); + param.current_parsed_str->add_op (op, env.str_ref); break; } } @@ -381,9 +381,9 @@ struct CFF1CSOpSet_SubrSubset : CFF1CSOpSetadd_call_op (op, substr, env.context.subr_num); + 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); } diff --git a/src/hb-subset-cff2.cc b/src/hb-subset-cff2.cc index ac6b9fac2..5c05a4247 100644 --- a/src/hb-subset-cff2.cc +++ b/src/hb-subset-cff2.cc @@ -202,7 +202,7 @@ struct CFF2CSOpSet_SubrSubset : CFF2CSOpSetadd_op (op, env.substr); + param.current_parsed_str->add_op (op, env.str_ref); break; } } @@ -212,9 +212,9 @@ struct CFF2CSOpSet_SubrSubset : CFF2CSOpSetadd_call_op (op, substr, env.context.subr_num); + 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); }