From 6876fd23ef84487c016e7be46d3deb7d1e695cef Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 18 Dec 2018 14:17:55 +0300 Subject: Fix standard_version constructors --- libbutl/standard-version.ixx | 17 +++++++++++------ libbutl/standard-version.mxx | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/libbutl/standard-version.ixx b/libbutl/standard-version.ixx index c488284..66dccba 100644 --- a/libbutl/standard-version.ixx +++ b/libbutl/standard-version.ixx @@ -70,6 +70,9 @@ namespace butl return version % 10000 == 1 && !snapshot () && !stub (); } + // Note: in the following constructors we subtract one from AAABBBCCC if + // DDDE is not zero (see standard-version.hxx for details). + // inline standard_version:: standard_version (std::uint16_t ep, std::uint16_t mj, @@ -82,7 +85,8 @@ namespace butl (mj * 10000000000ULL + mi * 10000000ULL + pa * 10000ULL + - pr * 10ULL), + pr * 10ULL - + (pr != 0 ? 10000ULL : 0ULL)), "" /* snapshot */, rv) { @@ -99,11 +103,12 @@ namespace butl std::uint16_t rv) : standard_version (ep, // AAABBBCCCDDDE - (mj * 10000000000ULL + - mi * 10000000ULL + - pa * 10000ULL + - pr * 10ULL + - /**/ 1ULL /* snapshot */), + (mj * 10000000000ULL + + mi * 10000000ULL + + pa * 10000ULL + + pr * 10ULL + + 1ULL /* snapshot */ - + 10000ULL), sn, si, rv) diff --git a/libbutl/standard-version.mxx b/libbutl/standard-version.mxx index 0415318..1cc557b 100644 --- a/libbutl/standard-version.mxx +++ b/libbutl/standard-version.mxx @@ -190,7 +190,7 @@ LIBBUTL_MODEXPORT namespace butl flags = none); // Version as separate major, minor, patch, and pre-release components. - // Note that the pre-release here is in the DDD form, that is, incremenetd + // Note that the pre-release here is in the DDD form, that is, incremented // by 500 for betas. // standard_version (std::uint16_t epoch, -- cgit v1.1