Ver Fonte

tlsauthentication.c: inelegant mute of compiler warning

Evgeny Grin (Karlson2k) há 4 anos atrás
pai
commit
40501c2f5d
1 ficheiros alterados com 4 adições e 2 exclusões
  1. 4 2
      doc/examples/tlsauthentication.c

+ 4 - 2
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;
 }