summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorartemp <artem@mapnik.org>2014-10-27 11:00:31 -0400
committerartemp <artem@mapnik.org>2014-10-27 14:18:11 -0400
commit5508285424b68c6f0a26e70ede8e389715d02deb (patch)
treee1e21bccf3251ede8525619700f4a5ca30ed892f /src
parent54b3741cf1550e6e8e004da62930791cc09c8c05 (diff)
downloadqtlocation-mapboxgl-5508285424b68c6f0a26e70ede8e389715d02deb.tar.gz
prefer c++ style memory alloc
Diffstat (limited to 'src')
-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 fd0d34de2d..4cbecc8c2b 100644
--- a/src/util/image.cpp
+++ b/src/util/image.cpp
@@ -139,7 +139,8 @@ Image::Image(const std::string &data, bool flip) {
png_size_t rowbytes = png_get_rowbytes(png, info);
assert(width * 4 == rowbytes);
- img = (char *)std::malloc(width * height * 4);
+ img = static_cast<char*>(::operator new(width * height * 4));
+
char *surface = img;
assert(surface);
@@ -162,7 +163,7 @@ Image::Image(const std::string &data, bool flip) {
fprintf(stderr, "loading PNG failed: %s\n", e.what());
png_destroy_read_struct(&png, &info, nullptr);
if (img) {
- std::free(img);
+ ::operator delete(img);
img = nullptr;
}
width = 0;
@@ -172,7 +173,7 @@ Image::Image(const std::string &data, bool flip) {
Image::~Image() {
if (img) {
- std::free(img);
+ ::operator delete(img);
img = nullptr;
}
}