Skip to content

Commit

Permalink
Bug 1113070 - Update harfbuzz to 0.9.37+ (upstream 7d5e7613ced3dd39d0…
Browse files Browse the repository at this point in the history
…5df83ca7e8952cbecd68f6). r=jdaggett
  • Loading branch information
jfkthame committed Dec 20, 2014
1 parent 9f08e24 commit 6dceede
Show file tree
Hide file tree
Showing 35 changed files with 1,020 additions and 640 deletions.
43 changes: 22 additions & 21 deletions gfx/harfbuzz/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ hb-gobject-enums.%: hb-gobject-enums.%.tmpl $(HBHEADERS)
$(AM_V_GEN) $(GLIB_MKENUMS) \
--identifier-prefix hb_ --symbol-prefix hb_gobject \
--template $^ | \
sed 's/_t_get_type/_get_type/g; s/_T (/ (/g' > "$@.tmp" && \
mv "$@.tmp" "$@" || ( $(RM) "@.tmp" && false )
sed 's/_t_get_type/_get_type/g; s/_T (/ (/g' > "$@" \
|| ($(RM) "$@"; false)
endif
EXTRA_DIST += \
harfbuzz-gobject.pc.in \
Expand All @@ -251,8 +251,8 @@ EXTRA_DIST += \
-e 's@%libdir%@$(libdir)@g' \
-e 's@%includedir%@$(includedir)@g' \
-e 's@%VERSION%@$(VERSION)@g' \
"$<" \
> "$@.tmp" && mv "$@.tmp" "$@" || ( $(RM) "$@.tmp"; false )
"$<" > "$@" \
|| ($(RM) "$@"; false)

CLEANFILES += $(pkgconfig_DATA)

Expand All @@ -265,8 +265,9 @@ harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS)
sed -e 's/ (.*//' | \
LANG=C sort; \
echo LIBRARY libharfbuzz-$(HB_VERSION_MAJOR).dll; \
) >"$@.tmp"
@ ! grep -q hb_ERROR "$@.tmp" && mv "$@.tmp" "$@" || ($(RM) "$@"; false)
) >"$@"
@ ! grep -q hb_ERROR "$@" \
|| ($(RM) "$@"; false)


GENERATORS = \
Expand All @@ -278,36 +279,36 @@ EXTRA_DIST += $(GENERATORS)
unicode-tables: arabic-table indic-table

indic-table: gen-indic-table.py IndicSyllabicCategory.txt IndicMatraCategory.txt Blocks.txt
$(AM_V_GEN) $(builddir)/$^ > hb-ot-shape-complex-indic-table.cc.tmp && \
mv hb-ot-shape-complex-indic-table.cc.tmp $(srcdir)/hb-ot-shape-complex-indic-table.cc || \
($(RM) hb-ot-shape-complex-indic-table.cc.tmp; false)
$(AM_V_GEN) $(builddir)/$^ > hb-ot-shape-complex-indic-table.cc \
|| ($(RM) hb-ot-shape-complex-indic-table.cc; false)

arabic-table: gen-arabic-table.py ArabicShaping.txt UnicodeData.txt Blocks.txt
$(AM_V_GEN) $(builddir)/$^ > hb-ot-shape-complex-arabic-table.hh.tmp && \
mv hb-ot-shape-complex-arabic-table.hh.tmp $(srcdir)/hb-ot-shape-complex-arabic-table.hh || \
($(RM) hb-ot-shape-complex-arabic-table.hh.tmp; false)
$(AM_V_GEN) $(builddir)/$^ > hb-ot-shape-complex-arabic-table.hh \
|| ($(RM) hb-ot-shape-complex-arabic-table.hh; false)

built-sources: $(BUILT_SOURCES)

.PHONY: unicode-tables arabic-table indic-table built-sources

BUILT_SOURCES += \
hb-buffer-deserialize-json.hh \
hb-buffer-deserialize-text.hh \
hb-ot-shape-complex-indic-machine.hh \
hb-ot-shape-complex-myanmar-machine.hh \
hb-ot-shape-complex-sea-machine.hh \
RAGEL_GENERATED = \
$(srcdir)/hb-buffer-deserialize-json.hh \
$(srcdir)/hb-buffer-deserialize-text.hh \
$(srcdir)/hb-ot-shape-complex-indic-machine.hh \
$(srcdir)/hb-ot-shape-complex-myanmar-machine.hh \
$(srcdir)/hb-ot-shape-complex-sea-machine.hh \
$(NULL)
BUILT_SOURCES += $(RAGEL_GENERATED)
EXTRA_DIST += \
hb-buffer-deserialize-json.rl \
hb-buffer-deserialize-text.rl \
hb-ot-shape-complex-indic-machine.rl \
hb-ot-shape-complex-myanmar-machine.rl \
hb-ot-shape-complex-sea-machine.rl \
$(NULL)
.rl.hh:
$(AM_V_GEN)$(RAGEL) -e -F1 -o "$@.tmp" "$<" && \
mv "$@.tmp" "$@" || ( $(RM) "$@.tmp" && false )
MAINTAINERCLEANFILES += $(RAGEL_GENERATED)
$(srcdir)/%.hh: $(srcdir)/%.rl
$(AM_V_GEN)(cd $(srcdir) && $(RAGEL) -e -F1 -o "$*.hh" "$*.rl") \
|| ($(RM) "$@"; false)

noinst_PROGRAMS = \
main \
Expand Down
14 changes: 7 additions & 7 deletions gfx/harfbuzz/src/check-libstdc++.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ fi
tested=false
for suffix in so dylib; do
so=.libs/libharfbuzz.$suffix
if test -f "$so"; then
echo "Checking that we are not linking to libstdc++"
if ldd $so | grep 'libstdc[+][+]'; then
echo "Ouch, linked to libstdc++"
stat=1
fi
tested=true
if ! test -f "$so"; then continue; fi

echo "Checking that we are not linking to libstdc++"
if ldd $so | grep 'libstdc[+][+]'; then
echo "Ouch, linked to libstdc++"
stat=1
fi
tested=true
done
if ! $tested; then
echo "check-libstdc++.sh: libharfbuzz shared library not found; skipping test"
Expand Down
4 changes: 2 additions & 2 deletions gfx/harfbuzz/src/check-static-inits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ fi

echo "Checking that no object file has static initializers"
for obj in $OBJS; do
if objdump -t "$obj" | grep '[.]ctors'; then
echo "Ouch, $obj has static initializers"
if objdump -t "$obj" | grep '[.][cd]tors' | grep -v '\<00*\>'; then
echo "Ouch, $obj has static initializers/finalizers"
stat=1
fi
done
Expand Down
10 changes: 8 additions & 2 deletions gfx/harfbuzz/src/check-symbols.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ fi

echo "Checking that we are not exposing internal symbols"
tested=false
for so in `ls .libs/lib*.so .libs/lib*.dylib 2>/dev/null` ; do
for suffix in so dylib; do
so=.libs/libharfbuzz.$suffix
if ! test -f "$so"; then continue; fi

EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>' | cut -d' ' -f3`"
EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>\| __gcov_flush\>\| llvm_' | cut -d' ' -f3`"

prefix=`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'`

# On mac, C symbols are prefixed with _
if test $suffix = dylib; then prefix="_$prefix"; fi

echo "Processing $so"
if echo "$EXPORTED_SYMBOLS" | grep -v "^${prefix}_"; then
echo "Ouch, internal symbols exposed"
Expand Down
5 changes: 4 additions & 1 deletion gfx/harfbuzz/src/hb-blob.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ hb_blob_create (const char *data,
{
hb_blob_t *blob;

if (!length || !(blob = hb_object_create<hb_blob_t> ())) {
if (!length ||
length >= 1u << 31 ||
data + length < data /* overflows */ ||
!(blob = hb_object_create<hb_blob_t> ())) {
if (destroy)
destroy (user_data);
return hb_blob_get_empty ();
Expand Down
4 changes: 2 additions & 2 deletions gfx/harfbuzz/src/hb-buffer-deserialize-json.rl
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ _hb_buffer_deserialize_glyphs_json (hb_buffer_t *buffer,

const char *tok = NULL;
int cs;
hb_glyph_info_t info;
hb_glyph_position_t pos;
hb_glyph_info_t info = {0};
hb_glyph_position_t pos = {0};
%%{
write init;
write exec;
Expand Down
7 changes: 4 additions & 3 deletions gfx/harfbuzz/src/hb-buffer-private.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,13 @@ struct hb_buffer_t {
ASSERT_POD ();

/* Information about how the text in the buffer should be treated */

hb_unicode_funcs_t *unicode; /* Unicode functions */
hb_segment_properties_t props; /* Script, language, direction */
hb_buffer_flags_t flags; /* BOT / EOT / etc. */
hb_codepoint_t replacement; /* U+FFFD or something else. */

/* Buffer contents */

hb_buffer_content_type_t content_type;
hb_segment_properties_t props; /* Script, language, direction */

bool in_error; /* Allocation failed */
bool have_output; /* Whether we have an output buffer going on */
Expand Down Expand Up @@ -183,6 +181,9 @@ struct hb_buffer_t {
inline bool ensure (unsigned int size)
{ return likely (!size || size < allocated) ? true : enlarge (size); }

inline bool ensure_inplace (unsigned int size)
{ return likely (!size || size < allocated); }

HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out);
HB_INTERNAL bool shift_forward (unsigned int count);

Expand Down
4 changes: 2 additions & 2 deletions gfx/harfbuzz/src/hb-buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ hb_buffer_t::reset (void)

hb_unicode_funcs_destroy (unicode);
unicode = hb_unicode_funcs_get_default ();
flags = HB_BUFFER_FLAG_DEFAULT;
replacement = HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT;

clear ();
Expand All @@ -191,7 +192,6 @@ hb_buffer_t::clear (void)

hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT;
props = default_props;
flags = HB_BUFFER_FLAG_DEFAULT;

content_type = HB_BUFFER_CONTENT_TYPE_INVALID;
in_error = false;
Expand Down Expand Up @@ -702,11 +702,11 @@ hb_buffer_get_empty (void)
HB_OBJECT_HEADER_STATIC,

const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_nil),
HB_SEGMENT_PROPERTIES_DEFAULT,
HB_BUFFER_FLAG_DEFAULT,
HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT,

HB_BUFFER_CONTENT_TYPE_INVALID,
HB_SEGMENT_PROPERTIES_DEFAULT,
true, /* in_error */
true, /* have_output */
true /* have_positions */
Expand Down
4 changes: 2 additions & 2 deletions gfx/harfbuzz/src/hb-common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ struct hb_language_item_t {

static hb_language_item_t *langs;

#ifdef HAVE_ATEXIT
#ifdef HB_USE_ATEXIT
static inline
void free_langs (void)
{
Expand Down Expand Up @@ -269,7 +269,7 @@ lang_find_or_insert (const char *key)
goto retry;
}

#ifdef HAVE_ATEXIT
#ifdef HB_USE_ATEXIT
if (!first_lang)
atexit (free_langs); /* First person registers atexit() callback. */
#endif
Expand Down
5 changes: 3 additions & 2 deletions gfx/harfbuzz/src/hb-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ hb_direction_from_string (const char *str, int len);
const char *
hb_direction_to_string (hb_direction_t direction);

#define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4)
/* Direction must be valid for the following */
#define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4)
#define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6)
#define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4)
#define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5)
#define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4)
#define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)) ^ 1)) /* Direction must be valid */
#define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)) ^ 1))


/* hb_language_t */
Expand Down
Loading

0 comments on commit 6dceede

Please sign in to comment.