From a523f686fcf37d0ae4f1729ed5ef335ffb8f3639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 20 Dec 2014 11:39:12 +0100 Subject: [PATCH 1/2] fix "Program returns random data in a function" GCC warning --- src/raster/algofill.cpp | 1 + src/raster/conversion_alleg.cpp | 1 + src/raster/conversion_she.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/raster/algofill.cpp b/src/raster/algofill.cpp index 96bbe018f..c27292dc2 100644 --- a/src/raster/algofill.cpp +++ b/src/raster/algofill.cpp @@ -93,6 +93,7 @@ template static inline bool color_equal(color_t c1, color_t c2, int tolerance) { static_assert(false && sizeof(ImageTraits), "Invalid color comparison"); + return false; } template<> diff --git a/src/raster/conversion_alleg.cpp b/src/raster/conversion_alleg.cpp index e2301d47d..d1fb6798c 100644 --- a/src/raster/conversion_alleg.cpp +++ b/src/raster/conversion_alleg.cpp @@ -39,6 +39,7 @@ namespace { template int convert_color_to_allegro(color_t color, const Palette* palette) { static_assert(false && sizeof(ImageTraits), "Invalid color conversion"); + return 0; } template<> diff --git a/src/raster/conversion_she.cpp b/src/raster/conversion_she.cpp index 3b95b28a3..d106f058d 100644 --- a/src/raster/conversion_she.cpp +++ b/src/raster/conversion_she.cpp @@ -42,6 +42,7 @@ namespace { template uint32_t convert_color_to_surface(color_t color, const Palette* palette, const she::SurfaceFormatData* fd) { static_assert(false && sizeof(ImageTraits), "Invalid color conversion"); + return 0; } template<> From d5068e071d9f8305eabe010859b413bbf0b1adc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 20 Dec 2014 11:45:17 +0100 Subject: [PATCH 2/2] fix "Program is using uninitialized variables." GCC warning --- src/app/color.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/color.cpp b/src/app/color.cpp index 2cb0b9e70..d077b716e 100644 --- a/src/app/color.cpp +++ b/src/app/color.cpp @@ -86,7 +86,7 @@ Color Color::fromIndex(int index) // static Color Color::fromImage(PixelFormat pixelFormat, color_t c) { - Color color = Color::fromMask(); + Color color = app::Color::fromMask(); switch (pixelFormat) { @@ -124,7 +124,7 @@ Color Color::fromImageGetPixel(Image *image, int x, int y) // static Color Color::fromString(const std::string& str) { - Color color = Color::fromMask(); + Color color = app::Color::fromMask(); if (str != "mask") { if (str.find("rgb{") == 0 ||