From: Andreas Gruenbacher Date: Fri, 08 Jan 2010 13:40:00 GMT Subject: [PATCH 3/3] base85: Make the code more obvious instead of explaining the non-obvious Message-ID: <1262958000-27181-3-git-send-email-agruen@suse.de> In-Reply-To: Here is another cleanup ... Signed-off-by: Andreas Gruenbacher --- base85.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-) diff --git a/base85.c b/base85.c index 7204ce2..e459fee 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; -- 1.6.6.75.g37bae