[shotwell/wip/cleanup-facedetect: 4/15] Simplify FaceRect serializer
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/cleanup-facedetect: 4/15] Simplify FaceRect serializer
- Date: Sun, 14 Aug 2022 15:32:29 +0000 (UTC)
commit f7adf3f1c76a3d6ea2ae842b160200f6db23b285
Author: Jens Georg <mail jensge org>
Date: Sat Aug 13 17:55:57 2022 +0200
Simplify FaceRect serializer
Just ust GLibs Array2Variant function
subprojects/shotwell-facedetect/shotwell-facedetect.cpp | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/subprojects/shotwell-facedetect/shotwell-facedetect.cpp
b/subprojects/shotwell-facedetect/shotwell-facedetect.cpp
index cfca3e99..bb21a14b 100644
--- a/subprojects/shotwell-facedetect/shotwell-facedetect.cpp
+++ b/subprojects/shotwell-facedetect/shotwell-facedetect.cpp
@@ -21,14 +21,8 @@ const char* FACEDETECT_PATH = "/org/gnome/shotwell/faces";
GVariant *FaceRect::serialize() const
{
- GVariantBuilder *arr_builder = g_variant_builder_new(G_VARIANT_TYPE("ad"));
- for(std::vector<double>::const_iterator v = vec.begin(); v != vec.end(); v++) {
- GVariant *d = g_variant_new("d", *v);
- g_variant_builder_add(arr_builder, "d", d);
- }
- GVariant *vec = g_variant_new("ad", arr_builder);
- g_variant_builder_unref(arr_builder);
- return g_variant_new("(dddd@ad)", x, y, width, height, vec);
+ return g_variant_new("(dddd@ad)", x, y, width, height,
+ g_variant_new_fixed_array(G_VARIANT_TYPE_DOUBLE, vec.data(), vec.size(),
sizeof(double)));
}
// DBus binding functions
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]