[gnome-photos] base-item: Sanity check the orientation values
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] base-item: Sanity check the orientation values
- Date: Sun, 26 Nov 2017 09:59:33 +0000 (UTC)
commit babe4085b6643b9d65203a79a484bfa12c47a72f
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Nov 24 08:22:13 2017 +0100
base-item: Sanity check the orientation values
Invalid values are not marked with a warning because all possible valid
values are not yet covered.
https://bugzilla.gnome.org/show_bug.cgi?id=781736
src/photos-base-item.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index f1c3952..6a0bd2d 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -55,6 +55,7 @@
#include "photos-pipeline.h"
#include "photos-print-notification.h"
#include "photos-print-operation.h"
+#include "photos-quarks.h"
#include "photos-query.h"
#include "photos-search-context.h"
#include "photos-single-item-job.h"
@@ -2795,6 +2796,13 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
orientation = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_ORIENTATION, NULL);
priv->orientation = g_quark_from_string (orientation);
+ if (priv->orientation != PHOTOS_ORIENTATION_BOTTOM
+ && priv->orientation != PHOTOS_ORIENTATION_LEFT
+ && priv->orientation != PHOTOS_ORIENTATION_RIGHT
+ && priv->orientation != PHOTOS_ORIENTATION_TOP)
+ {
+ priv->orientation = PHOTOS_ORIENTATION_TOP;
+ }
priv->exposure_time = tracker_sparql_cursor_get_double (cursor, PHOTOS_QUERY_COLUMNS_EXPOSURE_TIME);
priv->fnumber = tracker_sparql_cursor_get_double (cursor, PHOTOS_QUERY_COLUMNS_FNUMBER);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]