From b51f6e4117164ce463370b27c21e0015584a623c Mon Sep 17 00:00:00 2001 From: Luke Ceddia Date: Wed, 9 Nov 2016 16:22:07 +1100 Subject: [PATCH] Fix comparisons involving empty strings and inequalities. --- internal/c/libqb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index 730f7794f..5e2a38302 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -8728,7 +8728,7 @@ int32 qbs_lessorequal(qbs *str1,qbs *str2){ //same process as lessthan, but we check to see if the lengths are equal here also. int32 i, limit, l1, l2; l1 = str1->len; l2 = str2->len; - if (!l1) return 0; //if the first string has no length then it HAS to be smaller or equal to the second + if (!l1) return -1; //if the first string has no length then it HAS to be smaller or equal to the second if (l1<=l2) limit = l1; else limit = l2; i=memcmp(str1->chr,str2->chr,limit); if (i<0) return -1; @@ -8740,7 +8740,7 @@ int32 qbs_greaterorequal(qbs *str2,qbs *str1){ //same process as for lessorequal; we just reverse the string order int32 i, limit, l1, l2; l1 = str1->len; l2 = str2->len; - if (!l1) return 0; + if (!l1) return -1; if (l1<=l2) limit = l1; else limit = l2; i=memcmp(str1->chr,str2->chr,limit); if (i<0) return -1;