summaryrefslogtreecommitdiff
blob: 4d760d672f8d69bba2d1aca326bc5de5f0c5f588 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Description: Fix compilation with gcc-6
Author: Gert Wollny <gw.fossdev@gmail.com>
Last-Updated: 2016-07-09
Forwarded: No
Bug-Debian: https://bugs.debian.org/811642

--- fracplanet-0.4.0.orig/image.cpp
+++ fracplanet-0.4.0/image.cpp
@@ -85,7 +85,7 @@ template <> bool Raster<uchar>::write_pg
       out.write(reinterpret_cast<const char*>(&(*(row->begin()))),row->size());
     }
   out.close();
-  return out;
+  return out.good();
 }
 
 template <> bool Raster<ushort>::write_pgmfile(const std::string& filename,Progress* target) const
@@ -101,7 +101,7 @@ template <> bool Raster<ushort>::write_p
       progress.step();
       for (const ushort* it=row->begin();it!=row->end();++it)
 	{
-	  const uchar p[2]={((*it)>>8),(*it)};
+	  const uchar p[2]={static_cast<uchar>((*it)>>8),static_cast<uchar>((*it) & 0x00FF)};
 	  if (m>=256)
 	    {
 	      // PGM spec is most significant byte first
@@ -115,7 +115,7 @@ template <> bool Raster<ushort>::write_p
 	}
     }
   out.close();
-  return out;
+  return out.good();
 }
 
 template <> bool Raster<ByteRGBA>::write_ppmfile(const std::string& filename,Progress* target) const
@@ -132,7 +132,7 @@ template <> bool Raster<ByteRGBA>::write
 	out.write(reinterpret_cast<const char*>(&((*it).r)),3);
     }
   out.close();
-  return out;
+  return out.good();
 }