[gimp] libgimpbase: new gimp_parasite_get_data().
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpbase: new gimp_parasite_get_data().
- Date: Thu, 7 Jan 2021 21:03:29 +0000 (UTC)
commit 3e25ea532e092b61a0b3215d90faa5296d582214
Author: Jehan <jehan girinstud io>
Date: Wed Apr 22 14:49:33 2020 +0200
libgimpbase: new gimp_parasite_get_data().
libgimpbase/gimpparasite.c | 24 ++++++++++++++++++++++++
libgimpbase/gimpparasite.h | 2 ++
2 files changed, 26 insertions(+)
---
diff --git a/libgimpbase/gimpparasite.c b/libgimpbase/gimpparasite.c
index cd4cf43dfd..acdf2f4a6b 100644
--- a/libgimpbase/gimpparasite.c
+++ b/libgimpbase/gimpparasite.c
@@ -443,3 +443,27 @@ gimp_parasite_data_size (const GimpParasite *parasite)
return 0;
}
+
+/**
+ * gimp_parasite_get_data:
+ * @parasite: a #GimpParasite
+ * @num_bytes: (out): size of the returned data.
+ *
+ * Gets the parasite's data. It may not necessarily be text, nor is it
+ * guaranteed to be %NULL-terminated. It is your responsibility to know
+ * how to deal with this data.
+ *
+ * Returns: (array length=num_bytes) (element-type char): parasite's data.
+ */
+gconstpointer
+gimp_parasite_get_data (const GimpParasite *parasite,
+ gint *num_bytes)
+{
+ if (parasite)
+ {
+ *num_bytes = parasite->size;
+ return parasite->data;
+ }
+
+ return NULL;
+}
diff --git a/libgimpbase/gimpparasite.h b/libgimpbase/gimpparasite.h
index 0d550ba3ec..25ba74be56 100644
--- a/libgimpbase/gimpparasite.h
+++ b/libgimpbase/gimpparasite.h
@@ -109,6 +109,8 @@ const gchar * gimp_parasite_name (const GimpParasite *parasite);
gconstpointer gimp_parasite_data (const GimpParasite *parasite);
glong gimp_parasite_data_size (const GimpParasite *parasite);
+gconstpointer gimp_parasite_get_data (const GimpParasite *parasite,
+ gint *num_bytes);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]