From 392eef7900fdedda28f9c3aff5b0434f963a7f86 Mon Sep 17 00:00:00 2001 From: iphydf Date: Wed, 18 Jul 2018 00:19:24 +0000 Subject: Correct the max hostname length constant. 256 bytes including NUL byte is confusing and makes for really annoying bindings to other languages that don't account for NUL bytes in their string length. We pass C strings, not byte arrays, for hostnames, so 255 makes more sense here. --- toxcore/tox.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'toxcore/tox.h') diff --git a/toxcore/tox.h b/toxcore/tox.h index 6a4df16d..40d37b0b 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -345,12 +345,12 @@ uint32_t tox_max_filename_length(void); /** * Maximum length of a hostname, e.g. proxy or bootstrap node names. * - * This length includes the NUL byte. Hostnames are NUL-terminated C strings, so - * they are 255 characters plus one NUL byte. + * This length does not include the NUL byte. Hostnames are NUL-terminated C + * strings, so they are 255 characters plus one NUL byte. * * @deprecated The macro will be removed in 0.3.0. Use the function instead. */ -#define TOX_MAX_HOSTNAME_LENGTH 256 +#define TOX_MAX_HOSTNAME_LENGTH 255 uint32_t tox_max_hostname_length(void); -- cgit v1.2.3