Signed-off-by: Michael Stefaniuc mstefani@winehq.org --- This was a very puzzling to validate and as it is crypto code I wanted to make sure this is a real no-op change:
mpi.c: Even with the int to unsigned int change this is a no-op aka the same object files are generated when compiled with CFLAGS="-O2 -g0".
rsa.c: There was never the same object file generated with any permutation of CFLAGS. With -O2 the assembler diff was hard to validate as quite a few location changed. Even more so when comparing the disassembled object files. With -O0 the assembler diff was just one line: .L2: cmpl $2, -4(%ebp) - jle .L5 + jbe .L5 movl $1, %eax "WHY is the 'jump lower equal' changing to a 'jump bigger equal'???" Nothing like making the wrong assumptions about the assembler mnemonincs... "jbe == Jump if Below or Equal" and it's the unsingned variant of jle. So for all practical purposes the same code is generated.
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 e05fa59f8b..3fbca42a8c 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 5e9019f53d..7bcfa750ef 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; }