Delete default assignment operator Offset<>

This commit is contained in:
Behdad Esfahbod 2019-04-15 16:00:20 -04:00
parent 02d864aa26
commit 699de689e9
3 changed files with 11 additions and 8 deletions

View File

@ -173,6 +173,9 @@ typedef Index NameID;
template <typename Type, bool has_null=true>
struct Offset : Type
{
HB_DELETE_COPY_ASSIGN (Offset);
Offset () = default;
Offset& operator = (typename Type::type i) { Type::operator= (i); return *this; }
typedef Type type;

View File

@ -904,7 +904,7 @@ struct cmap
// Write out format 4 sub table
{
CmapSubtable &subtable = format4_plat0_rec.subtable.serialize (&c, table);
format4_plat3_rec.subtable = format4_plat0_rec.subtable;
format4_plat3_rec.subtable = (unsigned int) format4_plat0_rec.subtable;
subtable.u.format = 4;
CmapSubtableFormat4 &format4 = subtable.u.format4;

View File

@ -583,25 +583,25 @@ struct Feature
* Adobe tools, only the 'size' feature had FeatureParams defined.
*/
OffsetTo<FeatureParams> orig_offset = featureParams;
if (likely (featureParams.is_null ()))
return_trace (true);
unsigned int orig_offset = featureParams;
if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE)))
return_trace (false);
if (likely (orig_offset.is_null ()))
return_trace (true);
if (featureParams == 0 && closure &&
closure->tag == HB_TAG ('s','i','z','e') &&
closure->list_base && closure->list_base < this)
{
unsigned int new_offset_int = (unsigned int) orig_offset -
unsigned int new_offset_int = orig_offset -
(((char *) this) - ((char *) closure->list_base));
OffsetTo<FeatureParams> new_offset;
/* Check that it did not overflow. */
/* Check that it would not overflow. */
new_offset = new_offset_int;
if (new_offset == new_offset_int &&
c->try_set (&featureParams, new_offset) &&
c->try_set (&featureParams, new_offset_int) &&
!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))
return_trace (false);
}