Skip to content

Commit c2b0d57

Browse files
committed
add -Wall to see compile warnings, and fix these warnings
1 parent 4817d02 commit c2b0d57

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile for k5prog
22

33
CC=gcc
4-
COPTS=-g
4+
COPTS=-g -O2 -Wall
55

66
default: k5prog
77

k5prog.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void hdump(unsigned char *buf,int len)
143143
unsigned char sss;
144144
char hexz[]="0123456789abcdef";
145145

146-
int lasttmp;
146+
int lasttmp=0;
147147

148148
printf("\n0x%6.6x |0 |1 |2 |3 |4 |5 |6 |7 |8 |9 |a |b |c |d |e |f |\n",len);
149149
printf("---------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+------------\n");
@@ -264,7 +264,7 @@ void destroy_k5_struct(struct k5_command *cmd)
264264
}
265265

266266
/* ripped from https://mdfs.net/Info/Comp/Comms/CRC16.htm */
267-
uint16_t crc16xmodem(char *addr, int num, int crc)
267+
uint16_t crc16xmodem(unsigned char *addr, int num, int crc)
268268
{
269269
#define poly 0x1021
270270
int i;
@@ -414,7 +414,6 @@ int k5_send_buf(int fd,unsigned char *buf,int len) {
414414
/* receive a response, deobfuscate it */
415415
struct k5_command *k5_receive(int fd,int tmout) {
416416
unsigned char buf[4];
417-
unsigned char buf2[2048];
418417
struct k5_command *cmd;
419418
int len;
420419

@@ -460,7 +459,6 @@ struct k5_command *k5_receive(int fd,int tmout) {
460459
/******************************/
461460
int k5_readmem(int fd, unsigned char *buf, unsigned char maxlen, int offset)
462461
{
463-
int l;
464462
unsigned char readmem[sizeof(uvk5_readmem1)];
465463

466464

@@ -491,7 +489,6 @@ int k5_readmem(int fd, unsigned char *buf, unsigned char maxlen, int offset)
491489

492490
int k5_writemem(int fd, unsigned char *buf, unsigned char len, int offset)
493491
{
494-
int l;
495492
unsigned char writemem[512];
496493

497494

@@ -539,9 +536,7 @@ int k5_writemem(int fd, unsigned char *buf, unsigned char len, int offset)
539536
/* reset the radio */
540537
int k5_reset(int fd)
541538
{
542-
int l;
543539
int r;
544-
struct k5_command *cmd;
545540

546541
if (verbose>1) printf("@@@@@@@@@@@@@@@@@@ reset\n");
547542
r=k5_send_buf(fd,uvk5_reset,sizeof(uvk5_reset));
@@ -817,7 +812,6 @@ static speed_t baud_to_speed_t(int baud)
817812
void parse_cmdline(int argc, char **argv)
818813
{
819814
int opt;
820-
int tmpval;
821815

822816
int res;
823817
/* cmdline opts:
@@ -1043,7 +1037,7 @@ int main(int argc,char **argv)
10431037

10441038

10451039
if (flash_max_block_addr>UVK5_MAX_FLASH_SIZE) {
1046-
fprintf(stderr,"flash length 0x%x is greater than max flash size 0x%s\n",flash_max_block_addr,UVK5_MAX_FLASH_SIZE);
1040+
fprintf(stderr,"flash length 0x%x is greater than max flash size 0x%x\n",flash_max_block_addr,UVK5_MAX_FLASH_SIZE);
10471041
exit(1);
10481042
}
10491043

0 commit comments

Comments
 (0)