summaryrefslogtreecommitdiff
path: root/src/util/image.cpp
diff options
context:
space:
mode:
authorDane Springmeyer <dane@mapbox.com>2014-05-30 13:38:09 -0700
committerDane Springmeyer <dane@mapbox.com>2014-05-30 13:38:09 -0700
commit42a2c252b860374e63e8ca9c9a4ae079f27c63f3 (patch)
tree5297ebd48699eafc62b57651da6b37acb6ee3b7a /src/util/image.cpp
parent78ad02597381166a23769a3d5814cd9d2eef7dad (diff)
downloadqtlocation-mapboxgl-42a2c252b860374e63e8ca9c9a4ae079f27c63f3.tar.gz
use malloc/free from c++: fixes compile with libc++ on linux - refs #287
Diffstat (limited to 'src/util/image.cpp')
-rw-r--r--src/util/image.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util/image.cpp b/src/util/image.cpp
index 156828183f..2d4eb36021 100644
--- a/src/util/image.cpp
+++ b/src/util/image.cpp
@@ -2,6 +2,7 @@
#include <png.h>
#include <cassert>
+#include <cstdlib>
std::string llmr::util::compress_png(int width, int height, void *rgba, bool flip) {
@@ -137,7 +138,7 @@ Image::Image(const std::string &data) {
png_size_t rowbytes = png_get_rowbytes(png, info);
assert(width * 4 == rowbytes);
- img = (char *)malloc(width * height * 4);
+ img = (char *)std::malloc(width * height * 4);
char *surface = img;
assert(surface);
@@ -160,7 +161,7 @@ Image::Image(const std::string &data) {
fprintf(stderr, "loading PNG failed: %s\n", e.what());
png_destroy_read_struct(&png, &info, nullptr);
if (img) {
- free(img);
+ std::free(img);
img = nullptr;
}
width = 0;
@@ -170,7 +171,7 @@ Image::Image(const std::string &data) {
Image::~Image() {
if (img) {
- free(img);
+ std::free(img);
img = nullptr;
}
}