]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
country: Fix comparison function
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 17 Oct 2019 15:45:19 +0000 (15:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 17 Oct 2019 15:54:50 +0000 (15:54 +0000)
This return value was incorrect which caused that sorting
countries did not work and therefore could not been found
in the database any more.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.c

index d19bf7c140bc3ded8b7fb51641b73dba3f66deaf..862fe75dffdf65a1dedd6be990af1f755c5a85ca 100644 (file)
@@ -664,7 +664,7 @@ LOC_EXPORT int loc_database_get_country(struct loc_database* db,
                // adjust our search pointers
                loc_country_unref(*country);
 
                // adjust our search pointers
                loc_country_unref(*country);
 
-               if (result < 0) {
+               if (result > 0) {
                        lo = i + 1;
                } else
                        hi = i - 1;
                        lo = i + 1;
                } else
                        hi = i - 1;