[PPL-devel] [GIT] ppl/ppl(master): Prefer explicit tests against zero.

Enea Zaffanella zaffanella at cs.unipr.it
Sat Feb 25 12:18:41 CET 2012


Module: ppl/ppl
Branch: master
Commit: 4ddf6ce187e9217e560fb3e8d18b315fa28d6d92
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=4ddf6ce187e9217e560fb3e8d18b315fa28d6d92

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Sat Feb 25 12:18:10 2012 +0100

Prefer explicit tests against zero.
Detected by ECLAIR service utypflag.

---

 src/c_streambuf.cc |    2 +-
 src/stdiobuf.cc    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/c_streambuf.cc b/src/c_streambuf.cc
index c76ca44..fdd630f 100644
--- a/src/c_streambuf.cc
+++ b/src/c_streambuf.cc
@@ -89,7 +89,7 @@ c_streambuf::int_type
 c_streambuf::overflow(int_type c) {
   const int_type eof = traits_type::eof();
   if (traits_type::eq_int_type(c, eof))
-    return sync() ? eof : traits_type::not_eof(c);
+    return (sync() != 0) ? eof : traits_type::not_eof(c);
   else {
     char buf = static_cast<char>(c);
     if (cb_write(&buf, 1) == 1)
diff --git a/src/stdiobuf.cc b/src/stdiobuf.cc
index 8a5fe95..a10a7ed 100644
--- a/src/stdiobuf.cc
+++ b/src/stdiobuf.cc
@@ -71,7 +71,7 @@ stdiobuf::int_type
 stdiobuf::overflow(int_type c) {
   const int_type eof = traits_type::eof();
   if (traits_type::eq_int_type(c, eof))
-    return fflush(fp) ? eof : traits_type::not_eof(c);
+    return (fflush(fp) != 0) ? eof : traits_type::not_eof(c);
   else
     return putc(c, fp);
 }




More information about the PPL-devel mailing list