Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2010-01-08 16:40:00 +0300
committerJunio C Hamano <gitster@pobox.com>2010-01-10 09:43:47 +0300
commit0606c36a73449e76d8f6133253c1eff291ee8c97 (patch)
tree2ec75efa7aff370eecab0acaaf0431855b83b4b3 /base85.c
parentb0bec518aa4a90485c411cebc7260425271af949 (diff)
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.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/base85.c b/base85.c
index f2b9a24d5e..24ddf60eb0 100644
--- a/base85.c
+++ b/base85.c
@@ -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;