Use setprecision for std::cout
[ctsim.git] / libctsim / imagefile.cpp
index eeda46d37d4300f4662d15ac2924fa88ebdaa311..623b4e32c265de5b75abdc46531bab1088b546ab 100644 (file)
@@ -264,6 +264,7 @@ ImageFile::printStatistics (std::ostream& os) const
   if (isComplex())
     os << "Real Component Statistics" << std::endl;
 
+  os << std::setprecision(7);
   os << "   min: " << min << std::endl;
   os << "   max: " << max << std::endl;
   os << "  mean: " << mean << std::endl;
@@ -1545,8 +1546,8 @@ ImageFile::readImagePNG (const char* const pszFile)
   if (!fp)
     return false;
   unsigned char header[8];
-  fread (header, 1, 8, fp);
-  if (png_sig_cmp (header, 0, 8)) {
+  int n = fread (header, 1, 8, fp);
+  if (n != 8 || png_sig_cmp (header, 0, 8)) {
     fclose (fp);
     return false;
   }