diff options
Diffstat (limited to 'platform/default/image.cpp')
-rw-r--r-- | platform/default/image.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/default/image.cpp b/platform/default/image.cpp index 397a6b1928..96d01ab718 100644 --- a/platform/default/image.cpp +++ b/platform/default/image.cpp @@ -1,4 +1,5 @@ #include <mbgl/util/image.hpp> +#include <mbgl/util/string.hpp> #include <png.h> @@ -8,6 +9,19 @@ #include <cstring> #include <mbgl/util/image_reader.hpp> +// Check png library version. +const static bool png_version_check = []() { + const png_uint_32 version = png_access_version_number(); + if (version != PNG_LIBPNG_VER) { + throw std::runtime_error(mbgl::util::sprintf<96>( + "libpng version mismatch: headers report %d.%d.%d, but library reports %d.%d.%d", + PNG_LIBPNG_VER / 10000, (PNG_LIBPNG_VER / 100) % 100, PNG_LIBPNG_VER % 100, + version / 10000, (version / 100) % 100, version % 100)); + } + return true; +}(); + + namespace mbgl { namespace util { |