Skip to content

Commit 31a2927

Browse files
committed
fix clang compiler warnings (including fixing a bug revealed in cmdhftopaz.c)
1 parent 8aee1b8 commit 31a2927

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

client/cmdhfepa.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ int CmdHFEPAPACEReplay(const char *Cmd)
8686
uint8_t *apdus[] = {msesa_apdu, gn_apdu, map_apdu, pka_apdu, ma_apdu};
8787

8888
// usage message
89-
static const char const *usage_msg =
89+
static const char *usage_msg =
9090
"Please specify 5 APDUs separated by spaces. "
9191
"Example:\n preplay 0022C1A4 1068000000 1086000002 1234ABCDEF 1A2B3C4D";
9292

client/cmdhftopaz.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static void topaz_print_control_TLVs(uint8_t *memory)
337337
if (TLV_type == 0x02) { // a Reserved Memory Control TLV
338338
uint8_t pages_addr = TLV_value[0] >> 4;
339339
uint8_t byte_offset = TLV_value[0] & 0x0f;
340-
uint8_t size_in_bytes = TLV_value[1] ? TLV_value[1] : 256;
340+
uint16_t size_in_bytes = TLV_value[1] ? TLV_value[1] : 256;
341341
uint8_t bytes_per_page = 1 << (TLV_value[2] & 0x0f);
342342
uint16_t area_start = pages_addr * bytes_per_page + byte_offset;
343343
PrintAndLog("Reserved Memory of %d bytes at byte offset 0x%02x.",

client/reveng/poly.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ filtop(FILE *input, unsigned long length, int flags, int bperhx) {
139139
bmp_t accu = BMP_C(0);
140140
bmp_t mask = bperhx == BMP_BIT ? ~BMP_C(0) : (BMP_C(1) << bperhx) - BMP_C(1);
141141
unsigned long iter = 0UL, idx;
142-
int cmask = ~(~0 << CHAR_BIT), c;
142+
int cmask = ~(~0U << CHAR_BIT), c;
143143
int count = 0, ofs;
144144
poly_t poly = PZERO;
145145
if(bperhx == 0) return(poly);
@@ -204,7 +204,7 @@ strtop(const char *string, int flags, int bperhx) {
204204
bmp_t accu;
205205
bmp_t mask = bperhx == BMP_BIT ? ~BMP_C(0) : (BMP_C(1) << bperhx) - BMP_C(1);
206206
int pass, count, ofs;
207-
int cmask = ~(~0 << CHAR_BIT), c;
207+
int cmask = ~(~0U << CHAR_BIT), c;
208208
const char *s;
209209

210210
poly_t poly = PZERO;

common/crapto1/crapto1.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void bucket_sort_intersect(uint32_t* const estart, uint32_t* const estop,
9999
/** binsearch
100100
* Binary search for the first occurence of *stop's MSB in sorted [start,stop]
101101
*/
102-
static inline uint32_t* binsearch(uint32_t *start, uint32_t *stop)
102+
/* static inline uint32_t* binsearch(uint32_t *start, uint32_t *stop)
103103
{
104104
uint32_t mid, val = *stop & 0xff000000;
105105
while(start != stop)
@@ -110,7 +110,7 @@ static inline uint32_t* binsearch(uint32_t *start, uint32_t *stop)
110110
111111
return start;
112112
}
113-
113+
*/
114114
/** update_contribution
115115
* helper, calculates the partial linear feedback contributions and puts in MSB
116116
*/

zlib/inflate.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,7 @@ z_streamp strm;
15231523
{
15241524
struct inflate_state FAR *state;
15251525

1526-
if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
1526+
if (strm == Z_NULL || strm->state == Z_NULL) return ~0UL << 16;
15271527
state = (struct inflate_state FAR *)strm->state;
15281528
return ((long)(state->back) << 16) +
15291529
(state->mode == COPY ? state->length :

0 commit comments

Comments
 (0)