From: Michael Tremer Date: Mon, 8 Jan 2018 18:36:49 +0000 (+0000) Subject: database: Make level variable unsigned (as used in log messages) X-Git-Tag: 0.9.0~100 X-Git-Url: http://git.ipfire.org/?p=location%2Flibloc.git;a=commitdiff_plain;h=f66f15e186169991e878ef834a89c06da387f03f database: Make level variable unsigned (as used in log messages) Signed-off-by: Michael Tremer --- diff --git a/examples/python/read-database.py b/examples/python/read-database.py index 2f59dec..28a2c6d 100644 --- a/examples/python/read-database.py +++ b/examples/python/read-database.py @@ -17,3 +17,6 @@ print(a) # Search for an IP address in the database n = d.lookup("8.8.8.8") print(n) + +n = d.lookup("2a07:1c44:5800:1234:1234:1234:1234:1234") +print(n) diff --git a/src/database.c b/src/database.c index 2d930a6..563546a 100644 --- a/src/database.c +++ b/src/database.c @@ -453,7 +453,7 @@ static int __loc_database_lookup_handle_leaf(struct loc_database* db, const stru // Returns the highest result available static int __loc_database_lookup_max(struct loc_database* db, const struct in6_addr* address, struct loc_network** network, struct in6_addr* network_address, - const struct loc_database_network_node_v0* node, int level) { + const struct loc_database_network_node_v0* node, unsigned int level) { // If the node is a leaf node, we end here if (__loc_database_node_is_leaf(node)) return __loc_database_lookup_handle_leaf(db, address, network, network_address, node); @@ -501,7 +501,7 @@ static int __loc_database_lookup_max(struct loc_database* db, const struct in6_a // Searches for an exact match along the path static int __loc_database_lookup(struct loc_database* db, const struct in6_addr* address, struct loc_network** network, struct in6_addr* network_address, - const struct loc_database_network_node_v0* node, int level) { + const struct loc_database_network_node_v0* node, unsigned int level) { // If the node is a leaf node, we end here if (__loc_database_node_is_leaf(node)) return __loc_database_lookup_handle_leaf(db, address, network, network_address, node);