From 4f316d8f9982a0c04d062d638d48a9a44257ccc3 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Thu, 6 Nov 2008 09:47:37 +0000 Subject: [PATCH] Submitted by limor * usbtiny.c (usbtiny_cmd): Replace sizeof() by a fixed constant 4 for the result array, because otherwise it would take the size of a pointer which miserably fails on 64-bit machines. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@787 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 7 +++++++ usbtiny.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b65656f..ede8cabe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-11-06 Joerg Wunsch + + Submitted by limor + * usbtiny.c (usbtiny_cmd): Replace sizeof() by a fixed constant + 4 for the result array, because otherwise it would take the size + of a pointer which miserably fails on 64-bit machines. + 2008-11-05 Joerg Wunsch patch #6609: Using PCI parallel port cards on Windows diff --git a/usbtiny.c b/usbtiny.c index 333453fe..88ffcbfa 100644 --- a/usbtiny.c +++ b/usbtiny.c @@ -312,19 +312,19 @@ static int usbtiny_cmd(PROGRAMMER * pgm, unsigned char cmd[4], unsigned char res int nbytes; // Make sure its empty so we don't read previous calls if it fails - memset(res, '\0', sizeof(res) ); + memset(res, '\0', 4 ); nbytes = usb_in( pgm, USBTINY_SPI, (cmd[1] << 8) | cmd[0], // convert to 16-bit words (cmd[3] << 8) | cmd[2], // " - res, sizeof(res), 8 * PDATA(pgm)->sck_period ); + res, 4, 8 * PDATA(pgm)->sck_period ); if (verbose > 1) { // print out the data we sent and received printf( "CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n", cmd[0], cmd[1], cmd[2], cmd[3], res[0], res[1], res[2], res[3] ); } - return ((nbytes == sizeof(res)) && // should have read 4 bytes + return ((nbytes == 4) && // should have read 4 bytes res[2] == cmd[1]); // AVR's do a delayed-echo thing }