diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2010-01-08 14:40:00 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-09 22:43:47 -0800 |
commit | 0606c36a73449e76d8f6133253c1eff291ee8c97 (patch) | |
tree | 2ec75efa7aff370eecab0acaaf0431855b83b4b3 /base85.c | |
parent | b0bec518aa4a90485c411cebc7260425271af949 (diff) | |
download | git-0606c36a73449e76d8f6133253c1eff291ee8c97.tar.gz git-0606c36a73449e76d8f6133253c1eff291ee8c97.tar.xz |
base85: Make the code more obvious instead of explaining the non-obvious
Here is another cleanup ...
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'base85.c')
-rw-r--r-- | base85.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -57,14 +57,8 @@ int decode_85(char *dst, const char *buffer, int len) de = de85[ch]; if (--de < 0) return error("invalid base85 alphabet %c", ch); - /* - * Detect overflow. The largest - * 5-letter possible is "|NsC0" to - * encode 0xffffffff, and "|NsC" gives - * 0x03030303 at this point (i.e. - * 0xffffffff = 0x03030303 * 85). - */ - if (0x03030303 < acc || + /* Detect overflow. */ + if (0xffffffff / 85 < acc || 0xffffffff - de < (acc *= 85)) return error("invalid base85 sequence %.5s", buffer-5); acc += de; |