Commit Graph

76 Commits

Author SHA1 Message Date
Behdad Esfahbod 39e1b6d03f Convert boolean enum class consts to static constexpr
Part of https://github.com/harfbuzz/harfbuzz/issues/1553
2019-01-22 12:17:26 +01:00
Behdad Esfahbod ce317d0320 Fix warning
warning: '_WIN64' is not defined, evaluates to 0 [-Wundef]
2019-01-19 09:21:33 -05:00
Behdad Esfahbod 865deeb3be Adjust internal header dependencies 2018-12-21 17:46:10 -05:00
Behdad Esfahbod c87ee72232 Minor [skip ci] 2018-12-19 22:28:16 -05:00
fanc999 3ee4ea9456 Fix build on older Visual Studio versions (#1499)
* src/hb-cff-interp-dict-common.hh: Use ull for unsigned int64_t

The llu suffix does not work for older Visual Studio versions
(pre-2013), but ull works for all the compilers that we attempt to
support.

* test/api: Fix build on pre-C99 compilers

Ensure variables are declared at the top of the block.

* src/hb-dsalgs.hh: Add specialization for hb_is_signed<> for __int8

Pre-Visual Studio 2010 does not consider __int8 (which is typedef'ed to
int8_t) to be equivilant to signed char, so the compiler cannot find the
corresponding hb_is_signed<> specialization that is needed.

The interesting thing is unsigned __int8 is considered to be equivilant
to unsigned char, so as the other types (short, int, long) that we look
for here, so only the specialization for __int8 is added here.

This will fix builds on Visual Studio 2008 at least.
2018-12-19 22:26:54 -05:00
Behdad Esfahbod 6b5eaa7530 Hide hb_addressof() 2018-12-17 21:55:33 -05:00
Behdad Esfahbod 6befa75cdf Enable __builtin_* on clang
We'll see which old clang versions this breaks...
2018-12-17 20:35:45 -05:00
Behdad Esfahbod 8d2d410256 Add hb_addressof() and use it to fix bug after hb_bytes_t merge
We cannot take address hb_bytes_t direction.  We need to use the
newly added hb_addressof(), ala std::addressof().
2018-12-17 20:23:26 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Behdad Esfahbod 5a552f7546 [array] Move hb_array_t and related types to hb-array.hh 2018-12-16 22:31:10 -05:00
Ebrahim Byagowi b2ebaa9afa Remove redundant 'inline' from methods (#1483) 2018-12-16 14:08:10 -05:00
Ebrahim Byagowi 7ee5c52345
minor style fix, use void in methods on no argument 2018-12-12 15:14:37 +03:30
Behdad Esfahbod d866e905fd Add default value to first argument of sub_array() 2018-12-06 10:26:32 -08:00
Behdad Esfahbod ca23b71935 Add default-value for second arg of sub_array() 2018-12-06 10:21:17 -08:00
Behdad Esfahbod 50e0273ab1 Change hb_assert_unsigned_t<> to hb_is_signed<> 2018-12-01 13:07:49 -05:00
Behdad Esfahbod dfad19ad5a Make operator [] take signed int
The built-in operator takes signed int.  So, match it, such that
the built-in is never a better or equally-good match to our operator.
Fixes "ambiguous overload" errors from gcc 4.2 and VS 2008.

See https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-30 20:56:14 -05:00
Behdad Esfahbod 44cbd2ea3d Convert "static const bool" constants to anonymous enum 2018-11-29 14:56:27 -05:00
Behdad Esfahbod 3246a8ebbd [arrays] Merge ArrayOf's sub_array into hb_array_t's 2018-11-24 21:32:00 -05:00
Behdad Esfahbod d77a098b73 [arrays] Improve bfind() interface
Much more useful now. :)
2018-11-24 10:06:13 -05:00
Behdad Esfahbod 70d80c90fe [arrays] Port ArrayOf.qsort() and hb_vector_t.qsort() to hb_array_t 2018-11-24 09:48:06 -05:00
Behdad Esfahbod ad5c871d80 [arrays] Add copy-constructor to hb_array_t and hb_sorted_array_t 2018-11-24 09:48:06 -05:00
Behdad Esfahbod 61de55bf49 [arrays] Port hb_vector_t.qsort() to hb_array_t's 2018-11-24 09:48:06 -05:00
Behdad Esfahbod e700392f5c [arrays] Port SortedArrayOf.bsearch/bfind to hb_sorted_array_t's 2018-11-24 09:48:06 -05:00
Behdad Esfahbod e604306f28 [arrays] Port hb_vector_t.bsearch/bfind to (new) hb_sorted_array_t's 2018-11-24 09:48:06 -05:00
Behdad Esfahbod 830856ba6b [arrays] Port hb_vector_t.lsearch() to hb_array_t's 2018-11-24 09:48:06 -05:00
Behdad Esfahbod bb2a206508 Assert that item-type of arrays have static size 2018-11-24 00:31:40 -05:00
Behdad Esfahbod 46c0da820f Fix build 2018-11-19 13:32:48 -05:00
Behdad Esfahbod 4a6a692e3e [fvar] Use hb_array_t for axes 2018-11-19 13:06:44 -05:00
Behdad Esfahbod af123bd1b8 Add hb_memcmp() 2018-11-12 16:27:08 -05:00
Behdad Esfahbod f2e942f302 Fix hb_bytes_t's unused template array constructor 2018-11-10 16:11:14 -05:00
Behdad Esfahbod 6213a75b68 Add trivial casts to hb_bytes_t 2018-11-10 16:09:21 -05:00
Behdad Esfahbod 8bb97d2ce1 Revert back hb_bytes_t.cmp() to the scheme it was
But fix UBSan complaint.

There's nothing in hb_bytes_t that guarantees lexical ordering, and
ordering by length first is much faster.
2018-11-10 16:00:51 -05:00
Behdad Esfahbod 534e1d7694 Fix hb_bytes_t.cmp() for realz this time 2018-11-10 15:45:31 -05:00
Behdad Esfahbod 929f07dbfc Fix hb_bytes_t.cmp()
Ouch!
2018-11-10 15:39:07 -05:00
Behdad Esfahbod 3a9fa8c026 [qsort] Fix O(N^2) behavior if all array elements are the same
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11327

Reported as https://github.com/noporpoise/sort_r/issues/7
2018-11-10 01:58:26 -05:00
Behdad Esfahbod f6e7cb51b1 Fix const-confusion in hb_array_t as well 2018-11-05 13:23:07 -05:00
Behdad Esfahbod d0163afb7b Revert "Add operator char * to the naked array types as well"
This reverts commit db889c182e.

Was resulting in ambigious overloads...
2018-11-03 21:38:30 -04:00
Behdad Esfahbod db889c182e Add operator char * to the naked array types as well 2018-11-03 16:04:19 -04:00
Behdad Esfahbod 91de9dfcf3 Fix &array_of<> 2018-11-02 12:16:51 -04:00
Behdad Esfahbod 9b7cb13794 Fixup 2018-11-02 12:00:55 -04:00
Behdad Esfahbod c6ef5dbd5c Add cast operators to hb_array_t 2018-11-02 11:51:21 -04:00
Behdad Esfahbod 72462eb765 Add UnsizedArrayOf::as_array() instead of hb_array() template 2018-11-02 11:46:42 -04:00
Behdad Esfahbod 5854d3fa25 [set] Warning fix with gcc 8.1
https://github.com/harfbuzz/harfbuzz/pull/1334
2018-10-31 10:42:49 -07:00
Behdad Esfahbod 166ae8b0aa Remove now unused hb_auto_t<> 2018-10-29 22:40:37 -07:00
Behdad Esfahbod dc9a5f88b4 [name] Do record sanitization at run-time 2018-10-26 21:22:26 -07:00
Behdad Esfahbod 69f5da0629 [name] More
It assumes all names are encoded in UTF16-BE.  Other than that, and not
listing languages correctly, it's *supposed* to work.
2018-10-26 21:22:26 -07:00
Behdad Esfahbod 21ede867df Fix possible overflow in bsearch impls
From bungeman.

Fixes https://github.com/harfbuzz/harfbuzz/pull/1314
2018-10-25 13:19:58 -07:00
Behdad Esfahbod 8c78ced95b Unbreak builds 2018-10-22 21:49:42 -07:00
Behdad Esfahbod abfbba1911 Add hb_array<>()
Simplifies transient object creation.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1301
2018-10-22 21:27:45 -07:00
Behdad Esfahbod d7865107ea Remove const from hb_array_t details
Will come in through <T> if desired.
2018-10-22 16:24:16 -07:00