From 907b9f4affaacedd713eae959b64e9800c0db761 Mon Sep 17 00:00:00 2001 From: liushuai <770722922@qq.com> Date: Wed, 21 Aug 2019 22:20:02 +0800 Subject: [PATCH] Refine setTimeout by const reference --- include/serial/impl/unix.h | 2 +- include/serial/impl/win.h | 2 +- include/serial/serial.h | 2 +- src/impl/unix.cc | 2 +- src/impl/win.cc | 2 +- src/serial.cc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/serial/impl/unix.h b/include/serial/impl/unix.h index 0fb38f24..f20525c0 100644 --- a/include/serial/impl/unix.h +++ b/include/serial/impl/unix.h @@ -141,7 +141,7 @@ class serial::Serial::SerialImpl { getPort () const; void - setTimeout (Timeout &timeout); + setTimeout (const Timeout &timeout); Timeout getTimeout () const; diff --git a/include/serial/impl/win.h b/include/serial/impl/win.h index 2c0c6cde..e689875d 100644 --- a/include/serial/impl/win.h +++ b/include/serial/impl/win.h @@ -130,7 +130,7 @@ class serial::Serial::SerialImpl { getPort () const; void - setTimeout (Timeout &timeout); + setTimeout (const Timeout &timeout); Timeout getTimeout () const; diff --git a/include/serial/serial.h b/include/serial/serial.h index a1657852..3901f846 100644 --- a/include/serial/serial.h +++ b/include/serial/serial.h @@ -458,7 +458,7 @@ class Serial { * \see serial::Timeout */ void - setTimeout (Timeout &timeout); + setTimeout (const Timeout &timeout); /*! Sets the timeout for reads and writes. */ void diff --git a/src/impl/unix.cc b/src/impl/unix.cc index 4309aa6b..774ae954 100755 --- a/src/impl/unix.cc +++ b/src/impl/unix.cc @@ -707,7 +707,7 @@ Serial::SerialImpl::getPort () const } void -Serial::SerialImpl::setTimeout (serial::Timeout &timeout) +Serial::SerialImpl::setTimeout (const serial::Timeout &timeout) { timeout_ = timeout; } diff --git a/src/impl/win.cc b/src/impl/win.cc index 786f4f67..cbaa5773 100644 --- a/src/impl/win.cc +++ b/src/impl/win.cc @@ -370,7 +370,7 @@ Serial::SerialImpl::getPort () const } void -Serial::SerialImpl::setTimeout (serial::Timeout &timeout) +Serial::SerialImpl::setTimeout (const serial::Timeout &timeout) { timeout_ = timeout; if (is_open_) { diff --git a/src/serial.cc b/src/serial.cc index 37b5d704..8bcd6bbd 100755 --- a/src/serial.cc +++ b/src/serial.cc @@ -295,7 +295,7 @@ Serial::getPort () const } void -Serial::setTimeout (serial::Timeout &timeout) +Serial::setTimeout (const serial::Timeout &timeout) { pimpl_->setTimeout (timeout); }