[HarfBuzz] harfbuzz: Branch 'master' - 4 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Wed Jan 31 16:28:31 UTC 2018
src/hb-blob.cc | 2 +-
src/hb-buffer-private.hh | 2 +-
src/hb-common.cc | 2 +-
src/hb-coretext.cc | 15 ++++++++++++---
src/hb-directwrite.cc | 2 +-
src/hb-ft.cc | 2 +-
src/hb-graphite2.cc | 2 +-
src/hb-ot-layout-common-private.hh | 2 +-
src/hb-ot-layout.cc | 10 ++++++----
src/test-buffer-serialize.cc | 2 +-
10 files changed, 26 insertions(+), 15 deletions(-)
New commits:
commit dae20fb5a79caad9a4af14137a961b60fe256235
Author: Bruce Mitchener <bruce.mitchener at gmail.com>
Date: Wed Jan 31 20:16:08 2018 +0700
Use nullptr instead of 0.
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 255f2053..752dea8a 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -314,7 +314,7 @@ _hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data)
hb_font_t *
hb_coretext_font_create (CTFontRef ct_font)
{
- CGFontRef cg_font = CTFontCopyGraphicsFont (ct_font, 0);
+ CGFontRef cg_font = CTFontCopyGraphicsFont (ct_font, nullptr);
hb_face_t *face = hb_coretext_face_create (cg_font);
CFRelease (cg_font);
hb_font_t *font = hb_font_create (face);
@@ -1045,7 +1045,7 @@ resize_and_retry:
}
if (!matched)
{
- CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, 0);
+ CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, nullptr);
if (run_cg_font)
{
matched = CFEqual (run_cg_font, cg_font);
diff --git a/src/test-buffer-serialize.cc b/src/test-buffer-serialize.cc
index 4b429eab..636b0037 100644
--- a/src/test-buffer-serialize.cc
+++ b/src/test-buffer-serialize.cc
@@ -101,7 +101,7 @@ main (int argc, char **argv)
bool ret = true;
char line[BUFSIZ], out[BUFSIZ];
- while (fgets (line, sizeof(line), stdin) != 0)
+ while (fgets (line, sizeof(line), stdin) != nullptr)
{
hb_buffer_clear_contents (buf);
commit 90218fa93cf8b5d4b192be12d31aed92d271d09e
Author: Bruce Mitchener <bruce.mitchener at gmail.com>
Date: Wed Jan 31 20:44:45 2018 +0700
Fix typos.
diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index 4cf6d1e5..80460125 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -222,7 +222,7 @@ hb_blob_reference (hb_blob_t *blob)
* hb_blob_destroy: (skip)
* @blob: a blob.
*
- * Descreases the reference count on @blob, and if it reaches zero, destroys
+ * Decreases the reference count on @blob, and if it reaches zero, destroys
* @blob, freeing all memory, possibly calling the destroy-callback the blob
* was created for if it has not been called already.
*
diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 9148ef31..a72376de 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -93,7 +93,7 @@ struct hb_buffer_t {
hb_buffer_flags_t flags; /* BOT / EOT / etc. */
hb_buffer_cluster_level_t cluster_level;
hb_codepoint_t replacement; /* U+FFFD or something else. */
- hb_buffer_scratch_flags_t scratch_flags; /* Have space-flallback, etc. */
+ hb_buffer_scratch_flags_t scratch_flags; /* Have space-fallback, etc. */
unsigned int max_len; /* Maximum allowed len. */
int max_ops; /* Maximum allowed operations. */
diff --git a/src/hb-common.cc b/src/hb-common.cc
index 1d0e7264..d1fcf799 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -879,7 +879,7 @@ parse_feature_value_postfix (const char **pp, const char *end, hb_feature_t *fea
parse_bool (pp, end, &feature->value);
/* CSS doesn't use equal-sign between tag and value.
* If there was an equal-sign, then there *must* be a value.
- * A value without an eqaul-sign is ok, but not required. */
+ * A value without an equal-sign is ok, but not required. */
return !had_equal || had_value;
}
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 905c9f76..255f2053 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -1218,7 +1218,7 @@ resize_and_retry:
}
/* Mac OS 10.6 doesn't have kCTTypesetterOptionForcedEmbeddingLevel,
- * or if it does, it doesn't resepct it. So we get runs with wrong
+ * or if it does, it doesn't respect it. So we get runs with wrong
* directions. As such, disable the assert... It wouldn't crash, but
* cursoring will be off...
*
diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index 0674ef9b..5429255a 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -370,7 +370,7 @@ public:
{
if (textPosition == 0 || textPosition > mTextLength) {
// Either there is no text before here (== 0), or this
- // is an invalid position. The query is considered valid thouh.
+ // is an invalid position. The query is considered valid though.
*textString = nullptr;
*textLength = 0;
}
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 1c526cf3..fc4b1122 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -58,7 +58,7 @@
*
* - In the future, we should add constructors to create fonts in font space?
*
- * - FT_Load_Glyph() is exteremely costly. Do something about it?
+ * - FT_Load_Glyph() is extremely costly. Do something about it?
*/
diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index 62aaae9e..3b55b475 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -80,7 +80,7 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s
p->tag = tag;
/* TODO Not thread-safe, but fairly harmless.
- * We can do the double-chcked pointer cmpexch thing here. */
+ * We can do the double-checked pointer cmpexch thing here. */
p->next = face_data->tlist;
face_data->tlist = p;
}
diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index 31c436a0..8bf69a37 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -299,7 +299,7 @@ struct FeatureParamsSize
* better.
*
* Assume that the offset to the size feature is according to specification,
- * and make the following value checks. If it fails, assume the the size
+ * and make the following value checks. If it fails, assume the size
* feature is calculated as versions of MakeOTF before the AFDKO 2.0 built it.
* If this fails, reject the 'size' feature. The older makeOTF's calculated the
* offset from the beginning of the FeatureList table, rather than from the
commit 148ca61075d821a09e42e2c75fbc9be47cfc6003
Author: Bruce Mitchener <bruce.mitchener at gmail.com>
Date: Wed Jan 31 22:24:51 2018 +0700
[ot-layout] Fix nullptr dereference.
If the `calloc` for `gsub_accels` or `gpos_accels` fails, then the
unlikely branch afterwards can be taken, which frees up the
`hb_ot_layout_t`, but since those fields can now be `nullptr`, then
we don't want to dereference them.
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 919ecbb4..e93fc078 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -195,10 +195,12 @@ _hb_ot_layout_create (hb_face_t *face)
void
_hb_ot_layout_destroy (hb_ot_layout_t *layout)
{
- for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
- layout->gsub_accels[i].fini ();
- for (unsigned int i = 0; i < layout->gpos_lookup_count; i++)
- layout->gpos_accels[i].fini ();
+ if (layout->gsub_accels)
+ for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
+ layout->gsub_accels[i].fini ();
+ if (layout->gpos_accels)
+ for (unsigned int i = 0; i < layout->gpos_lookup_count; i++)
+ layout->gpos_accels[i].fini ();
free (layout->gsub_accels);
free (layout->gpos_accels);
commit 0c66043a924fd114017a862d2cacd70f64b92370
Author: Bruce Mitchener <bruce.mitchener at gmail.com>
Date: Wed Jan 31 20:24:27 2018 +0700
[coretext] Fix memory leaks.
In `reference_table`, if the data is empty and we return early,
we still need to release the data object.
In `hb_coretext_shape`, there two edge cases where an early
return should release the attributed string.
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 44020176..905c9f76 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -74,7 +74,10 @@ reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
const char *data = reinterpret_cast<const char*> (CFDataGetBytePtr (cf_data));
const size_t length = CFDataGetLength (cf_data);
if (!data || !length)
+ {
+ CFRelease (cf_data);
return nullptr;
+ }
return hb_blob_create (data, length, HB_MEMORY_MODE_READONLY,
reinterpret_cast<void *> (const_cast<__CFData *> (cf_data)),
@@ -877,7 +880,10 @@ resize_and_retry:
kCFStringEncodingUTF8,
kCFAllocatorNull);
if (unlikely (!lang))
+ {
+ CFRelease (attr_string);
FAIL ("CFStringCreateWithCStringNoCopy failed");
+ }
CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len),
kCTLanguageAttributeName, lang);
CFRelease (lang);
@@ -946,7 +952,10 @@ resize_and_retry:
&kCFTypeDictionaryValueCallBacks);
CFRelease (level_number);
if (unlikely (!options))
+ {
+ CFRelease (attr_string);
FAIL ("CFDictionaryCreate failed");
+ }
CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedStringAndOptions (attr_string, options);
CFRelease (options);
More information about the HarfBuzz
mailing list