diff --git a/libssh/base64.c b/libssh/base64.c index 51563ef2..4c6f92d8 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) +/* 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) +#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);