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>
This commit is contained in:
Michael Stefaniuc 2018-11-09 10:51:51 +01:00 committed by Alexandre Julliard
parent 4600169fd4
commit de38a9e40a
2 changed files with 5 additions and 4 deletions

View File

@ -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) {

View File

@ -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;
}