rsaenh: Remove unneeded casts

Andrew Talbot andrew.talbot at talbotville.com
Thu Jan 17 16:06:36 CST 2008


Changelog:
    rsaenh: Remove unneeded casts.

diff --git a/dlls/rsaenh/handle.c b/dlls/rsaenh/handle.c
index fc4c717..0773813 100644
--- a/dlls/rsaenh/handle.c
+++ b/dlls/rsaenh/handle.c
@@ -193,10 +193,10 @@ int alloc_handle_table(HANDLETABLE **lplpTable)
 int release_handle_table(HANDLETABLE *lpTable) 
 {
     TRACE("(lpTable=%p)\n", lpTable);
-        
+
     release_all_handles(lpTable);
     destroy_handle_table(lpTable);
-    return (int)HeapFree(GetProcessHeap(), 0, lpTable);
+    return HeapFree(GetProcessHeap(), 0, lpTable);
 }
 
 /******************************************************************************
diff --git a/dlls/rsaenh/md2.c b/dlls/rsaenh/md2.c
index 947a359..a3cc768 100644
--- a/dlls/rsaenh/md2.c
+++ b/dlls/rsaenh/md2.c
@@ -62,7 +62,7 @@ static void md2_update_chksum(md2_state *md2)
 /* caution, the RFC says its "C[j] = S[M[i*16+j] xor L]" but the reference source code [and test vectors] say 
    otherwise.
 */
-       L = (md2->chksum[j] ^= PI_SUBST[(int)(md2->buf[j] ^ L)] & 255);
+       L = (md2->chksum[j] ^= PI_SUBST[md2->buf[j] ^ L] & 255);
    }
 }
 
@@ -82,7 +82,7 @@ static void md2_compress(md2_state *md2)
    /* do 18 rounds */
    for (j = 0; j < 18; j++) {
        for (k = 0; k < 48; k++) {
-           t = (md2->X[k] ^= PI_SUBST[(int)(t & 255)]);
+           t = (md2->X[k] ^= PI_SUBST[t & 255]);
        }
        t = (t + (unsigned char)j) & 255;
    }
diff --git a/dlls/rsaenh/mpi.c b/dlls/rsaenh/mpi.c
index c6f083b..9e24fc6 100644
--- a/dlls/rsaenh/mpi.c
+++ b/dlls/rsaenh/mpi.c
@@ -1069,7 +1069,7 @@ int mp_div (const mp_int * a, const mp_int * b, mp_int * c, mp_int * d)
 
   /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */
   norm = mp_count_bits(&y) % DIGIT_BIT;
-  if (norm < (int)(DIGIT_BIT-1)) {
+  if (norm < DIGIT_BIT-1) {
      norm = (DIGIT_BIT-1) - norm;
      if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) {
        goto __Y;
@@ -1285,7 +1285,7 @@ int mp_div_2d (const mp_int * a, int b, mp_int * c, mp_int * d)
   }
 
   /* shift by as many digits in the bit count */
-  if (b >= (int)DIGIT_BIT) {
+  if (b >= DIGIT_BIT) {
     mp_rshd (c, b / DIGIT_BIT);
   }
 
@@ -1390,9 +1390,9 @@ int mp_div_d (const mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
       } else {
         t = 0;
       }
-      q.dp[ix] = (mp_digit)t;
+      q.dp[ix] = t;
   }
-  
+
   if (d != NULL) {
      *d = (mp_digit)w;
   }
@@ -1710,11 +1710,11 @@ mp_exptmod_fast (const mp_int * G, const mp_int * X, mp_int * P, mp_int * Y, int
       }
       /* read next digit and reset bitcnt */
       buf    = X->dp[digidx--];
-      bitcnt = (int)DIGIT_BIT;
+      bitcnt = DIGIT_BIT;
     }
 
     /* grab the next msb from the exponent */
-    y     = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1;
+    y     = (buf >> (DIGIT_BIT - 1)) & 1;
     buf <<= (mp_digit)1;
 
     /* if the bit is zero and mode == 0 then we ignore it
@@ -2609,7 +2609,7 @@ mp_mod_2d (const mp_int * a, int b, mp_int * c)
   }
 
   /* if the modulus is larger than the value than return */
-  if (b > (int) (a->used * DIGIT_BIT)) {
+  if (b > a->used * DIGIT_BIT) {
     res = mp_copy (a, c);
     return res;
   }
@@ -2625,7 +2625,7 @@ mp_mod_2d (const mp_int * a, int b, mp_int * c)
   }
   /* clear the digit that is not completely outside/inside the modulus */
   c->dp[b / DIGIT_BIT] &=
-    (mp_digit) ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1));
+    ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1));
   mp_clamp (c);
   return MP_OKAY;
 }
@@ -2661,7 +2661,7 @@ int mp_montgomery_calc_normalization (mp_int * a, const mp_int * b)
 
 
   /* now compute C = A * B mod b */
-  for (x = bits - 1; x < (int)DIGIT_BIT; x++) {
+  for (x = bits - 1; x < DIGIT_BIT; x++) {
     if ((res = mp_mul_2 (a, a)) != MP_OKAY) {
       return res;
     }
@@ -2907,14 +2907,14 @@ int mp_mul_2d (const mp_int * a, int b, mp_int * c)
      }
   }
 
-  if (c->alloc < (int)(c->used + b/DIGIT_BIT + 1)) {
+  if (c->alloc < c->used + b/DIGIT_BIT + 1) {
      if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) {
        return res;
      }
   }
 
   /* shift by as many digits in the bit count */
-  if (b >= (int)DIGIT_BIT) {
+  if (b >= DIGIT_BIT) {
     if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) {
       return res;
     }
@@ -4068,7 +4068,7 @@ int s_mp_exptmod (const mp_int * G, const mp_int * X, mp_int * P, mp_int * Y)
       }
       /* read next digit and reset the bitcnt */
       buf    = X->dp[digidx--];
-      bitcnt = (int) DIGIT_BIT;
+      bitcnt = DIGIT_BIT;
     }
 
     /* grab the next msb from the exponent */
diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c
index 29e072c..1f0e0b2 100644
--- a/dlls/rsaenh/rsaenh.c
+++ b/dlls/rsaenh/rsaenh.c
@@ -828,8 +828,8 @@ static HCRYPTKEY new_key(HCRYPTPROV hProv, ALG_ID aiAlgid, DWORD dwFlags, CRYPTK
             }
     }
 
-    hCryptKey = (HCRYPTKEY)new_object(&handle_table, sizeof(CRYPTKEY), RSAENH_MAGIC_KEY, 
-                                      destroy_key, (OBJECTHDR**)&pCryptKey);
+    hCryptKey = new_object(&handle_table, sizeof(CRYPTKEY), RSAENH_MAGIC_KEY,
+                           destroy_key, (OBJECTHDR**)&pCryptKey);
     if (hCryptKey != (HCRYPTKEY)INVALID_HANDLE_VALUE)
     {
         pCryptKey->aiAlgid = aiAlgid;
@@ -1095,8 +1095,8 @@ static HCRYPTPROV new_key_container(PCCH pszContainerName, DWORD dwFlags, const
     KEYCONTAINER *pKeyContainer;
     HCRYPTPROV hKeyContainer;
 
-    hKeyContainer = (HCRYPTPROV)new_object(&handle_table, sizeof(KEYCONTAINER), RSAENH_MAGIC_CONTAINER,
-                                           destroy_key_container, (OBJECTHDR**)&pKeyContainer);
+    hKeyContainer = new_object(&handle_table, sizeof(KEYCONTAINER), RSAENH_MAGIC_CONTAINER,
+                               destroy_key_container, (OBJECTHDR**)&pKeyContainer);
     if (hKeyContainer != (HCRYPTPROV)INVALID_HANDLE_VALUE)
     {
         lstrcpynA(pKeyContainer->szName, pszContainerName, MAX_PATH);
@@ -1670,10 +1670,10 @@ BOOL WINAPI RSAENH_CPCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
         }
     }
 
-    *phHash = (HCRYPTHASH)new_object(&handle_table, sizeof(CRYPTHASH), RSAENH_MAGIC_HASH,
-                                     destroy_hash, (OBJECTHDR**)&pCryptHash);
+    *phHash = new_object(&handle_table, sizeof(CRYPTHASH), RSAENH_MAGIC_HASH,
+                         destroy_hash, (OBJECTHDR**)&pCryptHash);
     if (!pCryptHash) return FALSE;
-    
+
     pCryptHash->aiAlgid = Algid;
     pCryptHash->hKey = hKey;
     pCryptHash->hProv = hProv;
@@ -1834,8 +1834,8 @@ BOOL WINAPI RSAENH_CPDuplicateHash(HCRYPTPROV hUID, HCRYPTHASH hHash, DWORD *pdw
         return FALSE;
     }
 
-    *phHash = (HCRYPTHASH)new_object(&handle_table, sizeof(CRYPTHASH), RSAENH_MAGIC_HASH, 
-                                     destroy_hash, (OBJECTHDR**)&pDestHash);
+    *phHash = new_object(&handle_table, sizeof(CRYPTHASH), RSAENH_MAGIC_HASH,
+                         destroy_hash, (OBJECTHDR**)&pDestHash);
     if (*phHash != (HCRYPTHASH)INVALID_HANDLE_VALUE)
     {
         memcpy(pDestHash, pSrcHash, sizeof(CRYPTHASH));
@@ -1890,8 +1890,8 @@ BOOL WINAPI RSAENH_CPDuplicateKey(HCRYPTPROV hUID, HCRYPTKEY hKey, DWORD *pdwRes
         return FALSE;
     }
 
-    *phKey = (HCRYPTKEY)new_object(&handle_table, sizeof(CRYPTKEY), RSAENH_MAGIC_KEY, destroy_key, 
-                                   (OBJECTHDR**)&pDestKey);
+    *phKey = new_object(&handle_table, sizeof(CRYPTKEY), RSAENH_MAGIC_KEY, destroy_key,
+                        (OBJECTHDR**)&pDestKey);
     if (*phKey != (HCRYPTKEY)INVALID_HANDLE_VALUE)
     {
         memcpy(pDestKey, pSrcKey, sizeof(CRYPTKEY));



More information about the wine-patches mailing list