summaryrefslogtreecommitdiff
path: root/src/version.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/version.c')
-rw-r--r--src/version.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/version.c b/src/version.c
index f6fc5af..7c1c0b4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -161,24 +161,32 @@ const char *apk_version_op_string(int mask)
}
}
-int apk_version_result_mask(const char *str)
+int apk_version_result_mask_blob(apk_blob_t op)
{
- int r = 0;
- switch (*str) {
- case '<':
- r = APK_VERSION_LESS;
- str++;
- break;
- case '>':
- r = APK_VERSION_GREATER;
- str++;
- break;
+ int i, r = 0;
+ for (i = 0; i < op.len; i++) {
+ switch (op.ptr[i]) {
+ case '<':
+ r |= APK_VERSION_LESS;
+ break;
+ case '>':
+ r |= APK_VERSION_GREATER;
+ break;
+ case '=':
+ r |= APK_VERSION_EQUAL;
+ break;
+ default:
+ return 0;
+ }
}
- if (*str == '=')
- r |= APK_VERSION_EQUAL;
return r;
}
+int apk_version_result_mask(const char *op)
+{
+ return apk_version_result_mask_blob(APK_BLOB_STR(op));
+}
+
int apk_version_validate(apk_blob_t ver)
{
int t = TOKEN_DIGIT;