Remove MIN/MAX in favor of hb_min/hb_max
This commit is contained in:
parent
5c0f62adc9
commit
41248cce0e
|
@ -576,7 +576,7 @@ struct StateTable
|
||||||
if (unlikely (stop > states))
|
if (unlikely (stop > states))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
for (const HBUSHORT *p = states; stop < p; p--)
|
for (const HBUSHORT *p = states; stop < p; p--)
|
||||||
num_entries = MAX<unsigned int> (num_entries, *(p - 1) + 1);
|
num_entries = hb_max (num_entries, *(p - 1) + 1);
|
||||||
state_neg = min_state;
|
state_neg = min_state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ struct StateTable
|
||||||
if (unlikely (stop < states))
|
if (unlikely (stop < states))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
for (const HBUSHORT *p = &states[state_pos * num_classes]; p < stop; p++)
|
for (const HBUSHORT *p = &states[state_pos * num_classes]; p < stop; p++)
|
||||||
num_entries = MAX<unsigned int> (num_entries, *p + 1);
|
num_entries = hb_max (num_entries, *p + 1);
|
||||||
state_pos = max_state + 1;
|
state_pos = max_state + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -611,8 +611,8 @@ struct StateTable
|
||||||
for (const Entry<Extra> *p = &entries[entry]; p < stop; p++)
|
for (const Entry<Extra> *p = &entries[entry]; p < stop; p++)
|
||||||
{
|
{
|
||||||
int newState = new_state (p->newState);
|
int newState = new_state (p->newState);
|
||||||
min_state = MIN (min_state, newState);
|
min_state = hb_min (min_state, newState);
|
||||||
max_state = MAX (max_state, newState);
|
max_state = hb_max (max_state, newState);
|
||||||
}
|
}
|
||||||
entry = num_entries;
|
entry = num_entries;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ struct feat
|
||||||
unsigned int feature_count = featureNameCount;
|
unsigned int feature_count = featureNameCount;
|
||||||
if (count && *count)
|
if (count && *count)
|
||||||
{
|
{
|
||||||
unsigned int len = MIN (feature_count - start_offset, *count);
|
unsigned int len = hb_min (feature_count - start_offset, *count);
|
||||||
for (unsigned int i = 0; i < len; i++)
|
for (unsigned int i = 0; i < len; i++)
|
||||||
features[i] = namesZ[i + start_offset].get_feature_type ();
|
features[i] = namesZ[i + start_offset].get_feature_type ();
|
||||||
*count = len;
|
*count = len;
|
||||||
|
|
|
@ -251,7 +251,7 @@ struct KerxSubTableFormat1
|
||||||
|
|
||||||
if (Format1EntryT::performAction (entry) && depth)
|
if (Format1EntryT::performAction (entry) && depth)
|
||||||
{
|
{
|
||||||
unsigned int tuple_count = MAX (1u, table->header.tuple_count ());
|
unsigned int tuple_count = hb_max (1u, table->header.tuple_count ());
|
||||||
|
|
||||||
unsigned int kern_idx = Format1EntryT::kernActionIndex (entry);
|
unsigned int kern_idx = Format1EntryT::kernActionIndex (entry);
|
||||||
kern_idx = Types::byteOffsetToIndex (kern_idx, &table->machine, kernAction.arrayZ);
|
kern_idx = Types::byteOffsetToIndex (kern_idx, &table->machine, kernAction.arrayZ);
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct RearrangementSubtable
|
||||||
start = buffer->idx;
|
start = buffer->idx;
|
||||||
|
|
||||||
if (flags & MarkLast)
|
if (flags & MarkLast)
|
||||||
end = MIN (buffer->idx + 1, buffer->len);
|
end = hb_min (buffer->idx + 1, buffer->len);
|
||||||
|
|
||||||
if ((flags & Verb) && start < end)
|
if ((flags & Verb) && start < end)
|
||||||
{
|
{
|
||||||
|
@ -117,14 +117,14 @@ struct RearrangementSubtable
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int m = map[flags & Verb];
|
unsigned int m = map[flags & Verb];
|
||||||
unsigned int l = MIN<unsigned int> (2, m >> 4);
|
unsigned int l = hb_min (2u, m >> 4);
|
||||||
unsigned int r = MIN<unsigned int> (2, m & 0x0F);
|
unsigned int r = hb_min (2u, m & 0x0F);
|
||||||
bool reverse_l = 3 == (m >> 4);
|
bool reverse_l = 3 == (m >> 4);
|
||||||
bool reverse_r = 3 == (m & 0x0F);
|
bool reverse_r = 3 == (m & 0x0F);
|
||||||
|
|
||||||
if (end - start >= l + r)
|
if (end - start >= l + r)
|
||||||
{
|
{
|
||||||
buffer->merge_clusters (start, MIN (buffer->idx + 1, buffer->len));
|
buffer->merge_clusters (start, hb_min (buffer->idx + 1, buffer->len));
|
||||||
buffer->merge_clusters (start, end);
|
buffer->merge_clusters (start, end);
|
||||||
|
|
||||||
hb_glyph_info_t *info = buffer->info;
|
hb_glyph_info_t *info = buffer->info;
|
||||||
|
@ -261,13 +261,13 @@ struct ContextualSubtable
|
||||||
}
|
}
|
||||||
if (replacement)
|
if (replacement)
|
||||||
{
|
{
|
||||||
buffer->unsafe_to_break (mark, MIN (buffer->idx + 1, buffer->len));
|
buffer->unsafe_to_break (mark, hb_min (buffer->idx + 1, buffer->len));
|
||||||
buffer->info[mark].codepoint = *replacement;
|
buffer->info[mark].codepoint = *replacement;
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
replacement = nullptr;
|
replacement = nullptr;
|
||||||
unsigned int idx = MIN (buffer->idx, buffer->len - 1);
|
unsigned int idx = hb_min (buffer->idx, buffer->len - 1);
|
||||||
if (Types::extended)
|
if (Types::extended)
|
||||||
{
|
{
|
||||||
if (entry.data.currentIndex != 0xFFFF)
|
if (entry.data.currentIndex != 0xFFFF)
|
||||||
|
@ -337,9 +337,9 @@ struct ContextualSubtable
|
||||||
const EntryData &data = entries[i].data;
|
const EntryData &data = entries[i].data;
|
||||||
|
|
||||||
if (data.markIndex != 0xFFFF)
|
if (data.markIndex != 0xFFFF)
|
||||||
num_lookups = MAX<unsigned int> (num_lookups, 1 + data.markIndex);
|
num_lookups = hb_max (num_lookups, 1 + data.markIndex);
|
||||||
if (data.currentIndex != 0xFFFF)
|
if (data.currentIndex != 0xFFFF)
|
||||||
num_lookups = MAX<unsigned int> (num_lookups, 1 + data.currentIndex);
|
num_lookups = hb_max (num_lookups, 1 + data.currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_trace (substitutionTables.sanitize (c, this, num_lookups));
|
return_trace (substitutionTables.sanitize (c, this, num_lookups));
|
||||||
|
@ -744,7 +744,7 @@ struct InsertionSubtable
|
||||||
|
|
||||||
buffer->move_to (end + count);
|
buffer->move_to (end + count);
|
||||||
|
|
||||||
buffer->unsafe_to_break_from_outbuffer (mark, MIN (buffer->idx + 1, buffer->len));
|
buffer->unsafe_to_break_from_outbuffer (mark, hb_min (buffer->idx + 1, buffer->len));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & SetMark)
|
if (flags & SetMark)
|
||||||
|
|
|
@ -186,6 +186,10 @@ struct
|
||||||
}
|
}
|
||||||
HB_FUNCOBJ (hb_second);
|
HB_FUNCOBJ (hb_second);
|
||||||
|
|
||||||
|
/* Note. In min/max, we can use hb_type_identity<T> for second argument.
|
||||||
|
* However, that would silently convert between different-signedness integers.
|
||||||
|
* Instead we accept two different types, such that compiler can err if
|
||||||
|
* comparing integers of different signedness. */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
template <typename T, typename T2> auto
|
template <typename T, typename T2> auto
|
||||||
|
@ -409,14 +413,6 @@ static inline unsigned char TOUPPER (unsigned char c)
|
||||||
static inline unsigned char TOLOWER (unsigned char c)
|
static inline unsigned char TOLOWER (unsigned char c)
|
||||||
{ return (c >= 'A' && c <= 'Z') ? c - 'A' + 'a' : c; }
|
{ return (c >= 'A' && c <= 'Z') ? c - 'A' + 'a' : c; }
|
||||||
|
|
||||||
#undef MIN
|
|
||||||
template <typename Type>
|
|
||||||
static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
|
|
||||||
|
|
||||||
#undef MAX
|
|
||||||
template <typename Type>
|
|
||||||
static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; }
|
|
||||||
|
|
||||||
static inline unsigned int DIV_CEIL (const unsigned int a, unsigned int b)
|
static inline unsigned int DIV_CEIL (const unsigned int a, unsigned int b)
|
||||||
{ return (a + (b - 1)) / b; }
|
{ return (a + (b - 1)) / b; }
|
||||||
|
|
||||||
|
@ -668,7 +664,7 @@ hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *o
|
||||||
{
|
{
|
||||||
/* Pain because we don't know whether s is nul-terminated. */
|
/* Pain because we don't know whether s is nul-terminated. */
|
||||||
char buf[64];
|
char buf[64];
|
||||||
len = MIN (ARRAY_LENGTH (buf) - 1, len);
|
len = hb_min (ARRAY_LENGTH (buf) - 1, len);
|
||||||
strncpy (buf, s, len);
|
strncpy (buf, s, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
||||||
}
|
}
|
||||||
void qsort (unsigned int start, unsigned int end)
|
void qsort (unsigned int start, unsigned int end)
|
||||||
{
|
{
|
||||||
end = MIN (end, length);
|
end = hb_min (end, length);
|
||||||
assert (start <= end);
|
assert (start <= end);
|
||||||
if (likely (start < end))
|
if (likely (start < end))
|
||||||
::qsort (arrayZ + start, end - start, this->item_size, Type::cmp);
|
::qsort (arrayZ + start, end - start, this->item_size, Type::cmp);
|
||||||
|
@ -166,7 +166,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
||||||
else
|
else
|
||||||
count -= start_offset;
|
count -= start_offset;
|
||||||
if (seg_count)
|
if (seg_count)
|
||||||
count = *seg_count = MIN (count, *seg_count);
|
count = *seg_count = hb_min (count, *seg_count);
|
||||||
return hb_array_t<Type> (arrayZ + start_offset, count);
|
return hb_array_t<Type> (arrayZ + start_offset, count);
|
||||||
}
|
}
|
||||||
hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int seg_count) const
|
hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int seg_count) const
|
||||||
|
|
|
@ -155,7 +155,7 @@ hb_blob_create_sub_blob (hb_blob_t *parent,
|
||||||
hb_blob_make_immutable (parent);
|
hb_blob_make_immutable (parent);
|
||||||
|
|
||||||
blob = hb_blob_create (parent->data + offset,
|
blob = hb_blob_create (parent->data + offset,
|
||||||
MIN (length, parent->length - offset),
|
hb_min (length, parent->length - offset),
|
||||||
HB_MEMORY_MODE_READONLY,
|
HB_MEMORY_MODE_READONLY,
|
||||||
hb_blob_reference (parent),
|
hb_blob_reference (parent),
|
||||||
_hb_blob_destroy);
|
_hb_blob_destroy);
|
||||||
|
|
|
@ -138,34 +138,34 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
|
||||||
*p++ = '"';
|
*p++ = '"';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%u", info[i].codepoint));
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%u", info[i].codepoint));
|
||||||
|
|
||||||
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS)) {
|
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS)) {
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"cl\":%u", info[i].cluster));
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"cl\":%u", info[i].cluster));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS))
|
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS))
|
||||||
{
|
{
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"dx\":%d,\"dy\":%d",
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"dx\":%d,\"dy\":%d",
|
||||||
x+pos[i].x_offset, y+pos[i].y_offset));
|
x+pos[i].x_offset, y+pos[i].y_offset));
|
||||||
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES))
|
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES))
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"ax\":%d,\"ay\":%d",
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"ax\":%d,\"ay\":%d",
|
||||||
pos[i].x_advance, pos[i].y_advance));
|
pos[i].x_advance, pos[i].y_advance));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS)
|
if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS)
|
||||||
{
|
{
|
||||||
if (info[i].mask & HB_GLYPH_FLAG_DEFINED)
|
if (info[i].mask & HB_GLYPH_FLAG_DEFINED)
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"fl\":%u", info[i].mask & HB_GLYPH_FLAG_DEFINED));
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"fl\":%u", info[i].mask & HB_GLYPH_FLAG_DEFINED));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS)
|
if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS)
|
||||||
{
|
{
|
||||||
hb_glyph_extents_t extents;
|
hb_glyph_extents_t extents;
|
||||||
hb_font_get_glyph_extents(font, info[i].codepoint, &extents);
|
hb_font_get_glyph_extents(font, info[i].codepoint, &extents);
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"xb\":%d,\"yb\":%d",
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"xb\":%d,\"yb\":%d",
|
||||||
extents.x_bearing, extents.y_bearing));
|
extents.x_bearing, extents.y_bearing));
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"w\":%d,\"h\":%d",
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"w\":%d,\"h\":%d",
|
||||||
extents.width, extents.height));
|
extents.width, extents.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,37 +224,37 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
|
||||||
p += strlen (p);
|
p += strlen (p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%u", info[i].codepoint));
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%u", info[i].codepoint));
|
||||||
|
|
||||||
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS)) {
|
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS)) {
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "=%u", info[i].cluster));
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "=%u", info[i].cluster));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS))
|
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS))
|
||||||
{
|
{
|
||||||
if (x+pos[i].x_offset || y+pos[i].y_offset)
|
if (x+pos[i].x_offset || y+pos[i].y_offset)
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "@%d,%d", x+pos[i].x_offset, y+pos[i].y_offset));
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "@%d,%d", x+pos[i].x_offset, y+pos[i].y_offset));
|
||||||
|
|
||||||
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES))
|
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES))
|
||||||
{
|
{
|
||||||
*p++ = '+';
|
*p++ = '+';
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%d", pos[i].x_advance));
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%d", pos[i].x_advance));
|
||||||
if (pos[i].y_advance)
|
if (pos[i].y_advance)
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",%d", pos[i].y_advance));
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",%d", pos[i].y_advance));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS)
|
if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS)
|
||||||
{
|
{
|
||||||
if (info[i].mask & HB_GLYPH_FLAG_DEFINED)
|
if (info[i].mask & HB_GLYPH_FLAG_DEFINED)
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "#%X", info[i].mask &HB_GLYPH_FLAG_DEFINED));
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "#%X", info[i].mask &HB_GLYPH_FLAG_DEFINED));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS)
|
if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS)
|
||||||
{
|
{
|
||||||
hb_glyph_extents_t extents;
|
hb_glyph_extents_t extents;
|
||||||
hb_font_get_glyph_extents(font, info[i].codepoint, &extents);
|
hb_font_get_glyph_extents(font, info[i].codepoint, &extents);
|
||||||
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "<%d,%d,%d,%d>", extents.x_bearing, extents.y_bearing, extents.width, extents.height));
|
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "<%d,%d,%d,%d>", extents.x_bearing, extents.y_bearing, extents.width, extents.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int l = p - b;
|
unsigned int l = p - b;
|
||||||
|
@ -380,7 +380,7 @@ static hb_bool_t
|
||||||
parse_uint (const char *pp, const char *end, uint32_t *pv)
|
parse_uint (const char *pp, const char *end, uint32_t *pv)
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - pp));
|
unsigned int len = hb_min (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - pp));
|
||||||
strncpy (buf, pp, len);
|
strncpy (buf, pp, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ static hb_bool_t
|
||||||
parse_int (const char *pp, const char *end, int32_t *pv)
|
parse_int (const char *pp, const char *end, int32_t *pv)
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - pp));
|
unsigned int len = hb_min (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - pp));
|
||||||
strncpy (buf, pp, len);
|
strncpy (buf, pp, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -524,7 +524,7 @@ hb_buffer_t::merge_clusters_impl (unsigned int start,
|
||||||
unsigned int cluster = info[start].cluster;
|
unsigned int cluster = info[start].cluster;
|
||||||
|
|
||||||
for (unsigned int i = start + 1; i < end; i++)
|
for (unsigned int i = start + 1; i < end; i++)
|
||||||
cluster = MIN<unsigned int> (cluster, info[i].cluster);
|
cluster = hb_min (cluster, info[i].cluster);
|
||||||
|
|
||||||
/* Extend end */
|
/* Extend end */
|
||||||
while (end < len && info[end - 1].cluster == info[end].cluster)
|
while (end < len && info[end - 1].cluster == info[end].cluster)
|
||||||
|
@ -555,7 +555,7 @@ hb_buffer_t::merge_out_clusters (unsigned int start,
|
||||||
unsigned int cluster = out_info[start].cluster;
|
unsigned int cluster = out_info[start].cluster;
|
||||||
|
|
||||||
for (unsigned int i = start + 1; i < end; i++)
|
for (unsigned int i = start + 1; i < end; i++)
|
||||||
cluster = MIN<unsigned int> (cluster, out_info[i].cluster);
|
cluster = hb_min (cluster, out_info[i].cluster);
|
||||||
|
|
||||||
/* Extend start */
|
/* Extend start */
|
||||||
while (start && out_info[start - 1].cluster == out_info[start].cluster)
|
while (start && out_info[start - 1].cluster == out_info[start].cluster)
|
||||||
|
|
|
@ -379,7 +379,7 @@ struct hb_buffer_t
|
||||||
unsigned int cluster) const
|
unsigned int cluster) const
|
||||||
{
|
{
|
||||||
for (unsigned int i = start; i < end; i++)
|
for (unsigned int i = start; i < end; i++)
|
||||||
cluster = MIN<unsigned int> (cluster, infos[i].cluster);
|
cluster = hb_min (cluster, infos[i].cluster);
|
||||||
return cluster;
|
return cluster;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
|
|
@ -356,7 +356,7 @@ hb_language_from_string (const char *str, int len)
|
||||||
{
|
{
|
||||||
/* NUL-terminate it. */
|
/* NUL-terminate it. */
|
||||||
char strbuf[64];
|
char strbuf[64];
|
||||||
len = MIN (len, (int) sizeof (strbuf) - 1);
|
len = hb_min (len, (int) sizeof (strbuf) - 1);
|
||||||
memcpy (strbuf, str, len);
|
memcpy (strbuf, str, len);
|
||||||
strbuf[len] = '\0';
|
strbuf[len] = '\0';
|
||||||
item = lang_find_or_insert (strbuf);
|
item = lang_find_or_insert (strbuf);
|
||||||
|
@ -720,7 +720,7 @@ static bool
|
||||||
parse_uint (const char **pp, const char *end, unsigned int *pv)
|
parse_uint (const char **pp, const char *end, unsigned int *pv)
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
|
unsigned int len = hb_min (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
|
||||||
strncpy (buf, *pp, len);
|
strncpy (buf, *pp, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
@ -744,7 +744,7 @@ static bool
|
||||||
parse_uint32 (const char **pp, const char *end, uint32_t *pv)
|
parse_uint32 (const char **pp, const char *end, uint32_t *pv)
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
|
unsigned int len = hb_min (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
|
||||||
strncpy (buf, *pp, len);
|
strncpy (buf, *pp, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ static bool
|
||||||
parse_float (const char **pp, const char *end, float *pv)
|
parse_float (const char **pp, const char *end, float *pv)
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
|
unsigned int len = hb_min (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
|
||||||
strncpy (buf, *pp, len);
|
strncpy (buf, *pp, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
@ -1071,21 +1071,21 @@ hb_feature_to_string (hb_feature_t *feature,
|
||||||
{
|
{
|
||||||
s[len++] = '[';
|
s[len++] = '[';
|
||||||
if (feature->start)
|
if (feature->start)
|
||||||
len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->start));
|
len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->start));
|
||||||
if (feature->end != feature->start + 1) {
|
if (feature->end != feature->start + 1) {
|
||||||
s[len++] = ':';
|
s[len++] = ':';
|
||||||
if (feature->end != (unsigned int) -1)
|
if (feature->end != (unsigned int) -1)
|
||||||
len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->end));
|
len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->end));
|
||||||
}
|
}
|
||||||
s[len++] = ']';
|
s[len++] = ']';
|
||||||
}
|
}
|
||||||
if (feature->value > 1)
|
if (feature->value > 1)
|
||||||
{
|
{
|
||||||
s[len++] = '=';
|
s[len++] = '=';
|
||||||
len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->value));
|
len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->value));
|
||||||
}
|
}
|
||||||
assert (len < ARRAY_LENGTH (s));
|
assert (len < ARRAY_LENGTH (s));
|
||||||
len = MIN (len, size - 1);
|
len = hb_min (len, size - 1);
|
||||||
memcpy (buf, s, len);
|
memcpy (buf, s, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -1152,10 +1152,10 @@ hb_variation_to_string (hb_variation_t *variation,
|
||||||
while (len && s[len - 1] == ' ')
|
while (len && s[len - 1] == ' ')
|
||||||
len--;
|
len--;
|
||||||
s[len++] = '=';
|
s[len++] = '=';
|
||||||
len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", (double) variation->value));
|
len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", (double) variation->value));
|
||||||
|
|
||||||
assert (len < ARRAY_LENGTH (s));
|
assert (len < ARRAY_LENGTH (s));
|
||||||
len = MIN (len, size - 1);
|
len = hb_min (len, size - 1);
|
||||||
memcpy (buf, s, len);
|
memcpy (buf, s, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
|
@ -771,7 +771,7 @@ resize_and_retry:
|
||||||
feature.start < chars_len && feature.start < feature.end)
|
feature.start < chars_len && feature.start < feature.end)
|
||||||
{
|
{
|
||||||
CFRange feature_range = CFRangeMake (feature.start,
|
CFRange feature_range = CFRangeMake (feature.start,
|
||||||
MIN (feature.end, chars_len) - feature.start);
|
hb_min (feature.end, chars_len) - feature.start);
|
||||||
if (feature.value)
|
if (feature.value)
|
||||||
CFAttributedStringRemoveAttribute (attr_string, feature_range, kCTKernAttributeName);
|
CFAttributedStringRemoveAttribute (attr_string, feature_range, kCTKernAttributeName);
|
||||||
else
|
else
|
||||||
|
@ -1116,7 +1116,7 @@ resize_and_retry:
|
||||||
unsigned int cluster = info[count - 1].cluster;
|
unsigned int cluster = info[count - 1].cluster;
|
||||||
for (unsigned int i = count - 1; i > 0; i--)
|
for (unsigned int i = count - 1; i > 0; i--)
|
||||||
{
|
{
|
||||||
cluster = MIN (cluster, info[i - 1].cluster);
|
cluster = hb_min (cluster, info[i - 1].cluster);
|
||||||
info[i - 1].cluster = cluster;
|
info[i - 1].cluster = cluster;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1125,7 +1125,7 @@ resize_and_retry:
|
||||||
unsigned int cluster = info[0].cluster;
|
unsigned int cluster = info[0].cluster;
|
||||||
for (unsigned int i = 1; i < count; i++)
|
for (unsigned int i = 1; i < count; i++)
|
||||||
{
|
{
|
||||||
cluster = MIN (cluster, info[i].cluster);
|
cluster = hb_min (cluster, info[i].cluster);
|
||||||
info[i].cluster = cluster;
|
info[i].cluster = cluster;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ _hb_debug_msg_va (const char *what,
|
||||||
VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR;
|
VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR;
|
||||||
fprintf (stderr, "%2u %s" VRBAR "%s",
|
fprintf (stderr, "%2u %s" VRBAR "%s",
|
||||||
level,
|
level,
|
||||||
bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars) - 1, (unsigned int) (sizeof (VBAR) - 1) * level),
|
bars + sizeof (bars) - 1 - hb_min ((unsigned int) sizeof (bars) - 1, (unsigned int) (sizeof (VBAR) - 1) * level),
|
||||||
level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR);
|
level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR);
|
||||||
} else
|
} else
|
||||||
fprintf (stderr, " " VRBAR LBAR);
|
fprintf (stderr, " " VRBAR LBAR);
|
||||||
|
|
|
@ -778,7 +778,7 @@ retry_getglyphs:
|
||||||
{
|
{
|
||||||
uint32_t *p =
|
uint32_t *p =
|
||||||
&vis_clusters[log_clusters[buffer->info[i].utf16_index ()]];
|
&vis_clusters[log_clusters[buffer->info[i].utf16_index ()]];
|
||||||
*p = MIN (*p, buffer->info[i].cluster);
|
*p = hb_min (*p, buffer->info[i].cluster);
|
||||||
}
|
}
|
||||||
for (unsigned int i = 1; i < glyphCount; i++)
|
for (unsigned int i = 1; i < glyphCount; i++)
|
||||||
if (vis_clusters[i] == (uint32_t) -1)
|
if (vis_clusters[i] == (uint32_t) -1)
|
||||||
|
|
|
@ -439,7 +439,7 @@ hb_ft_get_glyph_from_name (hb_font_t *font HB_UNUSED,
|
||||||
else {
|
else {
|
||||||
/* Make a nul-terminated version. */
|
/* Make a nul-terminated version. */
|
||||||
char buf[128];
|
char buf[128];
|
||||||
len = MIN (len, (int) sizeof (buf) - 1);
|
len = hb_min (len, (int) sizeof (buf) - 1);
|
||||||
strncpy (buf, name, len);
|
strncpy (buf, name, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
*glyph = FT_Get_Name_Index (ft_face, buf);
|
*glyph = FT_Get_Name_Index (ft_face, buf);
|
||||||
|
|
|
@ -464,7 +464,7 @@ struct hb_zip_iter_t :
|
||||||
__item_t__ __item__ () const { return __item_t__ (*a, *b); }
|
__item_t__ __item__ () const { return __item_t__ (*a, *b); }
|
||||||
__item_t__ __item_at__ (unsigned i) const { return __item_t__ (a[i], b[i]); }
|
__item_t__ __item_at__ (unsigned i) const { return __item_t__ (a[i], b[i]); }
|
||||||
bool __more__ () const { return a && b; }
|
bool __more__ () const { return a && b; }
|
||||||
unsigned __len__ () const { return MIN (a.len (), b.len ()); }
|
unsigned __len__ () const { return hb_min (a.len (), b.len ()); }
|
||||||
void __next__ () { ++a; ++b; }
|
void __next__ () { ++a; ++b; }
|
||||||
void __forward__ (unsigned n) { a += n; b += n; }
|
void __forward__ (unsigned n) { a += n; b += n; }
|
||||||
void __prev__ () { --a; --b; }
|
void __prev__ () { --a; --b; }
|
||||||
|
|
|
@ -94,7 +94,7 @@ typedef struct OffsetTable
|
||||||
if (start_offset >= tables.len)
|
if (start_offset >= tables.len)
|
||||||
*table_count = 0;
|
*table_count = 0;
|
||||||
else
|
else
|
||||||
*table_count = MIN<unsigned int> (*table_count, tables.len - start_offset);
|
*table_count = hb_min (*table_count, tables.len - start_offset);
|
||||||
|
|
||||||
const TableRecord *sub_tables = tables.arrayZ + start_offset;
|
const TableRecord *sub_tables = tables.arrayZ + start_offset;
|
||||||
unsigned int count = *table_count;
|
unsigned int count = *table_count;
|
||||||
|
|
|
@ -921,7 +921,7 @@ struct BinSearchHeader
|
||||||
{
|
{
|
||||||
len = v;
|
len = v;
|
||||||
assert (len == v);
|
assert (len == v);
|
||||||
entrySelector = MAX (1u, hb_bit_storage (v)) - 1;
|
entrySelector = hb_max (1u, hb_bit_storage (v)) - 1;
|
||||||
searchRange = 16 * (1u << entrySelector);
|
searchRange = 16 * (1u << entrySelector);
|
||||||
rangeShift = v * 16 > searchRange
|
rangeShift = v * 16 > searchRange
|
||||||
? 16 * v - searchRange
|
? 16 * v - searchRange
|
||||||
|
|
|
@ -93,7 +93,7 @@ struct CmapSubtableFormat4
|
||||||
this->length = get_sub_table_size (segments);
|
this->length = get_sub_table_size (segments);
|
||||||
|
|
||||||
this->segCountX2 = segments.length * 2;
|
this->segCountX2 = segments.length * 2;
|
||||||
this->entrySelector = MAX (1u, hb_bit_storage (segments.length)) - 1;
|
this->entrySelector = hb_max (1u, hb_bit_storage (segments.length)) - 1;
|
||||||
this->searchRange = 2 * (1u << this->entrySelector);
|
this->searchRange = 2 * (1u << this->entrySelector);
|
||||||
this->rangeShift = segments.length * 2 > this->searchRange
|
this->rangeShift = segments.length * 2 > this->searchRange
|
||||||
? 2 * segments.length - this->searchRange
|
? 2 * segments.length - this->searchRange
|
||||||
|
@ -348,7 +348,7 @@ struct CmapSubtableFormat4
|
||||||
/* Some broken fonts have too long of a "length" value.
|
/* Some broken fonts have too long of a "length" value.
|
||||||
* If that is the case, just change the value to truncate
|
* If that is the case, just change the value to truncate
|
||||||
* the subtable at the end of the blob. */
|
* the subtable at the end of the blob. */
|
||||||
uint16_t new_length = (uint16_t) MIN ((uintptr_t) 65535,
|
uint16_t new_length = (uint16_t) hb_min ((uintptr_t) 65535,
|
||||||
(uintptr_t) (c->end -
|
(uintptr_t) (c->end -
|
||||||
(char *) this));
|
(char *) this));
|
||||||
if (!c->try_set (&length, new_length))
|
if (!c->try_set (&length, new_length))
|
||||||
|
@ -478,7 +478,7 @@ struct CmapSubtableLongSegmented
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < this->groups.len; i++) {
|
for (unsigned int i = 0; i < this->groups.len; i++) {
|
||||||
out->add_range (this->groups[i].startCharCode,
|
out->add_range (this->groups[i].startCharCode,
|
||||||
MIN ((hb_codepoint_t) this->groups[i].endCharCode,
|
hb_min ((hb_codepoint_t) this->groups[i].endCharCode,
|
||||||
(hb_codepoint_t) HB_UNICODE_MAX));
|
(hb_codepoint_t) HB_UNICODE_MAX));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,7 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
hb_codepoint_t first = arrayZ[i].startUnicodeValue;
|
hb_codepoint_t first = arrayZ[i].startUnicodeValue;
|
||||||
hb_codepoint_t last = MIN ((hb_codepoint_t) (first + arrayZ[i].additionalCount),
|
hb_codepoint_t last = hb_min ((hb_codepoint_t) (first + arrayZ[i].additionalCount),
|
||||||
(hb_codepoint_t) HB_UNICODE_MAX);
|
(hb_codepoint_t) HB_UNICODE_MAX);
|
||||||
out->add_range (first, last);
|
out->add_range (first, last);
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,15 +349,15 @@ struct CBLC
|
||||||
if (unlikely (!count))
|
if (unlikely (!count))
|
||||||
return Null(BitmapSizeTable);
|
return Null(BitmapSizeTable);
|
||||||
|
|
||||||
unsigned int requested_ppem = MAX (font->x_ppem, font->y_ppem);
|
unsigned int requested_ppem = hb_max (font->x_ppem, font->y_ppem);
|
||||||
if (!requested_ppem)
|
if (!requested_ppem)
|
||||||
requested_ppem = 1<<30; /* Choose largest strike. */
|
requested_ppem = 1<<30; /* Choose largest strike. */
|
||||||
unsigned int best_i = 0;
|
unsigned int best_i = 0;
|
||||||
unsigned int best_ppem = MAX (sizeTables[0].ppemX, sizeTables[0].ppemY);
|
unsigned int best_ppem = hb_max (sizeTables[0].ppemX, sizeTables[0].ppemY);
|
||||||
|
|
||||||
for (unsigned int i = 1; i < count; i++)
|
for (unsigned int i = 1; i < count; i++)
|
||||||
{
|
{
|
||||||
unsigned int ppem = MAX (sizeTables[i].ppemX, sizeTables[i].ppemY);
|
unsigned int ppem = hb_max (sizeTables[i].ppemX, sizeTables[i].ppemY);
|
||||||
if ((requested_ppem <= ppem && ppem < best_ppem) ||
|
if ((requested_ppem <= ppem && ppem < best_ppem) ||
|
||||||
(requested_ppem > best_ppem && ppem > best_ppem))
|
(requested_ppem > best_ppem && ppem > best_ppem))
|
||||||
{
|
{
|
||||||
|
|
|
@ -144,7 +144,7 @@ struct CPAL
|
||||||
{
|
{
|
||||||
hb_array_t<const BGRAColor> segment_colors = palette_colors.sub_array (start_offset, *color_count);
|
hb_array_t<const BGRAColor> segment_colors = palette_colors.sub_array (start_offset, *color_count);
|
||||||
/* Always return numColors colors per palette even if it has out-of-bounds start index. */
|
/* Always return numColors colors per palette even if it has out-of-bounds start index. */
|
||||||
unsigned int count = MIN<unsigned int> (MAX<int> (numColors - start_offset, 0), *color_count);
|
unsigned int count = hb_min ((unsigned) hb_max ((int) (numColors - start_offset), 0), *color_count);
|
||||||
*color_count = count;
|
*color_count = count;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
colors[i] = segment_colors[i]; /* Bound-checked read. */
|
colors[i] = segment_colors[i]; /* Bound-checked read. */
|
||||||
|
|
|
@ -175,7 +175,7 @@ struct sbix
|
||||||
if (unlikely (!count))
|
if (unlikely (!count))
|
||||||
return Null(SBIXStrike);
|
return Null(SBIXStrike);
|
||||||
|
|
||||||
unsigned int requested_ppem = MAX (font->x_ppem, font->y_ppem);
|
unsigned int requested_ppem = hb_max (font->x_ppem, font->y_ppem);
|
||||||
if (!requested_ppem)
|
if (!requested_ppem)
|
||||||
requested_ppem = 1<<30; /* Choose largest strike. */
|
requested_ppem = 1<<30; /* Choose largest strike. */
|
||||||
/* TODO Add DPI sensitivity as well? */
|
/* TODO Add DPI sensitivity as well? */
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct loca
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always
|
DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always
|
||||||
* check the size externally, allow Null() object of it by
|
* check the size externally, allow Null() object of it by
|
||||||
* defining it MIN() instead. */
|
* defining it _MIN instead. */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ struct glyf
|
||||||
loca_table = hb_sanitize_context_t ().reference_table<loca> (face);
|
loca_table = hb_sanitize_context_t ().reference_table<loca> (face);
|
||||||
glyf_table = hb_sanitize_context_t ().reference_table<glyf> (face);
|
glyf_table = hb_sanitize_context_t ().reference_table<glyf> (face);
|
||||||
|
|
||||||
num_glyphs = MAX (1u, loca_table.get_length () / (short_offset ? 2 : 4)) - 1;
|
num_glyphs = hb_max (1u, loca_table.get_length () / (short_offset ? 2 : 4)) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fini ()
|
void fini ()
|
||||||
|
@ -451,10 +451,10 @@ struct glyf
|
||||||
|
|
||||||
const GlyphHeader &glyph_header = StructAtOffset<GlyphHeader> (glyf_table, start_offset);
|
const GlyphHeader &glyph_header = StructAtOffset<GlyphHeader> (glyf_table, start_offset);
|
||||||
|
|
||||||
extents->x_bearing = MIN (glyph_header.xMin, glyph_header.xMax);
|
extents->x_bearing = hb_min (glyph_header.xMin, glyph_header.xMax);
|
||||||
extents->y_bearing = MAX (glyph_header.yMin, glyph_header.yMax);
|
extents->y_bearing = hb_max (glyph_header.yMin, glyph_header.yMax);
|
||||||
extents->width = MAX (glyph_header.xMin, glyph_header.xMax) - extents->x_bearing;
|
extents->width = hb_max (glyph_header.xMin, glyph_header.xMax) - extents->x_bearing;
|
||||||
extents->height = MIN (glyph_header.yMin, glyph_header.yMax) - extents->y_bearing;
|
extents->height = hb_min (glyph_header.yMin, glyph_header.yMax) - extents->y_bearing;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -471,7 +471,7 @@ struct glyf
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always
|
DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always
|
||||||
* check the size externally, allow Null() object of it by
|
* check the size externally, allow Null() object of it by
|
||||||
* defining it MIN() instead. */
|
* defining it _MIN instead. */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct glyf_accelerator_t : glyf::accelerator_t {};
|
struct glyf_accelerator_t : glyf::accelerator_t {};
|
||||||
|
|
|
@ -240,7 +240,7 @@ struct hmtxvmtx
|
||||||
return default_advance;
|
return default_advance;
|
||||||
}
|
}
|
||||||
|
|
||||||
return table->longMetricZ[MIN (glyph, (uint32_t) num_advances - 1)].advance;
|
return table->longMetricZ[hb_min (glyph, (uint32_t) num_advances - 1)].advance;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int get_advance (hb_codepoint_t glyph,
|
unsigned int get_advance (hb_codepoint_t glyph,
|
||||||
|
|
|
@ -1287,7 +1287,7 @@ struct MarkLigPosFormat1
|
||||||
unsigned int mark_id = _hb_glyph_info_get_lig_id (&buffer->cur());
|
unsigned int mark_id = _hb_glyph_info_get_lig_id (&buffer->cur());
|
||||||
unsigned int mark_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
|
unsigned int mark_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
|
||||||
if (lig_id && lig_id == mark_id && mark_comp > 0)
|
if (lig_id && lig_id == mark_id && mark_comp > 0)
|
||||||
comp_index = MIN (comp_count, _hb_glyph_info_get_lig_comp (&buffer->cur())) - 1;
|
comp_index = hb_min (comp_count, _hb_glyph_info_get_lig_comp (&buffer->cur())) - 1;
|
||||||
else
|
else
|
||||||
comp_index = comp_count - 1;
|
comp_index = comp_count - 1;
|
||||||
|
|
||||||
|
|
|
@ -484,7 +484,7 @@ struct AlternateSet
|
||||||
unsigned int shift = hb_ctz (lookup_mask);
|
unsigned int shift = hb_ctz (lookup_mask);
|
||||||
unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift);
|
unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift);
|
||||||
|
|
||||||
/* If alt_index is MAX, randomize feature if it is the rand feature. */
|
/* If alt_index is MAX_VALUE, randomize feature if it is the rand feature. */
|
||||||
if (alt_index == HB_OT_MAP_MAX_VALUE && c->random)
|
if (alt_index == HB_OT_MAP_MAX_VALUE && c->random)
|
||||||
alt_index = c->random_number () % count + 1;
|
alt_index = c->random_number () % count + 1;
|
||||||
|
|
||||||
|
@ -792,7 +792,7 @@ struct LigatureSet
|
||||||
if (unlikely (!ligature.serialize (c, ligatures.length))) return_trace (false);
|
if (unlikely (!ligature.serialize (c, ligatures.length))) return_trace (false);
|
||||||
for (unsigned int i = 0; i < ligatures.length; i++)
|
for (unsigned int i = 0; i < ligatures.length; i++)
|
||||||
{
|
{
|
||||||
unsigned int component_count = MAX<int> (component_count_list[i] - 1, 0);
|
unsigned int component_count = (unsigned) hb_max ((int) component_count_list[i] - 1, 0);
|
||||||
if (unlikely (!ligature[i].serialize (c, this)
|
if (unlikely (!ligature[i].serialize (c, this)
|
||||||
.serialize (c,
|
.serialize (c,
|
||||||
ligatures[i],
|
ligatures[i],
|
||||||
|
|
|
@ -973,7 +973,7 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
|
||||||
if (this_comp == 0)
|
if (this_comp == 0)
|
||||||
this_comp = last_num_components;
|
this_comp = last_num_components;
|
||||||
unsigned int new_lig_comp = components_so_far - last_num_components +
|
unsigned int new_lig_comp = components_so_far - last_num_components +
|
||||||
MIN (this_comp, last_num_components);
|
hb_min (this_comp, last_num_components);
|
||||||
_hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
|
_hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
|
||||||
}
|
}
|
||||||
buffer->next_glyph ();
|
buffer->next_glyph ();
|
||||||
|
@ -995,7 +995,7 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
|
||||||
if (!this_comp)
|
if (!this_comp)
|
||||||
break;
|
break;
|
||||||
unsigned int new_lig_comp = components_so_far - last_num_components +
|
unsigned int new_lig_comp = components_so_far - last_num_components +
|
||||||
MIN (this_comp, last_num_components);
|
hb_min (this_comp, last_num_components);
|
||||||
_hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp);
|
_hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp);
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
|
@ -1173,7 +1173,7 @@ static inline bool apply_lookup (hb_ot_apply_context_t *c,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* NOTE: delta is negative. */
|
/* NOTE: delta is negative. */
|
||||||
delta = MAX (delta, (int) next - (int) count);
|
delta = hb_max (delta, (int) next - (int) count);
|
||||||
next -= delta;
|
next -= delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1735,7 +1735,7 @@ hb_ot_layout_feature_get_characters (hb_face_t *face,
|
||||||
unsigned int len = 0;
|
unsigned int len = 0;
|
||||||
if (char_count && characters && start_offset < cv_params.characters.len)
|
if (char_count && characters && start_offset < cv_params.characters.len)
|
||||||
{
|
{
|
||||||
len = MIN (cv_params.characters.len - start_offset, *char_count);
|
len = hb_min (cv_params.characters.len - start_offset, *char_count);
|
||||||
for (unsigned int i = 0; i < len; ++i)
|
for (unsigned int i = 0; i < len; ++i)
|
||||||
characters[i] = cv_params.characters[start_offset + i];
|
characters[i] = cv_params.characters[start_offset + i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,12 +188,12 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
|
||||||
feature_infos[j].default_value = feature_infos[i].default_value;
|
feature_infos[j].default_value = feature_infos[i].default_value;
|
||||||
} else {
|
} else {
|
||||||
feature_infos[j].flags &= ~F_GLOBAL;
|
feature_infos[j].flags &= ~F_GLOBAL;
|
||||||
feature_infos[j].max_value = MAX (feature_infos[j].max_value, feature_infos[i].max_value);
|
feature_infos[j].max_value = hb_max (feature_infos[j].max_value, feature_infos[i].max_value);
|
||||||
/* Inherit default_value from j */
|
/* Inherit default_value from j */
|
||||||
}
|
}
|
||||||
feature_infos[j].flags |= (feature_infos[i].flags & F_HAS_FALLBACK);
|
feature_infos[j].flags |= (feature_infos[i].flags & F_HAS_FALLBACK);
|
||||||
feature_infos[j].stage[0] = MIN (feature_infos[j].stage[0], feature_infos[i].stage[0]);
|
feature_infos[j].stage[0] = hb_min (feature_infos[j].stage[0], feature_infos[i].stage[0]);
|
||||||
feature_infos[j].stage[1] = MIN (feature_infos[j].stage[1], feature_infos[i].stage[1]);
|
feature_infos[j].stage[1] = hb_min (feature_infos[j].stage[1], feature_infos[i].stage[1]);
|
||||||
}
|
}
|
||||||
feature_infos.shrink (j + 1);
|
feature_infos.shrink (j + 1);
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
|
||||||
bits_needed = 0;
|
bits_needed = 0;
|
||||||
else
|
else
|
||||||
/* Limit bits per feature. */
|
/* Limit bits per feature. */
|
||||||
bits_needed = MIN(HB_OT_MAP_MAX_BITS, hb_bit_storage (info->max_value));
|
bits_needed = hb_min (HB_OT_MAP_MAX_BITS, hb_bit_storage (info->max_value));
|
||||||
|
|
||||||
if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t))
|
if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t))
|
||||||
continue; /* Feature disabled, or not enough bits. */
|
continue; /* Feature disabled, or not enough bits. */
|
||||||
|
|
|
@ -131,7 +131,7 @@ struct post
|
||||||
hb_bytes_t s = find_glyph_name (glyph);
|
hb_bytes_t s = find_glyph_name (glyph);
|
||||||
if (!s.length) return false;
|
if (!s.length) return false;
|
||||||
if (!buf_len) return true;
|
if (!buf_len) return true;
|
||||||
unsigned int len = MIN (buf_len - 1, s.length);
|
unsigned int len = hb_min (buf_len - 1, s.length);
|
||||||
strncpy (buf, s.arrayZ, len);
|
strncpy (buf, s.arrayZ, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -645,7 +645,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
/* Reorder characters */
|
/* Reorder characters */
|
||||||
|
|
||||||
for (unsigned int i = start; i < base; i++)
|
for (unsigned int i = start; i < base; i++)
|
||||||
info[i].indic_position() = MIN (POS_PRE_C, (indic_position_t) info[i].indic_position());
|
info[i].indic_position() = hb_min (POS_PRE_C, (indic_position_t) info[i].indic_position());
|
||||||
|
|
||||||
if (base < end)
|
if (base < end)
|
||||||
info[base].indic_position() = POS_BASE_C;
|
info[base].indic_position() = POS_BASE_C;
|
||||||
|
@ -801,7 +801,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
unsigned int j = start + info[i].syllable();
|
unsigned int j = start + info[i].syllable();
|
||||||
while (j != i)
|
while (j != i)
|
||||||
{
|
{
|
||||||
max = MAX (max, j);
|
max = hb_max (max, j);
|
||||||
unsigned int next = start + info[j].syllable();
|
unsigned int next = start + info[j].syllable();
|
||||||
info[j].syllable() = 255; /* So we don't process j later again. */
|
info[j].syllable() = 255; /* So we don't process j later again. */
|
||||||
j = next;
|
j = next;
|
||||||
|
@ -1231,14 +1231,14 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
|
|
||||||
/* Note: this merge_clusters() is intentionally *after* the reordering.
|
/* Note: this merge_clusters() is intentionally *after* the reordering.
|
||||||
* Indic matra reordering is special and tricky... */
|
* Indic matra reordering is special and tricky... */
|
||||||
buffer->merge_clusters (new_pos, MIN (end, base + 1));
|
buffer->merge_clusters (new_pos, hb_min (end, base + 1));
|
||||||
|
|
||||||
new_pos--;
|
new_pos--;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (unsigned int i = start; i < base; i++)
|
for (unsigned int i = start; i < base; i++)
|
||||||
if (info[i].indic_position () == POS_PRE_M) {
|
if (info[i].indic_position () == POS_PRE_M) {
|
||||||
buffer->merge_clusters (i, MIN (end, base + 1));
|
buffer->merge_clusters (i, hb_min (end, base + 1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ setup_rphf_mask (const hb_ot_shape_plan_t *plan,
|
||||||
|
|
||||||
foreach_syllable (buffer, start, end)
|
foreach_syllable (buffer, start, end)
|
||||||
{
|
{
|
||||||
unsigned int limit = info[start].use_category() == USE_R ? 1 : MIN (3u, end - start);
|
unsigned int limit = info[start].use_category() == USE_R ? 1 : hb_min (3u, end - start);
|
||||||
for (unsigned int i = start; i < start + limit; i++)
|
for (unsigned int i = start; i < start + limit; i++)
|
||||||
info[i].mask |= mask;
|
info[i].mask |= mask;
|
||||||
}
|
}
|
||||||
|
|
|
@ -962,12 +962,12 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
|
||||||
c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
|
c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
|
||||||
if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR)))
|
if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR)))
|
||||||
{
|
{
|
||||||
c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR,
|
c->buffer->max_len = hb_max (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR,
|
||||||
(unsigned) HB_BUFFER_MAX_LEN_MIN);
|
(unsigned) HB_BUFFER_MAX_LEN_MIN);
|
||||||
}
|
}
|
||||||
if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR)))
|
if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR)))
|
||||||
{
|
{
|
||||||
c->buffer->max_ops = MAX (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR,
|
c->buffer->max_ops = hb_max (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR,
|
||||||
(unsigned) HB_BUFFER_MAX_OPS_MIN);
|
(unsigned) HB_BUFFER_MAX_OPS_MIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ struct LangTag
|
||||||
p = strchr (b, '-');
|
p = strchr (b, '-');
|
||||||
db = p ? (unsigned int) (p - b) : strlen (b);
|
db = p ? (unsigned int) (p - b) : strlen (b);
|
||||||
|
|
||||||
return strncmp (a, b, MAX (da, db));
|
return strncmp (a, b, hb_max (da, db));
|
||||||
}
|
}
|
||||||
int cmp (const LangTag *that) const
|
int cmp (const LangTag *that) const
|
||||||
{ return cmp (that->language); }
|
{ return cmp (that->language); }
|
||||||
|
|
|
@ -123,7 +123,7 @@ struct avar
|
||||||
|
|
||||||
void map_coords (int *coords, unsigned int coords_length) const
|
void map_coords (int *coords, unsigned int coords_length) const
|
||||||
{
|
{
|
||||||
unsigned int count = MIN<unsigned int> (coords_length, axisCount);
|
unsigned int count = hb_min (coords_length, axisCount);
|
||||||
|
|
||||||
const SegmentMaps *map = &firstAxisSegmentMaps;
|
const SegmentMaps *map = &firstAxisSegmentMaps;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
|
|
|
@ -122,8 +122,8 @@ struct fvar
|
||||||
info->name_id = axis.axisNameID;
|
info->name_id = axis.axisNameID;
|
||||||
info->default_value = axis.defaultValue / 65536.;
|
info->default_value = axis.defaultValue / 65536.;
|
||||||
/* Ensure order, to simplify client math. */
|
/* Ensure order, to simplify client math. */
|
||||||
info->min_value = MIN<float> (info->default_value, axis.minValue / 65536.);
|
info->min_value = hb_min (info->default_value, axis.minValue / 65536.);
|
||||||
info->max_value = MAX<float> (info->default_value, axis.maxValue / 65536.);
|
info->max_value = hb_max (info->default_value, axis.maxValue / 65536.);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_axis_info (unsigned int axis_index,
|
void get_axis_info (unsigned int axis_index,
|
||||||
|
@ -136,8 +136,8 @@ struct fvar
|
||||||
info->flags = (hb_ot_var_axis_flags_t) (unsigned int) axis.flags;
|
info->flags = (hb_ot_var_axis_flags_t) (unsigned int) axis.flags;
|
||||||
info->default_value = axis.defaultValue / 65536.;
|
info->default_value = axis.defaultValue / 65536.;
|
||||||
/* Ensure order, to simplify client math. */
|
/* Ensure order, to simplify client math. */
|
||||||
info->min_value = MIN<float> (info->default_value, axis.minValue / 65536.);
|
info->min_value = hb_min (info->default_value, axis.minValue / 65536.);
|
||||||
info->max_value = MAX<float> (info->default_value, axis.maxValue / 65536.);
|
info->max_value = hb_max (info->default_value, axis.maxValue / 65536.);
|
||||||
info->reserved = 0;
|
info->reserved = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,12 +149,12 @@ struct fvar
|
||||||
{
|
{
|
||||||
/* TODO Rewrite as hb_array_t<>::sub-array() */
|
/* TODO Rewrite as hb_array_t<>::sub-array() */
|
||||||
unsigned int count = axisCount;
|
unsigned int count = axisCount;
|
||||||
start_offset = MIN (start_offset, count);
|
start_offset = hb_min (start_offset, count);
|
||||||
|
|
||||||
count -= start_offset;
|
count -= start_offset;
|
||||||
axes_array += start_offset;
|
axes_array += start_offset;
|
||||||
|
|
||||||
count = MIN (count, *axes_count);
|
count = hb_min (count, *axes_count);
|
||||||
*axes_count = count;
|
*axes_count = count;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
|
@ -171,12 +171,12 @@ struct fvar
|
||||||
{
|
{
|
||||||
/* TODO Rewrite as hb_array_t<>::sub-array() */
|
/* TODO Rewrite as hb_array_t<>::sub-array() */
|
||||||
unsigned int count = axisCount;
|
unsigned int count = axisCount;
|
||||||
start_offset = MIN (start_offset, count);
|
start_offset = hb_min (start_offset, count);
|
||||||
|
|
||||||
count -= start_offset;
|
count -= start_offset;
|
||||||
axes_array += start_offset;
|
axes_array += start_offset;
|
||||||
|
|
||||||
count = MIN (count, *axes_count);
|
count = hb_min (count, *axes_count);
|
||||||
*axes_count = count;
|
*axes_count = count;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
|
@ -223,7 +223,7 @@ struct fvar
|
||||||
hb_ot_var_axis_info_t axis;
|
hb_ot_var_axis_info_t axis;
|
||||||
get_axis_info (axis_index, &axis);
|
get_axis_info (axis_index, &axis);
|
||||||
|
|
||||||
v = MAX (MIN (v, axis.max_value), axis.min_value); /* Clamp. */
|
v = hb_max (hb_min (v, axis.max_value), axis.min_value); /* Clamp. */
|
||||||
|
|
||||||
if (v == axis.default_value)
|
if (v == axis.default_value)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -175,7 +175,7 @@ struct hb_sanitize_context_t :
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->start = obj_start;
|
this->start = obj_start;
|
||||||
this->end = obj_start + MIN<uintptr_t> (this->end - obj_start, obj->get_size ());
|
this->end = obj_start + hb_min (this->end - obj_start, obj->get_size ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ struct hb_sanitize_context_t :
|
||||||
void start_processing ()
|
void start_processing ()
|
||||||
{
|
{
|
||||||
reset_object ();
|
reset_object ();
|
||||||
this->max_ops = MAX ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR,
|
this->max_ops = hb_max ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR,
|
||||||
(unsigned) HB_SANITIZE_MAX_OPS_MIN);
|
(unsigned) HB_SANITIZE_MAX_OPS_MIN);
|
||||||
this->edit_count = 0;
|
this->edit_count = 0;
|
||||||
this->debug_depth = 0;
|
this->debug_depth = 0;
|
||||||
|
|
|
@ -967,7 +967,7 @@ retry:
|
||||||
vis_clusters[i] = (uint32_t) -1;
|
vis_clusters[i] = (uint32_t) -1;
|
||||||
for (unsigned int i = 0; i < buffer->len; i++) {
|
for (unsigned int i = 0; i < buffer->len; i++) {
|
||||||
uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]];
|
uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]];
|
||||||
*p = MIN (*p, buffer->info[i].cluster);
|
*p = hb_min (*p, buffer->info[i].cluster);
|
||||||
}
|
}
|
||||||
for (unsigned int i = 1; i < glyphs_len; i++)
|
for (unsigned int i = 1; i < glyphs_len; i++)
|
||||||
if (vis_clusters[i] == (uint32_t) -1)
|
if (vis_clusters[i] == (uint32_t) -1)
|
||||||
|
|
Loading…
Reference in New Issue