Index: third_party/harfbuzz-ng/src/hb-blob.cc |
diff --git a/third_party/harfbuzz-ng/src/hb-blob.cc b/third_party/harfbuzz-ng/src/hb-blob.cc |
index f0d3b25274d2b0e239a0a98ea5bd966f421bac9a..da2509cbce0e21367d40c41bd26a3d0b58a508e1 100644 |
--- a/third_party/harfbuzz-ng/src/hb-blob.cc |
+++ b/third_party/harfbuzz-ng/src/hb-blob.cc |
@@ -79,6 +79,22 @@ _hb_blob_destroy_user_data (hb_blob_t *blob) |
} |
} |
+/** |
+ * hb_blob_create: (Xconstructor) |
+ * @data: (array length=length) (closure user_data) (destroy destroy) (scope notified) (transfer none): Pointer to blob data. |
+ * @length: Length of @data in bytes. |
+ * @mode: Memory mode for @data. |
+ * @user_data: Data parameter to pass to @destroy. |
+ * @destroy: Callback to call when @data is not needed anymore. |
+ * |
+ * Creates a new "blob" object wrapping @data. The @mode parameter is used |
+ * to negotiate ownership and lifecycle of @data. |
+ * |
+ * Return value: New blob, or the empty blob if something failed or if @length is |
+ * zero. Destroy with hb_blob_destroy(). |
+ * |
+ * Since: 1.0 |
+ **/ |
hb_blob_t * |
hb_blob_create (const char *data, |
unsigned int length, |
@@ -112,6 +128,26 @@ hb_blob_create (const char *data, |
return blob; |
} |
+/** |
+ * hb_blob_create_sub_blob: |
+ * @parent: Parent blob. |
+ * @offset: Start offset of sub-blob within @parent, in bytes. |
+ * @length: Length of sub-blob. |
+ * |
+ * Returns a blob that represents a range of bytes in @parent. The new |
+ * blob is always created with %HB_MEMORY_MODE_READONLY, meaning that it |
+ * will never modify data in the parent blob. The parent data is not |
+ * expected to be modified, and will result in undefined behavior if it |
+ * is. |
+ * |
+ * Makes @parent immutable. |
+ * |
+ * Return value: New blob, or the empty blob if something failed or if |
+ * @length is zero or @offset is beyond the end of @parent's data. Destroy |
+ * with hb_blob_destroy(). |
+ * |
+ * Since: 1.0 |
+ **/ |
hb_blob_t * |
hb_blob_create_sub_blob (hb_blob_t *parent, |
unsigned int offset, |
@@ -133,6 +169,17 @@ hb_blob_create_sub_blob (hb_blob_t *parent, |
return blob; |
} |
+/** |
+ * hb_blob_get_empty: |
+ * |
+ * Returns the singleton empty blob. |
+ * |
+ * See TODO:link object types for more information. |
+ * |
+ * Return value: (transfer full): the empty blob. |
+ * |
+ * Since: 1.0 |
+ **/ |
hb_blob_t * |
hb_blob_get_empty (void) |
{ |
@@ -152,12 +199,36 @@ hb_blob_get_empty (void) |
return const_cast<hb_blob_t *> (&_hb_blob_nil); |
} |
+/** |
+ * hb_blob_reference: (skip) |
+ * @blob: a blob. |
+ * |
+ * Increases the reference count on @blob. |
+ * |
+ * See TODO:link object types for more information. |
+ * |
+ * Return value: @blob. |
+ * |
+ * Since: 1.0 |
+ **/ |
hb_blob_t * |
hb_blob_reference (hb_blob_t *blob) |
{ |
return hb_object_reference (blob); |
} |
+/** |
+ * hb_blob_destroy: (skip) |
+ * @blob: a blob. |
+ * |
+ * Descreases 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. |
+ * |
+ * See TODO:link object types for more information. |
+ * |
+ * Since: 1.0 |
+ **/ |
void |
hb_blob_destroy (hb_blob_t *blob) |
{ |
@@ -168,6 +239,18 @@ hb_blob_destroy (hb_blob_t *blob) |
free (blob); |
} |
+/** |
+ * hb_blob_set_user_data: (skip) |
+ * @blob: a blob. |
+ * @key: key for data to set. |
+ * @data: data to set. |
+ * @destroy: callback to call when @data is not needed anymore. |
+ * @replace: whether to replace an existing data with the same key. |
+ * |
+ * Return value: |
+ * |
+ * Since: 1.0 |
+ **/ |
hb_bool_t |
hb_blob_set_user_data (hb_blob_t *blob, |
hb_user_data_key_t *key, |
@@ -178,6 +261,17 @@ hb_blob_set_user_data (hb_blob_t *blob, |
return hb_object_set_user_data (blob, key, data, destroy, replace); |
} |
+/** |
+ * hb_blob_get_user_data: (skip) |
+ * @blob: a blob. |
+ * @key: key for data to get. |
+ * |
+ * |
+ * |
+ * Return value: (transfer none): |
+ * |
+ * Since: 1.0 |
+ **/ |
void * |
hb_blob_get_user_data (hb_blob_t *blob, |
hb_user_data_key_t *key) |
@@ -186,6 +280,14 @@ hb_blob_get_user_data (hb_blob_t *blob, |
} |
+/** |
+ * hb_blob_make_immutable: |
+ * @blob: a blob. |
+ * |
+ * |
+ * |
+ * Since: 1.0 |
+ **/ |
void |
hb_blob_make_immutable (hb_blob_t *blob) |
{ |
@@ -195,6 +297,16 @@ hb_blob_make_immutable (hb_blob_t *blob) |
blob->immutable = true; |
} |
+/** |
+ * hb_blob_is_immutable: |
+ * @blob: a blob. |
+ * |
+ * |
+ * |
+ * Return value: TODO |
+ * |
+ * Since: 1.0 |
+ **/ |
hb_bool_t |
hb_blob_is_immutable (hb_blob_t *blob) |
{ |
@@ -202,12 +314,33 @@ hb_blob_is_immutable (hb_blob_t *blob) |
} |
+/** |
+ * hb_blob_get_length: |
+ * @blob: a blob. |
+ * |
+ * |
+ * |
+ * Return value: the length of blob data in bytes. |
+ * |
+ * Since: 1.0 |
+ **/ |
unsigned int |
hb_blob_get_length (hb_blob_t *blob) |
{ |
return blob->length; |
} |
+/** |
+ * hb_blob_get_data: |
+ * @blob: a blob. |
+ * @length: (out): |
+ * |
+ * |
+ * |
+ * Returns: (transfer none) (array length=length): |
+ * |
+ * Since: 1.0 |
+ **/ |
const char * |
hb_blob_get_data (hb_blob_t *blob, unsigned int *length) |
{ |
@@ -217,6 +350,22 @@ hb_blob_get_data (hb_blob_t *blob, unsigned int *length) |
return blob->data; |
} |
+/** |
+ * hb_blob_get_data_writable: |
+ * @blob: a blob. |
+ * @length: (out): output length of the writable data. |
+ * |
+ * Tries to make blob data writable (possibly copying it) and |
+ * return pointer to data. |
+ * |
+ * Fails if blob has been made immutable, or if memory allocation |
+ * fails. |
+ * |
+ * Returns: (transfer none) (array length=length): Writable blob data, |
+ * or %NULL if failed. |
+ * |
+ * Since: 1.0 |
+ **/ |
char * |
hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length) |
{ |
@@ -327,5 +476,3 @@ _try_writable (hb_blob_t *blob) |
return true; |
} |
- |
- |