Use hb_memset instead of memset consistently

This commit is contained in:
Behdad Esfahbod 2022-11-22 12:50:36 -07:00
parent 44a892a233
commit ac0efaf818
13 changed files with 39 additions and 39 deletions

View File

@ -38,7 +38,7 @@ struct hb_aat_map_t
void init ()
{
memset (this, 0, sizeof (*this));
hb_memset (this, 0, sizeof (*this));
chain_flags.init ();
}
void fini () { chain_flags.fini (); }

View File

@ -41,7 +41,7 @@ struct hb_vector_size_t
elt_t& operator [] (unsigned int i) { return v[i]; }
const elt_t& operator [] (unsigned int i) const { return v[i]; }
void clear (unsigned char v = 0) { memset (this, v, sizeof (*this)); }
void clear (unsigned char v = 0) { hb_memset (this, v, sizeof (*this)); }
template <typename Op>
hb_vector_size_t process (const Op& op) const
@ -116,7 +116,7 @@ struct hb_bit_page_t
*la |= ~(mask (a) - 1);
la++;
memset (la, 0xff, (char *) lb - (char *) la);
hb_memset (la, 0xff, (char *) lb - (char *) la);
*lb |= ((mask (b) << 1) - 1);
}
@ -132,7 +132,7 @@ struct hb_bit_page_t
*la &= mask (a) - 1;
la++;
memset (la, 0, (char *) lb - (char *) la);
hb_memset (la, 0, (char *) lb - (char *) la);
*lb &= ~((mask (b) << 1) - 1);
}

View File

@ -590,8 +590,8 @@ _resume:
case 1:
#line 38 "hb-buffer-deserialize-json.rl"
{
memset (&info, 0, sizeof (info));
memset (&pos , 0, sizeof (pos ));
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
break;
case 5:

View File

@ -493,8 +493,8 @@ _resume:
case 1:
#line 38 "hb-buffer-deserialize-text.rl"
{
memset (&info, 0, sizeof (info));
memset (&pos , 0, sizeof (pos ));
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
break;
case 4:
@ -548,8 +548,8 @@ _resume:
case 15:
#line 38 "hb-buffer-deserialize-text.rl"
{
memset (&info, 0, sizeof (info));
memset (&pos , 0, sizeof (pos ));
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
#line 51 "hb-buffer-deserialize-text.rl"
{
@ -665,8 +665,8 @@ _resume:
case 12:
#line 38 "hb-buffer-deserialize-text.rl"
{
memset (&info, 0, sizeof (info));
memset (&pos , 0, sizeof (pos ));
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
#line 51 "hb-buffer-deserialize-text.rl"
{
@ -678,8 +678,8 @@ _resume:
case 14:
#line 38 "hb-buffer-deserialize-text.rl"
{
memset (&info, 0, sizeof (info));
memset (&pos , 0, sizeof (pos ));
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
#line 51 "hb-buffer-deserialize-text.rl"
{
@ -717,8 +717,8 @@ _resume:
case 11:
#line 38 "hb-buffer-deserialize-text.rl"
{
memset (&info, 0, sizeof (info));
memset (&pos , 0, sizeof (pos ));
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
#line 51 "hb-buffer-deserialize-text.rl"
{
@ -744,8 +744,8 @@ _resume:
case 13:
#line 38 "hb-buffer-deserialize-text.rl"
{
memset (&info, 0, sizeof (info));
memset (&pos , 0, sizeof (pos ));
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
#line 51 "hb-buffer-deserialize-text.rl"
{
@ -875,8 +875,8 @@ _again:
case 11:
#line 38 "hb-buffer-deserialize-text.rl"
{
memset (&info, 0, sizeof (info));
memset (&pos , 0, sizeof (pos ));
hb_memset (&info, 0, sizeof (info));
hb_memset (&pos , 0, sizeof (pos ));
}
#line 51 "hb-buffer-deserialize-text.rl"
{

View File

@ -230,7 +230,7 @@ hb_buffer_t::shift_forward (unsigned int count)
* Ideally, we should at least set Default_Ignorable bits on
* these, as well as consistent cluster values. But the former
* is layering violation... */
memset (info + len, 0, (idx + count - len) * sizeof (info[0]));
hb_memset (info + len, 0, (idx + count - len) * sizeof (info[0]));
}
len += count;
idx += count;
@ -299,8 +299,8 @@ hb_buffer_t::clear ()
out_len = 0;
out_info = info;
memset (context, 0, sizeof context);
memset (context_len, 0, sizeof context_len);
hb_memset (context, 0, sizeof context);
hb_memset (context_len, 0, sizeof context_len);
deallocate_var_all ();
serial = 0;
@ -345,7 +345,7 @@ hb_buffer_t::add (hb_codepoint_t codepoint,
glyph = &info[len];
memset (glyph, 0, sizeof (*glyph));
hb_memset (glyph, 0, sizeof (*glyph));
glyph->codepoint = codepoint;
glyph->mask = 0;
glyph->cluster = cluster;
@ -1432,9 +1432,9 @@ hb_buffer_set_length (hb_buffer_t *buffer,
/* Wipe the new space */
if (length > buffer->len) {
memset (buffer->info + buffer->len, 0, sizeof (buffer->info[0]) * (length - buffer->len));
hb_memset (buffer->info + buffer->len, 0, sizeof (buffer->info[0]) * (length - buffer->len));
if (buffer->have_positions)
memset (buffer->pos + buffer->len, 0, sizeof (buffer->pos[0]) * (length - buffer->len));
hb_memset (buffer->pos + buffer->len, 0, sizeof (buffer->pos[0]) * (length - buffer->len));
}
buffer->len = length;

View File

@ -976,7 +976,7 @@ hb_feature_from_string (const char *str, int len,
}
if (feature)
memset (feature, 0, sizeof (*feature));
hb_memset (feature, 0, sizeof (*feature));
return false;
}
@ -1088,7 +1088,7 @@ hb_variation_from_string (const char *str, int len,
}
if (variation)
memset (variation, 0, sizeof (*variation));
hb_memset (variation, 0, sizeof (*variation));
return false;
}

View File

@ -71,7 +71,7 @@ hb_font_get_font_h_extents_nil (hb_font_t *font HB_UNUSED,
hb_font_extents_t *extents,
void *user_data HB_UNUSED)
{
memset (extents, 0, sizeof (*extents));
hb_memset (extents, 0, sizeof (*extents));
return false;
}
@ -96,7 +96,7 @@ hb_font_get_font_v_extents_nil (hb_font_t *font HB_UNUSED,
hb_font_extents_t *extents,
void *user_data HB_UNUSED)
{
memset (extents, 0, sizeof (*extents));
hb_memset (extents, 0, sizeof (*extents));
return false;
}
@ -409,7 +409,7 @@ hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
hb_glyph_extents_t *extents,
void *user_data HB_UNUSED)
{
memset (extents, 0, sizeof (*extents));
hb_memset (extents, 0, sizeof (*extents));
return false;
}

View File

@ -206,14 +206,14 @@ struct hb_font_t
hb_bool_t get_font_h_extents (hb_font_extents_t *extents)
{
memset (extents, 0, sizeof (*extents));
hb_memset (extents, 0, sizeof (*extents));
return klass->get.f.font_h_extents (this, user_data,
extents,
!klass->user_data ? nullptr : klass->user_data->font_h_extents);
}
hb_bool_t get_font_v_extents (hb_font_extents_t *extents)
{
memset (extents, 0, sizeof (*extents));
hb_memset (extents, 0, sizeof (*extents));
return klass->get.f.font_v_extents (this, user_data,
extents,
!klass->user_data ? nullptr : klass->user_data->font_v_extents);
@ -342,7 +342,7 @@ struct hb_font_t
hb_bool_t get_glyph_extents (hb_codepoint_t glyph,
hb_glyph_extents_t *extents)
{
memset (extents, 0, sizeof (*extents));
hb_memset (extents, 0, sizeof (*extents));
return klass->get.f.glyph_extents (this, user_data,
glyph,
extents,

View File

@ -318,7 +318,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan HB_UNUSED,
#undef ALLOCATE_ARRAY
memset (clusters, 0, sizeof (clusters[0]) * buffer->len);
hb_memset (clusters, 0, sizeof (clusters[0]) * buffer->len);
hb_codepoint_t *pg = gids;
clusters[0].cluster = buffer->info[0].cluster;

View File

@ -45,7 +45,7 @@ void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_o
hb_ot_map_builder_t::hb_ot_map_builder_t (hb_face_t *face_,
const hb_segment_properties_t &props_)
{
memset (this, 0, sizeof (*this));
hb_memset (this, 0, sizeof (*this));
feature_infos.init ();
for (unsigned int table_index = 0; table_index < 2; table_index++)

View File

@ -89,7 +89,7 @@ struct hb_ot_map_t
void init ()
{
memset (this, 0, sizeof (*this));
hb_memset (this, 0, sizeof (*this));
features.init ();
for (unsigned int table_index = 0; table_index < 2; table_index++)

View File

@ -58,7 +58,7 @@ struct hb_pool_t
T* obj = next;
next = * ((T**) next);
memset (obj, 0, sizeof (T));
hb_memset (obj, 0, sizeof (T));
return obj;
}

View File

@ -478,7 +478,7 @@ populate_log_font (LOGFONTW *lf,
hb_font_t *font,
unsigned int font_size)
{
memset (lf, 0, sizeof (*lf));
hb_memset (lf, 0, sizeof (*lf));
lf->lfHeight = - (int) font_size;
lf->lfCharSet = DEFAULT_CHARSET;