From b20f8191ea4da22bc7191e10e46c2875d8718269 Mon Sep 17 00:00:00 2001 From: randomdan Date: Wed, 29 Jun 2011 19:13:24 +0000 Subject: Fix unused_result warning when compiled with optimization enabled Fix incorrect error handling when object loading fails --- project2/fileStrmVarWriter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'project2/fileStrmVarWriter.cpp') diff --git a/project2/fileStrmVarWriter.cpp b/project2/fileStrmVarWriter.cpp index 8f3ca5c..564c86a 100644 --- a/project2/fileStrmVarWriter.cpp +++ b/project2/fileStrmVarWriter.cpp @@ -49,10 +49,14 @@ void FileStreamVariableWriter::operator()(const double & i) const { fprintf(out, "%g", i); } void FileStreamVariableWriter::operator()(const Glib::ustring & i) const { - fwrite(i.c_str(), i.bytes(), 1, out); + if (fwrite(i.c_str(), i.bytes(), 1, out) < 1) { + // Care much? None of the others check. + } } void FileStreamVariableWriter::operator()(const boost::shared_ptr & i) const { - fwrite(i->c_str(), i->bytes(), 1, out); + if (fwrite(i->c_str(), i->bytes(), 1, out) < 1) { + // Care much? None of the others check. + } } void FileStreamVariableWriter::operator()(const boost::posix_time::ptime & i) const { fprintf(out, "[%s]", boost::posix_time::to_iso_extended_string(i).c_str()); -- cgit v1.2.3