From 31b4ffcca73e65503be8fc2805ce1df00e6cb80d Mon Sep 17 00:00:00 2001 From: joerg_wunsch Date: Thu, 7 Jan 2010 13:13:02 +0000 Subject: [PATCH] Fix a few warnings that came up recently (some of them only triggered by recent GCC versions). * config_gram.y (parse_cmdbits): "brkt possibly used uninitialized" (GCC errs here) * jtagmkII.c (jtagmkII_reset32): "status possibly used uninitialized" (I think GCC errs, too) * buspirate.c: "pointers differ in signedness" (mismatch between string processing and the use of "unsigned char" throughought the AVRDUDE API) git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@882 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 12 ++++++++++++ buspirate.c | 14 +++++++------- config_gram.y | 2 +- jtagmkII.c | 2 ++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index eaa4e13a..d9f0980e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2010-01-07 Joerg Wunsch + + Fix a few warnings that came up recently (some of them only triggered + by recent GCC versions). + * config_gram.y (parse_cmdbits): "brkt possibly used uninitialized" + (GCC errs here) + * jtagmkII.c (jtagmkII_reset32): "status possibly used uninitialized" + (I think GCC errs, too) + * buspirate.c: "pointers differ in signedness" (mismatch between + string processing and the use of "unsigned char" throughought the + AVRDUDE API) + 2010-01-01 Joerg Wunsch * jtagmkII.c (jtagmkII_smc_init32): replace sleep() by usleep() for diff --git a/buspirate.c b/buspirate.c index 0aa3cc81..7138efab 100644 --- a/buspirate.c +++ b/buspirate.c @@ -89,14 +89,14 @@ buspirate_uses_ascii(struct programmer_t *pgm) /* ====== Serial talker functions - binmode ====== */ -static void dump_mem(unsigned char *buf, size_t len) +static void dump_mem(char *buf, size_t len) { size_t i; for (i = 0; ifd, data, len); + rc = serial_send(&pgm->fd, (unsigned char *)data, len); return rc; } @@ -124,7 +124,7 @@ static int buspirate_recv_bin(struct programmer_t *pgm, char *buf, size_t len) { int rc; - rc = serial_recv(&pgm->fd, buf, len); + rc = serial_recv(&pgm->fd, (unsigned char *)buf, len); if (rc < 0) return EOF; if (verbose > 1) { @@ -394,7 +394,7 @@ static void buspirate_reset_from_binmode(struct programmer_t *pgm) static int buspirate_start_spi_mode_bin(struct programmer_t *pgm) { - unsigned char buf[20] = { '\0' }; + char buf[20] = { '\0' }; /* == Switch to binmode - send 20x '\0' == */ buspirate_send_bin(pgm, buf, sizeof(buf)); @@ -596,8 +596,8 @@ static int buspirate_cmd_bin(struct programmer_t *pgm, if (!buspirate_expect_bin_byte(pgm, 0x13, 0x01)) return -1; - buspirate_send_bin(pgm, cmd, 4); - buspirate_recv_bin(pgm, res, 4); + buspirate_send_bin(pgm, (char *)cmd, 4); + buspirate_recv_bin(pgm, (char *)res, 4); return 0; } diff --git a/config_gram.y b/config_gram.y index 8185382c..cf412ce0 100644 --- a/config_gram.y +++ b/config_gram.y @@ -1395,7 +1395,7 @@ static int parse_cmdbits(OPCODE * op) char * e; char * q; int len; - char * s, *brkt; + char * s, *brkt = NULL; bitno = 32; while (lsize(string_list)) { diff --git a/jtagmkII.c b/jtagmkII.c index caa63465..75cfbf58 100644 --- a/jtagmkII.c +++ b/jtagmkII.c @@ -2618,6 +2618,8 @@ static int jtagmkII_reset32(PROGRAMMER * pgm, unsigned short flags) "%s: jtagmkII_reset32(%2.2x)\n", progname, flags); + status = -1; + // Happens at the start of a programming operation if(flags & AVR32_RESET_READ) { buf[0] = CMND_GET_IR;