]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
use size_t in solv_MD5_Update()
authorMichael Schroeder <mls@suse.de>
Tue, 28 Apr 2026 12:21:04 +0000 (14:21 +0200)
committerMichael Schroeder <mls@suse.de>
Tue, 28 Apr 2026 12:21:04 +0000 (14:21 +0200)
Instead of unsigned long.

src/md5.c
src/md5.h

index 0431b50a179997d1bb50715c769051bc07b0dc04..b5600d8ab6be48464a0c383a65f2b7ad4b4a699c 100644 (file)
--- a/src/md5.c
+++ b/src/md5.c
@@ -66,7 +66,7 @@
  * This processes one or more 64-byte data blocks, but does NOT update
  * the bit counters.  There're no alignment requirements.
  */
-static void *body(MD5_CTX *ctx, void *data, unsigned long size)
+static void *body(MD5_CTX *ctx, void *data, size_t size)
 {
        unsigned char *ptr;
        MD5_u32plus a, b, c, d;
@@ -184,13 +184,13 @@ void solv_MD5_Init(MD5_CTX *ctx)
        ctx->hi = 0;
 }
 
-void solv_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size)
+void solv_MD5_Update(MD5_CTX *ctx, void *data, size_t size)
 {
        MD5_u32plus saved_lo;
        unsigned long used, free;
 
        saved_lo = ctx->lo;
-       if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
+       if ((ctx->lo = (saved_lo + (MD5_u32plus)size) & 0x1fffffff) < saved_lo)
                ctx->hi++;
        ctx->hi += size >> 29;
 
@@ -211,7 +211,7 @@ void solv_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size)
        }
 
        if (size >= 64) {
-               data = body(ctx, data, size & ~(unsigned long)0x3f);
+               data = body(ctx, data, size & ~(size_t)0x3f);
                size &= 0x3f;
        }
 
index 54533c75b9e78500e4b3585955119c9a964f607e..d05094266a3fb3aaf8561735c0293108e2842697 100644 (file)
--- a/src/md5.h
+++ b/src/md5.h
@@ -17,5 +17,5 @@ typedef struct {
 } MD5_CTX;
 
 extern void solv_MD5_Init(MD5_CTX *ctx);
-extern void solv_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size);
+extern void solv_MD5_Update(MD5_CTX *ctx, void *data, size_t size);
 extern void solv_MD5_Final(unsigned char *result, MD5_CTX *ctx);