X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdevices%2Finputfile.cpp;h=b866deb8245ed1d6051833f897efc2b7d59ee282;hp=c30bcd33db570d1b56ff219b94928b322dc57924;hb=30677c1392b54604b01558cf29b44572731659fc;hpb=cda515676ce6c2fa81e1cecacba3ea26ec2ee50e diff --git a/pv/devices/inputfile.cpp b/pv/devices/inputfile.cpp index c30bcd33..b866deb8 100644 --- a/pv/devices/inputfile.cpp +++ b/pv/devices/inputfile.cpp @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ #include @@ -25,15 +24,22 @@ #include "inputfile.hpp" +using std::map; +using std::shared_ptr; +using std::streamsize; +using std::string; +using std::ifstream; +using std::ios; + namespace pv { namespace devices { -const std::streamsize InputFile::BufferSize = 16384; +const streamsize InputFile::BufferSize = 16384; -InputFile::InputFile(const std::shared_ptr &context, - const std::string &file_name, - std::shared_ptr format, - const std::map &options) : +InputFile::InputFile(const shared_ptr &context, + const string &file_name, + shared_ptr format, + const map &options) : File(file_name), context_(context), format_(format), @@ -56,11 +62,11 @@ void InputFile::open() // open() should add the input device to the session but // we can't open the device without sending some data first - f = new std::ifstream(file_name_, std::ios::binary); + f = new ifstream(file_name_, ios::binary); char buffer[BufferSize]; f->read(buffer, BufferSize); - const std::streamsize size = f->gcount(); + const streamsize size = f->gcount(); if (size == 0) return; @@ -68,7 +74,7 @@ void InputFile::open() try { device_ = input_->device(); - } catch (sigrok::Error) { + } catch (sigrok::Error&) { return; } @@ -91,14 +97,14 @@ void InputFile::run() if (!f) { // Previous call to run() processed the entire file already - f = new std::ifstream(file_name_, std::ios::binary); + f = new ifstream(file_name_, ios::binary); input_->reset(); } interrupt_ = false; while (!interrupt_ && !f->eof()) { f->read(buffer, BufferSize); - const std::streamsize size = f->gcount(); + const streamsize size = f->gcount(); if (size == 0) break;