]> Savannah Git Hosting - gnulib.git/commitdiff
base32, base64: Prefer stdckdint to intprops.
authorCollin Funk <collin.funk1@gmail.com>
Wed, 8 May 2024 04:47:17 +0000 (21:47 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Wed, 8 May 2024 07:42:28 +0000 (00:42 -0700)
* lib/base32.c (base32_encode_alloc): Include stdckdint.h. Prefer
ckd_mul to INT_MULTIPLY_OK.
* lib/base64.c (base64_encode_alloc): Likewise.
* modules/base32 (Depends-on): Add stdckdint.
* modules/base64 (Depends-on): Likewise.

ChangeLog
lib/base32.c
lib/base64.c
modules/base32
modules/base64

index b752fde06552ef19425d6e5d29c340d21a4f3438..41a8ef7eb637f040b6bad336347a0cd015ffa883 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-05-07  Collin Funk  <collin.funk1@gmail.com>
+
+       base32, base64: Prefer stdckdint to intprops.
+       * lib/base32.c (base32_encode_alloc): Include stdckdint.h. Prefer
+       ckd_mul to INT_MULTIPLY_OK.
+       * lib/base64.c (base64_encode_alloc): Likewise.
+       * modules/base32 (Depends-on): Add stdckdint.
+       * modules/base64 (Depends-on): Likewise.
+
 2024-05-07  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Handle module dependencies that cannot be found.
index 270c505e201f6494fb96e67fc7c96fa5d23ba177..266b32e14ce7e6d77edcee9846f7c1f25138496e 100644 (file)
@@ -46,7 +46,7 @@
 /* Get imalloc. */
 #include <ialloc.h>
 
-#include <intprops.h>
+#include <stdckdint.h>
 
 #include <string.h>
 
@@ -143,7 +143,7 @@ base32_encode_alloc (const char *in, idx_t inlen, char **out)
      Treat negative INLEN as overflow, for better compatibility with
      pre-2021-08-27 API, which used size_t.  */
   idx_t in_over_5 = inlen / 5 + (inlen % 5 != 0), outlen;
-  if (! INT_MULTIPLY_OK (in_over_5, 8, &outlen) || inlen < 0)
+  if (ckd_mul (&outlen, in_over_5, 8) || inlen < 0)
     {
       *out = NULL;
       return 0;
index c8b3b76b0b9bcbceeee64505f1ae52cf37b75859..26c08e583bbd0b1354af0334faa4bd3619127a21 100644 (file)
@@ -48,7 +48,7 @@
 /* Get imalloc. */
 #include <ialloc.h>
 
-#include <intprops.h>
+#include <stdckdint.h>
 
 #include <string.h>
 
@@ -148,7 +148,7 @@ base64_encode_alloc (const char *in, idx_t inlen, char **out)
      Treat negative INLEN as overflow, for better compatibility with
      pre-2021-08-27 API, which used size_t.  */
   idx_t in_over_3 = inlen / 3 + (inlen % 3 != 0), outlen;
-  if (! INT_MULTIPLY_OK (in_over_3, 4, &outlen) || inlen < 0)
+  if (ckd_mul (&outlen, in_over_3, 4) || inlen < 0)
     {
       *out = NULL;
       return 0;
index 85cbeeb8a8b3ca07225d4a963bf94d0e94b49b5e..534e2ac5ef61d937c31463ec2ecacdd945c24c2b 100644 (file)
@@ -11,6 +11,7 @@ extern-inline
 ialloc
 stdbool
 memchr
+stdckdint
 
 configure.ac:
 gl_FUNC_BASE32
index 8956c44af854f94d0b1c3b228969b29c165bd1a2..99f3eb87006d051b2c8ff845682a68c0d5ab868c 100644 (file)
@@ -11,6 +11,7 @@ extern-inline
 ialloc
 stdbool
 memchr
+stdckdint
 
 configure.ac:
 gl_FUNC_BASE64