From 3f78d84661b61c686c9b49a51ab742fb3484b4de Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 12 Sep 2013 13:37:11 +0000 Subject: Eliminate less-than-zero checks for unsigned variables * ext/bigdecimal/bigdecimal.c, ext/digest/md5/md5.c, ext/json/fbuffer/fbuffer.h, ext/json/generator/generator.c: Eliminate less-than-zero checks for unsigned variables. According to section 4.1.5 of C89 standard, size_t is an unsigned type. These checks were found with 'cppcheck' static analysis tool. [ruby-core:57117] [Feature #8890] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/digest/md5/md5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/digest') diff --git a/ext/digest/md5/md5.c b/ext/digest/md5/md5.c index 518f8239ed..8d7d33c5a6 100644 --- a/ext/digest/md5/md5.c +++ b/ext/digest/md5/md5.c @@ -368,7 +368,7 @@ MD5_Update(MD5_CTX *pms, const uint8_t *data, size_t nbytes) size_t offset = (pms->count[0] >> 3) & 63; uint32_t nbits = (uint32_t)(nbytes << 3); - if (nbytes <= 0) + if (nbytes == 0) return; /* Update the message length. */ -- cgit v1.2.3