fix build attempt

This commit is contained in:
Michiharu Ariza 2018-09-10 17:02:31 -07:00
parent cc52e53cf0
commit c6f75c3049
2 changed files with 43 additions and 43 deletions

View File

@ -584,62 +584,62 @@ struct CFF1TopDictInterpEnv : NumInterpEnv
unsigned int last_offset; unsigned int last_offset;
}; };
enum NameDictValIndex
{
version,
notice,
copyright,
fullName,
familyName,
weight,
postscript,
fontName,
baseFontName,
registry,
ordering,
NameDictValCount
};
struct NameDictValues struct NameDictValues
{ {
enum NameDictValIndex
{
version,
notice,
copyright,
fullName,
familyName,
weight,
postscript,
fontName,
baseFontName,
registry,
ordering,
ValCount
};
inline void init (void) inline void init (void)
{ {
for (unsigned int i = 0; i < NameDictValCount; i++) for (unsigned int i = 0; i < ValCount; i++)
values[i] = CFF_UNDEF_SID; values[i] = CFF_UNDEF_SID;
} }
inline unsigned int& operator[] (unsigned int i) inline unsigned int& operator[] (unsigned int i)
{ assert (i < NameDictValCount); return values[i]; } { assert (i < ValCount); return values[i]; }
inline unsigned int operator[] (unsigned int i) const inline unsigned int operator[] (unsigned int i) const
{ assert (i < NameDictValCount); return values[i]; } { assert (i < ValCount); return values[i]; }
static inline enum NameDictValIndex name_op_to_index (OpCode op) static inline enum NameDictValIndex name_op_to_index (OpCode op)
{ {
switch (op) { switch (op) {
case OpCode_version: case OpCode_version:
return NameDictValIndex::version; return version;
case OpCode_Notice: case OpCode_Notice:
return NameDictValIndex::notice; return notice;
case OpCode_Copyright: case OpCode_Copyright:
return NameDictValIndex::copyright; return copyright;
case OpCode_FullName: case OpCode_FullName:
return NameDictValIndex::fullName; return fullName;
case OpCode_FamilyName: case OpCode_FamilyName:
return NameDictValIndex::familyName; return familyName;
case OpCode_Weight: case OpCode_Weight:
return NameDictValIndex::weight; return weight;
case OpCode_PostScript: case OpCode_PostScript:
return NameDictValIndex::postscript; return postscript;
case OpCode_FontName: case OpCode_FontName:
return NameDictValIndex::fontName; return fontName;
default: default:
assert (0); assert (0);
} }
} }
unsigned int values[NameDictValCount]; unsigned int values[ValCount];
}; };
struct CFF1TopDictVal : OpStr struct CFF1TopDictVal : OpStr
@ -651,7 +651,7 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
{ {
inline void init (void) inline void init (void)
{ {
TopDictValues::init (); TopDictValues<CFF1TopDictVal>::init ();
nameSIDs.init (); nameSIDs.init ();
ros_supplement = 0; ros_supplement = 0;
@ -664,11 +664,11 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
inline void fini (void) inline void fini (void)
{ {
TopDictValues::fini (); TopDictValues<CFF1TopDictVal>::fini ();
} }
inline bool is_CID (void) const inline bool is_CID (void) const
{ return nameSIDs[NameDictValIndex::registry] != CFF_UNDEF_SID; } { return nameSIDs[NameDictValues::registry] != CFF_UNDEF_SID; }
NameDictValues nameSIDs; NameDictValues nameSIDs;
unsigned int ros_supplement_offset; unsigned int ros_supplement_offset;
@ -728,8 +728,8 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
case OpCode_ROS: case OpCode_ROS:
if (unlikely (!env.argStack.check_pop_uint (dictval.ros_supplement) || if (unlikely (!env.argStack.check_pop_uint (dictval.ros_supplement) ||
!env.argStack.check_pop_uint (dictval.nameSIDs[NameDictValIndex::ordering]) || !env.argStack.check_pop_uint (dictval.nameSIDs[NameDictValues::ordering]) ||
!env.argStack.check_pop_uint (dictval.nameSIDs[NameDictValIndex::registry]))) !env.argStack.check_pop_uint (dictval.nameSIDs[NameDictValues::registry])))
return false; return false;
env.clear_args (); env.clear_args ();
break; break;
@ -762,7 +762,7 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
default: default:
env.last_offset = env.substr.offset; env.last_offset = env.substr.offset;
if (unlikely (!TopDictOpSet::process_op (op, env, dictval))) if (unlikely (!TopDictOpSet<CFF1TopDictVal>::process_op (op, env, dictval)))
return false; return false;
/* Record this operand below if stack is empty, otherwise done */ /* Record this operand below if stack is empty, otherwise done */
if (!env.argStack.is_empty ()) return true; if (!env.argStack.is_empty ()) return true;

View File

@ -107,7 +107,7 @@ struct CFF1TopDictValuesMod : CFF1TopDictValues
inline void reassignSIDs (const RemapSID& sidmap) inline void reassignSIDs (const RemapSID& sidmap)
{ {
for (unsigned int i = 0; i < NameDictValCount; i++) for (unsigned int i = 0; i < NameDictValues::ValCount; i++)
nameSIDs[i] = sidmap[base->nameSIDs[i]]; nameSIDs[i] = sidmap[base->nameSIDs[i]];
} }
@ -119,13 +119,13 @@ struct CFF1TopDictValuesMod : CFF1TopDictValues
struct TopDictModifiers struct TopDictModifiers
{ {
inline TopDictModifiers (const CFF1SubTableOffsets &offsets_, inline TopDictModifiers (const CFF1SubTableOffsets &offsets_,
const unsigned int (&nameSIDs_)[NameDictValCount]) const unsigned int (&nameSIDs_)[NameDictValues::ValCount])
: offsets (offsets_), : offsets (offsets_),
nameSIDs (nameSIDs_) nameSIDs (nameSIDs_)
{} {}
const CFF1SubTableOffsets &offsets; const CFF1SubTableOffsets &offsets;
const unsigned int (&nameSIDs)[NameDictValCount]; const unsigned int (&nameSIDs)[NameDictValues::ValCount];
}; };
struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal> struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal>
@ -177,8 +177,8 @@ struct CFF1TopDict_OpSerializer : CFFTopDict_OpSerializer<CFF1TopDictVal>
supp_op.str.str = opstr.str.str + opstr.last_arg_offset; supp_op.str.str = opstr.str.str + opstr.last_arg_offset;
assert (opstr.str.len >= opstr.last_arg_offset + 3); assert (opstr.str.len >= opstr.last_arg_offset + 3);
supp_op.str.len = opstr.str.len - opstr.last_arg_offset; supp_op.str.len = opstr.str.len - opstr.last_arg_offset;
return_trace (UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[NameDictValIndex::registry]) && return_trace (UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[NameDictValues::registry]) &&
UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[NameDictValIndex::ordering]) && UnsizedByteStr::serialize_int2 (c, mod.nameSIDs[NameDictValues::ordering]) &&
copy_opstr (c, supp_op)); copy_opstr (c, supp_op));
} }
default: default:
@ -342,7 +342,7 @@ struct cff_subset_plan {
subset_enc_supp_codes.init (); subset_enc_supp_codes.init ();
subset_charset_ranges.init (); subset_charset_ranges.init ();
sidmap.init (); sidmap.init ();
for (unsigned int i = 0; i < NameDictValCount; i++) for (unsigned int i = 0; i < NameDictValues::ValCount; i++)
topDictModSIDs[i] = CFF_UNDEF_SID; topDictModSIDs[i] = CFF_UNDEF_SID;
} }
@ -491,7 +491,7 @@ struct cff_subset_plan {
if (unlikely (!sidmap.reset (acc.stringIndex->count))) if (unlikely (!sidmap.reset (acc.stringIndex->count)))
return false; return false;
for (unsigned int i = 0; i < NameDictValCount; i++) for (unsigned int i = 0; i < NameDictValues::ValCount; i++)
{ {
unsigned int sid = acc.topDict.nameSIDs[i]; unsigned int sid = acc.topDict.nameSIDs[i];
if (sid != CFF_UNDEF_SID) if (sid != CFF_UNDEF_SID)
@ -714,7 +714,7 @@ struct cff_subset_plan {
bool subset_charset; bool subset_charset;
RemapSID sidmap; RemapSID sidmap;
unsigned int topDictModSIDs[NameDictValCount]; unsigned int topDictModSIDs[NameDictValues::ValCount];
}; };
static inline bool _write_cff1 (const cff_subset_plan &plan, static inline bool _write_cff1 (const cff_subset_plan &plan,