X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fio%2Fsg_serial.cxx;h=b7b2f5a94cbca8c45d01928f6ec603eddbc0bcf7;hb=70c5d605641b628039f75cb8761ce783a17a5bdf;hp=f6eb07c0fd30153a6ae872011b766cc1ad5ac425;hpb=b2a4cd488dfcfbf1d02fa41f2dfa5ad39aabb13a;p=simgear.git diff --git a/simgear/io/sg_serial.cxx b/simgear/io/sg_serial.cxx index f6eb07c0..b7b2f5a9 100644 --- a/simgear/io/sg_serial.cxx +++ b/simgear/io/sg_serial.cxx @@ -16,21 +16,23 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // $Id$ +#include +#include #include -#include STL_STRING +#include #include #include #include "sg_serial.hxx" -SG_USING_STD(string); +using std::string; SGSerial::SGSerial( const string& device_name, const string& baud_rate ) : @@ -57,7 +59,7 @@ bool SGSerial::open( const SGProtocolDir d ) { // cout << "fd = " << port.fd << endl; - if ( ! port.set_baud( atoi( baud.c_str() ) ) ) { + if ( ! port.set_baud( std::atoi( baud.c_str() ) ) ) { SG_LOG( SG_IO, SG_ALERT, "Error setting baud: " << baud ); return false; } @@ -80,7 +82,7 @@ int SGSerial::read( char *buf, int length ) { result = port.read_port( buf_ptr, length - save_len ); if ( result + save_len == length ) { - strncpy( buf, save_buf, length ); + std::strncpy( buf, save_buf, length ); save_len = 0; return length; @@ -114,7 +116,7 @@ int SGSerial::readline( char *buf, int length ) { // we found an end of line // copy to external buffer - strncpy( buf, save_buf, result ); + std::strncpy( buf, save_buf, result ); buf[result] = '\0'; SG_LOG( SG_IO, SG_INFO, "fg_serial line = " << buf ); @@ -142,7 +144,7 @@ int SGSerial::write( const char *buf, const int length ) { // write null terminated string to port int SGSerial::writestring( const char *str ) { - int length = strlen( str ); + int length = std::strlen( str ); return write( str, length ); }