Skip to content

Commit da92bb3

Browse files
authored
Merge pull request #106 from CyberShadow/pull-20230821-073531
deimos.openssl.opensslv: Fix parsing versions with suffixes
2 parents 1f88418 + 789a3f0 commit da92bb3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

source/deimos/openssl/opensslv.di

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ private OpenSSLVersionStruct parseOpenSSLVersion()(string textVersion)
8585

8686
v.text = textVersion;
8787

88+
textVersion = textVersion.splitter('-').front;
89+
8890
v.major = textVersion.splitter('.')
8991
.front.to!uint;
9092
assert (v.major >= 0);
@@ -115,6 +117,14 @@ private OpenSSLVersionStruct parseOpenSSLVersion()(string textVersion)
115117
return v;
116118
}
117119

120+
version (DeimosOpenSSLTest)
121+
{
122+
static assert(parseOpenSSLVersion("0.9.3") == OpenSSLVersionStruct("0.9.3", 0, 9, 3));
123+
static assert(parseOpenSSLVersion("3.0.10") == OpenSSLVersionStruct("3.0.10", 3, 0, 10));
124+
static assert(parseOpenSSLVersion("1.1.1v") == OpenSSLVersionStruct("1.1.1v", 1, 1, 1, 22));
125+
static assert(parseOpenSSLVersion("1.1.1o-freebsd") == OpenSSLVersionStruct("1.1.1o-freebsd", 1, 1, 1, 15));
126+
}
127+
118128
/* Numeric release version identifier:
119129
* MNNFFPPS: major minor fix patch status
120130
* The status nibble has one of the values 0 for development, 1 to e for betas

0 commit comments

Comments
 (0)