apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: svn commit: r124243 - /apr/apr/trunk/random/unix/sha2.c
Date Wed, 05 Jan 2005 19:21:02 GMT
Can I have a second set of eyes for a reality check before
I backport this compile-time cleanup?

Bill

At 01:01 PM 1/5/2005, wrowe@apache.org wrote:
>Author: wrowe
>Date: Wed Jan  5 11:01:20 2005
>New Revision: 124243
>
>URL: http://svn.apache.org/viewcvs?view=rev&rev=124243
>Log:
>
>  Clean up 4 extranious emits.  Because of the modulo operator, these
>  becomes safe casts to unsigned.
>
>Modified:
>   apr/apr/trunk/random/unix/sha2.c
>
>Modified: apr/apr/trunk/random/unix/sha2.c
>Url: http://svn.apache.org/viewcvs/apr/apr/trunk/random/unix/sha2.c?view=diff&rev=124243&p1=apr/apr/trunk/random/unix/sha2.c&r1=124242&p2=apr/apr/trunk/random/unix/sha2.c&r2=124243
>==============================================================================
>--- apr/apr/trunk/random/unix/sha2.c    (original)
>+++ apr/apr/trunk/random/unix/sha2.c    Wed Jan  5 11:01:20 2005
>@@ -458,7 +458,8 @@
>         /* Sanity check: */
>         assert(context != (SHA256_CTX*)0 && data != (sha2_byte*)0);
> 
>-        usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
>+        usedspace = (unsigned int)((context->bitcount >> 3) 
>+                                 % SHA256_BLOCK_LENGTH);
>         if (usedspace > 0) {
>                 /* Calculate how much free space is available in the buffer */
>                 freespace = SHA256_BLOCK_LENGTH - usedspace;
>@@ -504,7 +505,8 @@
> 
>         /* If no digest buffer is passed, we don't bother doing this: */
>         if (digest != (sha2_byte*)0) {
>-                usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
>+                usedspace = (unsigned int)((context->bitcount >> 3) 
>+                                         % SHA256_BLOCK_LENGTH);
> #if !APR_IS_BIGENDIAN
>                 /* Convert FROM host byte order */
>                 REVERSE64(context->bitcount,context->bitcount);
>@@ -780,7 +782,8 @@
>         /* Sanity check: */
>         assert(context != (SHA512_CTX*)0 && data != (sha2_byte*)0);
> 
>-        usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
>+        usedspace = (unsigned int)((context->bitcount[0] >> 3) 
>+                                 % SHA512_BLOCK_LENGTH);
>         if (usedspace > 0) {
>                 /* Calculate how much free space is available in the buffer */
>                 freespace = SHA512_BLOCK_LENGTH - usedspace;
>@@ -820,7 +823,8 @@
> void SHA512_Last(SHA512_CTX* context) {
>         unsigned int    usedspace;
> 
>-        usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
>+        usedspace = (unsigned int)((context->bitcount[0] >> 3) 
>+                                 % SHA512_BLOCK_LENGTH);
> #if !APR_IS_BIGENDIAN
>         /* Convert FROM host byte order */
>         REVERSE64(context->bitcount[0],context->bitcount[0]);



Mime
View raw message