Skip to content

Commit c99a88e

Browse files
authored
Merge pull request #266 from fperrad/20190517_lint
more linting
2 parents 3f2d891 + d3cbfd5 commit c99a88e

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

bn_deprecated.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ int mp_get_bit(const mp_int *a, int b)
99
if (b < 0) {
1010
return MP_VAL;
1111
}
12-
return s_mp_get_bit(a, (unsigned int)b) == MP_YES ? MP_YES : MP_NO;
12+
return (s_mp_get_bit(a, (unsigned int)b) == MP_YES) ? MP_YES : MP_NO;
1313
}
1414
#endif
1515
#ifdef BN_S_MP_JACOBI_C

bn_mp_cmp_mag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
mp_ord mp_cmp_mag(const mp_int *a, const mp_int *b)
88
{
99
int n;
10-
mp_digit *tmpa, *tmpb;
10+
const mp_digit *tmpa, *tmpb;
1111

1212
/* compare based on # of non-zero digits */
1313
if (a->used > b->used) {

bn_mp_fwrite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ mp_err mp_fwrite(const mp_int *a, int radix, FILE *stream)
2424
return err;
2525
}
2626

27-
if (fwrite(buf, (size_t)len, 1, stream) != 1) {
27+
if (fwrite(buf, (size_t)len, 1uL, stream) != 1uL) {
2828
MP_FREE_BUFFER(buf, (size_t)len);
2929
return MP_ERR;
3030
}

bn_mp_prime_next_prime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style)
6868
if ((a->dp[0] & 3u) != 3u) {
6969
if ((err = mp_sub_d(a, (a->dp[0] & 3u) + 1u, a)) != MP_OKAY) {
7070
return err;
71-
};
71+
}
7272
}
7373
} else {
7474
if (MP_IS_EVEN(a)) {

tommath_private.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ do { \
8282
do { \
8383
size_t zs_ = (size); \
8484
char* zm_ = (char*)(mem); \
85-
while (zs_-- > 0) { \
86-
*zm_++ = 0; \
85+
while (zs_-- > 0u) { \
86+
*zm_++ = '\0'; \
8787
} \
8888
} while (0)
8989
# define MP_ZERO_DIGITS(mem, digits) \
@@ -156,7 +156,7 @@ typedef private_mp_word mp_word;
156156
#define MP_IS_EVEN(a) (((a)->used == 0) || (((a)->dp[0] & 1u) == 0u))
157157
#define MP_IS_ODD(a) (((a)->used > 0) && (((a)->dp[0] & 1u) == 1u))
158158

159-
#define MP_SIZEOF_BITS(type) (CHAR_BIT * sizeof(type))
159+
#define MP_SIZEOF_BITS(type) ((size_t)CHAR_BIT * sizeof(type))
160160
#define MP_MAXFAST (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
161161

162162
/* Minimum number of available digits in mp_int, MP_PREC >= MP_MIN_PREC */

0 commit comments

Comments
 (0)