diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-01-01 13:47:27 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-01-01 13:47:27 +0100 |
commit | fa1d60ad91e7cdc007d19011bb79ea666b83b5e6 (patch) | |
tree | 4784cd4db7bc330a2f2120084f561f233882b55e /utils.c | |
parent | adc5d408b5d28e8c91d81d885ef1da2a9016f1cf (diff) |
minor cleanup
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 30 |
1 files changed, 12 insertions, 18 deletions
@@ -149,12 +149,10 @@ int uh_urlencode(char *buf, int blen, const char *src, int slen) int uh_b64decode(char *buf, int blen, const unsigned char *src, int slen) { - int i = 0; - int len = 0; - - unsigned int cin = 0; unsigned int cout = 0; - + unsigned int cin = 0; + int len = 0; + int i = 0; for (i = 0; (i <= slen) && (src[i] != 0); i++) { @@ -177,19 +175,15 @@ int uh_b64decode(char *buf, int blen, const unsigned char *src, int slen) cout = (cout << 6) | cin; - if ((i % 4) == 3) - { - if ((len + 3) < blen) - { - buf[len++] = (char)(cout >> 16); - buf[len++] = (char)(cout >> 8); - buf[len++] = (char)(cout); - } - else - { - break; - } - } + if ((i % 4) != 3) + continue; + + if ((len + 3) >= blen) + break; + + buf[len++] = (char)(cout >> 16); + buf[len++] = (char)(cout >> 8); + buf[len++] = (char)(cout); } buf[len++] = 0; |