Address compiler warnings in 4 source files

This commit is contained in:
Stefan Rueger 2022-08-12 14:58:21 +01:00
parent c2c9053b13
commit 8420b27233
No known key found for this signature in database
GPG Key ID: B0B4F1FD86B1EC55
4 changed files with 13 additions and 14 deletions

View File

@ -402,13 +402,10 @@ static int avrpart_deep_copy(AVRPARTdeep *d, const AVRPART *p) {
// Copy over desc, id, and family_id // Copy over desc, id, and family_id
memset(d->descbuf, 0, sizeof d->descbuf); memset(d->descbuf, 0, sizeof d->descbuf);
if(d->descbuf)
strncpy(d->descbuf, p->desc, sizeof d->descbuf-1); strncpy(d->descbuf, p->desc, sizeof d->descbuf-1);
memset(d->idbuf, 0, sizeof d->idbuf); memset(d->idbuf, 0, sizeof d->idbuf);
if(d->idbuf)
strncpy(d->idbuf, p->id, sizeof d->idbuf-1); strncpy(d->idbuf, p->id, sizeof d->idbuf-1);
memset(d->family_idbuf, 0, sizeof d->family_idbuf); memset(d->family_idbuf, 0, sizeof d->family_idbuf);
if(d->family_idbuf)
strncpy(d->family_idbuf, p->family_id, sizeof d->family_idbuf-1); strncpy(d->family_idbuf, p->family_id, sizeof d->family_idbuf-1);
// Zap address values // Zap address values

View File

@ -488,7 +488,6 @@ static int jtagmkII_recv_frame(PROGRAMMER * pgm, unsigned char **msg,
int rv; int rv;
unsigned char c, *buf = NULL, header[8]; unsigned char c, *buf = NULL, header[8];
unsigned short r_seqno = 0; unsigned short r_seqno = 0;
unsigned short checksum = 0;
struct timeval tv; struct timeval tv;
double timeoutval = 100; /* seconds */ double timeoutval = 100; /* seconds */
@ -521,7 +520,6 @@ static int jtagmkII_recv_frame(PROGRAMMER * pgm, unsigned char **msg,
if (serial_recv(&pgm->fd, &c, 1) != 0) if (serial_recv(&pgm->fd, &c, 1) != 0)
goto timedout; goto timedout;
} }
checksum ^= c;
if (state < sDATA) if (state < sDATA)
header[headeridx++] = c; header[headeridx++] = c;

View File

@ -393,7 +393,7 @@ static int net_send(union filedescriptor *fd, const unsigned char * buf, size_t
} }
while (len) { while (len) {
rc = send(fd->ifd, p, (len > 1024) ? 1024 : len, 0); rc = send(fd->ifd, (const char *) p, (len > 1024)? 1024: len, 0);
if (rc < 0) { if (rc < 0) {
FormatMessage( FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ALLOCATE_BUFFER |
@ -527,7 +527,7 @@ reselect:
} }
} }
rc = recv(fd->ifd, p, (buflen - len > 1024) ? 1024 : buflen - len, 0); rc = recv(fd->ifd, (char *) p, (buflen - len > 1024)? 1024: buflen - len, 0);
if (rc < 0) { if (rc < 0) {
FormatMessage( FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ALLOCATE_BUFFER |
@ -693,7 +693,7 @@ static int net_drain(union filedescriptor *fd, int display)
} }
} }
rc = recv(fd->ifd, &buf, 1, 0); rc = recv(fd->ifd, (char *) &buf, 1, 0);
if (rc < 0) { if (rc < 0) {
FormatMessage( FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ALLOCATE_BUFFER |

View File

@ -3093,12 +3093,14 @@ static int stk500v2_setparm_real(PROGRAMMER * pgm, unsigned char parm, unsigned
static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char value) static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char value)
{ {
unsigned char current_value; unsigned char current_value = value;
int res; int res;
res = stk500v2_getparm(pgm, parm, &current_value); res = stk500v2_getparm(pgm, parm, &current_value);
if (res < 0) if (res < 0) {
avrdude_message(MSG_INFO, "%s: Unable to get parameter 0x%02x\n", progname, parm); avrdude_message(MSG_INFO, "%s: Unable to get parameter 0x%02x\n", progname, parm);
return -1;
}
// don't issue a write if the correct value is already set. // don't issue a write if the correct value is already set.
if (value == current_value) { if (value == current_value) {
@ -3245,7 +3247,7 @@ f_to_kHz_MHz(double f, const char **unit)
static void stk500v2_print_parms1(PROGRAMMER * pgm, const char * p) static void stk500v2_print_parms1(PROGRAMMER * pgm, const char * p)
{ {
unsigned char vtarget, vadjust, osc_pscale, osc_cmatch, sck_duration =0; //XXX 0 is not correct, check caller unsigned char vtarget = 0, vadjust = 0, osc_pscale = 0, osc_cmatch = 0, sck_duration =0; //XXX 0 is not correct, check caller
unsigned int sck_stk600, clock_conf, dac, oct, varef; unsigned int sck_stk600, clock_conf, dac, oct, varef;
unsigned char vtarget_jtag[4]; unsigned char vtarget_jtag[4];
int prescale; int prescale;
@ -3253,6 +3255,8 @@ static void stk500v2_print_parms1(PROGRAMMER * pgm, const char * p)
const char *unit; const char *unit;
void *mycookie; void *mycookie;
memset(vtarget_jtag, 0, sizeof vtarget_jtag);
if (PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE_MKII) { if (PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE_MKII) {
mycookie = pgm->cookie; mycookie = pgm->cookie;
pgm->cookie = PDATA(pgm)->chained_pdata; pgm->cookie = PDATA(pgm)->chained_pdata;