Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Tue, 17 Oct 2023 14:26:00 UTC Commit: d5f345fd63d12e7ce65f7417b4ca7e7df8205dde https://github.com/geany/geany-plugins/commit/d5f345fd63d12e7ce65f7417b4ca7e...
Log Message: ----------- updatechecker: Fix logic comparing version numbers
The condition is wrong and for version 2.0 it will constantly report there's an update available when upgrading from 1.x (where x > 0).
Modified Paths: -------------- updatechecker/src/updatechecker.c
Modified: updatechecker/src/updatechecker.c 22 lines changed, 14 insertions(+), 8 deletions(-) =================================================================== @@ -166,16 +166,22 @@ version_compare(const gchar *current_version) parse_version_string(current_version, &geany_current.major, &geany_current.minor, &geany_current.mini, &geany_current.extra);
- if ((geany_running.major < geany_current.major) || - (geany_running.minor < geany_current.minor) || - (geany_running.minor < geany_current.minor)) - { + if (geany_running.major < geany_current.major) return TRUE; - } - else - { + if (geany_running.major > geany_current.major) return FALSE; - } + + if (geany_running.minor < geany_current.minor) + return TRUE; + if (geany_running.minor > geany_current.minor) + return FALSE; + + if (geany_running.mini < geany_current.mini) + return TRUE; + if (geany_running.mini > geany_current.mini) + return FALSE; + + return FALSE; }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org