< prev index next >

src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-gpos-table.hh

Print this page
rev 16297 : 8171248: Minor HarfBuzz fixes to pacify Coverity code scan


 672     return_trace (closure->valueFormats[0].sanitize_values_stride_unsafe (c, closure->base, &record->values[0], count, closure->stride) &&
 673                   closure->valueFormats[1].sanitize_values_stride_unsafe (c, closure->base, &record->values[closure->len1], count, closure->stride));
 674   }
 675 
 676   protected:
 677   USHORT        len;                    /* Number of PairValueRecords */
 678   USHORT        arrayZ[VAR];            /* Array of PairValueRecords--ordered
 679                                          * by GlyphID of the second glyph */
 680   public:
 681   DEFINE_SIZE_ARRAY (2, arrayZ);
 682 };
 683 
 684 struct PairPosFormat1
 685 {
 686   inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
 687   {
 688     TRACE_COLLECT_GLYPHS (this);
 689     (this+coverage).add_coverage (c->input);
 690     unsigned int count = pairSet.len;
 691     for (unsigned int i = 0; i < count; i++)
 692       (this+pairSet[i]).collect_glyphs (c, &valueFormat1);
 693   }
 694 
 695   inline const Coverage &get_coverage (void) const
 696   {
 697     return this+coverage;
 698   }
 699 
 700   inline bool apply (hb_apply_context_t *c) const
 701   {
 702     TRACE_APPLY (this);
 703     hb_buffer_t *buffer = c->buffer;
 704     unsigned int index = (this+coverage).get_coverage  (buffer->cur().codepoint);
 705     if (likely (index == NOT_COVERED)) return_trace (false);
 706 
 707     hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
 708     skippy_iter.reset (buffer->idx, 1);
 709     if (!skippy_iter.next ()) return_trace (false);
 710 
 711     return_trace ((this+pairSet[index]).apply (c, &valueFormat1, skippy_iter.idx));
 712   }
 713 
 714   inline bool sanitize (hb_sanitize_context_t *c) const
 715   {
 716     TRACE_SANITIZE (this);
 717 
 718     if (!c->check_struct (this)) return_trace (false);
 719 
 720     unsigned int len1 = valueFormat1.get_len ();
 721     unsigned int len2 = valueFormat2.get_len ();
 722     PairSet::sanitize_closure_t closure = {
 723       this,
 724       &valueFormat1,
 725       len1,
 726       1 + len1 + len2
 727     };
 728 
 729     return_trace (coverage.sanitize (c, this) && pairSet.sanitize (c, this, &closure));
 730   }
 731 
 732   protected:
 733   USHORT        format;                 /* Format identifier--format = 1 */
 734   OffsetTo<Coverage>
 735                 coverage;               /* Offset to Coverage table--from
 736                                          * beginning of subtable */
 737   ValueFormat   valueFormat1;           /* Defines the types of data in
 738                                          * ValueRecord1--for the first glyph
 739                                          * in the pair--may be zero (0) */
 740   ValueFormat   valueFormat2;           /* Defines the types of data in
 741                                          * ValueRecord2--for the second glyph
 742                                          * in the pair--may be zero (0) */
 743   OffsetArrayOf<PairSet>
 744                 pairSet;                /* Array of PairSet tables
 745                                          * ordered by Coverage Index */
 746   public:
 747   DEFINE_SIZE_ARRAY (10, pairSet);
 748 };
 749 
 750 struct PairPosFormat2
 751 {
 752   inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
 753   {
 754     TRACE_COLLECT_GLYPHS (this);
 755     (this+coverage).add_coverage (c->input);
 756 
 757     unsigned int count1 = class1Count;
 758     const ClassDef &klass1 = this+classDef1;
 759     for (unsigned int i = 0; i < count1; i++)
 760       klass1.add_class (c->input, i);




 672     return_trace (closure->valueFormats[0].sanitize_values_stride_unsafe (c, closure->base, &record->values[0], count, closure->stride) &&
 673                   closure->valueFormats[1].sanitize_values_stride_unsafe (c, closure->base, &record->values[closure->len1], count, closure->stride));
 674   }
 675 
 676   protected:
 677   USHORT        len;                    /* Number of PairValueRecords */
 678   USHORT        arrayZ[VAR];            /* Array of PairValueRecords--ordered
 679                                          * by GlyphID of the second glyph */
 680   public:
 681   DEFINE_SIZE_ARRAY (2, arrayZ);
 682 };
 683 
 684 struct PairPosFormat1
 685 {
 686   inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
 687   {
 688     TRACE_COLLECT_GLYPHS (this);
 689     (this+coverage).add_coverage (c->input);
 690     unsigned int count = pairSet.len;
 691     for (unsigned int i = 0; i < count; i++)
 692       (this+pairSet[i]).collect_glyphs (c, valueFormat);
 693   }
 694 
 695   inline const Coverage &get_coverage (void) const
 696   {
 697     return this+coverage;
 698   }
 699 
 700   inline bool apply (hb_apply_context_t *c) const
 701   {
 702     TRACE_APPLY (this);
 703     hb_buffer_t *buffer = c->buffer;
 704     unsigned int index = (this+coverage).get_coverage  (buffer->cur().codepoint);
 705     if (likely (index == NOT_COVERED)) return_trace (false);
 706 
 707     hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
 708     skippy_iter.reset (buffer->idx, 1);
 709     if (!skippy_iter.next ()) return_trace (false);
 710 
 711     return_trace ((this+pairSet[index]).apply (c, valueFormat, skippy_iter.idx));
 712   }
 713 
 714   inline bool sanitize (hb_sanitize_context_t *c) const
 715   {
 716     TRACE_SANITIZE (this);
 717 
 718     if (!c->check_struct (this)) return_trace (false);
 719 
 720     unsigned int len1 = valueFormat[0].get_len ();
 721     unsigned int len2 = valueFormat[1].get_len ();
 722     PairSet::sanitize_closure_t closure = {
 723       this,
 724       valueFormat,
 725       len1,
 726       1 + len1 + len2
 727     };
 728 
 729     return_trace (coverage.sanitize (c, this) && pairSet.sanitize (c, this, &closure));
 730   }
 731 
 732   protected:
 733   USHORT        format;                 /* Format identifier--format = 1 */
 734   OffsetTo<Coverage>
 735                 coverage;               /* Offset to Coverage table--from
 736                                          * beginning of subtable */
 737   ValueFormat   valueFormat[2];         /* [0] Defines the types of data in
 738                                          * ValueRecord1--for the first glyph
 739                                          * in the pair--may be zero (0) */
 740                                         /* [1] Defines the types of data in
 741                                          * ValueRecord2--for the second glyph
 742                                          * in the pair--may be zero (0) */
 743   OffsetArrayOf<PairSet>
 744                 pairSet;                /* Array of PairSet tables
 745                                          * ordered by Coverage Index */
 746   public:
 747   DEFINE_SIZE_ARRAY (10, pairSet);
 748 };
 749 
 750 struct PairPosFormat2
 751 {
 752   inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
 753   {
 754     TRACE_COLLECT_GLYPHS (this);
 755     (this+coverage).add_coverage (c->input);
 756 
 757     unsigned int count1 = class1Count;
 758     const ClassDef &klass1 = this+classDef1;
 759     for (unsigned int i = 0; i < count1; i++)
 760       klass1.add_class (c->input, i);


< prev index next >