apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <mt...@apache.org>
Subject [PATCH] suppress compile time warnings for sha2.c
Date Fri, 27 Aug 2004 09:08:37 GMT
The patch suppresses compile time warnings
about 64->32 bit assignment.


Index: sha2.c
===================================================================
RCS file: /home/cvspublic/apr/random/unix/sha2.c,v
retrieving revision 1.6
diff -u -r1.6 sha2.c
--- sha2.c	28 Feb 2004 18:31:41 -0000	1.6
+++ sha2.c	27 Aug 2004 09:04:43 -0000
@@ -458,7 +458,7 @@
          /* 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 +504,7 @@

          /* 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 +780,7 @@
          /* 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 +820,7 @@
  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]);





Regards,
MT.


Mime
View raw message