* ser_posix.c, ser_win32.c, serial.h:

Change baud from int to long to avoid a 16-bit int overflow.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@291 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
troth 2003-03-13 19:25:27 +00:00
parent 616581c5a0
commit 147c27da52
4 changed files with 14 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2003-03-13 Theodore A. Roth <troth@openavr.org>
* ser_posix.c, ser_win32.c, serial.h:
Change baud from int to long to avoid a 16-bit int overflow.
2003-03-12 Theodore A. Roth <troth@openavr.org>
* Makefile.am (avrdude_SOURCES): Add avr910.[ch], serial.h and

View File

@ -36,7 +36,7 @@
extern char *progname;
struct baud_mapping {
int baud;
long baud;
speed_t speed;
};
@ -55,7 +55,7 @@ static struct baud_mapping baud_lookup_table [] = {
{ 0, 0 } /* Terminator. */
};
static speed_t serial_baud_lookup(int baud)
static speed_t serial_baud_lookup(long baud)
{
struct baud_mapping *map = baud_lookup_table;
@ -65,12 +65,12 @@ static speed_t serial_baud_lookup(int baud)
map++;
}
fprintf(stderr, "%s: serial_baud_lookup(): unknown baud rate: %d",
fprintf(stderr, "%s: serial_baud_lookup(): unknown baud rate: %ld",
progname, baud);
exit(1);
}
static int serial_setattr(int fd, int baud)
static int serial_setattr(int fd, long baud)
{
int rc;
struct termios termios;

View File

@ -20,14 +20,16 @@
/* $Id$ */
/*
* Posix serial interface for avrdude.
* Native Win32 serial interface for avrdude.
*/
#include "serial.h"
extern char *progname;
#if 0
int serial_open(char * port, int baud)
int serial_open(char * port, long baud)
{
return fd;
}

View File

@ -32,7 +32,7 @@
#include "config.h"
extern int serial_open(char * port, int baud);
extern int serial_open(char * port, long baud);
extern void serial_close(int fd);
extern int serial_send(int fd, char * buf, size_t buflen);