summaryrefslogtreecommitdiff
path: root/toxcore/network.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2019-01-12 13:12:39 +0000
committeriphydf <iphydf@users.noreply.github.com>2019-01-12 13:12:39 +0000
commit91ff39599d97d610321970161ba6410f3bdd9b51 (patch)
tree30ada73995b857c9bde65a577427db4199426692 /toxcore/network.c
parent3dd31b1fd06a39a460e259ad525449b7f64e4a70 (diff)
Implement all min/max functions for (un)signed int types.
Also, use them in the `onion_client` module.
Diffstat (limited to 'toxcore/network.c')
-rw-r--r--toxcore/network.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toxcore/network.c b/toxcore/network.c
index ca363efa..5e5160d8 100644
--- a/toxcore/network.c
+++ b/toxcore/network.c
@@ -433,13 +433,13 @@ static void loglogdata(const Logger *log, const char *message, const uint8_t *bu
433 int error = net_error(); 433 int error = net_error();
434 const char *strerror = net_new_strerror(error); 434 const char *strerror = net_new_strerror(error);
435 LOGGER_TRACE(log, "[%2u] %s %3u%c %s:%u (%u: %s) | %04x%04x", 435 LOGGER_TRACE(log, "[%2u] %s %3u%c %s:%u (%u: %s) | %04x%04x",
436 buffer[0], message, (buflen < 999 ? buflen : 999), 'E', 436 buffer[0], message, min_u16(buflen, 999), 'E',
437 ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), error, 437 ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), error,
438 strerror, data_0(buflen, buffer), data_1(buflen, buffer)); 438 strerror, data_0(buflen, buffer), data_1(buflen, buffer));
439 net_kill_strerror(strerror); 439 net_kill_strerror(strerror);
440 } else if ((res > 0) && ((size_t)res <= buflen)) { 440 } else if ((res > 0) && ((size_t)res <= buflen)) {
441 LOGGER_TRACE(log, "[%2u] %s %3u%c %s:%u (%u: %s) | %04x%04x", 441 LOGGER_TRACE(log, "[%2u] %s %3u%c %s:%u (%u: %s) | %04x%04x",
442 buffer[0], message, (res < 999 ? res : 999), ((size_t)res < buflen ? '<' : '='), 442 buffer[0], message, min_u16(res, 999), ((size_t)res < buflen ? '<' : '='),
443 ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), 0, "OK", 443 ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), 0, "OK",
444 data_0(buflen, buffer), data_1(buflen, buffer)); 444 data_0(buflen, buffer), data_1(buflen, buffer));
445 } else { /* empty or overwrite */ 445 } else { /* empty or overwrite */