Commit c8dced17 authored by Niels Möller's avatar Niels Möller
Browse files

* sexp.c (encode_base64): Bug fix (don't use several ++ in an

expression without sequence points).

Rev: src/sexp.c:1.9
parent 478124af
...@@ -522,11 +522,11 @@ struct lsh_string *encode_base64(struct lsh_string *s, ...@@ -522,11 +522,11 @@ struct lsh_string *encode_base64(struct lsh_string *s,
unsigned i; unsigned i;
/* Loop over all but the last group. */ /* Loop over all but the last group. */
for (i=0; i<full_groups; dst += 4, i++) for (i=0; i<full_groups; dst += 4, src += 3, i++)
{ {
encode_base64_group( ( (*src++) << 16) encode_base64_group( (src[0] << 16)
| ( (*src++) << 8) | (src[1] << 8)
| (*src++), dst); | src[2], dst);
} }
} }
switch(last) switch(last)
...@@ -535,14 +535,14 @@ struct lsh_string *encode_base64(struct lsh_string *s, ...@@ -535,14 +535,14 @@ struct lsh_string *encode_base64(struct lsh_string *s,
/* Finished */ /* Finished */
break; break;
case 1: case 1:
encode_base64_group( (*src++) << 16, dst); encode_base64_group( src[0] << 16, dst);
dst += 2; dst += 2;
*dst++ = '='; *dst++ = '=';
*dst++ = '='; *dst++ = '=';
break; break;
case 2: case 2:
encode_base64_group( ( (*src++) << 16) encode_base64_group( (src[0] << 16)
| ( (*src++) << 8), dst); | (src[1] << 8), dst);
dst += 3; dst += 3;
*dst++ = '='; *dst++ = '=';
break; break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment