Author: rinrab
Date: Mon Mar 16 19:44:32 2026
New Revision: 1932343

Log:
Remove casts of data to PUCHAR where we don't need to.

PUCHAR is an alias to 'unsigned char*'. Which means that a general
NULL-terminated string can be implicitly casted into it as the (Windows API)
function is called. Internally it's handled as 'char *' the reason we want to
do that is 1) so we don't lose constantness of this pointer and 2) prevents
the compiler from accidently reinterpreting this pointer as a different type.
According to my understanding, it is generally intendent that PUCHAR is a type
that is compatible with other kinds of strings. 

* subversion/libsvn_subr/checksum_bcrypt.c
  (bcrypt_ctx_update, bcrypt_ctx_final, bcrypt_checksum): Remove casts.

Modified:
   subversion/trunk/subversion/libsvn_subr/checksum_bcrypt.c

Modified: subversion/trunk/subversion/libsvn_subr/checksum_bcrypt.c
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/checksum_bcrypt.c   Mon Mar 16 
17:47:42 2026        (r1932342)
+++ subversion/trunk/subversion/libsvn_subr/checksum_bcrypt.c   Mon Mar 16 
19:44:32 2026        (r1932343)
@@ -134,8 +134,7 @@ bcrypt_ctx_update(algorithm_state_t *alg
       else
         block = UINT_MAX;
 
-      SVN_ERR(handle_error(BCryptHashData(ctx->handle,
-                                          (PUCHAR) data, block,
+      SVN_ERR(handle_error(BCryptHashData(ctx->handle, data, block,
                                           /* dwFlags */ 0)));
 
       len -= block;
@@ -154,8 +153,7 @@ bcrypt_ctx_final(algorithm_state_t *algo
     SVN_ERR(bcrypt_ctx_init(algorithm, ctx));
 
   SVN_ERR(handle_error(BCryptFinishHash(ctx->handle,
-                                        (PUCHAR) digest,
-                                        algorithm->hash_length,
+                                        digest, algorithm->hash_length,
                                         /* dwFlags */ 0)));
 
   return SVN_NO_ERROR;
@@ -200,16 +198,14 @@ bcrypt_checksum(algorithm_state_t *algor
       else
         block = UINT_MAX;
 
-      SVN_ERR(handle_error(BCryptHashData(handle,
-                                          (PUCHAR) data, block,
+      SVN_ERR(handle_error(BCryptHashData(handle, data, block,
                                           /* dwFlags */ 0)));
 
       len -= block;
       data += block;
     }
 
-  SVN_ERR(handle_error(BCryptFinishHash(handle,
-                                        (PUCHAR) digest,
+  SVN_ERR(handle_error(BCryptFinishHash(handle, digest,
                                         algorithm->hash_length,
                                         /* dwFlags */ 0)));
 

Reply via email to