Commit Graph

67 Commits

Author SHA1 Message Date
Behdad Esfahbod abd81ed4f5 Umm. Cryptic, yes
In file included from hb-face.cc:35:
hb-ot-cmap-table.hh: In member function 'void OT::CmapSubtableFormat4::_compiles_assertion_on_line_388() const':
hb-ot-cmap-table.hh:388: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-open-type.hh:354: note: candidate 1: const Type& OT::UnsizedArrayOf<Type>::operator[](unsigned int) const [with Type = OT::IntType<short unsigned int, 2u>]
hb-ot-cmap-table.hh:388: note: candidate 2: operator[](const T*, int) <built-in>
hb-ot-cmap-table.hh: In member function 'void OT::CmapSubtableFormat4::_instance_assertion_on_line_388() const':
hb-ot-cmap-table.hh:388: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-open-type.hh:354: note: candidate 1: const Type& OT::UnsizedArrayOf<Type>::operator[](unsigned int) const [with Type = OT::IntType<short unsigned int, 2u>]
hb-ot-cmap-table.hh:388: note: candidate 2: operator[](const T*, int) <built-in>
hb-face.cc: In function 'hb_blob_t* _hb_face_builder_data_reference_blob(hb_face_builder_data_t*)':
hb-face.cc:650: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:650: note: candidate 2: operator[](T*, int) <built-in>
hb-face.cc:650: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:650: note: candidate 2: operator[](const T*, int) <built-in>
hb-face.cc:651: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:651: note: candidate 2: operator[](T*, int) <built-in>
hb-face.cc:651: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:651: note: candidate 2: operator[](const T*, int) <built-in>
2018-11-30 11:52:41 -05:00
Ebrahim Byagowi e7bd29ea11
Limit __builtin_bswap16 to GCC >= 5 as it was implemented on 4.8 2018-11-29 23:47:20 +03:30
Behdad Esfahbod 861bc75349 [vector] Make pointer cast explicit
Too bad this doesn't help MSVC 2008 build, as explicit operators are
C++11.
2018-11-29 14:34:44 -05:00
Behdad Esfahbod 987f418772
Merge pull request #1398 from Adenilson/bigInt01
Optimize harfbuzz big integer conversions
2018-11-27 17:40:32 -05:00
Behdad Esfahbod 4e2a03b6b6
Comment 2018-11-27 17:40:09 -05:00
Adenilson Cavalcanti 4a719a7f4c Optimize harfbuzz big integer conversions
Profiling showed that type conversions were adding considerable cycles in time
spent doing text shaping.

The idea is to optimize it using native processor instructions to help Blink
layout performance.

Doing further investigation revelead that compilers may not use the
proper instruction on ARM 32bits builds (i.e. REV16).

One way to insure that the generated ASM was ideal for both gcc/clang
was using __builtin_bswap16.

Added bonus is that we no longer need to test for CPU architecture.
2018-11-27 13:43:05 -08:00
Behdad Esfahbod 9326912941 [kerx] Fix crash 2018-11-25 00:27:23 -05:00
Behdad Esfahbod 6ee401049d Simplify sanitize set_object() / fix bots 2018-11-25 00:21:13 -05:00
Behdad Esfahbod 1e8994221f Add hb_sanitize_with_object_t
Context manager.
2018-11-24 23:38:06 -05:00
Behdad Esfahbod b3c5affc05 Simplify sanitize set_object() 2018-11-24 23:34:34 -05:00
Behdad Esfahbod 9eeebd8dde Revert "[sanitize] Remove now-unused set_object() machinery"
This reverts commit bbdb6edb3e.
2018-11-24 22:16:47 -05:00
Behdad Esfahbod bbdb6edb3e [sanitize] Remove now-unused set_object() machinery 2018-11-24 17:15:38 -05:00
Behdad Esfahbod a9fe787a11 [sanitizer] Add reset_object(), make set_object() do bounds-check
Affects morx/kerx run-time only currently.  Will adjust their sanitize next.
2018-11-22 22:12:36 -05:00
Behdad Esfahbod 3b9fd176e8 Disallow taking Null() of unbounded structs
Not sure I've marked all such structs.  To be done as we discover.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1300
2018-11-22 01:18:55 -05:00
Behdad Esfahbod 7dd945a876 One more time.. 2018-11-22 01:05:17 -05:00
Behdad Esfahbod d062ad10de Fix bots happy again, hopefully
So, our fallback static_assert cannot be had more than once per line
of source.
2018-11-22 00:39:14 -05:00
Behdad Esfahbod fb10c021c8 Revert alignof() == 1 check
Bots not happy with using "this" inside assertion...

This reverts 2656644887
2018-11-22 00:21:49 -05:00
Behdad Esfahbod 8d778877b8 .. 2018-11-21 23:46:09 -05:00
Behdad Esfahbod 8cfeed9948 Minor 2018-11-21 23:42:31 -05:00
Behdad Esfahbod e5d954a2fb Minor 2018-11-21 23:30:50 -05:00
Behdad Esfahbod e987059c61 Minor 2018-11-21 23:25:06 -05:00
Behdad Esfahbod a2b6d308a4 Remove DEFINE_SIZE_ARRAY2 2018-11-21 23:23:49 -05:00
Behdad Esfahbod 2656644887 Check alignof() structs are 1 2018-11-21 23:23:21 -05:00
Behdad Esfahbod 6321fdf704 Whitespace 2018-11-21 23:19:00 -05:00
Behdad Esfahbod cfb9771a3b [coretext] Try to fix 2018-11-16 03:25:07 -05:00
Behdad Esfahbod ce5da0f36a [shaper] Rewrite shaper data code to be more template-driven than macro-driven 2018-11-16 02:52:20 -05:00
Behdad Esfahbod dc4225ccd1 Don't retry creating again and again in lazy_loader if create failed
Still does that if get_null() returns nullptr.  Our shaper data objects
are like that.  Shrug.
2018-11-13 20:48:46 -05:00
Behdad Esfahbod 274f4c726f Rename check_array2() to check_array() 2018-11-12 14:24:36 -05:00
Behdad Esfahbod e014405a21 Rename check_array(array, a, b) to check_range() 2018-11-12 14:23:31 -05:00
Behdad Esfahbod c8f4cc4927 [kerx] Fix integer overflow in multiply
Fixes https://oss-fuzz.com/v2/testcase-detail/5754863779053568
2018-11-12 14:11:29 -05:00
Behdad Esfahbod 1fd183ee1c Finish off eecccc919c 2018-11-11 16:47:52 -05:00
Behdad Esfahbod eecccc919c Don't store to null object
Ouch :).
2018-11-11 15:48:47 -05:00
Behdad Esfahbod 903856ab50 Remove unused function 2018-11-11 15:45:58 -05:00
Behdad Esfahbod a953b64750 Revert parts of previous commit that made clang unhappy 2018-11-10 20:10:03 -05:00
Behdad Esfahbod 1d66cdcf77 Better fix for MSVC 2008
Follow up on b4c6113032

Fixes https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-10 19:57:51 -05:00
Behdad Esfahbod f6fc5574d3 Add pointer magic operators to hb_atomic_ptr_t 2018-11-05 13:23:54 -05:00
Behdad Esfahbod 138f9e0f25 Minor 2018-10-30 01:31:13 -07:00
Ebrahim Byagowi f7a08cd41d
Fix extra semicolon issues and test that on CI (#1330) 2018-10-30 11:29:09 +03:30
Behdad Esfahbod 35d410f2ba Remove ASSERT_POD
Newer compilers / language allows structs with constructor in union.
So, this was not actually testing anything.  Indeed, the recent
change in DISALLOW_COPY *is* making some of our types non-POD.
That broke some bots.

Just remove this since it wasn't doing much, and I'd rather have
DISALLOW_COPY.
2018-10-29 14:45:44 -07:00
Behdad Esfahbod 6f0454e176 Fix extra-semicolon warnings 2018-10-29 13:51:15 -07:00
Behdad Esfahbod 39bd07aed5 Fix bunch of unused parameter warnings
Show up with gcc -O0.

There's a few more but those are functions that need to be filled in.

Maybe this is a lost battle...
2018-10-26 21:22:26 -07:00
Behdad Esfahbod 955aa56b11 [vector] Make it act more like pointer
Add pointer cast operator and plus operator.
2018-10-25 16:50:38 -07:00
Garret Rieger aa5af8d041 Fix size calculation in DEFINE_SIZE_ARRAY_SIZED. 2018-10-23 16:04:21 -07:00
Behdad Esfahbod f7c0b4319c [aat] Implement LookupFormat10 2018-10-19 15:23:49 -07:00
Bruce Mitchener 257d0e5aa3 Fix typos. 2018-10-19 19:24:05 +03:30
Behdad Esfahbod c406aca193 Fix warning 2018-10-17 22:58:43 -07:00
Behdad Esfahbod 83780308b4 [aat] Fix sanitize slowdown
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11034
2018-10-17 22:34:16 -07:00
Behdad Esfahbod e9f9c0d81c [sanitize] Reorder condition to silence bogus gcc warning
Was givin a dozen of:

../../src/hb-machinery.hh: In member function ‘bool AAT::ankr::sanitize(hb_sanitize_context_t*) const’:
../../src/hb-machinery.hh:307:23: warning: missed loop optimization, the loop counter may overflow [-Wunsafe-loop-optimizations]
     bool ok = --this->max_ops > 0 &&
               ~~~~~~~~~~~~~~~~~~~~~~
        this->start <= p &&
        ~~~~~~~~~~~~~~~~~~~
        p <= this->end &&
        ~~~~~~~~~~~~~~~^~
        (unsigned int) (this->end - p) >= len;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I believe those are bogus, but this silences them and does not introduce
logic issues I believe.
2018-10-12 16:06:39 -04:00
Behdad Esfahbod 7fa69e92ca Comment 2018-10-10 19:02:32 -04:00
Behdad Esfahbod d35315cc02 [aat] Fixup recent commit
For 329f240108

max_ops is signed.
2018-10-09 23:17:32 -04:00