From 9c6921c08c905a0cf45ba0182134e6ff910fac51 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 30 Nov 2018 15:16:57 -0500 Subject: [PATCH] More... hb-ot-layout-gsubgpos.hh:1707: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: ... --- src/hb-aat-layout-morx-table.hh | 4 ++-- src/hb-ot-layout-gpos-table.hh | 32 ++++++++++++++++---------------- src/hb-ot-layout-gsubgpos.hh | 16 ++++++++-------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 9b37a713f..78a7b7d7d 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -249,7 +249,7 @@ struct ContextualSubtable { if (entry->data.markIndex != 0xFFFF) { - const Lookup &lookup = subs[entry->data.markIndex]; + const Lookup &lookup = subs[(unsigned) entry->data.markIndex]; replacement = lookup.get_value (buffer->info[mark].codepoint, driver->num_glyphs); } } @@ -274,7 +274,7 @@ struct ContextualSubtable { if (entry->data.currentIndex != 0xFFFF) { - const Lookup &lookup = subs[entry->data.currentIndex]; + const Lookup &lookup = subs[(unsigned) entry->data.currentIndex]; replacement = lookup.get_value (buffer->info[idx].codepoint, driver->num_glyphs); } } diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 32ed13c0d..8559744f5 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -625,8 +625,8 @@ struct PairSet inline bool intersects (const hb_set_t *glyphs, const ValueFormat *valueFormats) const { - unsigned int len1 = valueFormats[0].get_len (); - unsigned int len2 = valueFormats[1].get_len (); + unsigned int len1 = valueFormats[0u].get_len (); + unsigned int len2 = valueFormats[1u].get_len (); unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2); const PairValueRecord *record = &firstPairValueRecord; @@ -644,8 +644,8 @@ struct PairSet const ValueFormat *valueFormats) const { TRACE_COLLECT_GLYPHS (this); - unsigned int len1 = valueFormats[0].get_len (); - unsigned int len2 = valueFormats[1].get_len (); + unsigned int len1 = valueFormats[0u].get_len (); + unsigned int len2 = valueFormats[1u].get_len (); unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2); const PairValueRecord *record = &firstPairValueRecord; @@ -658,8 +658,8 @@ struct PairSet { TRACE_APPLY (this); hb_buffer_t *buffer = c->buffer; - unsigned int len1 = valueFormats[0].get_len (); - unsigned int len2 = valueFormats[1].get_len (); + unsigned int len1 = valueFormats[0u].get_len (); + unsigned int len2 = valueFormats[1u].get_len (); unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2); unsigned int count = len; @@ -681,8 +681,8 @@ struct PairSet else { /* Note the intentional use of "|" instead of short-circuit "||". */ - if (valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos()) | - valueFormats[1].apply_value (c, this, &record->values[len1], buffer->pos[pos])) + if (valueFormats[0u].apply_value (c, this, &record->values[0u], buffer->cur_pos()) | + valueFormats[1u].apply_value (c, this, &record->values[len1], buffer->pos[pos])) buffer->unsafe_to_break (buffer->idx, pos + 1); if (len2) pos++; @@ -698,7 +698,7 @@ struct PairSet { const void *base; const ValueFormat *valueFormats; - unsigned int len1; /* valueFormats[0].get_len() */ + unsigned int len1; /* valueFormats[0u].get_len() */ unsigned int stride; /* 1 + len1 + len2 */ }; @@ -713,8 +713,8 @@ struct PairSet unsigned int count = len; const PairValueRecord *record = &firstPairValueRecord; - return_trace (closure->valueFormats[0].sanitize_values_stride_unsafe (c, closure->base, &record->values[0], count, closure->stride) && - closure->valueFormats[1].sanitize_values_stride_unsafe (c, closure->base, &record->values[closure->len1], count, closure->stride)); + return_trace (closure->valueFormats[0u].sanitize_values_stride_unsafe (c, closure->base, &record->values[0u], count, closure->stride) && + closure->valueFormats[1u].sanitize_values_stride_unsafe (c, closure->base, &record->values[closure->len1], count, closure->stride)); } protected: @@ -781,8 +781,8 @@ struct PairPosFormat1 if (!c->check_struct (this)) return_trace (false); - unsigned int len1 = valueFormat[0].get_len (); - unsigned int len2 = valueFormat[1].get_len (); + unsigned int len1 = valueFormat[0u].get_len (); + unsigned int len2 = valueFormat[1u].get_len (); PairSet::sanitize_closure_t closure = { this, @@ -799,10 +799,10 @@ struct PairPosFormat1 OffsetTo coverage; /* Offset to Coverage table--from * beginning of subtable */ - ValueFormat valueFormat[2]; /* [0] Defines the types of data in + ValueFormat valueFormat[2u]; /* [0u] Defines the types of data in * ValueRecord1--for the first glyph * in the pair--may be zero (0) */ - /* [1] Defines the types of data in + /* [1u] Defines the types of data in * ValueRecord2--for the second glyph * in the pair--may be zero (0) */ OffsetArrayOf @@ -885,7 +885,7 @@ struct PairPosFormat2 return_trace (c->check_range ((const void *) values, count, record_size) && - valueFormat1.sanitize_values_stride_unsafe (c, this, &values[0], count, stride) && + valueFormat1.sanitize_values_stride_unsafe (c, this, &values[0u], count, stride) && valueFormat2.sanitize_values_stride_unsafe (c, this, &values[len1], count, stride)); } diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index a9bfee155..3429997bf 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -1350,7 +1350,7 @@ struct Rule return_trace (inputCount.sanitize (c) && lookupCount.sanitize (c) && c->check_range (inputZ.arrayZ, - inputZ[0].static_size * (inputCount ? inputCount - 1 : 0) + + inputZ.item_size * (inputCount ? inputCount - 1 : 0) + LookupRecord::static_size * lookupCount)); } @@ -1672,7 +1672,7 @@ struct ContextFormat3 { inline bool intersects (const hb_set_t *glyphs) const { - if (!(this+coverageZ[0]).intersects (glyphs)) + if (!(this+coverageZ[0u]).intersects (glyphs)) return false; struct ContextClosureLookupContext lookup_context = { @@ -1687,7 +1687,7 @@ struct ContextFormat3 inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - if (!(this+coverageZ[0]).intersects (c->glyphs)) + if (!(this+coverageZ[0u]).intersects (c->glyphs)) return; const LookupRecord *lookupRecord = &StructAfter (coverageZ.as_array (glyphCount)); @@ -1704,7 +1704,7 @@ struct ContextFormat3 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); - (this+coverageZ[0]).add_coverage (c->input); + (this+coverageZ[0u]).add_coverage (c->input); const LookupRecord *lookupRecord = &StructAfter (coverageZ.as_array (glyphCount)); struct ContextCollectGlyphsLookupContext lookup_context = { @@ -1731,12 +1731,12 @@ struct ContextFormat3 } inline const Coverage &get_coverage (void) const - { return this+coverageZ[0]; } + { return this+coverageZ[0u]; } inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); - unsigned int index = (this+coverageZ[0]).get_coverage (c->buffer->cur().codepoint); + unsigned int index = (this+coverageZ[0u]).get_coverage (c->buffer->cur().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); const LookupRecord *lookupRecord = &StructAfter (coverageZ.as_array (glyphCount)); @@ -1759,7 +1759,7 @@ struct ContextFormat3 TRACE_SANITIZE (this); if (!c->check_struct (this)) return_trace (false); unsigned int count = glyphCount; - if (!count) return_trace (false); /* We want to access coverageZ[0] freely. */ + if (!count) return_trace (false); /* We want to access coverageZ[0u] freely. */ if (!c->check_array (coverageZ.arrayZ, count)) return_trace (false); for (unsigned int i = 0; i < count; i++) if (!coverageZ[i].sanitize (c, this)) return_trace (false); @@ -1838,7 +1838,7 @@ static inline bool chain_context_intersects (const hb_set_t *glyphs, { return intersects_array (glyphs, backtrackCount, backtrack, - lookup_context.funcs.intersects, lookup_context.intersects_data[0]) + lookup_context.funcs.intersects, lookup_context.intersects_data[0u]) && intersects_array (glyphs, inputCount ? inputCount - 1 : 0, input, lookup_context.funcs.intersects, lookup_context.intersects_data[1])