sanity.c/sanity_check_lcms: incorrect semantic integer to major + minor parsing
With https://gitlab.gnome.org/GNOME/gimp/-/blob/GIMP_2_10_22/app/sanity.c#L394-408
> 394 if (LCMS_VERSION > lcms_version)
> 395 {
> 396 return g_strdup_printf
> 397 ("Liblcms2 version mismatch!\n\n"
> 398 "GIMP was compiled against LittleCMS version %d.%d, but the\n"
> 399 "LittleCMS version found at runtime is only %d.%d.\n\n"
> 400 "Somehow you or your software packager managed\n"
> 401 "to install a LittleCMS that is older than what GIMP was\n"
> 402 "built against.\n\n"
> 403 "Please make sure that the installed LittleCMS version\n"
> 404 "is at least %d.%d and that headers and library match.",
> 405 LCMS_VERSION / 1000, LCMS_VERSION % 100 / 10,
> 406 lcms_version / 1000, lcms_version % 100 / 10,
> 407 LCMS_VERSION / 1000, LCMS_VERSION % 100 / 10);
> 408 }
in a situation:
-
LCMS_VERSION = 2100
(as when built withlibcms2-devel-2.11
) -
lcms_version = 2090
(as when run withlcms2-2.9
)
the output message looks like:
Liblcms2 version mismatch!
GIMP was compiled against LittleCMS version 2.0, but the LittleCMS version found at runtime is only 2.9.
Somehow you or your software packager managed to install a LittleCMS that is older than what GIMP was built against.
Please make sure that the installed LittleCMS version is at least 2.0 and that headers and library match.
which doesn't make sense and is confusing at best.
I'd either ditch any semantic version parsing altogether (at least if there is no guiding correspondence, see below), or change it like this:
-LCMS_VERSION / 1000, LCMS_VERSION % 100 / 10
+LCMS_VERSION / 1000, LCMS_VERSION % 1000 / 10
but beware, as seen above, there is no tight correspondence,
since both libcms2-devel-2.10
and libcms2-devel-2.11
define LCMS_VERSION
as 2100
(at least on Fedora, and the
latter case might be just and accidental bump omission).
P.S. Maybe this was just a matter of copy-paste batch processing without paying attention to the actual version encoding, so perhaps other places would deserve this care as well.