X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_baudrate.c;h=9a425c69331081018df2b0f88fd7163cd37fe464;hp=1dee46c4792ae1867cd5af6d5acf2b1025a4867e;hb=76a479337308b4b5e749fa8c38b7b7f482998c5b;hpb=7d3e03f12f3e179f5780f733fa5b78d981080d48 diff --git a/ncurses/tinfo/lib_baudrate.c b/ncurses/tinfo/lib_baudrate.c index 1dee46c4..9a425c69 100644 --- a/ncurses/tinfo/lib_baudrate.c +++ b/ncurses/tinfo/lib_baudrate.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -49,7 +49,7 @@ * of the indices up to B115200 fit nicely in a 'short', allowing us to retain * ospeed's type for compatibility. */ -#if NCURSES_OSPEED_COMPAT && ((defined(__FreeBSD__) && (__FreeBSD_version < 700000)) || defined(__NetBSD__) || defined(__OpenBSD__)) +#if NCURSES_OSPEED_COMPAT && ((defined(__FreeBSD__) && (__FreeBSD_version < 700000)) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)) #undef B0 #undef B50 #undef B75 @@ -79,7 +79,7 @@ #undef USE_OLD_TTY #endif /* USE_OLD_TTY */ -MODULE_ID("$Id: lib_baudrate.c,v 1.35 2014/04/26 18:48:19 juergen Exp $") +MODULE_ID("$Id: lib_baudrate.c,v 1.38 2016/05/28 23:22:52 tom Exp $") /* * int @@ -151,7 +151,6 @@ _nc_baudrate(int OSpeed) #endif int result = ERR; - unsigned i; #if !USE_REENTRANT if (OSpeed == last_OSpeed) { @@ -160,8 +159,10 @@ _nc_baudrate(int OSpeed) #endif if (result == ERR) { if (OSpeed >= 0) { + unsigned i; + for (i = 0; i < SIZEOF(speeds); i++) { - if (speeds[i].s == OSpeed) { + if ((int) speeds[i].s == OSpeed) { result = speeds[i].sp; break; } @@ -181,9 +182,10 @@ NCURSES_EXPORT(int) _nc_ospeed(int BaudRate) { int result = 1; - unsigned i; if (BaudRate >= 0) { + unsigned i; + for (i = 0; i < SIZEOF(speeds); i++) { if (speeds[i].sp == BaudRate) { result = speeds[i].s;