[gimp] app: make update detection more robust to string revision field.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make update detection more robust to string revision field.
- Date: Tue, 21 Jun 2022 20:35:31 +0000 (UTC)
commit b79d26f097cb71b49597d54af61091cf4611921d
Author: Jehan <jehan girinstud io>
Date: Tue Jun 21 22:31:36 2022 +0200
app: make update detection more robust to string revision field.
The "revision" field in the json file is supposed to be int. But I just
realized that it was set as string a few times, e.g. in Windows
installer revision 1 of GIMP 2.10.32. As a consequence, the revision 0
build was not able to detect the new revision.
I have now fixed the data in gimp-web repo (commit e7690e36), yet just
in case this ever happens again, I make the parsing code more robust by
accepting string revision, then properly converted to int.
app/gimp-update.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/app/gimp-update.c b/app/gimp-update.c
index d22e0a842e..2c46bc6c56 100644
--- a/app/gimp-update.c
+++ b/app/gimp-update.c
@@ -268,7 +268,14 @@ gimp_update_get_highest (JsonParser *parser,
/* These are optional data. */
if (json_object_has_member (build, "revision"))
- *build_revision = json_object_get_int_member (build, "revision");
+ {
+ if (g_strcmp0 (json_node_type_name (json_object_get_member (build, "revision")),
+ "String") == 0)
+ *build_revision = g_ascii_strtoull (json_object_get_string_member (build,
"revision"),
+ NULL, 10);
+ else
+ *build_revision = json_object_get_int_member (build, "revision");
+ }
if (json_object_has_member (build, "comment"))
*build_comment = g_strdup (json_object_get_string_member (build, "comment"));
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]