aboutsummaryrefslogtreecommitdiff
path: root/libssh/base64.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-05-05 09:08:33 +0000
committerAndreas Schneider <mail@cynapses.org>2009-05-05 09:08:33 +0000
commitfb559c6ffd6ca9f09b0e4609efd3c38e6b51661d (patch)
treeb389929c04e12651416987a81270c81ac47131d4 /libssh/base64.c
parentf7d2040d5a7e2764bbe2983beab5e0e2bf3cbd9e (diff)
downloadlibssh-fb559c6ffd6ca9f09b0e4609efd3c38e6b51661d.tar.gz
libssh-fb559c6ffd6ca9f09b0e4609efd3c38e6b51661d.tar.xz
libssh-fb559c6ffd6ca9f09b0e4609efd3c38e6b51661d.zip
Fix the macros.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@741 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/base64.c')
-rw-r--r--libssh/base64.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libssh/base64.c b/libssh/base64.c
index 51563ef..4c6f92d 100644
--- a/libssh/base64.c
+++ b/libssh/base64.c
@@ -32,15 +32,15 @@ static char alphabet[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/" ;
-/* transformations */
-#define SET_A(n,i) do { n |= (i&63) <<18; } while (0)
-#define SET_B(n,i) do { n |= (i&63) <<12; } while (0)
-#define SET_C(n,i) do { n |= (i&63) << 6; } while (0)
-#define SET_D(n,i) do { n |= (i&63); } while (0)
-
-#define GET_A(n) ((n & 0xff0000) >> 16)
-#define GET_B(n) ((n & 0xff00) >> 8)
-#define GET_C(n) (n & 0xff)
+/* Transformations */
+#define SET_A(n, i) do { (n) |= ((i) & 63) <<18; } while (0)
+#define SET_B(n, i) do { (n) |= ((i) & 63) <<12; } while (0)
+#define SET_C(n, i) do { (n) |= ((i) & 63) << 6; } while (0)
+#define SET_D(n, i) do { (n) |= ((i) & 63); } while (0)
+
+#define GET_A(n) (((n) & 0xff0000) >> 16)
+#define GET_B(n) (((n) & 0xff00) >> 8)
+#define GET_C(n) ((n) & 0xff)
static int _base64_to_bin(unsigned char dest[3], const char *source, int num);
static int get_equals(char *string);