secur32: Remove superfluous pointer casts.

Michael Stefaniuc mstefani at redhat.de
Thu Jan 22 02:52:28 CST 2009


---
 dlls/secur32/ntlm.c     |   15 +++++++--------
 dlls/secur32/schannel.c |   14 +++++++-------
 dlls/secur32/util.c     |    2 +-
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/dlls/secur32/ntlm.c b/dlls/secur32/ntlm.c
index bc44a45..38c5134 100644
--- a/dlls/secur32/ntlm.c
+++ b/dlls/secur32/ntlm.c
@@ -181,8 +181,7 @@ static SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleW(
 
                 if(pAuthData != NULL)
                 {
-                    PSEC_WINNT_AUTH_IDENTITY_W auth_data =
-                        (PSEC_WINNT_AUTH_IDENTITY_W)pAuthData;
+                    PSEC_WINNT_AUTH_IDENTITY_W auth_data = pAuthData;
 
                     TRACE("Username is %s\n", debugstr_wn(auth_data->User, auth_data->UserLength));
                     TRACE("Domain name is %s\n", debugstr_wn(auth_data->Domain, auth_data->DomainLength));
@@ -262,8 +261,8 @@ static SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleA(
     
     if(pAuthData != NULL)
     {
-        identity = (PSEC_WINNT_AUTH_IDENTITY_A)pAuthData;
-        
+        identity = pAuthData;
+
         if(identity->Flags == SEC_WINNT_AUTH_IDENTITY_ANSI)
         {
             pAuthDataW = HeapAlloc(GetProcessHeap(), 0, 
@@ -585,12 +584,12 @@ static SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(
 
             TRACE("Converting password to unicode.\n");
             passwd_lenW = MultiByteToWideChar(CP_ACP, 0,
-                                              password ? (LPCSTR)password : (LPCSTR)ntlm_cred->password,
+                                              password ? password : ntlm_cred->password,
                                               password ? pwlen : ntlm_cred->pwlen,
                                               NULL, 0);
             unicode_password = HeapAlloc(GetProcessHeap(), 0,
                                          passwd_lenW * sizeof(SEC_WCHAR));
-            MultiByteToWideChar(CP_ACP, 0, password ? (LPCSTR)password : (LPCSTR)ntlm_cred->password,
+            MultiByteToWideChar(CP_ACP, 0, password ? password : ntlm_cred->password,
                                 password ? pwlen : ntlm_cred->pwlen, unicode_password, passwd_lenW);
 
             SECUR32_CreateNTLMv1SessionKey((PBYTE)unicode_password,
@@ -1523,7 +1522,7 @@ static SECURITY_STATUS ntlm_CreateSignature(PNegoHelper helper, PSecBufferDesc p
         for( i = 0; i < pMessage->cBuffers; ++i )
         {
             if(pMessage->pBuffers[i].BufferType & SECBUFFER_DATA)
-                HMACMD5Update(&hmac_md5_ctx, (BYTE *)pMessage->pBuffers[i].pvBuffer,
+                HMACMD5Update(&hmac_md5_ctx, pMessage->pBuffers[i].pvBuffer,
                         pMessage->pBuffers[i].cbBuffer);
         }
 
@@ -1770,7 +1769,7 @@ static SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(PCtxtHandle phContext,
     { 
         ntlm_CreateSignature(helper, pMessage, token_idx, NTLM_SEND, FALSE);
         SECUR32_arc4Process(helper->crypt.ntlm2.send_a4i,
-                (BYTE *)pMessage->pBuffers[data_idx].pvBuffer,
+                pMessage->pBuffers[data_idx].pvBuffer,
                 pMessage->pBuffers[data_idx].cbBuffer);
 
         if(helper->neg_flags & NTLMSSP_NEGOTIATE_KEY_EXCHANGE)
diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
index 9b102fb..fbf2a62 100644
--- a/dlls/secur32/schannel.c
+++ b/dlls/secur32/schannel.c
@@ -132,7 +132,7 @@ static ULONG_PTR schan_alloc_handle(void *object, enum schan_handle_type type)
             ERR("Handle %d(%p) is in the free list, but has type %#x.\n", (handle-schan_handle_table), handle, handle->type);
             return SCHAN_INVALID_HANDLE;
         }
-        schan_free_handles = (struct schan_handle *)handle->object;
+        schan_free_handles = handle->object;
         handle->object = object;
         handle->type = type;
 
@@ -215,7 +215,7 @@ static SECURITY_STATUS schan_QueryCredentialsAttributes(
     case SECPKG_ATTR_CIPHER_STRENGTHS:
         if (pBuffer)
         {
-            SecPkgCred_CipherStrengths *r = (SecPkgCred_CipherStrengths*)pBuffer;
+            SecPkgCred_CipherStrengths *r = pBuffer;
 
             /* FIXME: get from CryptoAPI */
             FIXME("SECPKG_ATTR_CIPHER_STRENGTHS: semi-stub\n");
@@ -432,7 +432,7 @@ static SECURITY_STATUS SEC_ENTRY schan_AcquireCredentialsHandleA(
      debugstr_a(pszPrincipal), debugstr_a(pszPackage), fCredentialUse,
      pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry);
     return schan_AcquireCredentialsHandle(fCredentialUse,
-     (PSCHANNEL_CRED)pAuthData, phCredential, ptsExpiry);
+     pAuthData, phCredential, ptsExpiry);
 }
 
 static SECURITY_STATUS SEC_ENTRY schan_AcquireCredentialsHandleW(
@@ -444,7 +444,7 @@ static SECURITY_STATUS SEC_ENTRY schan_AcquireCredentialsHandleW(
      debugstr_w(pszPrincipal), debugstr_w(pszPackage), fCredentialUse,
      pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry);
     return schan_AcquireCredentialsHandle(fCredentialUse,
-     (PSCHANNEL_CRED)pAuthData, phCredential, ptsExpiry);
+     pAuthData, phCredential, ptsExpiry);
 }
 
 static SECURITY_STATUS SEC_ENTRY schan_FreeCredentialsHandle(
@@ -565,7 +565,7 @@ static char *schan_get_buffer(const struct schan_transport *t, struct schan_buff
 
 static ssize_t schan_pull(gnutls_transport_ptr_t transport, void *buff, size_t buff_len)
 {
-    struct schan_transport *t = (struct schan_transport *)transport;
+    struct schan_transport *t = transport;
     char *b;
 
     TRACE("Pull %zu bytes\n", buff_len);
@@ -587,7 +587,7 @@ static ssize_t schan_pull(gnutls_transport_ptr_t transport, void *buff, size_t b
 
 static ssize_t schan_push(gnutls_transport_ptr_t transport, const void *buff, size_t buff_len)
 {
-    struct schan_transport *t = (struct schan_transport *)transport;
+    struct schan_transport *t = transport;
     char *b;
 
     TRACE("Push %zu bytes\n", buff_len);
@@ -851,7 +851,7 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
     {
         case SECPKG_ATTR_STREAM_SIZES:
         {
-            SecPkgContext_StreamSizes *stream_sizes = (SecPkgContext_StreamSizes *)buffer;
+            SecPkgContext_StreamSizes *stream_sizes = buffer;
             gnutls_mac_algorithm_t mac = pgnutls_mac_get(ctx->session);
             size_t mac_size = pgnutls_mac_get_key_size(mac);
             gnutls_cipher_algorithm_t cipher = pgnutls_cipher_get(ctx->session);
diff --git a/dlls/secur32/util.c b/dlls/secur32/util.c
index 15d3a2a..a226bf5 100644
--- a/dlls/secur32/util.c
+++ b/dlls/secur32/util.c
@@ -129,7 +129,7 @@ SECURITY_STATUS SECUR32_CreateNTLMv1SessionKey(PBYTE password, int len, PBYTE se
     TRACE("(%p, %p)\n", password, session_key);
 
     MD4Init(&ctx);
-    MD4Update(&ctx, (const unsigned char*) password, len);
+    MD4Update(&ctx, password, len);
     MD4Final(&ctx);
 
     memcpy(ntlm_hash, ctx.digest, 0x10);
-- 
1.6.0.6
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20090122/b5e43013/attachment-0001.pgp 


More information about the wine-patches mailing list