Browse Source

less warnings

master
Joshua Moerman 13 years ago
parent
commit
3483724cff
  1. 2
      AwesomeAttract0r.xcodeproj/project.pbxproj
  2. 2
      Canvas.hpp
  3. 4
      ImageFormatBMP.hpp
  4. 4
      ImageFormatPNG.hpp
  5. 13
      Logger.hpp
  6. 4
      Tonemapper.hpp

2
AwesomeAttract0r.xcodeproj/project.pbxproj

@ -254,6 +254,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
WARNING_CFLAGS = (
"-Weffc++",
"-Wall",
"-Wextra",
);
@ -306,6 +307,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
WARNING_CFLAGS = (
"-Weffc++",
"-Wall",
"-Wextra",
);

2
Canvas.hpp

@ -52,7 +52,7 @@ public:
const int c = 0.5*position[0]*width + width*.5;
const int r = 0.5*position[1]*width + height*.5;
if(0 <= c && c < width && 0 <= r && r < height)
if(0 <= c && (size_t)c < width && 0 <= r && (size_t)r < height)
storage[r][c]++;
}

4
ImageFormatBMP.hpp

@ -116,6 +116,10 @@ namespace ImageFormats {
struct bitmap_stream {
typedef P pixel;
bitmap_stream() = delete;
bitmap_stream(bitmap_stream const &) = delete;
bitmap_stream & operator=(bitmap_stream const &) = delete;
bitmap_stream(uint16_t width, uint16_t height, std::string filename)
: dib_header(width, height, sizeof(pixel)*8)
, header(dib_header)

4
ImageFormatPNG.hpp

@ -47,6 +47,10 @@ namespace ImageFormats {
struct png_stream{
typedef pixelRGB pixel;
png_stream() = delete;
png_stream(png_stream const &) = delete;
png_stream & operator=(png_stream const &) = delete;
png_stream(uint32_t width, uint32_t height, std::string filename)
: fp(0)
, png_ptr(0)

13
Logger.hpp

@ -41,6 +41,8 @@ protected:
, level(level)
{}
virtual ~LoggingBase(){}
bool shouldSkip(){
return verbose < level;
}
@ -52,6 +54,8 @@ protected:
struct Logger : public LoggingBase {
Logger(std::ostream& logging_stream_, LoggingLevels level, std::string prefix_ = "")
: LoggingBase(logging_stream_, level)
, event_map()
, event_name_stack()
, prefix(prefix_)
{}
@ -62,9 +66,7 @@ struct Logger : public LoggingBase {
void start(std::string what){
if (shouldSkip()) return;
Event e;
e.start = boost::posix_time::microsec_clock::local_time();
e.name = what;
Event e(what);
EventMap::iterator it = event_map.find(what);
if(it != event_map.end()){
@ -97,6 +99,11 @@ private:
}
struct Event {
Event(std::string const & name)
: start(boost::posix_time::microsec_clock::local_time())
, end(boost::posix_time::microsec_clock::local_time())
, name(name) {}
boost::posix_time::ptime start;
boost::posix_time::ptime end;
std::string name;

4
Tonemapper.hpp

@ -45,7 +45,8 @@ namespace Tonemappers {
struct GammaCorrector : public Normalizer {
GammaCorrector(double gamma = 1.0)
: gamma(gamma)
: power(1.0)
, gamma(gamma)
{}
template <typename C>
@ -78,6 +79,7 @@ namespace Tonemappers {
Colorizer(size_t n_planes)
: gamma_correctors(n_planes)
, gammas()
, colors()
{
gammas[0].push_back(1.3);
gammas[1].push_back(2.0);