aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GlobalLib.cpp2
-rw-r--r--src/VersionParser.cpp20
2 files changed, 14 insertions, 8 deletions
diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp
index 61e6648..2dd829f 100644
--- a/src/GlobalLib.cpp
+++ b/src/GlobalLib.cpp
@@ -54,7 +54,7 @@ namespace sibs
for(PackageListDependency *globalLibDependency : libs)
{
if(!parentConfig.packaging)
- printf("Dependency %s is missing from pkg-config, trying global lib\n", globalLibDependency->name.c_str());
+ printf("Dependency %s in version range %s is missing from pkg-config, trying global lib\n", globalLibDependency->name.c_str(), globalLibDependency->version.toString().c_str());
Result<bool> globalLibLinkerFlagsResult = GlobalLib::getLibsLinkerFlags(parentConfig, globalLibRootDir, globalLibDependency->name, globalLibDependency->version, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallbackFunc, globalIncludeDirCallback);
if(!globalLibLinkerFlagsResult)
{
diff --git a/src/VersionParser.cpp b/src/VersionParser.cpp
index 7b28cef..eccd109 100644
--- a/src/VersionParser.cpp
+++ b/src/VersionParser.cpp
@@ -6,13 +6,9 @@ namespace sibs
static int stringToIntNoVerify(const StringView &str)
{
int result = 0;
- if(str.size > 0)
- result += (str[0] - '0');
-
- for(int i = 1; i < (int)str.size; ++i)
+ for(usize i = 0; i < str.size; ++i)
{
- int num = str[i] - '0';
- result += (10 * ((int)str.size - i) * num);
+ result = (result * 10) + (str[i] - '0');
}
return result;
}
@@ -202,6 +198,16 @@ namespace sibs
{
if(!versionRange.startDefined)
return Result<PackageVersionRange>::Err("version can't be empty");
+
+ if(versionRange.startOperation == VersionOperation::NONE)
+ {
+ versionRange.startOperation = VersionOperation::GREATER_EQUAL;
+ versionRange.end.major = versionRange.start.major + 1;
+ versionRange.end.minor = 0;
+ versionRange.end.patch = 0;
+ versionRange.endOperation = VersionOperation::LESS;
+ versionRange.endDefined = true;
+ }
return Result<PackageVersionRange>::Ok(versionRange);
}
else if(token == VersionToken::INVALID)
@@ -246,7 +252,7 @@ namespace sibs
VersionToken token = tokenizer.next();
if(token == VersionToken::VERSION_NUMBER)
{
- versionRange.startOperation = VersionOperation::GREATER_EQUAL;
+ versionRange.startOperation = VersionOperation::NONE;
versionRange.start = tokenizer.version;
versionRange.startDefined = true;
token = tokenizer.next();