In jtagmkII_paged_write(), default the pages size to 256 early enough

so the buffer will then be allocated correctly.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@532 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2005-09-26 12:16:45 +00:00
parent 1ce76bfc60
commit 8e5b230e47
1 changed files with 2 additions and 2 deletions

View File

@ -1165,6 +1165,8 @@ static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
if (jtagmkII_program_enable(pgm) < 0) if (jtagmkII_program_enable(pgm) < 0)
return -1; return -1;
if (page_size == 0) page_size = 256;
if ((cmd = malloc(page_size + 10)) == NULL) { if ((cmd = malloc(page_size + 10)) == NULL) {
fprintf(stderr, "%s: jtagmkII_paged_write(): Out of memory\n", fprintf(stderr, "%s: jtagmkII_paged_write(): Out of memory\n",
progname); progname);
@ -1182,8 +1184,6 @@ static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
page_size = eeprom_pagesize; page_size = eeprom_pagesize;
} }
if (page_size == 0) page_size = 256;
serial_recv_timeout = 100; serial_recv_timeout = 100;
for (addr = 0; addr < n_bytes; addr += page_size) { for (addr = 0; addr < n_bytes; addr += page_size) {
report_progress(addr, n_bytes,NULL); report_progress(addr, n_bytes,NULL);