Module: wine Branch: master Commit: de38a9e40a0b0f09dd883aefe1eccdfa3b3a153e URL: https://source.winehq.org/git/wine.git/?a=commit;h=de38a9e40a0b0f09dd883aefe...
Author: Michael Stefaniuc mstefani@winehq.org Date: Fri Nov 9 10:51:51 2018 +0100
rsaenh: Use the ARRAY_SIZE() macro and better types.
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/rsaenh/mpi.c | 4 ++-- dlls/rsaenh/rsa.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/rsaenh/mpi.c b/dlls/rsaenh/mpi.c index e05fa59..3fbca42 100644 --- a/dlls/rsaenh/mpi.c +++ b/dlls/rsaenh/mpi.c @@ -3378,9 +3378,9 @@ static const struct { /* returns # of RM trials required for a given bit size */ int mp_prime_rabin_miller_trials(int size) { - int x; + unsigned int x;
- for (x = 0; x < (int)(sizeof(sizes)/(sizeof(sizes[0]))); x++) { + for (x = 0; x < ARRAY_SIZE(sizes); x++) { if (sizes[x].k == size) { return sizes[x].t; } else if (sizes[x].k > size) { diff --git a/dlls/rsaenh/rsa.c b/dlls/rsaenh/rsa.c index 5e9019f..7bcfa75 100644 --- a/dlls/rsaenh/rsa.c +++ b/dlls/rsaenh/rsa.c @@ -29,6 +29,7 @@ */
#include "tomcrypt.h" +#include "windef.h"
static const struct { int mpi_code, ltc_code; @@ -41,9 +42,9 @@ static const struct { /* convert a MPI error to a LTC error (Possibly the most powerful function ever! Oh wait... no) */ static int mpi_to_ltc_error(int err) { - int x; + unsigned int x;
- for (x = 0; x < (int)(sizeof(mpi_to_ltc_codes)/sizeof(mpi_to_ltc_codes[0])); x++) { + for (x = 0; x < ARRAY_SIZE(mpi_to_ltc_codes); x++) { if (err == mpi_to_ltc_codes[x].mpi_code) { return mpi_to_ltc_codes[x].ltc_code; }