[gnome-builder] plugins: be more careful about priority overflow
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins: be more careful about priority overflow
- Date: Mon, 13 May 2019 20:46:20 +0000 (UTC)
commit 16e71e9fb8743dc3456801e84976e8ada18261c3
Author: Christian Hergert <chergert redhat com>
Date: Mon May 13 13:38:54 2019 -0700
plugins: be more careful about priority overflow
src/libide/gui/ide-workbench.c | 7 ++++++-
src/libide/plugins/ide-extension-set-adapter.c | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/gui/ide-workbench.c b/src/libide/gui/ide-workbench.c
index 35aa809f2..532e81015 100644
--- a/src/libide/gui/ide-workbench.c
+++ b/src/libide/gui/ide-workbench.c
@@ -1872,7 +1872,12 @@ sort_by_priority (gconstpointer a,
if (!ide_workbench_addin_can_open (addin_b, o->file, o->content_type, &prio_b))
return -1;
- return prio_a - prio_b;
+ if (prio_a < prio_b)
+ return -1;
+ else if (prio_a > prio_b)
+ return 1;
+ else
+ return 0;
}
static void
diff --git a/src/libide/plugins/ide-extension-set-adapter.c b/src/libide/plugins/ide-extension-set-adapter.c
index d4586b1f6..77a54a9f1 100644
--- a/src/libide/plugins/ide-extension-set-adapter.c
+++ b/src/libide/plugins/ide-extension-set-adapter.c
@@ -678,7 +678,12 @@ sort_by_priority (gconstpointer a,
/* Greater values are higher priority */
- return sb->priority - sa->priority;
+ if (sa->priority < sb->priority)
+ return -1;
+ else if (sa->priority > sb->priority)
+ return 1;
+ else
+ return 0;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]