commit 40501c2f5df002673237d1c8eead1cfd3111904c
parent 5feee053a2bb5207ac3f8c7581fae7e156d19615
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Wed, 25 Aug 2021 19:55:06 +0300
tlsauthentication.c: inelegant mute of compiler warning
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c
@@ -53,8 +53,10 @@ string_to_base64 (const char *message)
strncat (tmp, &lookup[l & 0x3F], 1);
}
- if (length % 3)
- strncat (tmp, "==", 3 - length % 3);
+ if (2 == length % 3)
+ strncat (tmp, "=", 1);
+ else if (1 == length % 3)
+ strncat (tmp, "==", 2);
return tmp;
}