Commit Graph

7385 Commits

Author SHA1 Message Date
Behdad Esfahbod 40fb36a39d [meta] Minor 2019-05-10 21:01:19 -07:00
Behdad Esfahbod f9a96a0a97 [meta] More rewrites 2019-05-10 20:56:16 -07:00
Behdad Esfahbod 5252677e53 [meta] Rewrite hb_int_min/max 2019-05-10 20:49:52 -07:00
Behdad Esfahbod caa3f92e91 [meta] void_tt -> void_t 2019-05-10 20:44:22 -07:00
Behdad Esfahbod 7df3ecfb40 [meta] hb_void_t -> hb_empty_t 2019-05-10 20:43:26 -07:00
Behdad Esfahbod 149c3db8a2 [meta] Minor 2019-05-10 20:34:52 -07:00
Behdad Esfahbod 707ff5b59d Minor 2019-05-10 20:31:20 -07:00
Behdad Esfahbod ce300f4fb6 [meta] Rewrite is_signed, add is_unsigned 2019-05-10 20:26:29 -07:00
Behdad Esfahbod e939d88bd7 [meta] Rewrite is_integral / is_floating_point, add is_arithmetic 2019-05-10 20:20:51 -07:00
Behdad Esfahbod c3a456a26e [meta] Rewrite is_cr_convertible 2019-05-10 20:17:30 -07:00
Behdad Esfahbod b4ad6af9c4 [meta] Rewrite is_base_of 2019-05-10 20:15:03 -07:00
Behdad Esfahbod 5a171ed3a6 [null] Modernize template work 2019-05-10 20:11:29 -07:00
Behdad Esfahbod 61d150c916 [meta] Add integral_constant, true_t -> true_type, false_t -> false_type 2019-05-10 20:06:31 -07:00
Behdad Esfahbod 38e3a8bd53 [meta] bool_tt -> bool_constant 2019-05-10 20:03:14 -07:00
Behdad Esfahbod 3919ca41b5 [meta] Add is_floating_point 2019-05-10 19:56:36 -07:00
Behdad Esfahbod 25bb7e005d [meta] Add is_signed for floating point types 2019-05-10 19:52:36 -07:00
Behdad Esfahbod e0315b4aad [meta] is_integer -> is_integral 2019-05-10 19:48:02 -07:00
Behdad Esfahbod 9574de7a3e [meta] Add add_const, add_pointer, add_lvalue_reference, add_rvalue_reference 2019-05-10 19:29:32 -07:00
Behdad Esfahbod 2fb3a8327a [vector] Simplify arrayZ
Was turned into function when we had static ones and wanted to be
move-safe...  Not the case anymore.
2019-05-10 18:43:48 -07:00
Behdad Esfahbod 4d67743ffd [subset] Use more auto typing 2019-05-10 18:43:48 -07:00
Behdad Esfahbod a27a31b9ee Minor 2019-05-10 18:43:48 -07:00
Behdad Esfahbod 2ade008628 [serialize] More rewrite 2019-05-10 18:43:48 -07:00
Behdad Esfahbod 99ed6e29d8 [serialize] Fix a TODO 2019-05-10 18:43:48 -07:00
Behdad Esfahbod 25a5b287f2 Fix sanitize fail of extension sublookups
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=960331
2019-05-10 16:03:20 -07:00
Behdad Esfahbod 9c0c3589f3 Minor 2019-05-10 13:56:50 -07:00
Behdad Esfahbod 5d773ec600 Minor 2019-05-10 13:53:15 -07:00
Behdad Esfahbod ac737f8c9e Minor again 2019-05-10 13:51:12 -07:00
Behdad Esfahbod 5d4437fad0 Minor 2019-05-10 13:43:29 -07:00
Behdad Esfahbod cd9bc732a7 [gsubgpos] Minor 2019-05-10 13:17:41 -07:00
Behdad Esfahbod 1d870cce68 Fix bot
Any way to catch these?
2019-05-10 11:32:59 -07:00
Behdad Esfahbod 30e4ae6bd1 [meta] Add hb_is_base_of 2019-05-10 11:26:49 -07:00
Behdad Esfahbod 98974ac16f [iter] Adjust is_source_of / is_sink_of
There are two cases that we accept.  Encode both.
2019-05-10 11:26:49 -07:00
Behdad Esfahbod ed972d5d73 [iter] Rewrite test functions
Notably, add hb_is_source_of(,) and hb_is_sink_of(,) to replace most
uses of hb_is_iterator_of(,).
2019-05-09 16:58:28 -07:00
Behdad Esfahbod 42901d7af9 Minor 2019-05-09 16:22:08 -07:00
Behdad Esfahbod 322627ae1d Whitespace 2019-05-09 16:08:10 -07:00
Behdad Esfahbod 489f3c35bd Fix bot 2019-05-09 15:39:53 -07:00
Behdad Esfahbod 790315e0db [algs] Implement implicit casting between compatible pair types 2019-05-09 15:31:24 -07:00
Behdad Esfahbod 69d9114b53 [meta] Rewrite hb_is_cr_converitble 2019-05-09 15:24:25 -07:00
Behdad Esfahbod ceda1f03b7 Fix compile
NameRecord is not copy-constructible, so should be iterator of
const-reference.
2019-05-09 15:24:25 -07:00
Behdad Esfahbod 3686c3b65c Adjust is_cr_convertible
If To is const& then From doesn't need to be &.
2019-05-09 15:24:25 -07:00
Behdad Esfahbod 726002a6a6 [iter] Make hb_is_iterator_of() check is_convertible
Instead of is_cr_convertible.
2019-05-09 15:24:25 -07:00
Behdad Esfahbod 70a49f2e4a [meta] Add hb_conditional<> and hb_is_convertible() 2019-05-09 15:24:25 -07:00
Garret Rieger 5e3cbed048 [subset] Switch building of glyph maps in subset plan to use iterators. 2019-05-09 14:52:01 -07:00
Garret Rieger 971020eca7 Add sink support for hb_hashmap_t and a reverse call to hb_pair_t. 2019-05-09 14:52:01 -07:00
Behdad Esfahbod 98eec3dd5f Add hb_pair_t(,) macro as alternative to hb_pair_t<,>
Just so it's easier to use it in other macros.
2019-05-09 13:15:36 -07:00
Behdad Esfahbod c9b287a867 Add hb_lidentity(), and rename hb_rvalue() to hb_ridentity() 2019-05-09 12:43:57 -07:00
Behdad Esfahbod 00195a22ce [hdmx] Adjust to hb_iota() behavior change
Use hb_range() instead.
2019-05-09 12:14:36 -07:00
Behdad Esfahbod 4f2ad75a83 [enumerate] Fix hb_enumerate() len for step=0 2019-05-09 12:07:45 -07:00
Behdad Esfahbod 5da3c9c33f [iter] Fix hb_zip() end condition
We should compare-equal to end if either iterator's end reaches,
not if both reach at the same time.  Fixes infinite-loop in test
which was happening after hb_enumerate() switched to using hb_zip().
2019-05-09 11:31:13 -07:00
Behdad Esfahbod 57a5256fbc [iter] Minor 2019-05-09 11:31:13 -07:00
Behdad Esfahbod 12dd56f857 [iter] Minor 2019-05-09 11:31:13 -07:00
Behdad Esfahbod 57d545932f [test-iter] Don't walk past end
That's not legal.
2019-05-09 11:31:13 -07:00
Behdad Esfahbod 46837910e6 [iter] Allow negative step in hb_iota() 2019-05-09 11:31:13 -07:00
Behdad Esfahbod 087327af1e [iter] Minor 2019-05-09 11:31:13 -07:00
Behdad Esfahbod 64f0899a9f [iter] Bug fix 2019-05-09 11:31:13 -07:00
Behdad Esfahbod 5d263556b9 [iter] Fix 2019-05-09 11:31:13 -07:00
Behdad Esfahbod 2c24ea37b1 [iter] Take start value in hb_enumerate()
Also rewrite it via composition.
2019-05-09 11:31:13 -07:00
Behdad Esfahbod 7675d0d3a6 [iter] Add hb_range()
hb_range() is like Python range.  hb_iota() has slightly different API.
Ie. it takes a start, instead of end.
2019-05-09 11:31:13 -07:00
Behdad Esfahbod 05867d9f53 [meta] Add hb_int_max() 2019-05-09 11:31:13 -07:00
Behdad Esfahbod 71537f93e0 [iota] end -> end_ to not shadow 2019-05-09 11:31:13 -07:00
Behdad Esfahbod 3476445420 Remove unnecessary template keyword
Should fix MSVC.
2019-05-08 21:14:01 -07:00
Behdad Esfahbod e2a51ff726 Remove unused var 2019-05-08 16:41:39 -07:00
Behdad Esfahbod e8b45c1933 [array] Add .copy() 2019-05-08 16:37:38 -07:00
Behdad Esfahbod afb013f350 Fix msan issue
hb_identity returns rvalue-reference if input is rvalue.  That, can leak
the reference and cause in bad access to temporaries after they are
destructed.  This is unfortunately unfixable given the desired
transparency of hb_identity :(.  Just don't use it with hb_map().
2019-05-08 16:16:43 -07:00
Behdad Esfahbod 4c94bc63d9 Move hb_invoke() back to hb-algs.hh 2019-05-08 15:57:33 -07:00
Behdad Esfahbod b710176ce2 [hdmx] Touch up 2019-05-08 15:47:24 -07:00
Garret Rieger e8ef0e627c [subset] WIP convert hdmx subsetting to use iterators. 2019-05-08 15:47:24 -07:00
Garret Rieger d5decf9bf7 [subset] Move hdmx to subset2. 2019-05-08 15:47:24 -07:00
Behdad Esfahbod 27b2093009 [map] Return rvalues from keys()/values() 2019-05-08 15:32:57 -07:00
Behdad Esfahbod 372c5b97bf [map] Fix bots
Older compilers don't like calling iter() from return-type decltype()

../src/hb-map.hh:226:12: error: cannot call member function 'decltype ((((+ hb_array(((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::items, (((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::mask ? (((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::mask + 1) : 0))) | hb_filter((& hb_hashmap_t<K, V, kINVALID, vINVALID>::item_t:: is_real))) | hb_map((& hb_hashmap_t<K, V, kINVALID, vINVALID>::item_t:: get_pair)))) hb_hashmap_t<K, V, kINVALID, vINVALID>::iter() const [with K = const hb_serialize_context_t::object_t*; V = unsigned int; K kINVALID = 0u; V vINVALID = 0u; decltype ((((+ hb_array(((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::items, (((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::mask ? (((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::mask + 1) : 0))) | hb_filter((& hb_hashmap_t<K, V, kINVALID, vINVALID>::item_t:: is_real))) | hb_map((& hb_hashmap_t<K, V, kINVALID, vINVALID>::item_t:: get_pair)))) = hb_map_iter_t<hb_filter_iter_t<hb_array_t<hb_hashmap_t<const hb_serialize_context_t::object_t*, unsigned int, 0u, 0u>::item_t>, bool (hb_hashmap_t<const hb_serialize_context_t::object_t*, unsigned int, 0u, 0u>::item_t::*)() const, const<anonymous struct>&, 0u>, hb_pair_t<const hb_serialize_context_t::object_t*, unsigned int> (hb_hashmap_t<const hb_serialize_context_t::object_t*, unsigned int, 0u, 0u>::item_t::*)() const, 0u>]' without object
     + iter()
            ^
../src/hb-meta.hh:58:41: note: in definition of macro 'HB_AUTO_RETURN'
 #define HB_AUTO_RETURN(E) -> decltype ((E)) { return (E); }
                                         ^
2019-05-08 15:28:39 -07:00
Behdad Esfahbod a304827184 [map] Add .values() iterator 2019-05-08 15:08:33 -07:00
Behdad Esfahbod 3c69505b3a [map] Fix iter 2019-05-08 15:08:33 -07:00
Behdad Esfahbod 5ceaafa5de [algs] Fix identity return type 2019-05-08 15:08:33 -07:00
Behdad Esfahbod f5705d7656 Whitespace 2019-05-08 15:08:33 -07:00
Behdad Esfahbod a17f0fa3a1 [meta] Capture rvalue-references in is_reference / remove_reference 2019-05-08 15:08:33 -07:00
Behdad Esfahbod 7166bd5634 Minor 2019-05-08 15:08:33 -07:00
rsheeter b827181ba1 [map] tweak test-iter.cc 2019-05-08 15:08:33 -07:00
rsheeter 492af0f1bf [map] add keys() 2019-05-08 15:08:33 -07:00
rsheeter ba60512813 [map] add a test for iteration 2019-05-08 15:08:33 -07:00
rsheeter 183b8094b5 [map] add iteration 2019-05-08 15:08:33 -07:00
Michiharu Ariza 02ae2591d9 initialize return param subr_num in popSubrNum
also snake_cased popSubrtNum and other surrounding function names
2019-05-08 13:44:03 -07:00
Behdad Esfahbod 503748d8a8 [name] Sanitize records for reals
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14641
2019-05-08 12:45:02 -07:00
Behdad Esfahbod 5875d775e1 [iter] Rename hb_iter_t() to hb_iter_type<> and add hb_item_type<> 2019-05-08 12:28:46 -07:00
Behdad Esfahbod bad1606639 [map] Make .has() optionally return value 2019-05-08 12:11:52 -07:00
Behdad Esfahbod 750d5af48e Make compiler happy with -Og 2019-05-08 12:10:00 -07:00
Behdad Esfahbod cdb61eb043 [iter] Accept pointer in hb_iter() and hb_iter_t() 2019-05-08 11:00:18 -07:00
Behdad Esfahbod c93eeba9b2 [iter] Accept pointer in hb_map() 2019-05-08 10:56:09 -07:00
Behdad Esfahbod 4c9e0c37a3 [serialize] LangSys subset->copy 2019-05-08 10:40:39 -07:00
Behdad Esfahbod 50dc3e7d9f Add hb_iota() 2019-05-08 10:35:02 -07:00
Behdad Esfahbod aa4ac13f0b [iter] Actually fix previous commit
The iter objects shouldn't not be const.  D'oh.
2019-05-08 10:03:10 -07:00
Behdad Esfahbod a66598e030 [iter] For ref-qualified variants 2019-05-08 10:03:10 -07:00
Behdad Esfahbod 8479eb5955 [iter] Fix hb_sink() to accept rvalue 2019-05-08 09:48:55 -07:00
Behdad Esfahbod 710d459aca [iter] Default predicates to hb_identity instead of hb_bool
The bool conversion happens after predicate is called automatically.
2019-05-08 09:33:09 -07:00
Behdad Esfahbod fe14a4000a Adjust hb_all/any/none 2019-05-08 09:32:19 -07:00
Behdad Esfahbod 4a101d8ffc Add hb_match 2019-05-08 09:16:33 -07:00
Behdad Esfahbod 26adefd9ea [algs] Try f[v] in hb_get() as last resort 2019-05-08 09:14:44 -07:00
Behdad Esfahbod 0601a19d38 Fix a few more double-pomotion errors 2019-05-08 07:47:36 -07:00
Behdad Esfahbod 2ba984fcbb Fix signed comparison on 32bit 2019-05-07 23:28:22 -07:00
Behdad Esfahbod dfc5780245 Fix more double-promotion errors
WHy do only some of the clang bots catch this I have no idea :(.
2019-05-07 23:26:09 -07:00
Behdad Esfahbod c2c9d204fa Fix double-promotion warnings
Make it an error.
2019-05-07 23:13:38 -07:00
Behdad Esfahbod 2c7093ed01 More tests 2019-05-07 23:10:59 -07:00
Behdad Esfahbod 56d2d0294b [algs] Sprinkle hb_min/max with hb-forward salad
Let's see if fixes MSVC fail.  Though, the error doesn't make sense to me.

  hb-blob.cc
c:\projects\harfbuzz\src\hb-algs.hh(166): error C2440: 'return': cannot convert from 'unsigned int' to 'unsigned int &&' [C:\projects\harfbuzz\build\harfbuzz.vcxproj]
  c:\projects\harfbuzz\src\hb-algs.hh(166): note: You cannot bind an lvalue to an rvalue reference
  c:\projects\harfbuzz\src\hb-algs.hh(174): note: see reference to function template instantiation 'T &&<unnamed-type-hb_min>::impl<T,unsigned int&>(T &&,T2) const' being compiled
          with
          [
              T=unsigned int,
              T2=unsigned int &
          ]
2019-05-07 23:08:49 -07:00
Behdad Esfahbod bdbfdc92b5 [iter] Add value and projection to hb_all/any/none
Allows for eg, checking all values equal 2: hb_all (it, 2).
2019-05-07 23:02:44 -07:00
Behdad Esfahbod cf61acb9ea [iter] Accept rvalues to hb_enumerate() 2019-05-07 22:45:01 -07:00
Behdad Esfahbod e8bd5fc3fa [meta] Move hb_invoke from algs to meta 2019-05-07 22:29:40 -07:00
Behdad Esfahbod af571dbffc [meta] Replace most hb_enable_if with hb_requires
They do absolutely same thing.  hb_requires is to encode constraints,
whereas hb_enable_if is for more conditional enabling.
2019-05-07 21:39:20 -07:00
Behdad Esfahbod 6fa1f38070 [algs] Accept varargs in hb_min/max 2019-05-07 21:33:26 -07:00
Behdad Esfahbod 1ad07080c3 Rename 2019-05-07 21:00:23 -07:00
Behdad Esfahbod 83e3eabd84 Whitespace 2019-05-07 20:58:43 -07:00
Behdad Esfahbod 2b9402a86a Use universal references in hb_min/max 2019-05-07 20:55:33 -07:00
Behdad Esfahbod 41248cce0e Remove MIN/MAX in favor of hb_min/hb_max 2019-05-07 20:54:31 -07:00
Behdad Esfahbod 5c0f62adc9 [serializer] Accept pointer & reference in more methods 2019-05-07 17:25:58 -07:00
Behdad Esfahbod 839618de3b [serializer] Minor 2019-05-07 17:21:27 -07:00
Behdad Esfahbod 035b818e34 [meta] Fix addressof() 2019-05-07 17:21:18 -07:00
Behdad Esfahbod 7654ebe3a5 Whitespace 2019-05-07 16:53:03 -07:00
Behdad Esfahbod 95426ea983 Add comment 2019-05-07 15:56:51 -07:00
Behdad Esfahbod e33ad25222 [serialize] FeatureVariations subset->copy 2019-05-07 15:46:24 -07:00
Behdad Esfahbod fa8c4ba811 Minor 2019-05-07 14:26:03 -07:00
Behdad Esfahbod c09d6c58e9 [iter] Require lvalue in operators that return reference 2019-05-07 14:09:00 -07:00
Behdad Esfahbod 52f6c04c1e Minor 2019-05-07 13:45:48 -07:00
Behdad Esfahbod 7c037bd2be [name] Clean up some more 2019-05-07 13:37:43 -07:00
Behdad Esfahbod f982b9d9f8 [name] Clean up serialize() API 2019-05-07 13:29:01 -07:00
Behdad Esfahbod 59ee61fddc [name] Use iterators more 2019-05-07 13:26:15 -07:00
Behdad Esfahbod 2eb7e0e0e9 [serialize] Minor 2019-05-07 12:45:38 -07:00
Behdad Esfahbod 1c81cff2d3 Fix signed-comparison error on 32bit 2019-05-07 11:51:10 -07:00
Behdad Esfahbod 938de31575 Comment 2019-05-07 11:47:02 -07:00
Behdad Esfahbod 9b05db33b5 [ragel] Regenerate ragel-generated files using ragel 7.0.0.11 May 2018 2019-05-07 11:39:44 -07:00
Behdad Esfahbod 521262b236 [subset] Add TODO 2019-05-07 11:08:08 -07:00
Behdad Esfahbod e6a622b5b2 [serialize] Enable bias assertion 2019-05-07 11:06:43 -07:00
Behdad Esfahbod 530ddbbc32 [serialize] Use range-based loop 2019-05-07 11:05:51 -07:00
Behdad Esfahbod 0987c4204f [name] Remove dead code 2019-05-07 11:01:02 -07:00
Behdad Esfahbod 5ac4ab6868 [subset] fix for name table serializing with new serializer machinery 2019-05-07 10:59:03 -07:00
Behdad Esfahbod c548fcedc4 [WIP] [name] Port to fancy serializer machinery 2019-05-07 10:59:03 -07:00
Behdad Esfahbod fa2d97161f Remove use of deprecated implicit copy/move assignment operators
By removing custom copy constructor.
2019-05-07 00:36:36 -07:00
Behdad Esfahbod 45f5e56236 Warn on -Wdeprecated 2019-05-07 00:36:36 -07:00
Behdad Esfahbod 8903040fcd Actually make it work 2019-05-07 00:13:11 -07:00
Behdad Esfahbod 025eaa3c81 [iter] Make filter/map copyable 2019-05-07 00:05:37 -07:00
Behdad Esfahbod 03a68165d8 [meta] Add hb_reference_wrapper<>
Functionality kinda superset of std:: counterpart.
2019-05-07 00:05:31 -07:00
Behdad Esfahbod 0bf86d9c5d Whitespace 2019-05-06 23:39:26 -07:00
Behdad Esfahbod 72eb91deb9 Add hb_ref()
Unused.
2019-05-06 23:39:13 -07:00
Behdad Esfahbod 240f57e58d Rename hb_deref_pointer() to hb_deref() 2019-05-06 23:17:39 -07:00
Behdad Esfahbod 0b1ca5a13b [iter] Adjust hb_filter 2019-05-06 23:04:32 -07:00
Behdad Esfahbod 4c2fd05ca5 [iter] Implement range-based for loops
Part of https://github.com/harfbuzz/harfbuzz/issues/1648
2019-05-06 19:57:35 -07:00
Ebrahim Byagowi e261dc3a40
Ignore -Wc++11-compat as we require C++11 actually
pollutes gcc bots logs https://circleci.com/gh/harfbuzz/harfbuzz/85395
2019-05-07 01:24:55 +04:30
Behdad Esfahbod 9f9890e9e8 Remove HB_NO_OPTIONS in favor of HB_NO_GETENV
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-05-06 12:16:51 -07:00
Behdad Esfahbod 36bb24f7b4 [dispatch] Forward arguments in all dispatch multiplexers 2019-05-05 10:14:17 -07:00
Behdad Esfahbod c14efb8e68 Fix previous commit
Priority should be given to specific over dispatch.  Broke sanitize before.
This fixes it, by moving prioritization to the context implementation, since
the correct priority cannot be done in the dispatch implementation.  Done
for subset and sanitize only, which need it.
2019-05-05 09:54:58 -07:00
Behdad Esfahbod b10f65933a [dispatch] Use functionality from previous commit
To remove a couple of unwanted wrapper methods
2019-05-05 09:23:35 -07:00
Behdad Esfahbod ac350c92fd [dispatch] Try obj.dispatch(c) before trying c->dispatch(obj) 2019-05-05 09:10:46 -07:00
Behdad Esfahbod 0d5fd168f8 Revert "[WIP] [name] Port to fancy serializer machinery"
This reverts commit c7f366fbbb.

Don't know how it got to master!
2019-05-03 10:37:32 -07:00