Rename HeadlessArrayOf::len to lenP1
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 13 Sep 2018 18:21:54 +0000 (20:21 +0200)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 13 Sep 2018 18:21:54 +0000 (20:21 +0200)
So it doesn't accidentally match our templates, etc.

src/hb-open-type.hh
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsubgpos.hh

index b10d33b..6807973 100644 (file)
@@ -570,16 +570,16 @@ struct HeadlessArrayOf
 {
   inline const Type& operator [] (unsigned int i) const
   {
-    if (unlikely (i >= len || !i)) return Null(Type);
+    if (unlikely (i >= lenP1 || !i)) return Null(Type);
     return arrayZ[i-1];
   }
   inline Type& operator [] (unsigned int i)
   {
-    if (unlikely (i >= len || !i)) return Crap(Type);
+    if (unlikely (i >= lenP1 || !i)) return Crap(Type);
     return arrayZ[i-1];
   }
   inline unsigned int get_size (void) const
-  { return len.static_size + (len ? len - 1 : 0) * Type::static_size; }
+  { return lenP1.static_size + (lenP1 ? lenP1 - 1 : 0) * Type::static_size; }
 
   inline bool serialize (hb_serialize_context_t *c,
                         Supplier<Type> &items,
@@ -587,7 +587,7 @@ struct HeadlessArrayOf
   {
     TRACE_SERIALIZE (this);
     if (unlikely (!c->extend_min (*this))) return_trace (false);
-    len.set (items_len); /* TODO(serialize) Overflow? */
+    lenP1.set (items_len); /* TODO(serialize) Overflow? */
     if (unlikely (!items_len)) return_trace (true);
     if (unlikely (!c->extend (*this))) return_trace (false);
     for (unsigned int i = 0; i < items_len - 1; i++)
@@ -617,12 +617,12 @@ struct HeadlessArrayOf
   inline bool sanitize_shallow (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    return_trace (len.sanitize (c) &&
-                 (!len || c->check_array (arrayZ, len - 1)));
+    return_trace (lenP1.sanitize (c) &&
+                 (!lenP1 || c->check_array (arrayZ, lenP1 - 1)));
   }
 
   public:
-  LenType      len;
+  LenType      lenP1;
   Type         arrayZ[VAR];
   public:
   DEFINE_SIZE_ARRAY (sizeof (LenType), arrayZ);
index 4d5db6a..7e36e06 100644 (file)
@@ -710,7 +710,7 @@ struct Ligature
 {
   inline bool intersects (const hb_set_t *glyphs) const
   {
-    unsigned int count = component.len;
+    unsigned int count = component.lenP1;
     for (unsigned int i = 1; i < count; i++)
       if (!glyphs->has (component[i]))
         return false;
@@ -720,7 +720,7 @@ struct Ligature
   inline void closure (hb_closure_context_t *c) const
   {
     TRACE_CLOSURE (this);
-    unsigned int count = component.len;
+    unsigned int count = component.lenP1;
     for (unsigned int i = 1; i < count; i++)
       if (!c->glyphs->has (component[i]))
         return;
@@ -730,14 +730,14 @@ struct Ligature
   inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
   {
     TRACE_COLLECT_GLYPHS (this);
-    c->input->add_array (component.arrayZ, component.len ? component.len - 1 : 0);
+    c->input->add_array (component.arrayZ, component.lenP1 ? component.lenP1 - 1 : 0);
     c->output->add (ligGlyph);
   }
 
   inline bool would_apply (hb_would_apply_context_t *c) const
   {
     TRACE_WOULD_APPLY (this);
-    if (c->len != component.len)
+    if (c->len != component.lenP1)
       return_trace (false);
 
     for (unsigned int i = 1; i < c->len; i++)
@@ -750,7 +750,7 @@ struct Ligature
   inline bool apply (hb_ot_apply_context_t *c) const
   {
     TRACE_APPLY (this);
-    unsigned int count = component.len;
+    unsigned int count = component.lenP1;
 
     if (unlikely (!count)) return_trace (false);
 
index eae73ce..ff9783e 100644 (file)
@@ -1879,7 +1879,7 @@ struct ChainRule
     const ArrayOf<HBUINT16> &lookahead = StructAfter<ArrayOf<HBUINT16> > (input);
     return chain_context_intersects (glyphs,
                                     backtrack.len, backtrack.arrayZ,
-                                    input.len, input.arrayZ,
+                                    input.lenP1, input.arrayZ,
                                     lookahead.len, lookahead.arrayZ,
                                     lookup_context);
   }
@@ -1892,7 +1892,7 @@ struct ChainRule
     const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
     chain_context_closure_lookup (c,
                                  backtrack.len, backtrack.arrayZ,
-                                 input.len, input.arrayZ,
+                                 input.lenP1, input.arrayZ,
                                  lookahead.len, lookahead.arrayZ,
                                  lookup.len, lookup.arrayZ,
                                  lookup_context);
@@ -1906,7 +1906,7 @@ struct ChainRule
     const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
     chain_context_collect_glyphs_lookup (c,
                                         backtrack.len, backtrack.arrayZ,
-                                        input.len, input.arrayZ,
+                                        input.lenP1, input.arrayZ,
                                         lookahead.len, lookahead.arrayZ,
                                         lookup.len, lookup.arrayZ,
                                         lookup_context);
@@ -1920,7 +1920,7 @@ struct ChainRule
     const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
     return_trace (chain_context_would_apply_lookup (c,
                                                    backtrack.len, backtrack.arrayZ,
-                                                   input.len, input.arrayZ,
+                                                   input.lenP1, input.arrayZ,
                                                    lookahead.len, lookahead.arrayZ, lookup.len,
                                                    lookup.arrayZ, lookup_context));
   }
@@ -1933,7 +1933,7 @@ struct ChainRule
     const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
     return_trace (chain_context_apply_lookup (c,
                                              backtrack.len, backtrack.arrayZ,
-                                             input.len, input.arrayZ,
+                                             input.lenP1, input.arrayZ,
                                              lookahead.len, lookahead.arrayZ, lookup.len,
                                              lookup.arrayZ, lookup_context));
   }