From: Behdad Esfahbod Date: Thu, 6 Dec 2018 18:19:03 +0000 (-0800) Subject: Add default-value for second arg of sub_array() X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ca23b719357b01e98a5cf533bbf637d6706a4ec2;p=platform%2Fupstream%2FlibHarfBuzzSharp.git Add default-value for second arg of sub_array() --- diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index dccca3c..1956bb9 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -588,16 +588,15 @@ struct hb_array_t inline unsigned int get_size (void) const { return len * sizeof (Type); } - inline hb_array_t sub_array (unsigned int start_offset, unsigned int *seg_count /* IN/OUT */) const + inline hb_array_t sub_array (unsigned int start_offset, unsigned int *seg_count = nullptr /* IN/OUT */) const { - if (!seg_count) return hb_array_t (); - unsigned int count = len; if (unlikely (start_offset > count)) count = 0; else count -= start_offset; - count = *seg_count = MIN (count, *seg_count); + if (seg_count) + count = *seg_count = MIN (count, *seg_count); return hb_array_t (arrayZ + start_offset, count); } inline hb_array_t sub_array (unsigned int start_offset, unsigned int seg_count) const diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 69cc5cc..b9d917d 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -541,11 +541,11 @@ struct ArrayOf inline hb_array_t sub_array (unsigned int start_offset, unsigned int count) const { return as_array ().sub_array (start_offset, count);} - inline hb_array_t sub_array (unsigned int start_offset, unsigned int *count /* IN/OUT */) const + inline hb_array_t sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const { return as_array ().sub_array (start_offset, count);} inline hb_array_t sub_array (unsigned int start_offset, unsigned int count) { return as_array ().sub_array (start_offset, count);} - inline hb_array_t sub_array (unsigned int start_offset, unsigned int *count /* IN/OUT */) + inline hb_array_t sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) { return as_array ().sub_array (start_offset, count);} inline bool serialize (hb_serialize_context_t *c, @@ -812,11 +812,11 @@ struct SortedArrayOf : ArrayOf inline hb_array_t sub_array (unsigned int start_offset, unsigned int count) const { return as_array ().sub_array (start_offset, count);} - inline hb_array_t sub_array (unsigned int start_offset, unsigned int *count /* IN/OUT */) const + inline hb_array_t sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const { return as_array ().sub_array (start_offset, count);} inline hb_array_t sub_array (unsigned int start_offset, unsigned int count) { return as_array ().sub_array (start_offset, count);} - inline hb_array_t sub_array (unsigned int start_offset, unsigned int *count /* IN/OUT */) + inline hb_array_t sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) { return as_array ().sub_array (start_offset, count);} template