Commit Graph

139 Commits

Author SHA1 Message Date
Behdad Esfahbod b5d6fe1a45 [iter] Remove hb_sorted_iter_t
Not enforcing it using type hierarchy.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 5ec11ce13a [iter] Clarify readonly vs lvalue iterators
lvalue iterators must declare __item_type__ as a reference.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 6dc4a1c9b1 [iter] Remove const_iter 2019-01-20 20:12:12 -05:00
Behdad Esfahbod d3976b7e63 [iter] Make them work, mostly 2019-01-20 20:12:12 -05:00
Behdad Esfahbod bd1318b8cc Use static constexpr for large class constants 2019-01-20 19:47:52 -05:00
Behdad Esfahbod 043b610fa6 Fix sign compare warnings
../../third_party/harfbuzz-ng/src/src/hb-map.hh(56,45):  warning: comparison of integers of different signs: 'const hb_codepoint_t' (aka 'const unsigned int') and 'hb_map_t::(anonymous enum at ../../third_party/harfbuzz-ng/src/src/hb-map.hh:169:3)' [-Wsign-compare]
    bool is_unused () const    { return key == INVALID; }
2019-01-19 09:21:33 -05:00
Behdad Esfahbod fa333e34d6 [vector] Remove static_array
Was good idea, but with C++ types with constructor/destructor, was getting in
the way as compiler was destructing those items where it was not desired.
Since C++ does not allow zero-sized arrays, just remove it...
2018-12-27 17:56:22 -05:00
Behdad Esfahbod e4355b1ca1 [set] Add iter_t as alias to const_iter_t 2018-12-23 20:34:24 -05:00
Behdad Esfahbod 33f8de6186 [set] Change to const_iter 2018-12-23 20:34:24 -05:00
Behdad Esfahbod f88fed5cd8 [set] Cache length in iterator 2018-12-23 20:34:24 -05:00
Behdad Esfahbod 89d04129e2 [set] Actually derive iterator from hb_sorted_iter_t<> 2018-12-21 20:07:52 -05:00
Behdad Esfahbod fc35919d01 [set] Implement unified iterator 2018-12-21 20:06:17 -05:00
Behdad Esfahbod 4911e67d2d [set] Mark some internals protected 2018-12-21 20:00:52 -05:00
Behdad Esfahbod 474a12058d [array/vector] Rename len to length 2018-12-21 18:53:01 -05:00
Behdad Esfahbod 9aebfb4182 [serialize] Streamline error propagation 2018-12-18 13:22:17 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Ebrahim Byagowi b2ebaa9afa Remove redundant 'inline' from methods (#1483) 2018-12-16 14:08:10 -05:00
Behdad Esfahbod 0f32c95e14 Fix a few more sizeof(vector[0]) errors with weird compilers 2018-11-30 11:31:39 -05:00
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 72955e6825 Hand-hold older compilers 2018-11-29 14:28:44 -05:00
Behdad Esfahbod d77a098b73 [arrays] Improve bfind() interface
Much more useful now. :)
2018-11-24 10:06:13 -05:00
Behdad Esfahbod 22e1857b01 [arrays] Change argument type of cmp called by hb_vector_t.bsearch()
Towards consolidating all array bsearch/...
2018-11-24 09:48:06 -05:00
Behdad Esfahbod d0e81b2cc8 [set] Rename 2018-11-22 21:20:39 -05:00
Behdad Esfahbod af123bd1b8 Add hb_memcmp() 2018-11-12 16:27:08 -05:00
Behdad Esfahbod 5f97fe9956 Fix a few MSVC 2008 warnings
https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-09 10:01:50 -05:00
Behdad Esfahbod 93ef20a83b Replace most uses of is_inert with is_immutable 2018-11-03 15:03:06 -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
Simon Tooke 881e1054bc fix various GCC function pointer warnings 2018-10-30 13:17:54 -07:00
Behdad Esfahbod b186274362 [set/map] Fix uninitialized memory
I keep forgetting that primitive types are NOT initialized during construction. :|
2018-10-29 23:21:14 -07:00
Behdad Esfahbod 67a22f377d [set/map/vector] Make constructable, but not copy or assignable
Disable copy/assign on them, as they shouldn't.

Make constructor / destructor call init_shallow/fini_shallow,
and make those idempotent.  So, these three can be constructed
on stack now and no init/fini call is needed.  As such,
hb_auto_t<> is not needed anymore.  I'll remove that separately.
2018-10-29 22:23:22 -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
Behdad Esfahbod 8d55e2adef [set] Minor 2018-10-25 16:37:53 -07:00
Behdad Esfahbod 64c32edfe1 [set] Make array access more explicit
Follow up on 94e421abbf
2018-10-25 16:35:36 -07:00
Ben Wagner 94e421abbf Remove some use of Crap in hb-set.
When hb_set_t::page_for_insert needs to insert at the end of the page_map
it ends up evaluating '&page_map[i + 1]' which has hb_vector return an
lvalue of a Crap so that nothing can be moved to its address. This turns
into issues with ThreadSanitizer on Crap when two threads modify different
hb_set_t instances. This can be avoided by using '&page_map[i] + 1'
instead.
2018-10-25 11:42:20 -07:00
Behdad Esfahbod 341206eb60 [vector] Make hb_vector_t relocatable / nestable
Ugly, but...
Fixes https://github.com/harfbuzz/harfbuzz/issues/1227
2018-10-05 18:39:48 +02:00
Behdad Esfahbod 606bf57430 Revert forcing use of single-parameter static_assert()
Some clang versions define static_assert as a macro apparently, so we cannot
redefine it...

This reverts commit 94bfea0ce6.
This reverts commit 4e62627831.
2018-09-16 19:34:39 +02:00
Behdad Esfahbod 4e62627831 Enforce single-param static_assert() only
So we don't accidentally break it again.
2018-09-16 18:09:36 +02:00
Behdad Esfahbod fda994e1d4 Use enum instead of "static const" in class scope
Technically, static const needs an out-of-class definition.  Eg:

  CXXLD    libharfbuzz-subset.la
Undefined symbols for architecture x86_64:
  "OT::FeatureVariationRecord::min_size", referenced from:
      bool OT::GSUBGPOS::subset<OT::PosLookup>(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
      bool OT::GSUBGPOS::subset<OT::SubstLookup>(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
  "OT::Record<OT::LangSys>::min_size", referenced from:
      OT::Script::subset(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
  "OT::IntType<unsigned short, 2u>::min_size", referenced from:
      OT::Script::subset(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
      OT::RecordListOf<OT::Feature>::subset(hb_subset_context_t*) const  in libharfbuzz_subset_la-hb-subset.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[4]: *** [libharfbuzz-subset.la] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Exited with code 2
2018-09-07 15:02:57 -04:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00